2008-10-28 20:22:29 +03:00
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
2015-06-10 08:21:03 +03:00
dnl Copyright (c) 2004-2015 The University of Tennessee and The University
2008-10-28 20:22:29 +03:00
dnl of Tennessee Research Foundation. All rights
dnl reserved.
2015-06-24 06:59:57 +03:00
dnl Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
2008-10-28 20:22:29 +03:00
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
2015-04-24 13:43:00 +03:00
dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
2010-11-16 00:41:56 +03:00
dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
2017-02-27 04:35:49 +03:00
dnl Copyright (c) 2015-2017 Research Organization for Information Science
2015-02-03 09:19:22 +03:00
dnl and Technology (RIST). All rights reserved.
2017-06-23 17:27:48 +03:00
dnl Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
2016-03-30 01:57:15 +03:00
dnl reserved.
2017-04-07 05:47:34 +03:00
dnl Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights
dnl reserved.
2008-10-28 20:22:29 +03:00
dnl $COPYRIGHT$
2015-06-24 06:59:57 +03:00
dnl
2008-10-28 20:22:29 +03:00
dnl Additional copyrights may follow
2015-06-24 06:59:57 +03:00
dnl
2008-10-28 20:22:29 +03:00
dnl $HEADER$
dnl
2014-12-04 04:40:34 +03:00
AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
2014-12-05 00:25:53 +03:00
OPAL_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result CFLAGS_save])
2014-12-04 04:40:34 +03:00
2014-12-18 09:34:12 +03:00
AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128],
[enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])])
sync_bool_compare_and_swap_128_result=0
if test ! "$enable_cross_cmpset128" = "yes" ; then
AC_MSG_CHECKING([for processor support of __sync builtin atomic compare-and-swap on 128-bit values])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])],
[AC_MSG_RESULT([yes])
sync_bool_compare_and_swap_128_result=1],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([no (cross compiling)])])
if test $sync_bool_compare_and_swap_128_result = 0 ; then
CFLAGS_save=$CFLAGS
CFLAGS="$CFLAGS -mcx16"
AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values with -mcx16 flag])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])],
[AC_MSG_RESULT([yes])
sync_bool_compare_and_swap_128_result=1
CFLAGS_save="$CFLAGS"],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([no (cross compiling)])])
CFLAGS=$CFLAGS_save
fi
else
AC_MSG_CHECKING([for compiler support of __sync builtin atomic compare-and-swap on 128-bit values])
# Check if the compiler supports the __sync builtin
2014-12-10 04:56:21 +03:00
AC_TRY_LINK([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);],
2014-12-18 09:34:12 +03:00
[AC_MSG_RESULT([yes])
sync_bool_compare_and_swap_128_result=1],
[AC_MSG_RESULT([no])])
if test $sync_bool_compare_and_swap_128_result = 0 ; then
CFLAGS_save=$CFLAGS
CFLAGS="$CFLAGS -mcx16"
AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values with -mcx16 flag])
AC_TRY_LINK([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);],
[AC_MSG_RESULT([yes])
sync_bool_compare_and_swap_128_result=1
CFLAGS_save="$CFLAGS"],
[AC_MSG_RESULT([no])])
CFLAGS=$CFLAGS_save
fi
2014-12-05 00:25:53 +03:00
fi
2014-12-04 04:40:34 +03:00
AC_DEFINE_UNQUOTED([OPAL_HAVE_SYNC_BUILTIN_CSWAP_INT128], [$sync_bool_compare_and_swap_128_result],
[Whether the __sync builtin atomic compare and swap supports 128-bit values])
OPAL_VAR_SCOPE_POP
])
2011-11-23 08:25:41 +04:00
AC_DEFUN([OPAL_CHECK_SYNC_BUILTINS], [
AC_MSG_CHECKING([for __sync builtin atomics])
2016-04-12 19:00:22 +03:00
AC_TRY_LINK([long tmp;], [__sync_synchronize();
__sync_bool_compare_and_swap(&tmp, 0, 1);
__sync_add_and_fetch(&tmp, 1);],
2011-11-23 08:25:41 +04:00
[AC_MSG_RESULT([yes])
$1],
[AC_MSG_RESULT([no])
$2])
2016-05-09 12:12:12 +03:00
AC_MSG_CHECKING([for 64-bit __sync builtin atomics])
AC_TRY_LINK([
#include <stdint.h>
uint64_t tmp;], [
__sync_bool_compare_and_swap(&tmp, 0, 1);
__sync_add_and_fetch(&tmp, 1);],
[AC_MSG_RESULT([yes])
opal_asm_sync_have_64bit=1],
[AC_MSG_RESULT([no])
opal_asm_sync_have_64bit=0])
AC_DEFINE_UNQUOTED([OPAL_ASM_SYNC_HAVE_64BIT],[$opal_asm_sync_have_64bit],
[Whether 64-bit is supported by the __sync builtin atomics])
2016-05-10 13:15:26 +03:00
# Check for 128-bit support
OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128
2011-11-23 08:25:41 +04:00
])
2016-06-02 04:23:47 +03:00
AC_DEFUN([OPAL_CHECK_GCC_BUILTIN_CSWAP_INT128], [
OPAL_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result CFLAGS_save])
AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128],
[enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])])
atomic_compare_exchange_n_128_result=0
if test ! "$enable_cross_cmpset128" = "yes" ; then
AC_MSG_CHECKING([for processor support of __atomic builtin atomic compare-and-swap on 128-bit values])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])],
[AC_MSG_RESULT([yes])
atomic_compare_exchange_n_128_result=1],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([no (cross compiling)])])
if test $atomic_compare_exchange_n_128_result = 0 ; then
CFLAGS_save=$CFLAGS
CFLAGS="$CFLAGS -mcx16"
AC_MSG_CHECKING([for __atomic builtin atomic compare-and-swap on 128-bit values with -mcx16 flag])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])],
[AC_MSG_RESULT([yes])
atomic_compare_exchange_n_128_result=1
CFLAGS_save="$CFLAGS"],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([no (cross compiling)])])
CFLAGS=$CFLAGS_save
fi
2016-06-03 00:29:19 +03:00
if test $atomic_compare_exchange_n_128_result = 1 ; then
AC_MSG_CHECKING([if __int128 atomic compare-and-swap is always lock-free])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_always_lock_free(16, 0)) { return 1; }])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128
atomic_compare_exchange_n_128_result=0],
[AC_MSG_RESULT([no (cross compiling)])])
fi
2016-06-02 04:23:47 +03:00
else
AC_MSG_CHECKING([for compiler support of __atomic builtin atomic compare-and-swap on 128-bit values])
# Check if the compiler supports the __atomic builtin
2016-06-03 00:29:19 +03:00
AC_TRY_LINK([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);],
2016-06-02 04:23:47 +03:00
[AC_MSG_RESULT([yes])
atomic_compare_exchange_n_128_result=1],
[AC_MSG_RESULT([no])])
if test $atomic_compare_exchange_n_128_result = 0 ; then
CFLAGS_save=$CFLAGS
CFLAGS="$CFLAGS -mcx16"
AC_MSG_CHECKING([for __atomic builtin atomic compare-and-swap on 128-bit values with -mcx16 flag])
2016-06-03 00:29:19 +03:00
AC_TRY_LINK([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);],
2016-06-02 04:23:47 +03:00
[AC_MSG_RESULT([yes])
atomic_compare_exchange_n_128_result=1
CFLAGS_save="$CFLAGS"],
[AC_MSG_RESULT([no])])
CFLAGS=$CFLAGS_save
fi
fi
AC_DEFINE_UNQUOTED([OPAL_HAVE_GCC_BUILTIN_CSWAP_INT128], [$atomic_compare_exchange_n_128_result],
2016-06-03 00:29:19 +03:00
[Whether the __atomic builtin atomic compare and swap is lock-free on 128-bit values])
2016-06-02 04:23:47 +03:00
OPAL_VAR_SCOPE_POP
])
AC_DEFUN([OPAL_CHECK_GCC_ATOMIC_BUILTINS], [
AC_MSG_CHECKING([for __atomic builtin atomics])
2017-07-04 03:47:45 +03:00
AC_TRY_LINK([
#include <stdint.h>
uint32_t tmp, old = 0;
uint64_t tmp64, old64 = 0;], [
__atomic_thread_fence(__ATOMIC_SEQ_CST);
2016-06-02 04:23:47 +03:00
__atomic_compare_exchange_n(&tmp, &old, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
2017-07-04 03:47:45 +03:00
__atomic_add_fetch(&tmp, 1, __ATOMIC_RELAXED);
__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);],
2016-06-02 04:23:47 +03:00
[AC_MSG_RESULT([yes])
$1],
[AC_MSG_RESULT([no])
$2])
# Check for 128-bit support
OPAL_CHECK_GCC_BUILTIN_CSWAP_INT128
])
2008-10-28 20:22:29 +03:00
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_TEXT
2008-10-28 20:22:29 +03:00
dnl
dnl Determine how to set current mode as text.
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_TEXT],[
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([directive for setting text section])
2009-05-07 00:11:28 +04:00
opal_cv_asm_text=""
2014-05-06 19:01:34 +04:00
if test "$opal_cv_c_compiler_vendor" = "microsoft" ; then
2008-10-28 20:22:29 +03:00
# text section will be brought in with the rest of
# header for MS - leave blank for now
2009-05-07 00:11:28 +04:00
opal_cv_asm_text=""
2008-10-28 20:22:29 +03:00
else
case $host in
*-aix*)
2009-05-07 00:11:28 +04:00
opal_cv_asm_text=[".csect .text[PR]"]
2008-10-28 20:22:29 +03:00
;;
*)
2009-05-07 00:11:28 +04:00
opal_cv_asm_text=".text"
2008-10-28 20:22:29 +03:00
;;
esac
fi
2009-05-07 00:11:28 +04:00
AC_MSG_RESULT([$opal_cv_asm_text])
AC_DEFINE_UNQUOTED([OPAL_ASM_TEXT], ["$opal_cv_asm_text"],
2008-10-28 20:22:29 +03:00
[Assembly directive for setting text section])
2009-05-07 00:11:28 +04:00
OPAL_ASM_TEXT="$opal_cv_asm_text"
AC_SUBST(OPAL_ASM_TEXT)
2008-10-28 20:22:29 +03:00
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_GLOBAL
2008-10-28 20:22:29 +03:00
dnl
2009-05-07 00:11:28 +04:00
dnl Sets OPAL_ASM_GLOBAL to the value to prefix global values
2008-10-28 20:22:29 +03:00
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 #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_GLOBAL],[
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([directive for exporting symbols])
2009-05-07 00:11:28 +04:00
opal_cv_asm_global=""
2014-05-06 19:01:34 +04:00
if test "$opal_cv_c_compiler_vendor" = "microsoft" ; then
2009-05-07 00:11:28 +04:00
opal_cv_asm_global="PUBLIC"
2008-10-28 20:22:29 +03:00
else
case $host in
*)
2009-05-07 00:11:28 +04:00
opal_cv_asm_global=".globl"
2008-10-28 20:22:29 +03:00
;;
esac
fi
2009-05-07 00:11:28 +04:00
AC_MSG_RESULT([$opal_cv_asm_global])
AC_DEFINE_UNQUOTED([OPAL_ASM_GLOBAL], ["$opal_cv_asm_global"],
2008-10-28 20:22:29 +03:00
[Assembly directive for exporting symbols])
2009-05-07 00:11:28 +04:00
OPAL_ASM_GLOBAL="$opal_cv_asm_global"
2014-05-07 07:01:47 +04:00
AC_SUBST(OPAL_AS_GLOBAL)
2008-10-28 20:22:29 +03:00
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_LSYM
2008-10-28 20:22:29 +03:00
dnl
2009-05-07 00:11:28 +04:00
dnl Sets OPAL_ASM_LSYM to the prefix value on a symbol to make it
2008-10-28 20:22:29 +03:00
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 #################################################################
2014-05-07 05:00:06 +04:00
# _OPAL_CHECK_ASM_LSYM([variable-to-set])
2008-10-28 20:22:29 +03:00
# ---------------------------------------
2014-05-07 05:00:06 +04:00
AC_DEFUN([_OPAL_CHECK_ASM_LSYM],[
2008-10-28 20:22:29 +03:00
AC_REQUIRE([AC_PROG_GREP])
$1="L"
for sym in L .L $ L$ ; do
asm_result=0
echo "configure: trying $sym" >&AC_FD_CC
2014-05-07 00:30:37 +04:00
OPAL_TRY_ASSEMBLE([foobar$opal_cv_asm_label_suffix
2009-05-07 00:11:28 +04:00
${sym}mytestlabel$opal_cv_asm_label_suffix],
2015-06-24 06:59:57 +03:00
[# ok, we succeeded at assembling. see if we can nm,
2008-10-28 20:22:29 +03:00
# throwing the results in a file
if $NM conftest.$OBJEXT > conftest.out 2>&AC_FD_CC ; then
if test "`$GREP mytestlabel conftest.out`" = "" ; then
# there was no symbol... looks promising to me
$1="$sym"
asm_result=1
elif test ["`$GREP ' [Nt] .*mytestlabel' conftest.out`"] = "" ; then
# see if we have a non-global-ish symbol
# but we should see if we can do better.
$1="$sym"
fi
else
# not so much on the NM goodness :/
echo "$NM failed. Output from NM was:" >&AC_FD_CC
cat conftest.out >&AC_FD_CC
AC_MSG_WARN([$NM could not read object file])
fi
])
if test "$asm_result" = "1" ; then
break
fi
done
rm -f conftest.out
unset asm_result sym
])
2014-05-07 05:00:06 +04:00
# OPAL_CHECK_ASM_LSYM()
2008-10-28 20:22:29 +03:00
# ---------------------
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_LSYM],[
2008-10-28 20:22:29 +03:00
AC_REQUIRE([AC_PROG_NM])
AC_CACHE_CHECK([prefix for lsym labels],
2009-05-07 00:11:28 +04:00
[opal_cv_asm_lsym],
2014-05-07 05:00:06 +04:00
[_OPAL_CHECK_ASM_LSYM([opal_cv_asm_lsym])])
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASM_LSYM], ["$opal_cv_asm_lsym"],
2008-10-28 20:22:29 +03:00
[Assembly prefix for lsym labels])
2009-05-07 00:11:28 +04:00
OPAL_ASM_LSYM="$opal_cv_asm_lsym"
AC_SUBST(OPAL_ASM_LSYM)
2008-10-28 20:22:29 +03:00
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_PROC
2008-10-28 20:22:29 +03:00
dnl
dnl Sets a cv-flag, if the compiler needs a proc/endp-definition to
dnl link with C.
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_PROC],[
2008-10-28 20:22:29 +03:00
AC_CACHE_CHECK([if .proc/endp is needed],
2014-05-07 05:00:06 +04:00
[opal_cv_asm_need_proc],
[opal_cv_asm_need_proc="no"
2014-05-07 00:30:37 +04:00
OPAL_TRY_ASSEMBLE([
2008-10-28 20:22:29 +03:00
.proc mysym
mysym:
.endp mysym],
2014-05-07 05:00:06 +04:00
[opal_cv_asm_need_proc="yes"])
2008-10-28 20:22:29 +03:00
rm -f conftest.out])
2014-05-07 05:00:06 +04:00
if test "$opal_cv_asm_need_proc" = "yes" ; then
opal_cv_asm_proc=".proc"
opal_cv_asm_endproc=".endp"
2008-10-28 20:22:29 +03:00
else
2014-05-07 05:00:06 +04:00
opal_cv_asm_proc="#"
opal_cv_asm_endproc="#"
2008-10-28 20:22:29 +03:00
fi
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_GSYM
2008-10-28 20:22:29 +03:00
dnl
2009-05-07 00:11:28 +04:00
dnl Sets OPAL_ASM_GSYM to the prefix value on a symbol to make it
2008-10-28 20:22:29 +03:00
dnl a global linkable from C. Basically, an _ or not.
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_GSYM],[
2008-10-28 20:22:29 +03:00
AC_CACHE_CHECK([prefix for global symbol labels],
2009-05-07 00:11:28 +04:00
[opal_cv_asm_gsym],
2014-05-07 05:00:06 +04:00
[_OPAL_CHECK_ASM_GSYM])
2008-10-28 20:22:29 +03:00
2009-05-07 00:11:28 +04:00
if test "$opal_cv_asm_gsym" = "none" ; then
2008-10-28 20:22:29 +03:00
AC_MSG_ERROR([Could not determine global symbol label prefix])
fi
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASM_GSYM], ["$opal_cv_asm_gsym"],
2008-10-28 20:22:29 +03:00
[Assembly prefix for gsym labels])
2009-05-07 00:11:28 +04:00
OPAL_ASM_GSYM="$opal_cv_asm_gsym"
AC_SUBST(OPAL_ASM_GSYM)
2008-10-28 20:22:29 +03:00
])
2014-05-07 05:00:06 +04:00
AC_DEFUN([_OPAL_CHECK_ASM_GSYM],[
2009-05-07 00:11:28 +04:00
opal_cv_asm_gsym="none"
2008-10-28 20:22:29 +03:00
for sym in "_" "" "." ; do
asm_result=0
echo "configure: trying $sym" >&AC_FD_CC
cat > conftest_c.c <<EOF
#ifdef __cplusplus
extern "C" {
#endif
void gsym_test_func(void);
#ifdef __cplusplus
}
#endif
int
main()
{
gsym_test_func();
return 0;
}
EOF
2014-05-07 00:30:37 +04:00
OPAL_TRY_ASSEMBLE([
2009-05-07 00:11:28 +04:00
$opal_cv_asm_text
2014-05-07 05:00:06 +04:00
$opal_cv_asm_proc ${sym}gsym_test_func
2009-05-07 00:11:28 +04:00
$opal_cv_asm_global ${sym}gsym_test_func
${sym}gsym_test_func${opal_cv_asm_label_suffix}
2014-05-07 05:00:06 +04:00
$opal_cv_asm_endproc ${sym}gsym_test_func
2008-10-28 20:22:29 +03:00
],
2014-05-07 07:01:47 +04:00
[opal_compile="$CC $CFLAGS -I. conftest_c.c -c > conftest.cmpl 2>&1"
if AC_TRY_EVAL(opal_compile) ; then
2008-10-28 20:22:29 +03:00
# save the warnings
cat conftest.cmpl >&AC_FD_CC
2014-05-07 07:01:47 +04:00
opal_link="$CC $CFLAGS conftest_c.$OBJEXT conftest.$OBJEXT -o conftest $LDFLAGS $LIBS > conftest.link 2>&1"
if AC_TRY_EVAL(opal_link) ; then
2008-10-28 20:22:29 +03:00
# 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
2015-06-24 06:59:57 +03:00
fi],
2008-10-28 20:22:29 +03:00
[asm_result=0])
if test "$asm_result" = "1" ; then
2009-05-07 00:11:28 +04:00
opal_cv_asm_gsym="$sym"
2008-10-28 20:22:29 +03:00
break
fi
done
rm -rf conftest.*
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_LABEL_SUFFIX
2008-10-28 20:22:29 +03:00
dnl
2009-05-07 00:11:28 +04:00
dnl Sets OPAL_ASM_LABEL_SUFFIX to the value to suffix for labels
2008-10-28 20:22:29 +03:00
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 #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_LABEL_SUFFIX],[
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([suffix for labels])
2009-05-07 00:11:28 +04:00
opal_cv_asm_label_suffix=""
2008-10-28 20:22:29 +03:00
case $host in
*)
2009-05-07 00:11:28 +04:00
opal_cv_asm_label_suffix=":"
2008-10-28 20:22:29 +03:00
;;
esac
2009-05-07 00:11:28 +04:00
AC_MSG_RESULT([$opal_cv_asm_label_suffix])
AC_DEFINE_UNQUOTED([OPAL_ASM_LABEL_SUFFIX], ["$opal_cv_asm_label_suffix"],
2008-10-28 20:22:29 +03:00
[Assembly suffix for labels])
2009-05-07 00:11:28 +04:00
OPAL_ASM_LABEL_SUFFIX="$opal_cv_asm_label_suffix"
2014-05-07 07:01:47 +04:00
AC_SUBST(OPAL_AS_LABEL_SUFFIX)
2008-10-28 20:22:29 +03:00
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_ALIGN_LOG
2008-10-28 20:22:29 +03:00
dnl
2015-06-24 06:59:57 +03:00
dnl Sets OPAL_ASM_ALIGN_LOG to 1 if align is specified
2008-10-28 20:22:29 +03:00
dnl logarithmically, 0 otherwise
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_ALIGN_LOG],[
2008-10-28 20:22:29 +03:00
AC_REQUIRE([AC_PROG_NM])
AC_REQUIRE([AC_PROG_GREP])
AC_CACHE_CHECK([if .align directive takes logarithmic value],
2014-05-07 05:00:06 +04:00
[opal_cv_asm_align_log],
2014-05-07 00:30:37 +04:00
[ OPAL_TRY_ASSEMBLE([ $opal_cv_asm_text
2008-10-28 20:22:29 +03:00
.align 4
2009-05-07 00:11:28 +04:00
$opal_cv_asm_global foo
2008-10-28 20:22:29 +03:00
.byte 1
.align 4
2009-05-07 00:11:28 +04:00
foo$opal_cv_asm_label_suffix
2015-06-24 06:59:57 +03:00
.byte 2],
2014-05-07 07:01:47 +04:00
[opal_asm_addr=[`$NM conftest.$OBJEXT | $GREP foo | sed -e 's/.*\([0-9a-fA-F][0-9a-fA-F]\).*foo.*/\1/'`]],
[opal_asm_addr=""])
2008-10-28 20:22:29 +03:00
# test for both 16 and 10 (decimal and hex notations)
2014-05-07 07:01:47 +04:00
echo "configure: .align test address offset is $opal_asm_addr" >&AC_FD_CC
2015-02-03 09:19:22 +03:00
if test "$opal_asm_addr" = "16" || test "$opal_asm_addr" = "10" ; then
2014-05-07 05:00:06 +04:00
opal_cv_asm_align_log="yes"
2008-10-28 20:22:29 +03:00
else
2014-05-07 05:00:06 +04:00
opal_cv_asm_align_log="no"
2008-10-28 20:22:29 +03:00
fi])
2015-02-03 09:19:22 +03:00
if test "$opal_cv_asm_align_log" = "yes" || test "$opal_cv_asm_align_log" = "1" ; then
2014-05-07 07:01:47 +04:00
opal_asm_align_log_result=1
2008-10-28 20:22:29 +03:00
else
2014-05-07 07:01:47 +04:00
opal_asm_align_log_result=0
2008-10-28 20:22:29 +03:00
fi
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASM_ALIGN_LOG],
2008-10-28 20:22:29 +03:00
[$asm_align_log_result],
[Assembly align directive expects logarithmic value])
unset omp_asm_addr asm_result
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_TYPE
2008-10-28 20:22:29 +03:00
dnl
2015-06-24 06:59:57 +03:00
dnl Sets OPAL_ASM_TYPE to the prefix for the function type to
2008-10-28 20:22:29 +03:00
dnl set a symbol's type as function (needed on ELF for shared
2009-05-07 00:11:28 +04:00
dnl libaries). If no .type directive is needed, sets OPAL_ASM_TYPE
2008-10-28 20:22:29 +03:00
dnl to an empty string
dnl
dnl We look for @ \# %
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_TYPE],[
2008-10-28 20:22:29 +03:00
AC_CACHE_CHECK([prefix for function in .type],
2009-05-07 00:11:28 +04:00
[opal_cv_asm_type],
2014-05-07 05:00:06 +04:00
[_OPAL_CHECK_ASM_TYPE])
2008-10-28 20:22:29 +03:00
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASM_TYPE], ["$opal_cv_asm_type"],
2008-10-28 20:22:29 +03:00
[How to set function type in .type directive])
2009-05-07 00:11:28 +04:00
OPAL_ASM_TYPE="$opal_cv_asm_type"
AC_SUBST(OPAL_ASM_TYPE)
2008-10-28 20:22:29 +03:00
])
2014-05-07 05:00:06 +04:00
AC_DEFUN([_OPAL_CHECK_ASM_TYPE],[
2009-05-07 00:11:28 +04:00
opal_cv_asm_type=""
2008-10-28 20:22:29 +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
2009-05-07 00:11:28 +04:00
opal_cv_asm_type="#"
2008-10-28 20:22:29 +03:00
;;
*)
for type in @ \# % ; do
asm_result=0
echo "configure: trying $type" >&AC_FD_CC
2014-05-07 00:30:37 +04:00
OPAL_TRY_ASSEMBLE([ .type mysym, ${type}function
2008-10-28 20:22:29 +03:00
mysym:],
2009-05-07 00:11:28 +04:00
[opal_cv_asm_type="${type}"
2008-10-28 20:22:29 +03:00
asm_result=1])
if test "$asm_result" = "1" ; then
break
fi
done
;;
esac
rm -f conftest.out
unset asm_result type
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_ASM_SIZE
2008-10-28 20:22:29 +03:00
dnl
2009-05-07 00:11:28 +04:00
dnl Sets OPAL_ASM_SIZE to 1 if we should set .size directives for
2008-10-28 20:22:29 +03:00
dnl each function, 0 otherwise.
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_SIZE],[
2008-10-28 20:22:29 +03:00
AC_CACHE_CHECK([if .size is needed],
2014-05-07 05:00:06 +04:00
[opal_cv_asm_need_size],
[opal_cv_asm_need_size="no"
2014-05-07 00:30:37 +04:00
OPAL_TRY_ASSEMBLE([ .size mysym, 1],
2014-05-07 05:00:06 +04:00
[opal_cv_asm_need_size="yes"])
2008-10-28 20:22:29 +03:00
rm -f conftest.out])
2014-05-07 05:00:06 +04:00
if test "$opal_cv_asm_need_size" = "yes" ; then
2009-05-07 00:11:28 +04:00
opal_asm_size=1
2008-10-28 20:22:29 +03:00
else
2009-05-07 00:11:28 +04:00
opal_asm_size=0
2008-10-28 20:22:29 +03:00
fi
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASM_SIZE], ["$opal_asm_size"],
2008-10-28 20:22:29 +03:00
[Do we need to give a .size directive])
2009-05-07 00:11:28 +04:00
OPAL_ASM_SIZE="$opal_asm_size"
AC_SUBST(OPAL_ASM_TYPE)
2008-10-28 20:22:29 +03:00
unset asm_result
])dnl
2014-05-07 05:00:06 +04:00
# OPAL_CHECK_ASM_GNU_STACKEXEC(var)
2008-10-28 20:22:29 +03:00
# ----------------------------------
# sets shell variable var to the things necessary to
# disable execable stacks with GAS
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_ASM_GNU_STACKEXEC], [
2008-10-28 20:22:29 +03:00
AC_REQUIRE([AC_PROG_GREP])
AC_CHECK_PROG([OBJDUMP], [objdump], [objdump])
AC_CACHE_CHECK([if .note.GNU-stack is needed],
2014-05-07 05:00:06 +04:00
[opal_cv_asm_gnu_stack_result],
2008-10-28 20:22:29 +03:00
[AS_IF([test "$OBJDUMP" != ""],
[ # first, see if a simple C program has it set
cat >conftest.c <<EOF
int testfunc() {return 0; }
EOF
2010-11-13 02:22:11 +03:00
OPAL_LOG_COMMAND([$CC $CFLAGS -c conftest.c -o conftest.$OBJEXT],
2014-05-07 05:00:06 +04:00
[$OBJDUMP -x conftest.$OBJEXT | $GREP '\.note\.GNU-stack' > /dev/null && opal_cv_asm_gnu_stack_result=yes],
2010-11-13 02:22:11 +03:00
[OPAL_LOG_MSG([the failed program was:], 1)
OPAL_LOG_FILE([conftest.c])
2014-05-07 05:00:06 +04:00
opal_cv_asm_gnu_stack_result=no])
if test "$opal_cv_asm_gnu_stack_result" != "yes" ; then
opal_cv_asm_gnu_stack_result="no"
2008-10-28 20:22:29 +03:00
fi
rm -rf conftest.*],
2014-05-07 05:00:06 +04:00
[opal_cv_asm_gnu_stack_result="no"])])
if test "$opal_cv_asm_gnu_stack_result" = "yes" ; then
opal_cv_asm_gnu_stack=1
2008-10-28 20:22:29 +03:00
else
2014-05-07 05:00:06 +04:00
opal_cv_asm_gnu_stack=0
2008-10-28 20:22:29 +03:00
fi
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_POWERPC_REG
2008-10-28 20:22:29 +03:00
dnl
dnl See if the notation for specifying registers is X (most everyone)
dnl or rX (OS X)
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_POWERPC_REG],[
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([if PowerPC registers have r prefix])
2014-05-07 00:30:37 +04:00
OPAL_TRY_ASSEMBLE([$opal_cv_asm_text
2008-10-28 20:22:29 +03:00
addi 1,1,0],
2009-05-07 00:11:28 +04:00
[opal_cv_asm_powerpc_r_reg=0],
2014-05-07 00:30:37 +04:00
[OPAL_TRY_ASSEMBLE([$opal_cv_asm_text
2008-10-28 20:22:29 +03:00
addi r1,r1,0],
2009-05-07 00:11:28 +04:00
[opal_cv_asm_powerpc_r_reg=1],
2008-10-28 20:22:29 +03:00
[AC_MSG_ERROR([Can not determine how to use PPC registers])])])
2009-05-07 00:11:28 +04:00
if test "$opal_cv_asm_powerpc_r_reg" = "1" ; then
2008-10-28 20:22:29 +03:00
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_POWERPC_R_REGISTERS],
[$opal_cv_asm_powerpc_r_reg],
2008-10-28 20:22:29 +03:00
[Whether r notation is used for ppc registers])
])dnl
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_POWERPC_64BIT
2008-10-28 20:22:29 +03:00
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 #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_POWERPC_64BIT],[
2008-10-28 20:22:29 +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.])
fi
AC_MSG_CHECKING([for 64-bit PowerPC assembly support])
case $host in
*-darwin*)
ppc64_result=0
2009-05-07 00:11:28 +04:00
if test "$opal_cv_asm_powerpc_r_reg" = "1" ; then
2008-10-28 20:22:29 +03:00
ldarx_asm=" ldarx r1,r1,r1";
else
ldarx_asm=" ldarx 1,1,1";
fi
2014-05-07 00:30:37 +04:00
OPAL_TRY_ASSEMBLE([$opal_cv_asm_text
2008-10-28 20:22:29 +03:00
$ldarx_asm],
[ppc64_result=1],
[ppc64_result=0])
;;
*)
ppc64_result=0
;;
esac
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
dnl #################################################################
dnl
2014-05-07 05:00:06 +04:00
dnl OPAL_CHECK_SPARCV8PLUS
2008-10-28 20:22:29 +03:00
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_SPARCV8PLUS],[
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([if have Sparc v8+/v9 support])
sparc_result=0
2014-05-07 00:30:37 +04:00
OPAL_TRY_ASSEMBLE([$opal_cv_asm_text
2008-10-28 20:22:29 +03:00
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
2014-12-02 20:25:46 +03:00
dnl #################################################################
dnl
dnl OPAL_CHECK_CMPXCHG16B
dnl
dnl #################################################################
AC_DEFUN([OPAL_CHECK_CMPXCHG16B],[
OPAL_VAR_SCOPE_PUSH([cmpxchg16b_result])
2014-12-18 09:34:12 +03:00
AC_ARG_ENABLE([cross-cmpxchg16b],[AC_HELP_STRING([--enable-cross-cmpxchg16b],
[enable the use of the cmpxchg16b instruction when cross compiling])])
if test ! "$enable_cross_cmpxchg16b" = "yes" ; then
AC_MSG_CHECKING([if processor supports x86_64 16-byte compare-and-exchange])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[unsigned char tmp[16];]],[[
__asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])],
[AC_MSG_RESULT([yes])
cmpxchg16b_result=1],
[AC_MSG_RESULT([no])
cmpxchg16b_result=0],
[AC_MSG_RESULT([no (cross-compiling)])
cmpxchg16b_result=0])
else
AC_MSG_CHECKING([if assembler supports x86_64 16-byte compare-and-exchange])
OPAL_TRY_ASSEMBLE([$opal_cv_asm_text
cmpxchg16b 0],
[AC_MSG_RESULT([yes])
cmpxchg16b_result=1],
[AC_MSG_RESULT([no])
cmpxchg16b_result=0])
fi
2015-02-05 07:24:12 +03:00
if test "$cmpxchg16b_result" = 1; then
AC_MSG_CHECKING([if compiler correctly handles volatile 128bits])
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdint.h>
#include <assert.h>
union opal_counted_pointer_t {
struct {
uint64_t counter;
uint64_t item;
} data;
#if defined(HAVE___INT128) && HAVE___INT128
__int128 value;
#elif defined(HAVE_INT128_T) && HAVE_INT128_T
int128_t value;
#endif
};
typedef union opal_counted_pointer_t opal_counted_pointer_t;],
[volatile opal_counted_pointer_t a;
opal_counted_pointer_t b;
a.data.counter = 0;
a.data.item = 0x1234567890ABCDEF;
b.data.counter = a.data.counter;
b.data.item = a.data.item;
/* bozo checks */
assert(16 == sizeof(opal_counted_pointer_t));
assert(a.data.counter == b.data.counter);
assert(a.data.item == b.data.item);
/*
* the following test fails on buggy compilers
* so far, with icc -o conftest conftest.c
* - intel icc 14.0.0.080 (aka 2013sp1)
* - intel icc 14.0.1.106 (aka 2013sp1u1)
* older and more recents compilers work fine
* buggy compilers work also fine but only with -O0
*/
#if (defined(HAVE___INT128) && HAVE___INT128) || (defined(HAVE_INT128_T) && HAVE_INT128_T)
return (a.value != b.value);
#else
return 0;
#endif])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
cmpxchg16b_result=0],
[AC_MSG_RESULT([untested, assuming ok])])
fi
2014-12-02 20:25:46 +03:00
AC_DEFINE_UNQUOTED([OPAL_HAVE_CMPXCHG16B], [$cmpxchg16b_result],
[Whether the processor supports the cmpxchg16b instruction])
OPAL_VAR_SCOPE_POP
])dnl
2008-10-28 20:22:29 +03:00
dnl #################################################################
dnl
2014-05-07 07:01:47 +04:00
dnl OPAL_CHECK_INLINE_GCC
2008-10-28 20:22:29 +03:00
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
2015-06-24 06:59:57 +03:00
dnl the macro must be an assembly instruction in gcc format to move
dnl the value 0 into the register containing the variable ret.
2008-10-28 20:22:29 +03:00
dnl For PowerPC, this would be:
dnl
dnl "li %0,0" : "=&r"(ret)
dnl
2010-11-16 00:41:56 +03:00
dnl For testing ia32 assembly, the assembly instruction xaddl is
dnl tested. The xaddl instruction is used by some of the atomic
dnl implementations so it makes sense to test for it. In addition,
dnl some compilers (i.e. earlier versions of Sun Studio 12) do not
dnl necessarily handle xaddl properly, so that needs to be detected
dnl during configure time.
dnl
2014-05-07 07:01:47 +04:00
dnl DEFINE OPAL_GCC_INLINE_ASSEMBLY to 0 or 1 depending on GCC
2008-10-28 20:22:29 +03:00
dnl support
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_INLINE_C_GCC],[
2008-10-28 20:22:29 +03:00
assembly="$1"
asm_result="unknown"
AC_MSG_CHECKING([if $CC supports GCC inline assembly])
2016-09-02 21:44:08 +03:00
if test ! "$assembly" = "" ; then
AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[
int ret = 1;
2010-11-16 00:41:56 +03:00
int negone = -1;
2008-10-28 20:22:29 +03:00
__asm__ __volatile__ ($assembly);
2016-09-02 21:44:08 +03:00
return ret;
]])],
[asm_result="yes"], [asm_result="no"],
[asm_result="unknown"])
else
assembly="test skipped - assuming no"
fi
2008-10-28 20:22:29 +03:00
2016-09-02 21:44:08 +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([AC_INCLUDES_DEFAULT],[[
int ret = 1;
2010-11-16 00:41:56 +03:00
int negone = -1;
2008-10-28 20:22:29 +03:00
__asm__ __volatile__ ($assembly);
2016-09-02 21:44:08 +03:00
return ret;
]])],
[asm_result="yes"], [asm_result="no"])
2008-10-28 20:22:29 +03:00
fi
AC_MSG_RESULT([$asm_result])
if test "$asm_result" = "yes" ; then
2009-05-07 00:11:28 +04:00
OPAL_C_GCC_INLINE_ASSEMBLY=1
2008-10-28 20:22:29 +03:00
else
2009-05-07 00:11:28 +04:00
OPAL_C_GCC_INLINE_ASSEMBLY=0
2008-10-28 20:22:29 +03:00
fi
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_C_GCC_INLINE_ASSEMBLY],
[$OPAL_C_GCC_INLINE_ASSEMBLY],
2008-10-28 20:22:29 +03:00
[Whether C compiler supports GCC style inline assembly])
2009-05-07 00:11:28 +04:00
unset OPAL_C_GCC_INLINE_ASSEMBLY assembly asm_result
2008-10-28 20:22:29 +03:00
])dnl
dnl #################################################################
dnl
2014-05-07 07:01:47 +04:00
dnl OPAL_CHECK_INLINE_DEC
2008-10-28 20:22:29 +03:00
dnl
2014-05-07 07:01:47 +04:00
dnl DEFINE OPAL_DEC to 0 or 1 depending on DEC
2008-10-28 20:22:29 +03:00
dnl support
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_INLINE_C_DEC],[
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([if $CC supports DEC inline assembly])
2010-09-24 02:37:52 +04:00
AC_LINK_IFELSE([AC_LANG_PROGRAM([
2008-10-28 20:22:29 +03:00
AC_INCLUDES_DEFAULT
2010-09-24 02:37:52 +04:00
#include <c_asm.h>],
2008-10-28 20:22:29 +03:00
[[asm("");
2010-09-24 02:37:52 +04:00
return 0;]])],
2008-10-28 20:22:29 +03:00
[asm_result="yes"], [asm_result="no"])
AC_MSG_RESULT([$asm_result])
if test "$asm_result" = "yes" ; then
2009-05-07 00:11:28 +04:00
OPAL_C_DEC_INLINE_ASSEMBLY=1
2008-10-28 20:22:29 +03:00
else
2009-05-07 00:11:28 +04:00
OPAL_C_DEC_INLINE_ASSEMBLY=0
2008-10-28 20:22:29 +03:00
fi
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_C_DEC_INLINE_ASSEMBLY],
[$OPAL_C_DEC_INLINE_ASSEMBLY],
2008-10-28 20:22:29 +03:00
[Whether C compiler supports DEC style inline assembly])
2009-05-07 00:11:28 +04:00
unset OPAL_C_DEC_INLINE_ASSEMBLY asm_result
2008-10-28 20:22:29 +03:00
])dnl
dnl #################################################################
dnl
2014-05-07 07:01:47 +04:00
dnl OPAL_CHECK_INLINE_XLC
2008-10-28 20:22:29 +03:00
dnl
2014-05-07 07:01:47 +04:00
dnl DEFINE OPAL_XLC to 0 or 1 depending on XLC
2008-10-28 20:22:29 +03:00
dnl support
dnl
dnl #################################################################
2014-05-07 05:00:06 +04:00
AC_DEFUN([OPAL_CHECK_INLINE_C_XLC],[
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([if $CC supports XLC inline assembly])
2009-05-07 00:11:28 +04:00
OPAL_C_XLC_INLINE_ASSEMBLY=0
2008-10-28 20:22:29 +03:00
asm_result="no"
if test "$CC" = "xlc" ; then
2014-05-07 05:00:06 +04:00
OPAL_XLC_INLINE_ASSEMBLY=1
2008-10-28 20:22:29 +03:00
asm_result="yes"
fi
AC_MSG_RESULT([$asm_result])
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_C_XLC_INLINE_ASSEMBLY],
[$OPAL_C_XLC_INLINE_ASSEMBLY],
2008-10-28 20:22:29 +03:00
[Whether C compiler supports XLC style inline assembly])
2009-05-07 00:11:28 +04:00
unset OPAL_C_XLC_INLINE_ASSEMBLY
2008-10-28 20:22:29 +03:00
])dnl
dnl #################################################################
dnl
2010-07-27 08:51:50 +04:00
dnl OPAL_CONFIG_ASM
2008-10-28 20:22:29 +03:00
dnl
2009-05-07 00:11:28 +04:00
dnl DEFINE OPAL_ASSEMBLY_ARCH to something in sys/architecture.h
dnl DEFINE OPAL_ASSEMBLY_FORMAT to string containing correct
2008-10-28 20:22:29 +03:00
dnl format for assembly (not user friendly)
2009-05-07 00:11:28 +04:00
dnl SUBST OPAL_ASSEMBLY_FORMAT to string containing correct
2008-10-28 20:22:29 +03:00
dnl format for assembly (not user friendly)
dnl
dnl #################################################################
2010-07-27 08:51:50 +04:00
AC_DEFUN([OPAL_CONFIG_ASM],[
AC_REQUIRE([OPAL_SETUP_CC])
2008-10-28 20:22:29 +03:00
AC_REQUIRE([AM_PROG_AS])
2011-11-23 08:25:41 +04:00
AC_ARG_ENABLE([builtin-atomics],
[AC_HELP_STRING([--enable-builtin-atomics],
2015-06-10 10:17:42 +03:00
[Enable use of __sync builtin atomics (default: enabled)])],
2015-06-10 08:21:03 +03:00
[], [enable_builtin_atomics="yes"])
2013-10-30 21:48:15 +04:00
2015-06-10 08:21:03 +03:00
opal_cv_asm_builtin="BUILTIN_NO"
2016-06-02 04:23:47 +03:00
if test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes" ; then
OPAL_CHECK_GCC_ATOMIC_BUILTINS([opal_cv_asm_builtin="BUILTIN_GCC"], [])
fi
2015-12-28 07:22:46 +03:00
if test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes" ; then
2015-06-10 10:17:42 +03:00
OPAL_CHECK_SYNC_BUILTINS([opal_cv_asm_builtin="BUILTIN_SYNC"], [])
2015-06-10 09:26:02 +03:00
fi
2014-04-15 17:17:04 +04:00
2014-05-07 05:00:06 +04:00
OPAL_CHECK_ASM_PROC
OPAL_CHECK_ASM_TEXT
OPAL_CHECK_ASM_GLOBAL
OPAL_CHECK_ASM_GNU_STACKEXEC
OPAL_CHECK_ASM_LABEL_SUFFIX
OPAL_CHECK_ASM_GSYM
OPAL_CHECK_ASM_LSYM
OPAL_CHECK_ASM_TYPE
OPAL_CHECK_ASM_SIZE
OPAL_CHECK_ASM_ALIGN_LOG
2008-10-28 20:22:29 +03:00
# find our architecture for purposes of assembly stuff
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="UNSUPPORTED"
OPAL_GCC_INLINE_ASSIGN=""
2009-05-07 00:11:28 +04:00
OPAL_ASM_SUPPORT_64BIT=0
2008-10-28 20:22:29 +03:00
case "${host}" in
2016-12-06 03:01:29 +03:00
x86_64-*x32)
2017-02-27 09:09:52 +03:00
opal_cv_asm_arch="X86_64"
2016-12-06 03:01:29 +03:00
OPAL_ASM_SUPPORT_64BIT=1
OPAL_GCC_INLINE_ASSIGN='"xaddl %1,%0" : "=m"(ret), "+r"(negone) : "m"(ret)'
;;
2017-04-07 05:47:34 +03:00
i?86-*|x86_64*|amd64*)
2008-10-28 20:22:29 +03:00
if test "$ac_cv_sizeof_long" = "4" ; then
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="IA32"
2008-10-28 20:22:29 +03:00
else
2017-02-27 09:09:52 +03:00
opal_cv_asm_arch="X86_64"
2008-10-28 20:22:29 +03:00
fi
2009-05-07 00:11:28 +04:00
OPAL_ASM_SUPPORT_64BIT=1
2014-05-07 05:00:06 +04:00
OPAL_GCC_INLINE_ASSIGN='"xaddl %1,%0" : "=m"(ret), "+r"(negone) : "m"(ret)'
2014-12-02 20:25:46 +03:00
OPAL_CHECK_CMPXCHG16B
2008-10-28 20:22:29 +03:00
;;
ia64-*)
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="IA64"
2009-05-07 00:11:28 +04:00
OPAL_ASM_SUPPORT_64BIT=1
2014-05-07 05:00:06 +04:00
OPAL_GCC_INLINE_ASSIGN='"mov %0=r0\n;;\n" : "=&r"(ret)'
2008-10-28 20:22:29 +03:00
;;
2016-05-22 09:13:45 +03:00
aarch64*)
opal_cv_asm_arch="ARM64"
OPAL_ASM_SUPPORT_64BIT=1
OPAL_ASM_ARM_VERSION=8
AC_DEFINE_UNQUOTED([OPAL_ASM_ARM_VERSION], [$OPAL_ASM_ARM_VERSION],
[What ARM assembly version to use])
OPAL_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
;;
2008-10-28 20:22:29 +03:00
2016-12-06 03:05:44 +03:00
armv7*|arm-*-linux-gnueabihf)
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="ARM"
2011-01-26 20:22:44 +03:00
OPAL_ASM_SUPPORT_64BIT=1
2012-05-01 00:49:55 +04:00
OPAL_ASM_ARM_VERSION=7
AC_DEFINE_UNQUOTED([OPAL_ASM_ARM_VERSION], [$OPAL_ASM_ARM_VERSION],
[What ARM assembly version to use])
2014-05-07 05:00:06 +04:00
OPAL_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
2012-05-01 00:49:55 +04:00
;;
armv6*)
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="ARM"
2012-05-01 00:49:55 +04:00
OPAL_ASM_SUPPORT_64BIT=0
OPAL_ASM_ARM_VERSION=6
2013-01-29 18:13:55 +04:00
CCASFLAGS="$CCASFLAGS -march=armv7-a"
2012-05-01 00:49:55 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASM_ARM_VERSION], [$OPAL_ASM_ARM_VERSION],
[What ARM assembly version to use])
2014-05-07 05:00:06 +04:00
OPAL_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
2012-05-01 00:49:55 +04:00
;;
2016-12-06 03:05:44 +03:00
armv5*linux*|armv4*linux*|arm-*-linux-gnueabi)
2012-05-01 00:49:55 +04:00
# uses Linux kernel helpers for some atomic operations
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="ARM"
2012-05-01 00:49:55 +04:00
OPAL_ASM_SUPPORT_64BIT=0
OPAL_ASM_ARM_VERSION=5
2013-01-29 18:13:55 +04:00
CCASFLAGS="$CCASFLAGS -march=armv7-a"
2012-05-01 00:49:55 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASM_ARM_VERSION], [$OPAL_ASM_ARM_VERSION],
[What ARM assembly version to use])
2014-05-07 05:00:06 +04:00
OPAL_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
2011-01-26 20:22:44 +03:00
;;
2008-10-28 20:22:29 +03:00
mips-*|mips64*)
# Should really find some way to make sure that we are on
# a MIPS III machine (r4000 and later)
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="MIPS"
2009-05-07 00:11:28 +04:00
OPAL_ASM_SUPPORT_64BIT=1
2014-05-07 05:00:06 +04:00
OPAL_GCC_INLINE_ASSIGN='"or %0,[$]0,[$]0" : "=&r"(ret)'
2008-10-28 20:22:29 +03:00
;;
2015-04-23 00:38:06 +03:00
powerpc-*|powerpc64-*|powerpcle-*|powerpc64le-*|rs6000-*|ppc-*)
2014-05-07 05:00:06 +04:00
OPAL_CHECK_POWERPC_REG
2008-10-28 20:22:29 +03:00
if test "$ac_cv_sizeof_long" = "4" ; then
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="POWERPC32"
2008-10-28 20:22:29 +03:00
# 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.
2014-05-07 05:00:06 +04:00
OPAL_CHECK_POWERPC_64BIT(OPAL_ASM_SUPPORT_64BIT=1)
2008-10-28 20:22:29 +03:00
elif test "$ac_cv_sizeof_long" = "8" ; then
2009-05-07 00:11:28 +04:00
OPAL_ASM_SUPPORT_64BIT=1
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="POWERPC64"
2008-10-28 20:22:29 +03:00
else
AC_MSG_ERROR([Could not determine PowerPC word size: $ac_cv_sizeof_long])
fi
2014-05-07 05:00:06 +04:00
OPAL_GCC_INLINE_ASSIGN='"1: li %0,0" : "=&r"(ret)'
2008-10-28 20:22:29 +03:00
;;
2017-05-05 11:15:07 +03:00
# There is no current difference between s390 and s390x
# But use two different defines in case some come later
# as s390 is 31bits while s390x is 64bits
s390-*)
opal_cv_asm_arch="S390"
2017-06-23 17:27:48 +03:00
OPAL_CHECK_SYNC_BUILTINS([opal_cv_asm_builtin="BUILTIN_SYNC"],
[AC_MSG_ERROR([No atomic primitives available for $host])])
2017-05-05 11:15:07 +03:00
;;
s390x-*)
opal_cv_asm_arch="S390X"
2017-06-23 17:27:48 +03:00
OPAL_CHECK_SYNC_BUILTINS([opal_cv_asm_builtin="BUILTIN_SYNC"],
[AC_MSG_ERROR([No atomic primitives available for $host])])
2017-05-05 11:15:07 +03:00
;;
2008-10-28 20:22:29 +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
2015-06-24 06:59:57 +03:00
# earlier (casa is v8+/v9).
2008-10-28 20:22:29 +03:00
if test "$ac_cv_sizeof_long" = "4" ; then
have_v8plus=0
2014-05-07 05:00:06 +04:00
OPAL_CHECK_SPARCV8PLUS([have_v8plus=1])
2008-10-28 20:22:29 +03:00
if test "$have_v8plus" = "0" ; then
2009-05-07 00:11:28 +04:00
OPAL_ASM_SUPPORT_64BIT=0
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="SPARC"
2008-10-28 20:22:29 +03:00
AC_MSG_WARN([Sparc v8 target is not supported in this release of Open MPI.])
2014-01-30 21:51:13 +04:00
AC_MSG_WARN([You must specify the target architecture v8plus to compile])
AC_MSG_WARN([Open MPI in 32 bit mode on Sparc processors (see the README).])
2008-10-28 20:22:29 +03:00
AC_MSG_ERROR([Can not continue.])
else
2009-05-07 00:11:28 +04:00
OPAL_ASM_SUPPORT_64BIT=1
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="SPARCV9_32"
2008-10-28 20:22:29 +03:00
fi
elif test "$ac_cv_sizeof_long" = "8" ; then
2009-05-07 00:11:28 +04:00
OPAL_ASM_SUPPORT_64BIT=1
2014-05-07 05:00:06 +04:00
opal_cv_asm_arch="SPARCV9_64"
2008-10-28 20:22:29 +03:00
else
AC_MSG_ERROR([Could not determine Sparc word size: $ac_cv_sizeof_long])
fi
2014-05-07 05:00:06 +04:00
OPAL_GCC_INLINE_ASSIGN='"mov 0,%0" : "=&r"(ret)'
2008-10-28 20:22:29 +03:00
;;
*)
2014-05-07 05:00:06 +04:00
OPAL_CHECK_SYNC_BUILTINS([opal_cv_asm_builtin="BUILTIN_SYNC"],
2011-11-23 08:25:41 +04:00
[AC_MSG_ERROR([No atomic primitives available for $host])])
2008-10-28 20:22:29 +03:00
;;
esac
2016-05-10 13:15:26 +03:00
if test "x$OPAL_ASM_SUPPORT_64BIT" = "x1" && test "$opal_cv_asm_builtin" = "BUILTIN_SYNC" &&
test "$opal_asm_sync_have_64bit" = "0" ; then
# __sync builtins exist but do not implement 64-bit support. Fall back on inline asm.
opal_cv_asm_builtin="BUILTIN_NO"
fi
2016-06-02 04:23:47 +03:00
if test "$opal_cv_asm_builtin" = "BUILTIN_SYNC" || test "$opal_cv_asm_builtin" = "BUILTIN_GCC" ; then
2011-11-23 08:25:41 +04:00
AC_DEFINE([OPAL_C_GCC_INLINE_ASSEMBLY], [1],
[Whether C compiler supports GCC style inline assembly])
else
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASM_SUPPORT_64BIT],
[$OPAL_ASM_SUPPORT_64BIT],
2008-10-28 20:22:29 +03:00
[Whether we can do 64bit assembly operations or not. Should not be used outside of the assembly header files])
2009-05-07 00:11:28 +04:00
AC_SUBST([OPAL_ASM_SUPPORT_64BIT])
2008-10-28 20:22:29 +03:00
#
# figure out if we need any special function start / stop code
#
case $host_os in
aix*)
2014-05-07 07:01:47 +04:00
opal_asm_arch_config="aix"
2008-10-28 20:22:29 +03:00
;;
*)
2014-05-07 07:01:47 +04:00
opal_asm_arch_config="default"
2008-10-28 20:22:29 +03:00
;;
esac
# now that we know our architecture, try to inline assemble
2014-05-07 05:00:06 +04:00
OPAL_CHECK_INLINE_C_GCC([$OPAL_GCC_INLINE_ASSIGN])
OPAL_CHECK_INLINE_C_DEC
OPAL_CHECK_INLINE_C_XLC
2008-10-28 20:22:29 +03:00
# format:
# config_file-text-global-label_suffix-gsym-lsym-type-size-align_log-ppc_r_reg-64_bit-gnu_stack
2014-05-07 07:01:47 +04:00
asm_format="${opal_asm_arch_config}"
2009-05-07 00:11:28 +04:00
asm_format="${asm_format}-${opal_cv_asm_text}-${opal_cv_asm_global}"
asm_format="${asm_format}-${opal_cv_asm_label_suffix}-${opal_cv_asm_gsym}"
asm_format="${asm_format}-${opal_cv_asm_lsym}"
asm_format="${asm_format}-${opal_cv_asm_type}-${opal_asm_size}"
2014-05-07 07:01:47 +04:00
asm_format="${asm_format}-${opal_asm_align_log_result}"
2015-02-03 09:19:22 +03:00
if test "$opal_cv_asm_arch" = "POWERPC32" || test "$opal_cv_asm_arch" = "POWERPC64" ; then
2009-05-07 00:11:28 +04:00
asm_format="${asm_format}-${opal_cv_asm_powerpc_r_reg}"
2008-10-28 20:22:29 +03:00
else
asm_format="${asm_format}-1"
fi
2009-05-07 00:11:28 +04:00
asm_format="${asm_format}-${OPAL_ASM_SUPPORT_64BIT}"
2014-05-07 05:00:06 +04:00
opal_cv_asm_format="${asm_format}-${opal_cv_asm_gnu_stack}"
2008-10-28 20:22:29 +03: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.
2014-05-07 05:00:06 +04:00
OPAL_ASSEMBLY_FORMAT=`echo "$opal_cv_asm_format" | sed -e 's/\\\$/\\\$\\\$/'`
2008-10-28 20:22:29 +03:00
AC_MSG_CHECKING([for assembly format])
2014-05-07 05:00:06 +04:00
AC_MSG_RESULT([$opal_cv_asm_format])
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASSEMBLY_FORMAT], ["$OPAL_ASSEMBLY_FORMAT"],
2008-10-28 20:22:29 +03:00
[Format of assembly file])
2009-05-07 00:11:28 +04:00
AC_SUBST([OPAL_ASSEMBLY_FORMAT])
2014-05-07 05:00:06 +04:00
fi # if opal_cv_asm_builtin = BUILTIN_SYNC
2008-10-28 20:22:29 +03:00
2014-05-07 07:01:47 +04:00
result="OPAL_$opal_cv_asm_arch"
2014-05-07 05:00:06 +04:00
OPAL_ASSEMBLY_ARCH="$opal_cv_asm_arch"
2014-08-11 17:28:17 +04:00
AC_MSG_CHECKING([for assembly architecture])
2014-05-07 05:00:06 +04:00
AC_MSG_RESULT([$opal_cv_asm_arch])
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASSEMBLY_ARCH], [$result],
2014-04-15 17:17:04 +04:00
[Architecture type of assembly to use for atomic operations and CMA])
2009-05-07 00:11:28 +04:00
AC_SUBST([OPAL_ASSEMBLY_ARCH])
2008-10-28 20:22:29 +03:00
2014-11-27 19:13:46 +03:00
# Check for RDTSCP support
result=0
2017-02-27 09:09:52 +03:00
AS_IF([test "$opal_cv_asm_arch" = "OPAL_X86_64" || test "$opal_cv_asm_arch" = "OPAL_IA32"],
2014-11-27 19:13:46 +03:00
[AC_MSG_CHECKING([for RDTSCP assembly support])
AC_LANG_PUSH([C])
AC_TRY_RUN([[
int main(int argc, char* argv[])
{
unsigned int rax, rdx;
__asm__ __volatile__ ("rdtscp\n": "=a" (rax), "=d" (rdx):: "%rax", "%rdx");
return 0;
}
]],
[result=1
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])],
[#cross compile not supported
AC_MSG_RESULT(["no (cross compiling)"])])
AC_LANG_POP([C])])
AC_DEFINE_UNQUOTED([OPAL_ASSEMBLY_SUPPORTS_RDTSCP], [$result],
[Whether we have support for RDTSCP instruction])
2014-05-07 07:01:47 +04:00
result="OPAL_$opal_cv_asm_builtin"
2014-05-07 05:00:06 +04:00
OPAL_ASSEMBLY_BUILTIN="$opal_cv_asm_builtin"
2014-04-15 17:17:04 +04:00
AC_MSG_CHECKING([for builtin atomics])
2014-05-07 05:00:06 +04:00
AC_MSG_RESULT([$opal_cv_asm_builtin])
2014-04-15 17:17:04 +04:00
AC_DEFINE_UNQUOTED([OPAL_ASSEMBLY_BUILTIN], [$result],
[Whether to use builtin atomics])
AC_SUBST([OPAL_ASSEMBLY_BUILTIN])
2014-05-07 07:01:47 +04:00
OPAL_ASM_FIND_FILE
2008-10-28 20:22:29 +03:00
unset result asm_format
])dnl
dnl #################################################################
dnl
2014-05-07 07:01:47 +04:00
dnl OPAL_ASM_FIND_FILE
2008-10-28 20:22:29 +03:00
dnl
dnl
dnl do all the evil mojo to provide a working assembly file
dnl
dnl #################################################################
2014-05-07 07:01:47 +04:00
AC_DEFUN([OPAL_ASM_FIND_FILE], [
2008-10-28 20:22:29 +03:00
AC_REQUIRE([AC_PROG_GREP])
AC_REQUIRE([AC_PROG_FGREP])
2017-02-27 04:35:49 +03:00
if test "$opal_cv_asm_arch" != "WINDOWS" && test "$opal_cv_asm_builtin" != "BUILTIN_SYNC" && test "$opal_cv_asm_builtin" != "BUILTIN_GCC" && test "$opal_cv_asm_builtin" != "BUILTIN_OSX" ; then
2008-10-28 20:22:29 +03:00
# see if we have a pre-built one already
AC_MSG_CHECKING([for pre-built assembly file])
2014-05-07 05:00:06 +04:00
opal_cv_asm_file=""
2014-05-08 01:48:53 +04:00
if $GREP "$opal_cv_asm_arch" "${OPAL_TOP_SRCDIR}/opal/asm/asm-data.txt" | $FGREP "$opal_cv_asm_format" >conftest.out 2>&1 ; then
2014-05-07 05:00:06 +04:00
opal_cv_asm_file="`cut -f3 conftest.out`"
if test ! "$opal_cv_asm_file" = "" ; then
opal_cv_asm_file="atomic-${opal_cv_asm_file}.s"
2014-05-08 01:48:53 +04:00
if test -f "${OPAL_TOP_SRCDIR}/opal/asm/generated/${opal_cv_asm_file}" ; then
2014-05-07 05:00:06 +04:00
AC_MSG_RESULT([yes ($opal_cv_asm_file)])
2008-10-28 20:22:29 +03:00
else
2014-05-07 05:00:06 +04:00
AC_MSG_RESULT([no ($opal_cv_asm_file not found)])
opal_cv_asm_file=""
2008-10-28 20:22:29 +03:00
fi
fi
else
AC_MSG_RESULT([no (not in asm-data)])
fi
rm -rf conftest.*
2014-05-07 05:00:06 +04:00
if test "$opal_cv_asm_file" = "" ; then
2016-12-06 02:56:39 +03:00
# Can we generate a file?
AC_MSG_CHECKING([whether possible to generate assembly file])
mkdir -p opal/asm/generated
opal_cv_asm_file="atomic-local.s"
opal_try='$PERL $OPAL_TOP_SRCDIR/opal/asm/generate-asm.pl $opal_cv_asm_arch "$opal_cv_asm_format" $OPAL_TOP_SRCDIR/opal/asm/base $OPAL_TOP_BUILDDIR/opal/asm/generated/$opal_cv_asm_file >conftest.out 2>&1'
if AC_TRY_EVAL(opal_try) ; then
# save the warnings
cat conftest.out >&AC_FD_CC
AC_MSG_RESULT([yes])
2008-10-28 20:22:29 +03:00
else
2016-12-06 02:56:39 +03:00
# save output
cat conftest.out >&AC_FD_CC
opal_cv_asm_file=""
AC_MSG_RESULT([failed])
AC_MSG_WARN([Could not build atomic operations assembly file.])
2008-10-28 20:22:29 +03:00
AC_MSG_WARN([There will be no atomic operations for this build.])
fi
fi
rm -rf conftest.*
else
# On windows with VC++, atomics are done with compiler primitives
2014-05-07 05:00:06 +04:00
opal_cv_asm_file=""
2008-10-28 20:22:29 +03:00
fi
AC_MSG_CHECKING([for atomic assembly filename])
2014-05-07 05:00:06 +04:00
if test "$opal_cv_asm_file" = "" ; then
2008-10-28 20:22:29 +03:00
AC_MSG_RESULT([none])
result=0
else
2014-05-07 05:00:06 +04:00
AC_MSG_RESULT([$opal_cv_asm_file])
2008-10-28 20:22:29 +03:00
result=1
fi
2009-05-07 00:11:28 +04:00
AC_DEFINE_UNQUOTED([OPAL_HAVE_ASM_FILE], [$result],
2008-10-28 20:22:29 +03:00
[Whether there is an atomic assembly file available])
2009-05-07 00:11:28 +04:00
AM_CONDITIONAL([OPAL_HAVE_ASM_FILE], [test "$result" = "1"])
2008-10-28 20:22:29 +03:00
2014-05-07 05:00:06 +04:00
OPAL_ASM_FILE=$opal_cv_asm_file
AC_SUBST(OPAL_ASM_FILE)
2008-10-28 20:22:29 +03:00
])dnl