2005-01-27 04:39:55 +03:00
|
|
|
dnl
|
2005-11-05 22:57:48 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
dnl University Research and Technology
|
|
|
|
dnl Corporation. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
dnl of Tennessee Research Foundation. All rights
|
|
|
|
dnl reserved.
|
2006-08-01 02:30:07 +04:00
|
|
|
dnl Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
|
2005-01-27 04:39:55 +03:00
|
|
|
dnl University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
2005-01-27 04:39:55 +03:00
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_TEXT
|
|
|
|
dnl
|
|
|
|
dnl Determine how to set current mode as text.
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_TEXT],[
|
|
|
|
AC_MSG_CHECKING([directive for setting text section])
|
|
|
|
ompi_cv_asm_text=""
|
2005-12-15 07:19:16 +03:00
|
|
|
if test "$ompi_cv_c_compiler_vendor" = "microsoft" ; then
|
|
|
|
# text section will be brought in with the rest of
|
|
|
|
# header for MS - leave blank for now
|
|
|
|
ompi_cv_asm_text=""
|
|
|
|
else
|
|
|
|
case $host in
|
|
|
|
*-aix*)
|
|
|
|
ompi_cv_asm_text=[".csect .text[PR]"]
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ompi_cv_asm_text=".text"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_MSG_RESULT([$ompi_cv_asm_text])
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_TEXT], ["$ompi_cv_asm_text"],
|
|
|
|
[Assembly directive for setting text section])
|
|
|
|
OMPI_ASM_TEXT="$ompi_cv_asm_text"
|
|
|
|
AC_SUBST(OMPI_ASM_TEXT)
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_GLOBAL
|
|
|
|
dnl
|
|
|
|
dnl Sets OMPI_ASM_GLOBAL to the value to prefix global values
|
|
|
|
dnl
|
|
|
|
dnl I'm sure if I don't have a test for this, there will be some
|
|
|
|
dnl dumb platform that uses something else
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_GLOBAL],[
|
|
|
|
AC_MSG_CHECKING([directive for exporting symbols])
|
|
|
|
ompi_cv_asm_global=""
|
2005-12-15 07:19:16 +03:00
|
|
|
if test "$ompi_cv_c_compiler_vendor" = "microsoft" ; then
|
|
|
|
ompi_cv_asm_global="PUBLIC"
|
|
|
|
else
|
|
|
|
case $host in
|
|
|
|
*)
|
2005-01-27 04:39:55 +03:00
|
|
|
ompi_cv_asm_global=".globl"
|
2005-12-15 07:19:16 +03:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_MSG_RESULT([$ompi_cv_asm_global])
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_GLOBAL], ["$ompi_cv_asm_global"],
|
|
|
|
[Assembly directive for exporting symbols])
|
|
|
|
OMPI_ASM_GLOBAL="$ompi_cv_asm_global"
|
|
|
|
AC_SUBST(OMPI_AS_GLOBAL)
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_LSYM
|
|
|
|
dnl
|
|
|
|
dnl Sets OMPI_ASM_LSYM to the prefix value on a symbol to make it
|
|
|
|
dnl an internal label (jump target and whatnot)
|
|
|
|
dnl
|
|
|
|
dnl We look for L .L $ L$ (in that order) for something that both
|
|
|
|
dnl assembles and does not leave a label in the output of nm. Fall
|
|
|
|
dnl back to L if nothing else seems to work :/
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
|
2005-07-09 22:52:53 +04:00
|
|
|
# _OMPI_CHECK_ASM_LSYM([variable-to-set])
|
|
|
|
# ---------------------------------------
|
|
|
|
AC_DEFUN([_OMPI_CHECK_ASM_LSYM],[
|
2007-06-01 06:31:15 +04:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
|
|
|
|
2005-07-09 22:52:53 +04:00
|
|
|
$1="L"
|
2005-01-27 04:39:55 +03:00
|
|
|
|
|
|
|
for sym in L .L $ L$ ; do
|
|
|
|
asm_result=0
|
2005-09-16 16:28:53 +04:00
|
|
|
echo "configure: trying $sym" >&AC_FD_CC
|
2005-01-27 04:39:55 +03:00
|
|
|
OMPI_TRY_ASSEMBLE([foobar$ompi_cv_asm_label_suffix
|
|
|
|
${sym}mytestlabel$ompi_cv_asm_label_suffix],
|
|
|
|
[# ok, we succeeded at assembling. see if we can nm,
|
|
|
|
# throwing the results in a file
|
|
|
|
if $NM conftest.$OBJEXT > conftest.out 2>&AC_FD_CC ; then
|
2007-06-01 06:31:15 +04:00
|
|
|
if test "`$GREP mytestlabel conftest.out`" = "" ; then
|
2005-01-27 04:39:55 +03:00
|
|
|
# there was no symbol... looks promising to me
|
2005-07-09 22:52:53 +04:00
|
|
|
$1="$sym"
|
2005-01-27 04:39:55 +03:00
|
|
|
asm_result=1
|
2007-06-01 06:31:15 +04:00
|
|
|
elif test ["`$GREP ' [Nt] .*mytestlabel' conftest.out`"] = "" ; then
|
2005-01-27 04:39:55 +03:00
|
|
|
# see if we have a non-global-ish symbol
|
|
|
|
# but we should see if we can do better.
|
2005-07-09 22:52:53 +04:00
|
|
|
$1="$sym"
|
2005-01-27 04:39:55 +03:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
# not so much on the NM goodness :/
|
2005-09-16 16:28:53 +04:00
|
|
|
echo "$NM failed. Output from NM was:" >&AC_FD_CC
|
|
|
|
cat conftest.out >&AC_FD_CC
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_MSG_WARN([$NM could not read object file])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
if test "$asm_result" = "1" ; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
rm -f conftest.out
|
2005-07-09 22:52:53 +04:00
|
|
|
unset asm_result sym
|
|
|
|
])
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-07-09 22:52:53 +04:00
|
|
|
# OMPI_CHECK_ASM_LSYM()
|
|
|
|
# ---------------------
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_LSYM],[
|
|
|
|
AC_REQUIRE([AC_PROG_NM])
|
|
|
|
|
|
|
|
AC_CACHE_CHECK([prefix for lsym labels],
|
|
|
|
[ompi_cv_asm_lsym],
|
|
|
|
[_OMPI_CHECK_ASM_LSYM([ompi_cv_asm_lsym])])
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_LSYM], ["$ompi_cv_asm_lsym"],
|
|
|
|
[Assembly prefix for lsym labels])
|
|
|
|
OMPI_ASM_LSYM="$ompi_cv_asm_lsym"
|
|
|
|
AC_SUBST(OMPI_ASM_LSYM)
|
|
|
|
])dnl
|
|
|
|
|
2006-08-01 02:30:07 +04:00
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_PROC
|
|
|
|
dnl
|
|
|
|
dnl Sets a cv-flag, if the compiler needs a proc/endp-definition to
|
|
|
|
dnl link with C.
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_PROC],[
|
|
|
|
AC_CACHE_CHECK([if .proc/endp is needed],
|
|
|
|
[ompi_cv_asm_need_proc],
|
|
|
|
[ompi_cv_asm_need_proc="no"
|
|
|
|
OMPI_TRY_ASSEMBLE([
|
|
|
|
.proc mysym
|
|
|
|
mysym:
|
|
|
|
.endp mysym],
|
|
|
|
[ompi_cv_asm_need_proc="yes"])
|
|
|
|
rm -f conftest.out])
|
|
|
|
|
|
|
|
if test "$ompi_cv_asm_need_proc" = "yes" ; then
|
|
|
|
ompi_cv_asm_proc=".proc"
|
|
|
|
ompi_cv_asm_endproc=".endp"
|
|
|
|
else
|
|
|
|
ompi_cv_asm_proc="#"
|
|
|
|
ompi_cv_asm_endproc="#"
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
|
2005-01-27 04:39:55 +03:00
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_GSYM
|
|
|
|
dnl
|
|
|
|
dnl Sets OMPI_ASM_GSYM to the prefix value on a symbol to make it
|
|
|
|
dnl a global linkable from C. Basically, an _ or not.
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_GSYM],[
|
2005-09-16 06:49:31 +04:00
|
|
|
AC_CACHE_CHECK([prefix for global symbol labels],
|
|
|
|
[ompi_cv_asm_gsym],
|
|
|
|
[_OMPI_CHECK_ASM_GSYM])
|
|
|
|
|
|
|
|
if test "$ompi_cv_asm_gsym" = "none" ; then
|
|
|
|
AC_MSG_ERROR([Could not determine global symbol label prefix])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_GSYM], ["$ompi_cv_asm_gsym"],
|
|
|
|
[Assembly prefix for gsym labels])
|
|
|
|
OMPI_ASM_GSYM="$ompi_cv_asm_gsym"
|
|
|
|
AC_SUBST(OMPI_ASM_GSYM)
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([_OMPI_CHECK_ASM_GSYM],[
|
2005-01-27 04:39:55 +03:00
|
|
|
ompi_cv_asm_gsym="none"
|
|
|
|
|
2005-01-31 07:16:54 +03:00
|
|
|
for sym in "_" "" "." ; do
|
2005-01-27 04:39:55 +03:00
|
|
|
asm_result=0
|
2005-09-16 16:28:53 +04:00
|
|
|
echo "configure: trying $sym" >&AC_FD_CC
|
2005-01-27 04:39:55 +03:00
|
|
|
cat > conftest_c.c <<EOF
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
void gsym_test_func(void);
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
int
|
2006-09-23 03:58:23 +04:00
|
|
|
main()
|
2005-01-27 04:39:55 +03:00
|
|
|
{
|
|
|
|
gsym_test_func();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
OMPI_TRY_ASSEMBLE([
|
|
|
|
$ompi_cv_asm_text
|
2006-08-01 02:30:07 +04:00
|
|
|
$ompi_cv_asm_proc ${sym}gsym_test_func
|
2005-01-27 04:39:55 +03:00
|
|
|
$ompi_cv_asm_global ${sym}gsym_test_func
|
2006-08-01 02:30:07 +04:00
|
|
|
${sym}gsym_test_func${ompi_cv_asm_label_suffix}
|
|
|
|
$ompi_cv_asm_endproc ${sym}gsym_test_func
|
|
|
|
],
|
2005-01-27 04:39:55 +03:00
|
|
|
[ompi_compile="$CC $CFLAGS -I. conftest_c.c -c > conftest.cmpl 2>&1"
|
|
|
|
if AC_TRY_EVAL(ompi_compile) ; then
|
|
|
|
# save the warnings
|
|
|
|
cat conftest.cmpl >&AC_FD_CC
|
2008-03-22 02:00:54 +03:00
|
|
|
ompi_link="$CC $CFLAGS conftest_c.$OBJEXT conftest.$OBJEXT -o conftest $LDFLAGS $LIBS > conftest.link 2>&1"
|
2005-01-27 04:39:55 +03:00
|
|
|
if AC_TRY_EVAL(ompi_link) ; then
|
|
|
|
# save the warnings
|
|
|
|
cat conftest.link >&AC_FD_CC
|
|
|
|
asm_result=1
|
|
|
|
else
|
|
|
|
cat conftest.link >&AC_FD_CC
|
|
|
|
echo "configure: failed C program was: " >&AC_FD_CC
|
|
|
|
cat conftest_c.c >&AC_FD_CC
|
|
|
|
echo "configure: failed ASM program was: " >&AC_FD_CC
|
|
|
|
cat conftest.s >&AC_FD_CC
|
|
|
|
asm_result=0
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# save output and failed program
|
|
|
|
cat conftest.cmpl >&AC_FD_CC
|
|
|
|
echo "configure: failed C program was: " >&AC_FD_CC
|
|
|
|
cat conftest.c >&AC_FD_CC
|
|
|
|
asm_result=0
|
|
|
|
fi],
|
|
|
|
[asm_result=0])
|
|
|
|
if test "$asm_result" = "1" ; then
|
|
|
|
ompi_cv_asm_gsym="$sym"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2007-11-06 04:32:42 +03:00
|
|
|
rm -rf conftest.*
|
2005-01-27 04:39:55 +03:00
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_LABEL_SUFFIX
|
|
|
|
dnl
|
|
|
|
dnl Sets OMPI_ASM_LABEL_SUFFIX to the value to suffix for labels
|
|
|
|
dnl
|
|
|
|
dnl I'm sure if I don't have a test for this, there will be some
|
|
|
|
dnl dumb platform that uses something else
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_LABEL_SUFFIX],[
|
|
|
|
AC_MSG_CHECKING([suffix for labels])
|
|
|
|
ompi_cv_asm_label_suffix=""
|
|
|
|
case $host in
|
|
|
|
*)
|
|
|
|
ompi_cv_asm_label_suffix=":"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_MSG_RESULT([$ompi_cv_asm_label_suffix])
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_LABEL_SUFFIX], ["$ompi_cv_asm_label_suffix"],
|
|
|
|
[Assembly suffix for labels])
|
|
|
|
OMPI_ASM_LABEL_SUFFIX="$ompi_cv_asm_label_suffix"
|
|
|
|
AC_SUBST(OMPI_AS_LABEL_SUFFIX)
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_ALIGN_LOG
|
|
|
|
dnl
|
|
|
|
dnl Sets OMPI_ASM_ALIGN_LOG to 1 if align is specified
|
|
|
|
dnl logarithmically, 0 otherwise
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_ALIGN_LOG],[
|
|
|
|
AC_REQUIRE([AC_PROG_NM])
|
2007-06-01 06:31:15 +04:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-09-16 08:51:09 +04:00
|
|
|
AC_CACHE_CHECK([if .align directive takes logarithmic value],
|
|
|
|
[ompi_cv_asm_align_log],
|
|
|
|
[ OMPI_TRY_ASSEMBLE([ $ompi_cv_asm_text
|
2005-01-27 04:39:55 +03:00
|
|
|
.align 4
|
|
|
|
$ompi_cv_asm_global foo
|
|
|
|
.byte 1
|
|
|
|
.align 4
|
|
|
|
foo$ompi_cv_asm_label_suffix
|
|
|
|
.byte 2],
|
2007-06-01 06:31:15 +04:00
|
|
|
[ompi_asm_addr=[`$NM conftest.$OBJEXT | $GREP foo | sed -e 's/.*\([0-9a-fA-F][0-9a-fA-F]\).*foo.*/\1/'`]],
|
2005-01-27 04:39:55 +03:00
|
|
|
[ompi_asm_addr=""])
|
|
|
|
# test for both 16 and 10 (decimal and hex notations)
|
2005-09-16 16:28:53 +04:00
|
|
|
echo "configure: .align test address offset is $ompi_asm_addr" >&AC_FD_CC
|
2005-01-27 04:39:55 +03:00
|
|
|
if test "$ompi_asm_addr" = "16" -o "$ompi_asm_addr" = "10" ; then
|
2005-09-16 08:51:09 +04:00
|
|
|
ompi_cv_asm_align_log="yes"
|
|
|
|
else
|
|
|
|
ompi_cv_asm_align_log="no"
|
|
|
|
fi])
|
|
|
|
|
|
|
|
if test "$ompi_cv_asm_align_log" = "yes" -o "$ompi_cv_asm_align_log" = "1" ; then
|
|
|
|
ompi_asm_align_log_result=1
|
|
|
|
else
|
|
|
|
ompi_asm_align_log_result=0
|
2005-01-27 04:39:55 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_ALIGN_LOG],
|
2005-09-16 08:51:09 +04:00
|
|
|
[$asm_align_log_result],
|
2005-01-27 04:39:55 +03:00
|
|
|
[Assembly align directive expects logarithmic value])
|
|
|
|
|
|
|
|
unset omp_asm_addr asm_result
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_TYPE
|
|
|
|
dnl
|
|
|
|
dnl Sets OMPI_ASM_TYPE to the prefix for the function type to
|
|
|
|
dnl set a symbol's type as function (needed on ELF for shared
|
|
|
|
dnl libaries). If no .type directive is needed, sets OMPI_ASM_TYPE
|
|
|
|
dnl to an empty string
|
|
|
|
dnl
|
|
|
|
dnl We look for @ \# %
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_TYPE],[
|
2005-09-16 06:49:31 +04:00
|
|
|
AC_CACHE_CHECK([prefix for function in .type],
|
|
|
|
[ompi_cv_asm_type],
|
|
|
|
[_OMPI_CHECK_ASM_TYPE])
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_TYPE], ["$ompi_cv_asm_type"],
|
|
|
|
[How to set function type in .type directive])
|
|
|
|
OMPI_ASM_TYPE="$ompi_cv_asm_type"
|
|
|
|
AC_SUBST(OMPI_ASM_TYPE)
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN([_OMPI_CHECK_ASM_TYPE],[
|
2005-01-27 04:39:55 +03:00
|
|
|
ompi_cv_asm_type=""
|
|
|
|
|
2005-02-15 01:07:08 +03:00
|
|
|
case "${host}" in
|
|
|
|
*-sun-solaris*)
|
|
|
|
# GCC on solaris seems to accept just about anything, not
|
|
|
|
# that what it defines actually works... So just hardwire
|
|
|
|
# to the right answer
|
|
|
|
ompi_cv_asm_type="#"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
for type in @ \# % ; do
|
|
|
|
asm_result=0
|
2005-09-16 16:28:53 +04:00
|
|
|
echo "configure: trying $type" >&AC_FD_CC
|
2005-12-20 03:49:59 +03:00
|
|
|
OMPI_TRY_ASSEMBLE([ .type mysym, ${type}function
|
|
|
|
mysym:],
|
|
|
|
[ompi_cv_asm_type="${type}"
|
|
|
|
asm_result=1])
|
2005-02-15 01:07:08 +03:00
|
|
|
if test "$asm_result" = "1" ; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
2005-01-27 04:39:55 +03:00
|
|
|
rm -f conftest.out
|
|
|
|
|
|
|
|
unset asm_result type
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_ASM_SIZE
|
|
|
|
dnl
|
|
|
|
dnl Sets OMPI_ASM_SIZE to 1 if we should set .size directives for
|
|
|
|
dnl each function, 0 otherwise.
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_SIZE],[
|
2005-09-16 06:49:31 +04:00
|
|
|
AC_CACHE_CHECK([if .size is needed],
|
|
|
|
[ompi_cv_asm_need_size],
|
|
|
|
[ompi_cv_asm_need_size="no"
|
|
|
|
OMPI_TRY_ASSEMBLE([ .size mysym, 1],
|
2005-12-20 03:49:59 +03:00
|
|
|
[ompi_cv_asm_need_size="yes"])
|
2005-09-16 06:49:31 +04:00
|
|
|
rm -f conftest.out])
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-09-16 06:49:31 +04:00
|
|
|
if test "$ompi_cv_asm_need_size" = "yes" ; then
|
|
|
|
ompi_asm_size=1
|
|
|
|
else
|
|
|
|
ompi_asm_size=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_SIZE], ["$ompi_asm_size"],
|
|
|
|
[Do we need to give a .size directive])
|
|
|
|
OMPI_ASM_SIZE="$ompi_asm_size"
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_SUBST(OMPI_ASM_TYPE)
|
|
|
|
unset asm_result
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2006-01-11 07:49:40 +03:00
|
|
|
# OMPI_CHECK_ASM_GNU_STACKEXEC(var)
|
|
|
|
# ----------------------------------
|
|
|
|
# sets shell variable var to the things necessary to
|
|
|
|
# disable execable stacks with GAS
|
|
|
|
AC_DEFUN([OMPI_CHECK_ASM_GNU_STACKEXEC], [
|
2007-06-01 06:31:15 +04:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
|
|
|
|
2006-01-11 07:49:40 +03:00
|
|
|
AC_CHECK_PROG([OBJDUMP], [objdump], [objdump])
|
|
|
|
AC_CACHE_CHECK([if .note.GNU-stack is needed],
|
|
|
|
[ompi_cv_asm_gnu_stack_result],
|
|
|
|
[AS_IF([test "$OBJDUMP" != ""],
|
|
|
|
[ # first, see if a simple C program has it set
|
|
|
|
cat >conftest.c <<EOF
|
|
|
|
int testfunc() {return 0; }
|
|
|
|
EOF
|
|
|
|
OMPI_LOG_COMMAND([$CC $CFLAGS -c conftest.c -o conftest.$OBJEXT],
|
2007-06-01 06:31:15 +04:00
|
|
|
[$OBJDUMP -x conftest.$OBJEXT | $GREP '\.note\.GNU-stack' > /dev/null && ompi_cv_asm_gnu_stack_result=yes],
|
2006-01-11 07:49:40 +03:00
|
|
|
[OMPI_LOG_MSG([the failed program was:], 1)
|
|
|
|
OMPI_LOG_FILE([conftest.c])
|
|
|
|
ompi_cv_asm_gnu_stack_result=no])
|
|
|
|
if test "$ompi_cv_asm_gnu_stack_result" != "yes" ; then
|
|
|
|
ompi_cv_asm_gnu_stack_result="no"
|
|
|
|
fi
|
2007-11-06 04:32:42 +03:00
|
|
|
rm -rf conftest.*],
|
2006-01-11 07:49:40 +03:00
|
|
|
[ompi_cv_asm_gnu_stack_result="no"])])
|
|
|
|
if test "$ompi_cv_asm_gnu_stack_result" = "yes" ; then
|
|
|
|
ompi_cv_asm_gnu_stack=1
|
|
|
|
else
|
|
|
|
ompi_cv_asm_gnu_stack=0
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2005-01-27 04:39:55 +03:00
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_POWERPC_REG
|
|
|
|
dnl
|
|
|
|
dnl See if the notation for specifying registers is X (most everyone)
|
|
|
|
dnl or rX (OS X)
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_POWERPC_REG],[
|
|
|
|
AC_MSG_CHECKING([if PowerPC registers have r prefix])
|
|
|
|
OMPI_TRY_ASSEMBLE([$ompi_cv_asm_text
|
|
|
|
addi 1,1,0],
|
|
|
|
[ompi_cv_asm_powerpc_r_reg=0],
|
2006-05-31 07:37:31 +04:00
|
|
|
[OMPI_TRY_ASSEMBLE([$ompi_cv_asm_text
|
2005-01-27 04:39:55 +03:00
|
|
|
addi r1,r1,0],
|
|
|
|
[ompi_cv_asm_powerpc_r_reg=1],
|
2006-05-31 07:37:31 +04:00
|
|
|
[AC_MSG_ERROR([Can not determine how to use PPC registers])])])
|
2005-01-27 04:39:55 +03:00
|
|
|
if test "$ompi_cv_asm_powerpc_r_reg" = "1" ; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_POWERPC_R_REGISTERS],
|
|
|
|
[$ompi_cv_asm_powerpc_r_reg],
|
|
|
|
[Whether r notation is used for ppc registers])
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_POWERPC_64BIT
|
|
|
|
dnl
|
|
|
|
dnl On some powerpc chips (the PPC970 or G5), the OS usually runs in
|
|
|
|
dnl 32 bit mode, even though the hardware can do 64bit things. If
|
|
|
|
dnl the compiler will let us, emit code for 64bit test and set type
|
|
|
|
dnl operations (on a long long).
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_POWERPC_64BIT],[
|
2006-03-15 06:33:46 +03:00
|
|
|
if test "$ac_cv_sizeof_long" != "4" ; then
|
|
|
|
# this function should only be called in the 32 bit case
|
|
|
|
AC_MSG_ERROR([CHECK_POWERPC_64BIT called on 64 bit platform. Internal error.])
|
2005-01-27 04:39:55 +03:00
|
|
|
fi
|
2006-03-15 06:33:46 +03:00
|
|
|
AC_MSG_CHECKING([for 64-bit PowerPC assembly support])
|
|
|
|
case $host in
|
|
|
|
*-darwin*)
|
|
|
|
ppc64_result=0
|
|
|
|
if test "$ompi_cv_asm_powerpc_r_reg" = "1" ; then
|
|
|
|
ldarx_asm=" ldarx r1,r1,r1";
|
|
|
|
else
|
|
|
|
ldarx_asm=" ldarx 1,1,1";
|
|
|
|
fi
|
|
|
|
OMPI_TRY_ASSEMBLE([$ompi_cv_asm_text
|
2005-01-27 04:39:55 +03:00
|
|
|
$ldarx_asm],
|
|
|
|
[ppc64_result=1],
|
|
|
|
[ppc64_result=0])
|
2006-03-15 06:33:46 +03:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ppc64_result=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2005-01-27 04:39:55 +03:00
|
|
|
if test "$ppc64_result" = "1" ; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
ifelse([$1],,:,[$1])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
ifelse([$2],,:,[$2])
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset ppc64_result ldarx_asm
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2005-02-18 23:10:29 +03:00
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_SPARCV8PLUS
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CHECK_SPARCV8PLUS],[
|
|
|
|
AC_MSG_CHECKING([if have Sparc v8+/v9 support])
|
|
|
|
sparc_result=0
|
|
|
|
OMPI_TRY_ASSEMBLE([$ompi_cv_asm_text
|
|
|
|
casa [%o0] 0x80, %o1, %o2],
|
|
|
|
[sparc_result=1],
|
|
|
|
[sparc_result=0])
|
|
|
|
if test "$sparc_result" = "1" ; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
ifelse([$1],,:,[$1])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
ifelse([$2],,:,[$2])
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset sparc_result
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2005-01-27 04:39:55 +03:00
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_INLINE_GCC
|
|
|
|
dnl
|
|
|
|
dnl Check if the compiler is capable of doing GCC-style inline
|
|
|
|
dnl assembly. Some compilers emit a warning and ignore the inline
|
|
|
|
dnl assembly (xlc on OS X) and compile without error. Therefore,
|
|
|
|
dnl the test attempts to run the emited code to check that the
|
|
|
|
dnl assembly is actually run. To run this test, one argument to
|
|
|
|
dnl the macro must be an assembly instruction in gcc format to move
|
|
|
|
dnl the value 0 into the register containing the variable ret.
|
|
|
|
dnl For PowerPC, this would be:
|
|
|
|
dnl
|
|
|
|
dnl "li %0,0" : "=&r"(ret)
|
|
|
|
dnl
|
|
|
|
dnl DEFINE OMPI_GCC_INLINE_ASSEMBLY to 0 or 1 depending on GCC
|
|
|
|
dnl support
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
2005-08-02 23:51:57 +04:00
|
|
|
AC_DEFUN([OMPI_CHECK_INLINE_C_GCC],[
|
2005-01-27 04:39:55 +03:00
|
|
|
assembly="$1"
|
|
|
|
asm_result="unknown"
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if $CC supports GCC inline assembly])
|
|
|
|
|
2006-03-10 05:11:41 +03:00
|
|
|
if test "$ompi_cv_c_compiler_vendor" = "portland group" ; then
|
|
|
|
# PGI seems to have some issues with our inline assembly.
|
|
|
|
# Disable for now.
|
|
|
|
asm_result="no (Portland Group)"
|
|
|
|
else
|
|
|
|
case $host in
|
|
|
|
*-aix*)
|
|
|
|
# the AIX compilers and linkers really don't do gcc
|
|
|
|
# inline assembly right - disable for now.
|
|
|
|
asm_result="no (AIX)"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if test ! "$assembly" = "" ; then
|
|
|
|
AC_RUN_IFELSE(AC_LANG_PROGRAM([[
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_INCLUDES_DEFAULT]],
|
|
|
|
[[int ret = 1;
|
|
|
|
__asm__ __volatile__ ($assembly);
|
|
|
|
return ret;]]),
|
2005-10-18 23:04:35 +04:00
|
|
|
[asm_result="yes"], [asm_result="no"],
|
|
|
|
[asm_result="unknown"])
|
2006-03-10 05:11:41 +03:00
|
|
|
else
|
|
|
|
assembly="test skipped - assuming no"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2006-03-10 05:11:41 +03:00
|
|
|
# if we're cross compiling, just try to compile and figure good enough
|
|
|
|
if test "$asm_result" = "unknown" ; then
|
|
|
|
AC_LINK_IFELSE(AC_LANG_PROGRAM([[
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_INCLUDES_DEFAULT]],
|
|
|
|
[[int ret = 1;
|
|
|
|
__asm__ __volatile__ ($assembly);
|
|
|
|
return ret;]]),
|
|
|
|
[asm_result="yes"], [asm_result="no"])
|
2006-03-10 05:11:41 +03:00
|
|
|
fi
|
2005-01-27 04:39:55 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$asm_result])
|
|
|
|
|
|
|
|
if test "$asm_result" = "yes" ; then
|
2005-08-02 23:51:57 +04:00
|
|
|
OMPI_C_GCC_INLINE_ASSEMBLY=1
|
2005-01-27 04:39:55 +03:00
|
|
|
else
|
2005-08-02 23:51:57 +04:00
|
|
|
OMPI_C_GCC_INLINE_ASSEMBLY=0
|
2005-01-27 04:39:55 +03:00
|
|
|
fi
|
|
|
|
|
2005-08-02 23:51:57 +04:00
|
|
|
AC_DEFINE_UNQUOTED([OMPI_C_GCC_INLINE_ASSEMBLY],
|
|
|
|
[$OMPI_C_GCC_INLINE_ASSEMBLY],
|
|
|
|
[Whether C compiler supports GCC style inline assembly])
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-08-02 23:51:57 +04:00
|
|
|
unset OMPI_C_GCC_INLINE_ASSEMBLY assembly asm_result
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
AC_DEFUN([OMPI_CHECK_INLINE_CXX_GCC],[
|
|
|
|
assembly="$1"
|
|
|
|
asm_result="unknown"
|
|
|
|
|
|
|
|
AC_LANG_PUSH([C++])
|
|
|
|
AC_MSG_CHECKING([if $CXX supports GCC inline assembly])
|
|
|
|
|
2005-10-18 23:04:35 +04:00
|
|
|
case $host in
|
|
|
|
*-aix*)
|
|
|
|
# the AIX compilers and linkers really don't do gcc
|
|
|
|
# inline assembly right - disable for now.
|
|
|
|
asm_result="no (AIX)"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if test ! "$assembly" = "" ; then
|
|
|
|
AC_RUN_IFELSE(AC_LANG_PROGRAM([[
|
2005-08-02 23:51:57 +04:00
|
|
|
AC_INCLUDES_DEFAULT]],
|
|
|
|
[[int ret = 1;
|
|
|
|
__asm__ __volatile__ ($assembly);
|
|
|
|
return ret;]]),
|
2005-10-18 23:04:35 +04:00
|
|
|
[asm_result="yes"], [asm_result="no"],
|
|
|
|
[asm_result="unknown"])
|
|
|
|
else
|
|
|
|
assembly="test skipped - assuming no"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2005-08-02 23:51:57 +04:00
|
|
|
# if we're cross compiling, just try to compile and figure good enough
|
|
|
|
if test "$asm_result" = "unknown" ; then
|
|
|
|
AC_LINK_IFELSE(AC_LANG_PROGRAM([[
|
|
|
|
AC_INCLUDES_DEFAULT]],
|
|
|
|
[[int ret = 1;
|
|
|
|
__asm__ __volatile__ ($assembly);
|
|
|
|
return ret;]]),
|
|
|
|
[asm_result="yes"], [asm_result="no"])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$asm_result])
|
|
|
|
|
|
|
|
if test "$asm_result" = "yes" ; then
|
|
|
|
OMPI_CXX_GCC_INLINE_ASSEMBLY=1
|
|
|
|
else
|
|
|
|
OMPI_CXX_GCC_INLINE_ASSEMBLY=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_CXX_GCC_INLINE_ASSEMBLY],
|
|
|
|
[$OMPI_CXX_GCC_INLINE_ASSEMBLY],
|
|
|
|
[Whether C++ compiler supports GCC style inline assembly])
|
|
|
|
AC_LANG_POP([C++])
|
|
|
|
|
|
|
|
unset OMPI_CXX_GCC_INLINE_ASSEMBLY assembly asm_result
|
2005-01-27 04:39:55 +03:00
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_INLINE_DEC
|
|
|
|
dnl
|
|
|
|
dnl DEFINE OMPI_DEC to 0 or 1 depending on DEC
|
|
|
|
dnl support
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
2005-08-02 23:51:57 +04:00
|
|
|
AC_DEFUN([OMPI_CHECK_INLINE_C_DEC],[
|
2005-01-27 04:39:55 +03:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([if $CC supports DEC inline assembly])
|
|
|
|
|
|
|
|
AC_LINK_IFELSE(AC_LANG_PROGRAM([[
|
|
|
|
AC_INCLUDES_DEFAULT
|
|
|
|
#include <c_asm.h>]],
|
|
|
|
[[asm("");
|
|
|
|
return 0;]]),
|
|
|
|
[asm_result="yes"], [asm_result="no"])
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$asm_result])
|
|
|
|
|
|
|
|
if test "$asm_result" = "yes" ; then
|
2005-08-02 23:51:57 +04:00
|
|
|
OMPI_C_DEC_INLINE_ASSEMBLY=1
|
2005-01-27 04:39:55 +03:00
|
|
|
else
|
2005-08-02 23:51:57 +04:00
|
|
|
OMPI_C_DEC_INLINE_ASSEMBLY=0
|
2005-01-27 04:39:55 +03:00
|
|
|
fi
|
|
|
|
|
2005-08-02 23:51:57 +04:00
|
|
|
AC_DEFINE_UNQUOTED([OMPI_C_DEC_INLINE_ASSEMBLY],
|
|
|
|
[$OMPI_C_DEC_INLINE_ASSEMBLY],
|
|
|
|
[Whether C compiler supports DEC style inline assembly])
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-08-02 23:51:57 +04:00
|
|
|
unset OMPI_C_DEC_INLINE_ASSEMBLY asm_result
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
AC_DEFUN([OMPI_CHECK_INLINE_CXX_DEC],[
|
|
|
|
|
|
|
|
AC_LANG_PUSH([C++])
|
|
|
|
AC_MSG_CHECKING([if $CXX supports DEC inline assembly])
|
|
|
|
|
|
|
|
AC_LINK_IFELSE(AC_LANG_PROGRAM([[
|
|
|
|
AC_INCLUDES_DEFAULT
|
|
|
|
#include <c_asm.h>]],
|
|
|
|
[[asm("");
|
|
|
|
return 0;]]),
|
|
|
|
[asm_result="yes"], [asm_result="no"])
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$asm_result])
|
|
|
|
|
|
|
|
if test "$asm_result" = "yes" ; then
|
|
|
|
OMPI_CXX_DEC_INLINE_ASSEMBLY=1
|
|
|
|
else
|
|
|
|
OMPI_CXX_DEC_INLINE_ASSEMBLY=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_CXX_DEC_INLINE_ASSEMBLY],
|
|
|
|
[$OMPI_CXX_DEC_INLINE_ASSEMBLY],
|
|
|
|
[Whether C++ compiler supports DEC style inline assembly])
|
|
|
|
AC_LANG_POP([C++])
|
|
|
|
|
|
|
|
unset OMPI_CXX_DEC_INLINE_ASSEMBLY asm_result
|
2005-01-27 04:39:55 +03:00
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CHECK_INLINE_XLC
|
|
|
|
dnl
|
|
|
|
dnl DEFINE OMPI_XLC to 0 or 1 depending on XLC
|
|
|
|
dnl support
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
2005-08-02 23:51:57 +04:00
|
|
|
AC_DEFUN([OMPI_CHECK_INLINE_C_XLC],[
|
2005-01-27 04:39:55 +03:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([if $CC supports XLC inline assembly])
|
|
|
|
|
2005-08-02 23:51:57 +04:00
|
|
|
OMPI_C_XLC_INLINE_ASSEMBLY=0
|
2005-01-27 04:39:55 +03:00
|
|
|
asm_result="no"
|
|
|
|
if test "$CC" = "xlc" ; then
|
2005-08-02 23:51:57 +04:00
|
|
|
OMPI_XLC_INLINE_ASSEMBLY=1
|
|
|
|
asm_result="yes"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$asm_result])
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_C_XLC_INLINE_ASSEMBLY],
|
|
|
|
[$OMPI_C_XLC_INLINE_ASSEMBLY],
|
|
|
|
[Whether C compiler supports XLC style inline assembly])
|
|
|
|
|
|
|
|
unset OMPI_C_XLC_INLINE_ASSEMBLY
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
AC_DEFUN([OMPI_CHECK_INLINE_CXX_XLC],[
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if $CXX supports XLC inline assembly])
|
|
|
|
|
|
|
|
OMPI_CXX_XLC_INLINE_ASSEMBLY=0
|
|
|
|
asm_result="no"
|
|
|
|
if test "$CXX" = "xlC" -o "$CXX" = "xlc++" ; then
|
|
|
|
OMPI_CXX_XLC_INLINE_ASSEMBLY=1
|
|
|
|
asm_result="yes"
|
2005-01-27 04:39:55 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$asm_result])
|
2005-08-02 23:51:57 +04:00
|
|
|
AC_DEFINE_UNQUOTED([OMPI_CXX_XLC_INLINE_ASSEMBLY],
|
|
|
|
[$OMPI_CXX_XLC_INLINE_ASSEMBLY],
|
|
|
|
[Whether C++ compiler supports XLC style inline assembly])
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-08-02 23:51:57 +04:00
|
|
|
unset OMPI_CXX_XLC_INLINE_ASSEMBLY
|
2005-01-27 04:39:55 +03:00
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_CONFIG_ASM
|
|
|
|
dnl
|
|
|
|
dnl DEFINE OMPI_ASSEMBLY_ARCH to something in sys/architecture.h
|
|
|
|
dnl DEFINE OMPI_ASSEMBLY_FORMAT to string containing correct
|
|
|
|
dnl format for assembly (not user friendly)
|
|
|
|
dnl SUBST OMPI_ASSEMBLY_FORMAT to string containing correct
|
|
|
|
dnl format for assembly (not user friendly)
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_CONFIG_ASM],[
|
|
|
|
AC_REQUIRE([OMPI_SETUP_CC])
|
|
|
|
AC_REQUIRE([OMPI_SETUP_CXX])
|
|
|
|
AC_REQUIRE([AM_PROG_AS])
|
|
|
|
|
2007-11-06 15:02:11 +03:00
|
|
|
# OS X Leopard ld bus errors if you have "-g" in the link line
|
|
|
|
# with our assembly (!). So remove it from CCASFLAGS if it's
|
|
|
|
# there (and we're on Leopard).
|
|
|
|
OMPI_VAR_SCOPE_PUSH([ompi_config_asm_flags_new ompi_config_asm_flag])
|
|
|
|
AC_MSG_CHECKING([if need to remove -g from CCASFLAGS])
|
|
|
|
case "$host" in
|
2007-11-21 06:10:05 +03:00
|
|
|
*-apple-darwin9.*)
|
2007-11-06 15:02:11 +03:00
|
|
|
for ompi_config_asm_flag in $CCASFLAGS; do
|
|
|
|
if test "$ompi_config_asm_flag" != "-g"; then
|
|
|
|
ompi_config_asm_flags_new="$ompi_config_asm_flags_new $ompi_config_asm_flag"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
CCASFLAGS="$ompi_config_asm_flags_new"
|
|
|
|
AC_MSG_RESULT([OS X Leopard - yes ($CCASFLAGS)])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
OMPI_VAR_SCOPE_POP
|
|
|
|
|
2005-12-20 04:34:27 +03:00
|
|
|
AC_MSG_CHECKING([whether to enable smp locks])
|
|
|
|
AC_ARG_ENABLE([smp-locks],
|
|
|
|
[AC_HELP_STRING([--enable-smp-locks],
|
2006-04-26 06:07:19 +04:00
|
|
|
[enable smp locks in atomic ops. Do not disable if code will ever run in SMP or multi-threaded environment. (default: enabled)])])
|
2005-12-20 04:34:27 +03:00
|
|
|
if test "$enable_smp_locks" != "no"; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
want_smp_locks=1
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
want_smp_locks=0
|
|
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_WANT_SMP_LOCKS], [$want_smp_locks],
|
|
|
|
[whether we want to have smp locks in atomic ops or not])
|
|
|
|
|
|
|
|
if test "$ompi_cv_c_compiler_vendor" = "microsoft" ; then
|
|
|
|
ompi_cv_asm_arch="WINDOWS"
|
|
|
|
else
|
2006-08-01 02:30:07 +04:00
|
|
|
OMPI_CHECK_ASM_PROC
|
2005-12-20 04:34:27 +03:00
|
|
|
OMPI_CHECK_ASM_TEXT
|
|
|
|
OMPI_CHECK_ASM_GLOBAL
|
2006-01-11 07:49:40 +03:00
|
|
|
OMPI_CHECK_ASM_GNU_STACKEXEC
|
2005-12-20 04:34:27 +03:00
|
|
|
OMPI_CHECK_ASM_LABEL_SUFFIX
|
|
|
|
OMPI_CHECK_ASM_GSYM
|
|
|
|
OMPI_CHECK_ASM_LSYM
|
|
|
|
OMPI_CHECK_ASM_TYPE
|
|
|
|
OMPI_CHECK_ASM_SIZE
|
|
|
|
OMPI_CHECK_ASM_ALIGN_LOG
|
|
|
|
|
|
|
|
# find our architecture for purposes of assembly stuff
|
|
|
|
ompi_cv_asm_arch="UNSUPPORTED"
|
|
|
|
OMPI_GCC_INLINE_ASSIGN=""
|
|
|
|
OMPI_ASM_SUPPORT_64BIT=0
|
|
|
|
case "${host}" in
|
|
|
|
i?86-*|x86_64*)
|
2005-12-15 07:19:16 +03:00
|
|
|
if test "$ac_cv_sizeof_long" = "4" ; then
|
|
|
|
ompi_cv_asm_arch="IA32"
|
|
|
|
else
|
2005-08-13 22:32:36 +04:00
|
|
|
ompi_cv_asm_arch="AMD64"
|
2005-12-15 07:19:16 +03:00
|
|
|
fi
|
|
|
|
OMPI_ASM_SUPPORT_64BIT=1
|
|
|
|
OMPI_GCC_INLINE_ASSIGN='"movl [$]0, %0" : "=&r"(ret)'
|
2005-12-20 04:34:27 +03:00
|
|
|
;;
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-12-20 04:34:27 +03:00
|
|
|
ia64-*)
|
|
|
|
ompi_cv_asm_arch="IA64"
|
|
|
|
OMPI_ASM_SUPPORT_64BIT=1
|
|
|
|
OMPI_GCC_INLINE_ASSIGN='"mov %0=r0\n;;\n" : "=&r"(ret)'
|
|
|
|
;;
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2006-09-23 07:23:57 +04:00
|
|
|
alpha-*|alphaev[[4-8]]-*|alphaev56-*|alphaev6[[78]]-*)
|
2005-12-20 04:34:27 +03:00
|
|
|
ompi_cv_asm_arch="ALPHA"
|
|
|
|
OMPI_ASM_SUPPORT_64BIT=1
|
2006-09-23 07:23:57 +04:00
|
|
|
OMPI_GCC_INLINE_ASSIGN='"bis [$]31,[$]31,%0" : "=&r"(ret)'
|
2005-12-20 04:34:27 +03:00
|
|
|
;;
|
2005-02-18 23:10:29 +03:00
|
|
|
|
2008-06-25 07:07:53 +04:00
|
|
|
mips-*|mips64*)
|
2005-12-20 04:34:27 +03:00
|
|
|
# Should really find some way to make sure that we are on
|
|
|
|
# a MIPS III machine (r4000 and later)
|
|
|
|
ompi_cv_asm_arch="MIPS"
|
2005-01-30 07:56:38 +03:00
|
|
|
OMPI_ASM_SUPPORT_64BIT=1
|
2005-12-20 04:34:27 +03:00
|
|
|
OMPI_GCC_INLINE_ASSIGN='"or %0,[$]0,[$]0" : "=&r"(ret)'
|
|
|
|
;;
|
|
|
|
|
|
|
|
powerpc-*|powerpc64-*)
|
|
|
|
OMPI_CHECK_POWERPC_REG
|
|
|
|
if test "$ac_cv_sizeof_long" = "4" ; then
|
|
|
|
ompi_cv_asm_arch="POWERPC32"
|
|
|
|
|
|
|
|
# Note that on some platforms (Apple G5), even if we are
|
|
|
|
# compiling in 32 bit mode (and therefore should assume
|
|
|
|
# sizeof(long) == 4), we can use the 64 bit test and set
|
|
|
|
# operations.
|
|
|
|
OMPI_CHECK_POWERPC_64BIT(OMPI_ASM_SUPPORT_64BIT=1)
|
|
|
|
elif test "$ac_cv_sizeof_long" = "8" ; then
|
|
|
|
OMPI_ASM_SUPPORT_64BIT=1
|
|
|
|
ompi_cv_asm_arch="POWERPC64"
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Could not determine PowerPC word size: $ac_cv_sizeof_long])
|
|
|
|
fi
|
|
|
|
OMPI_GCC_INLINE_ASSIGN='"1: li %0,0" : "=&r"(ret)'
|
|
|
|
;;
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-12-20 04:34:27 +03:00
|
|
|
sparc*-*)
|
|
|
|
# SPARC v9 (and above) are the only ones with 64bit support
|
|
|
|
# if compiling 32 bit, see if we are v9 (aka v8plus) or
|
|
|
|
# earlier (casa is v8+/v9).
|
|
|
|
if test "$ac_cv_sizeof_long" = "4" ; then
|
|
|
|
have_v8plus=0
|
|
|
|
OMPI_CHECK_SPARCV8PLUS([have_v8plus=1])
|
|
|
|
if test "$have_v8plus" = "0" ; then
|
|
|
|
OMPI_ASM_SUPPORT_64BIT=0
|
|
|
|
ompi_cv_asm_arch="SPARC"
|
2006-06-17 22:45:29 +04:00
|
|
|
AC_MSG_WARN([Sparc v8 target is not supported in this release of Open MPI.])
|
|
|
|
AC_MSG_WARN([You must specify the target architecture v8plus])
|
2007-02-16 04:36:59 +03:00
|
|
|
AC_MSG_WARN([(cc: -xarch=v8plus, gcc: -mcpu=v9) for CFLAGS, CXXFLAGS,])
|
2006-06-20 20:25:31 +04:00
|
|
|
AC_MSG_WARN([FFLAGS, and FCFLAGS to compile Open MPI in 32 bit mode on])
|
2006-06-17 22:45:29 +04:00
|
|
|
AC_MSG_WARN([Sparc processors])
|
|
|
|
AC_MSG_ERROR([Can not continue.])
|
2005-12-20 04:34:27 +03:00
|
|
|
else
|
|
|
|
OMPI_ASM_SUPPORT_64BIT=1
|
|
|
|
ompi_cv_asm_arch="SPARCV9_32"
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif test "$ac_cv_sizeof_long" = "8" ; then
|
2005-02-18 23:10:29 +03:00
|
|
|
OMPI_ASM_SUPPORT_64BIT=1
|
2005-12-20 04:34:27 +03:00
|
|
|
ompi_cv_asm_arch="SPARCV9_64"
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Could not determine Sparc word size: $ac_cv_sizeof_long])
|
2005-02-18 23:10:29 +03:00
|
|
|
fi
|
2005-12-20 04:34:27 +03:00
|
|
|
OMPI_GCC_INLINE_ASSIGN='"mov 0,%0" : "=&r"(ret)'
|
|
|
|
;;
|
2005-02-18 23:10:29 +03:00
|
|
|
|
2005-12-20 04:34:27 +03:00
|
|
|
*)
|
|
|
|
AC_MSG_ERROR([No atomic primitives available for $host])
|
|
|
|
;;
|
|
|
|
esac
|
2005-01-27 04:39:55 +03:00
|
|
|
|
2005-12-20 04:34:27 +03:00
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASM_SUPPORT_64BIT],
|
|
|
|
[$OMPI_ASM_SUPPORT_64BIT],
|
|
|
|
[Whether we can do 64bit assembly operations or not. Should not be used outside of the assembly header files])
|
|
|
|
AC_SUBST([OMPI_ASM_SUPPORT_64BIT])
|
|
|
|
|
|
|
|
#
|
|
|
|
# figure out if we need any special function start / stop code
|
|
|
|
#
|
|
|
|
case $host_os in
|
|
|
|
aix*)
|
|
|
|
ompi_asm_arch_config="aix"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ompi_asm_arch_config="default"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# now that we know our architecture, try to inline assemble
|
|
|
|
OMPI_CHECK_INLINE_C_GCC([$OMPI_GCC_INLINE_ASSIGN])
|
|
|
|
OMPI_CHECK_INLINE_C_DEC
|
|
|
|
OMPI_CHECK_INLINE_C_XLC
|
|
|
|
OMPI_CHECK_INLINE_CXX_GCC([$OMPI_GCC_INLINE_ASSIGN])
|
|
|
|
OMPI_CHECK_INLINE_CXX_DEC
|
|
|
|
OMPI_CHECK_INLINE_CXX_XLC
|
|
|
|
|
|
|
|
# format:
|
2006-01-11 07:49:40 +03:00
|
|
|
# config_file-text-global-label_suffix-gsym-lsym-type-size-align_log-ppc_r_reg-64_bit-gnu_stack
|
2005-12-20 04:34:27 +03:00
|
|
|
asm_format="${ompi_asm_arch_config}"
|
|
|
|
asm_format="${asm_format}-${ompi_cv_asm_text}-${ompi_cv_asm_global}"
|
|
|
|
asm_format="${asm_format}-${ompi_cv_asm_label_suffix}-${ompi_cv_asm_gsym}"
|
|
|
|
asm_format="${asm_format}-${ompi_cv_asm_lsym}"
|
|
|
|
asm_format="${asm_format}-${ompi_cv_asm_type}-${ompi_asm_size}"
|
|
|
|
asm_format="${asm_format}-${ompi_asm_align_log_result}"
|
|
|
|
if test "$ompi_cv_asm_arch" = "POWERPC32" -o "$ompi_cv_asm_arch" = "POWERPC64" ; then
|
|
|
|
asm_format="${asm_format}-${ompi_cv_asm_powerpc_r_reg}"
|
|
|
|
else
|
|
|
|
asm_format="${asm_format}-1"
|
|
|
|
fi
|
2006-01-11 07:49:40 +03:00
|
|
|
asm_format="${asm_format}-${OMPI_ASM_SUPPORT_64BIT}"
|
|
|
|
ompi_cv_asm_format="${asm_format}-${ompi_cv_asm_gnu_stack}"
|
2006-09-26 06:37:35 +04:00
|
|
|
# For the Makefile, need to escape the $ as $$. Don't display
|
|
|
|
# this version, but make sure the Makefile gives the right thing
|
|
|
|
# when regenerating the files because the base has been touched.
|
|
|
|
OMPI_ASSEMBLY_FORMAT=`echo "$ompi_cv_asm_format" | sed -e 's/\\\$/\\\$\\\$/'`
|
2005-12-20 04:34:27 +03:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for assembly format])
|
2006-09-26 06:37:35 +04:00
|
|
|
AC_MSG_RESULT([$ompi_cv_asm_format])
|
2005-12-20 04:34:27 +03:00
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASSEMBLY_FORMAT], ["$OMPI_ASSEMBLY_FORMAT"],
|
|
|
|
[Format of assembly file])
|
|
|
|
AC_SUBST([OMPI_ASSEMBLY_FORMAT])
|
|
|
|
fi # if cv_c_compiler_vendor = microsoft
|
|
|
|
|
|
|
|
result="OMPI_$ompi_cv_asm_arch"
|
|
|
|
OMPI_ASSEMBLY_ARCH="$ompi_cv_asm_arch"
|
|
|
|
AC_MSG_CHECKING([for asssembly architecture])
|
|
|
|
AC_MSG_RESULT([$ompi_cv_asm_arch])
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_ASSEMBLY_ARCH], [$result],
|
|
|
|
[Architecture type of assembly to use for atomic operations])
|
|
|
|
AC_SUBST([OMPI_ASSEMBLY_ARCH])
|
|
|
|
|
|
|
|
OMPI_ASM_FIND_FILE
|
|
|
|
|
|
|
|
unset result asm_format
|
2005-01-27 04:39:55 +03:00
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
|
|
|
dnl #################################################################
|
|
|
|
dnl
|
|
|
|
dnl OMPI_ASM_FIND_FILE
|
|
|
|
dnl
|
|
|
|
dnl
|
|
|
|
dnl do all the evil mojo to provide a working assembly file
|
|
|
|
dnl
|
|
|
|
dnl #################################################################
|
|
|
|
AC_DEFUN([OMPI_ASM_FIND_FILE], [
|
2007-06-01 06:31:15 +04:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
2005-02-15 01:07:08 +03:00
|
|
|
AC_REQUIRE([AC_PROG_FGREP])
|
2005-12-15 07:19:16 +03:00
|
|
|
|
|
|
|
if test "$ompi_cv_asm_arch" != "WINDOWS" ; then
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_CHECK_PROG([PERL], [perl], [perl])
|
|
|
|
|
|
|
|
# see if we have a pre-built one already
|
|
|
|
AC_MSG_CHECKING([for pre-built assembly file])
|
|
|
|
ompi_cv_asm_file=""
|
2007-06-01 06:31:15 +04:00
|
|
|
if $GREP "$ompi_cv_asm_arch" "${top_ompi_srcdir}/opal/asm/asm-data.txt" | $FGREP "$ompi_cv_asm_format" >conftest.out 2>&1 ; then
|
2005-01-27 04:39:55 +03:00
|
|
|
ompi_cv_asm_file="`cut -f3 conftest.out`"
|
|
|
|
if test ! "$ompi_cv_asm_file" = "" ; then
|
|
|
|
ompi_cv_asm_file="atomic-${ompi_cv_asm_file}.s"
|
2005-07-02 18:57:46 +04:00
|
|
|
if test -f "${top_ompi_srcdir}/opal/asm/generated/${ompi_cv_asm_file}" ; then
|
2005-01-27 04:39:55 +03:00
|
|
|
AC_MSG_RESULT([yes ($ompi_cv_asm_file)])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no ($ompi_cv_asm_file not found)])
|
|
|
|
ompi_cv_asm_file=""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no (not in asm-data)])
|
|
|
|
fi
|
2007-11-06 04:32:42 +03:00
|
|
|
rm -rf conftest.*
|
2005-01-27 04:39:55 +03:00
|
|
|
|
|
|
|
if test "$ompi_cv_asm_file" = "" ; then
|
|
|
|
if test ! "$PERL" = "" ; then
|
|
|
|
# we have perl... Can we generate a file?
|
|
|
|
AC_MSG_CHECKING([whether possible to generate assembly file])
|
2005-07-02 18:57:46 +04:00
|
|
|
mkdir -p opal/asm/generated
|
2005-01-27 04:39:55 +03:00
|
|
|
ompi_cv_asm_file="atomic-local.s"
|
2008-03-05 03:42:39 +03:00
|
|
|
ompi_try='$PERL $top_ompi_srcdir/opal/asm/generate-asm.pl $ompi_cv_asm_arch "$ompi_cv_asm_format" $top_ompi_srcdir/opal/asm/base $top_ompi_builddir/opal/asm/generated/$ompi_cv_asm_file >conftest.out 2>&1'
|
2005-01-27 04:39:55 +03:00
|
|
|
if AC_TRY_EVAL(ompi_try) ; then
|
|
|
|
# save the warnings
|
|
|
|
cat conftest.out >&AC_FD_CC
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
# save output
|
|
|
|
cat conftest.out >&AC_FD_CC
|
|
|
|
ompi_cv_asm_file=""
|
|
|
|
AC_MSG_RESULT([failed])
|
|
|
|
AC_MSG_WARN([Could not build atomic operations assembly file.])
|
|
|
|
AC_MSG_WARN([There will be no atomic operations for this build.])
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
AC_MSG_WARN([Could not find prebuilt atomic operations file and could not])
|
|
|
|
AC_MSG_WARN([find perl to attempt to generate a custom assembly file.])
|
|
|
|
AC_MSG_WARN([There will be no atomic operations for this build.])
|
|
|
|
fi
|
|
|
|
fi
|
2007-11-06 04:32:42 +03:00
|
|
|
rm -rf conftest.*
|
2005-12-15 07:19:16 +03:00
|
|
|
else
|
|
|
|
# On windows with VC++, atomics are done with compiler primitives
|
|
|
|
ompi_cv_asm_file=""
|
|
|
|
fi
|
2005-01-27 04:39:55 +03:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for atomic assembly filename])
|
|
|
|
if test "$ompi_cv_asm_file" = "" ; then
|
|
|
|
AC_MSG_RESULT([none])
|
|
|
|
result=0
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([$ompi_cv_asm_file])
|
|
|
|
result=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED([OMPI_HAVE_ASM_FILE], [$result],
|
|
|
|
[Whether there is an atomic assembly file available])
|
|
|
|
AM_CONDITIONAL([OMPI_HAVE_ASM_FILE], [test "$result" = "1"])
|
|
|
|
|
|
|
|
OMPI_ASM_FILE=$ompi_cv_asm_file
|
|
|
|
AC_SUBST(OMPI_ASM_FILE)
|
|
|
|
])dnl
|