AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
libgomp_cv_have_sync_builtins, [
- AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);],
+ AC_TRY_LINK([], [int foo; __sync_val_compare_and_swap(&foo, 0, 1);],
libgomp_cv_have_sync_builtins=yes, libgomp_cv_have_sync_builtins=no)])
if test $libgomp_cv_have_sync_builtins = yes; then
AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
dnl LD (as a side effect of testing)
dnl Sets:
dnl with_gnu_ld
+dnl libgomp_ld_is_gold (possibly)
dnl libgomp_gnu_ld_version (possibly)
dnl
dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
# Start by getting the version number. I think the libtool test already
# does some of this, but throws away the result.
+ libgomp_ld_is_gold=no
+ if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+ libgomp_ld_is_gold=yes
+ 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/'`
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
changequote([,])
libgomp_gnu_ld_version=`echo $ldver | \
$AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
LIBGOMP_ENABLE(symvers,yes,[=STYLE],
[enables symbol versioning of the shared library],
- [permit yes|no|gnu])
+ [permit yes|no|gnu*|sun])
# If we never went through the LIBGOMP_CHECK_LINKER_FEATURES macro, then we
# don't know enough about $LD to do tricks...
AC_REQUIRE([LIBGOMP_CHECK_LINKER_FEATURES])
-# FIXME The following test is too strict, in theory.
-if test $enable_shared = no ||
- test "x$LD" = x ||
- test x$libgomp_gnu_ld_version = x; then
- enable_symvers=no
+
+# Turn a 'yes' into a suitable default.
+if test x$enable_symvers = xyes ; then
+ # FIXME The following test is too strict, in theory.
+ if test $enable_shared = no || test "x$LD" = x; then
+ enable_symvers=no
+ else
+ if test $with_gnu_ld = yes ; then
+ enable_symvers=gnu
+ else
+ case ${target_os} in
+ # Sun symbol versioning exists since Solaris 2.5.
+ solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
+ enable_symvers=sun ;;
+ *)
+ enable_symvers=no ;;
+ esac
+ fi
+ fi
+fi
+
+# Check if 'sun' was requested on non-Solaris 2 platforms.
+if test x$enable_symvers = xsun ; then
+ case ${target_os} in
+ solaris2*)
+ # All fine.
+ ;;
+ *)
+ # Unlikely to work.
+ AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
+ AC_MSG_WARN([=== you are not targetting Solaris 2.])
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ ;;
+ esac
fi
# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
# Check to see if unspecified "yes" value can win, given results above.
# Change "yes" into either "no" or a style name.
-if test $enable_symvers = yes; then
- if test $with_gnu_ld = yes &&
- test $libgomp_shared_libgcc = yes;
- then
+if test $enable_symvers != no && test $libgomp_shared_libgcc = yes; then
+ if test $with_gnu_ld = yes; then
if test $libgomp_gnu_ld_version -ge $libgomp_min_gnu_ld_version ; then
enable_symvers=gnu
+ elif test $libgomp_ld_is_gold = yes ; then
+ enable_symvers=gnu
else
# The right tools, the right setup, but too old. Fallbacks?
AC_MSG_WARN(=== Linker version $libgomp_gnu_ld_version is too old for)
enable_symvers=no
fi
fi
+ elif test $enable_symvers = sun; then
+ : All interesting versions of Sun ld support sun style symbol versioning.
else
# just fail for now
AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
fi
fi
+AC_CACHE_CHECK([whether the target supports .symver directive],
+ libgomp_cv_have_as_symver_directive, [
+ AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
+ [], libgomp_cv_have_as_symver_directive=yes,
+ libgomp_cv_have_as_symver_directive=no)])
+if test $libgomp_cv_have_as_symver_directive = yes; then
+ AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
+ [Define to 1 if the target assembler supports .symver directive.])
+fi
+
AM_CONDITIONAL(LIBGOMP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
+AM_CONDITIONAL(LIBGOMP_BUILD_VERSIONED_SHLIB_GNU, test $enable_symvers = gnu)
+AM_CONDITIONAL(LIBGOMP_BUILD_VERSIONED_SHLIB_SUN, test $enable_symvers = sun)
AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
+
+if test $enable_symvers != no ; then
+ case ${target_os} in
+ # The Solaris 2 runtime linker doesn't support the GNU extension of
+ # binding the same symbol to different versions
+ solaris2*)
+ ;;
+ # Other platforms with GNU symbol versioning (GNU/Linux, more?) do.
+ *)
+ AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1,
+ [Define to 1 if the target runtime linker supports binding the same symbol to different versions.])
+ ;;
+ esac
+fi
])