AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
have_sync_builtins, [
AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);],
have_sync_builtins=yes, have_sync_builtins=no)])
if test $have_sync_builtins = yes; then
AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
[Define to 1 if the target supports __sync_*_compare_and_swap])
fi])
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY], [
AC_CACHE_CHECK([whether the target supports hidden visibility],
have_attribute_visibility, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
[], have_attribute_visibility=yes,
have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"])
if test $have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi])
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT], [
AC_CACHE_CHECK([whether the target supports dllexport],
have_attribute_dllexport, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
[], have_attribute_dllexport=yes,
have_attribute_dllexport=no)
CFLAGS="$save_CFLAGS"])
if test $have_attribute_dllexport = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
[Define to 1 if the target supports __attribute__((dllexport)).])
fi])
AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_ALIAS], [
AC_CACHE_CHECK([whether the target supports symbol aliases],
have_attribute_alias, [
AC_TRY_LINK([
void foo(void) { }
extern void bar(void) __attribute__((alias("foo")));],
[bar();], have_attribute_alias=yes, have_attribute_alias=no)])
if test $have_attribute_alias = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
[Define to 1 if the target supports __attribute__((alias(...))).])
fi])
sinclude(../libtool.m4)
ifelse(,,,[AC_SUBST(LIBTOOL)
AC_DEFUN([AM_PROG_LIBTOOL])
AC_DEFUN([AC_LIBTOOL_DLOPEN])
AC_DEFUN([AC_PROG_LD])
])
m4_define([LIBGOMP_ENABLE],[m4_define([_g_switch],[--enable-$1])m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])]) AC_ARG_ENABLE($1,_g_help,
m4_bmatch([$5],
[^permit ],
[[
case "$enableval" in
m4_bpatsubst([$5],[permit ])) ;;
*) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
esac
]],
[^$],
[[
case "$enableval" in
yes|no) ;;
*) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
esac
]],
[[$5]]),
[enable_]m4_bpatsubst([$1],-,_)[=][$2])
m4_undefine([_g_switch])m4_undefine([_g_help])])
AC_DEFUN([LIBGOMP_CHECK_LINKER_FEATURES], [
test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
AC_REQUIRE([AC_PROG_LD])
AC_REQUIRE([AC_PROG_AWK])
if test x${with_gnu_ld+set} != xset; then
if test x${ac_cv_prog_gnu_ld+set} != xset; then
with_gnu_ld=no
else
with_gnu_ld=$ac_cv_prog_gnu_ld
fi
fi
changequote(,)
ldver=`$LD --version 2>/dev/null | head -1 | \
sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'`
changequote([,])
libgomp_gnu_ld_version=`echo $ldver | \
$AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
if test "$with_gnu_ld" = "notbroken"; then
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS='-x c++ -Wl,--gc-sections'
AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
AC_TRY_RUN([
int main(void)
{
try { throw 1; }
catch (...) { };
return 0;
}
], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
else
CFLAGS=''
fi
if test "$ac_sectionLDflags" = "yes"; then
SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
fi
AC_MSG_RESULT($ac_sectionLDflags)
fi
if test x"$with_gnu_ld" = x"yes"; then
OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
fi
AC_SUBST(SECTION_LDFLAGS)
AC_SUBST(OPT_LDFLAGS)
])
AC_DEFUN([LIBGOMP_ENABLE_SYMVERS], [
LIBGOMP_ENABLE(symvers,yes,[=STYLE],
[enables symbol versioning of the shared library],
[permit yes|no|gnu])
AC_REQUIRE([LIBGOMP_CHECK_LINKER_FEATURES])
if test $enable_shared = no ||
test "x$LD" = x ||
test x$libgomp_gnu_ld_version = x; then
enable_symvers=no
fi
if test $enable_symvers != no; then
AC_MSG_CHECKING([for shared libgcc])
ac_save_CFLAGS="$CFLAGS"
CFLAGS=' -lgcc_s'
AC_TRY_LINK(, [return 0;], libgomp_shared_libgcc=yes, libgomp_shared_libgcc=no)
CFLAGS="$ac_save_CFLAGS"
if test $libgomp_shared_libgcc = no; then
cat > conftest.c <<EOF
int main (void) { return 0; }
EOF
changequote(,) libgomp_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
-shared -shared-libgcc -o conftest.so \
conftest.c -v 2>&1 >/dev/null \
| sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
changequote([,]) rm -f conftest.c conftest.so
if test x${libgomp_libgcc_s_suffix+set} = xset; then
CFLAGS=" -lgcc_s$libgomp_libgcc_s_suffix"
AC_TRY_LINK(, [return 0;], libgomp_shared_libgcc=yes)
CFLAGS="$ac_save_CFLAGS"
fi
fi
AC_MSG_RESULT($libgomp_shared_libgcc)
fi
libgomp_min_gnu_ld_version=21400
if test $enable_symvers = yes; then
if test $with_gnu_ld = yes &&
test $libgomp_shared_libgcc = yes;
then
if test $libgomp_gnu_ld_version -ge $libgomp_min_gnu_ld_version ; then
enable_symvers=gnu
else
AC_MSG_WARN(=== Linker version $libgomp_gnu_ld_version is too old for)
AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
AC_MSG_WARN(=== You would need to upgrade your binutils to version)
AC_MSG_WARN(=== $libgomp_min_gnu_ld_version or later and rebuild GCC.)
if test $libgomp_gnu_ld_version -ge 21200 ; then
AC_MSG_WARN([=== Symbol versioning will be disabled.])
enable_symvers=no
else
AC_MSG_WARN([=== Symbol versioning will be disabled.])
enable_symvers=no
fi
fi
else
AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
AC_MSG_WARN([=== either you are not using a supported linker, or you are])
AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
AC_MSG_WARN([=== Symbol versioning will be disabled.])
enable_symvers=no
fi
fi
AM_CONDITIONAL(LIBGOMP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
])