2 dnl Unconditionally define a preprocessor macro, translating the shell
3 dnl macro from yes/no to 1/0.
5 AC_DEFUN([LIBAT_DEFINE_YESNO], [
6 yesno=`echo $2 | tr 'yesno' '1 0 '`
7 AC_DEFINE_UNQUOTED([$1], $yesno, [$3])
10 dnl Iterate over all of the modes we're prepared to check.
12 AC_DEFUN([LIBAT_FORALL_MODES],
20 dnl Check for builtin types by mode.
22 dnl A less interesting of size checking than autoconf normally provides.
23 dnl We know that gcc always provides <stdint.h>, but we don't often
24 dnl provide a builtin type for TImode.
26 AC_DEFUN([LIBAT_HAVE_INT_MODE],[
27 AC_CACHE_CHECK([for $2 byte integer],[libat_cv_have_mode_$1],
28 [AC_COMPILE_IFELSE([int x __attribute__((mode($1)));],
29 [libat_cv_have_mode_$1=yes],[libat_cv_have_mode_$1=no])])
30 LIBAT_DEFINE_YESNO([HAVE_INT$2], [$libat_cv_have_mode_$1],
31 [Have support for $2 byte integers.])
32 if test x$libat_cv_have_mode_$1 = xyes; then
37 dnl Check for atomic builtins.
39 dnl http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
41 dnl This checks to see if the host supports the compiler-generated
42 dnl builtins for atomic operations for various integral sizes.
44 AC_DEFUN([LIBAT_TEST_ATOMIC_INIT],[
45 # Do link tests if possible, instead asm tests, limited to some platforms
46 # see discussion in PR target/40134, PR libstdc++/40133 and the thread
47 # starting at http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00322.html
48 atomic_builtins_link_tests=no
49 if test x$gcc_no_link != xyes; then
50 # Can do link tests. Limit to some tested platforms
52 *-*-linux* | *-*-uclinux* | *-*-kfreebsd*-gnu | *-*-gnu*)
53 atomic_builtins_link_tests=yes
58 AC_DEFUN([LIBAT_TEST_ATOMIC_BUILTIN],[
59 AC_CACHE_CHECK([$1],[$2],[
60 AC_LANG_CONFTEST([AC_LANG_PROGRAM([],[$3])])
61 if test x$atomic_builtins_link_tests = xyes; then
62 if AC_TRY_EVAL(ac_link); then
69 # Compile unoptimized.
70 CFLAGS="$CFLAGS -O0 -S"
71 if AC_TRY_EVAL(ac_compile); then
72 if grep __atomic_ conftest.s >/dev/null 2>&1 ; then
87 dnl Test if we have __atomic_load and __atomic_store for mode $1, size $2
89 AC_DEFUN([LIBAT_HAVE_ATOMIC_LOADSTORE],[
90 LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_load/store for size $2],
91 [libat_cv_have_at_ldst_$2],
92 [typedef int T __attribute__((mode($1)));
93 T *x; volatile T sink; asm("" : "=g"(x));
94 sink = __atomic_load_n(x, 0);
95 __atomic_store_n(x, sink, 0);])
96 LIBAT_DEFINE_YESNO([HAVE_ATOMIC_LDST_$2], [$libat_cv_have_at_ldst_$2],
97 [Have __atomic_load/store for $2 byte integers.])
98 AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_LDST_$2 HAVE_ATOMIC_LDST_$2])
99 AH_BOTTOM([#define FAST_ATOMIC_LDST_$2 HAVE_ATOMIC_LDST_$2])
103 dnl Test if we have __atomic_test_and_set for mode $1, size $2
105 AC_DEFUN([LIBAT_HAVE_ATOMIC_TAS],[
106 LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_test_and_set for size $2],
107 [libat_cv_have_at_tas_$2],
108 [typedef int T __attribute__((mode($1))); T *x; asm("" : "=g"(x));
109 __atomic_test_and_set(x, 0);])
110 LIBAT_DEFINE_YESNO([HAVE_ATOMIC_TAS_$2], [$libat_cv_have_at_tas_$2],
111 [Have __atomic_test_and_set for $2 byte integers.])
112 AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_TAS_$2 HAVE_ATOMIC_TAS_$2])
116 dnl Test if we have __atomic_exchange for mode $1, size $2
118 AC_DEFUN([LIBAT_HAVE_ATOMIC_EXCHANGE],[
119 LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_exchange for size $2],
120 [libat_cv_have_at_exch_$2],
121 [typedef int T __attribute__((mode($1))); T *x; asm("" : "=g"(x));
122 __atomic_exchange_n(x, 0, 0);])
123 LIBAT_DEFINE_YESNO([HAVE_ATOMIC_EXCHANGE_$2], [$libat_cv_have_at_exch_$2],
124 [Have __atomic_exchange for $2 byte integers.])
125 AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_EXCHANGE_$2 HAVE_ATOMIC_EXCHANGE_$2])
129 dnl Test if we have __atomic_compare_exchange for mode $1, size $2
131 AC_DEFUN([LIBAT_HAVE_ATOMIC_CAS],[
132 LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_compare_exchange for size $2],
133 [libat_cv_have_at_cas_$2],
134 [typedef int T __attribute__((mode($1))); T *x, *y;
135 asm("" : "=g"(x), "=g"(y));
136 __atomic_compare_exchange_n(x, y, 0, 0, 0, 0);])
137 LIBAT_DEFINE_YESNO([HAVE_ATOMIC_CAS_$2], [$libat_cv_have_at_cas_$2],
138 [Have __atomic_compare_exchange for $2 byte integers.])
139 AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_CAS_$2 HAVE_ATOMIC_CAS_$2])
143 dnl Test if we have __atomic_fetch_add for mode $1, size $2
145 AC_DEFUN([LIBAT_HAVE_ATOMIC_FETCH_ADD],[
146 LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_fetch_add for size $2],
147 [libat_cv_have_at_fadd_$2],
148 [typedef int T __attribute__((mode($1))); T *x, y;
149 asm("" : "=g"(x), "=g"(y));
150 __atomic_fetch_add (x, y, 0);
151 __atomic_add_fetch (x, y, 0);])
152 LIBAT_DEFINE_YESNO([HAVE_ATOMIC_FETCH_ADD_$2], [$libat_cv_have_at_fadd_$2],
153 [Have __atomic_fetch_add for $2 byte integers.])
154 AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_FETCH_ADD_$2 HAVE_ATOMIC_FETCH_ADD_$2])
158 dnl Test if we have __atomic_fetch_op for all op for mode $1, size $2
160 AC_DEFUN([LIBAT_HAVE_ATOMIC_FETCH_OP],[
161 LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_fetch_op for size $2],
162 [libat_cv_have_at_fop_$2],
163 [typedef int T __attribute__((mode($1))); T *x, y;
164 asm("" : "=g"(x), "=g"(y));
165 __atomic_fetch_add (x, y, 0); __atomic_add_fetch (x, y, 0);
166 __atomic_fetch_sub (x, y, 0); __atomic_sub_fetch (x, y, 0);
167 __atomic_fetch_and (x, y, 0); __atomic_and_fetch (x, y, 0);
168 __atomic_fetch_nand (x, y, 0); __atomic_nand_fetch (x, y, 0);
169 __atomic_fetch_xor (x, y, 0); __atomic_xor_fetch (x, y, 0);
170 __atomic_fetch_or (x, y, 0); __atomic_or_fetch (x, y, 0); ])
171 LIBAT_DEFINE_YESNO([HAVE_ATOMIC_FETCH_OP_$2], [$libat_cv_have_at_fop_$2],
172 [Have __atomic_fetch_op for all op for $2 byte integers.])
173 AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_FETCH_OP_$2 HAVE_ATOMIC_FETCH_OP_$2])
177 dnl Test for the size of the target word.
179 AC_DEFUN([LIBAT_WORDSIZE],[
180 AC_CACHE_CHECK([for the word size],[libat_cv_wordsize],
181 [AC_COMPUTE_INT(libat_cv_wordsize,
182 [sizeof(word)], [typedef int word __attribute__((mode(word)));],
183 AC_ERROR([Could not determine word size.]))])
184 AC_DEFINE_UNQUOTED(WORDSIZE, $libat_cv_wordsize,
185 [The word size in bytes of the machine.])
189 dnl Check whether the target supports the ifunc attribute.
191 AC_DEFUN([LIBAT_CHECK_IFUNC], [
192 AC_CACHE_CHECK([whether the target supports the ifunc attribute],
193 libat_cv_have_ifunc, [
194 save_CFLAGS="$CFLAGS"
195 CFLAGS="$CFLAGS -Werror"
197 int foo_alt(void) { return 0; }
198 typedef int F (void);
199 F *foo_sel(void) { return foo_alt; }
200 int foo(void) __attribute__((ifunc("foo_sel")));],
201 [return foo();], libat_cv_have_ifunc=yes, libat_cv_have_ifunc=no)])
202 LIBAT_DEFINE_YESNO([HAVE_IFUNC], [$libat_cv_have_ifunc],
203 [Define to 1 if the target supports __attribute__((ifunc(...))).])
206 dnl ----------------------------------------------------------------------
207 dnl This whole bit snagged from libitm.
209 dnl Check whether the target supports hidden visibility.
210 AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_VISIBILITY], [
211 AC_CACHE_CHECK([whether the target supports hidden visibility],
212 libat_cv_have_attribute_visibility, [
213 save_CFLAGS="$CFLAGS"
214 CFLAGS="$CFLAGS -Werror"
215 AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
216 [], libat_cv_have_attribute_visibility=yes,
217 libat_cv_have_attribute_visibility=no)
218 CFLAGS="$save_CFLAGS"])
219 if test $libat_cv_have_attribute_visibility = yes; then
220 AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
221 [Define to 1 if the target supports __attribute__((visibility(...))).])
224 dnl Check whether the target supports dllexport
225 AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_DLLEXPORT], [
226 AC_CACHE_CHECK([whether the target supports dllexport],
227 libat_cv_have_attribute_dllexport, [
228 save_CFLAGS="$CFLAGS"
229 CFLAGS="$CFLAGS -Werror"
230 AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
231 [], libat_cv_have_attribute_dllexport=yes,
232 libat_cv_have_attribute_dllexport=no)
233 CFLAGS="$save_CFLAGS"])
234 if test $libat_cv_have_attribute_dllexport = yes; then
235 AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
236 [Define to 1 if the target supports __attribute__((dllexport)).])
239 dnl Check whether the target supports symbol aliases.
240 AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_ALIAS], [
241 AC_CACHE_CHECK([whether the target supports symbol aliases],
242 libat_cv_have_attribute_alias, [
245 extern void bar(void) __attribute__((alias("foo")));],
246 [bar();], libat_cv_have_attribute_alias=yes, libat_cv_have_attribute_alias=no)])
247 if test $libat_cv_have_attribute_alias = yes; then
248 AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
249 [Define to 1 if the target supports __attribute__((alias(...))).])
252 dnl ----------------------------------------------------------------------
253 dnl This whole bit snagged from libstdc++-v3.
257 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
258 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
259 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
261 dnl See docs/html/17_intro/configury.html#enable for documentation.
263 m4_define([LIBAT_ENABLE],[dnl
264 m4_define([_g_switch],[--enable-$1])dnl
265 m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
266 AC_ARG_ENABLE($1,_g_help,
271 m4_bpatsubst([$5],[permit ])) ;;
272 *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
273 dnl Idea for future: generate a URL pointing to
274 dnl "onlinedocs/configopts.html#whatever"
281 *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
285 [enable_]m4_bpatsubst([$1],-,_)[=][$2])
286 m4_undefine([_g_switch])dnl
287 m4_undefine([_g_help])dnl
291 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
292 dnl the native linker is in use, all variables will be defined to something
293 dnl safe (like an empty string).
296 dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
297 dnl OPT_LDFLAGS='-Wl,-O1' if possible
298 dnl LD (as a side effect of testing)
301 dnl libat_ld_is_gold (possibly)
302 dnl libat_gnu_ld_version (possibly)
304 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
305 dnl set libat_gnu_ld_version to 12345. Zeros cause problems.
307 AC_DEFUN([LIBAT_CHECK_LINKER_FEATURES], [
308 # If we're not using GNU ld, then there's no point in even trying these
309 # tests. Check for that first. We should have already tested for gld
310 # by now (in libtool), but require it now just to be safe...
311 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
312 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
313 AC_REQUIRE([AC_PROG_LD])
314 AC_REQUIRE([AC_PROG_AWK])
316 # The name set by libtool depends on the version of libtool. Shame on us
317 # for depending on an impl detail, but c'est la vie. Older versions used
318 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
319 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
320 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
321 # set (hence we're using an older libtool), then set it.
322 if test x${with_gnu_ld+set} != xset; then
323 if test x${ac_cv_prog_gnu_ld+set} != xset; then
324 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
327 with_gnu_ld=$ac_cv_prog_gnu_ld
331 # Start by getting the version number. I think the libtool test already
332 # does some of this, but throws away the result.
334 if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
338 ldver=`$LD --version 2>/dev/null |
339 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'`
341 libat_gnu_ld_version=`echo $ldver | \
342 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
345 if test "$with_gnu_ld" = "notbroken"; then
346 # GNU ld it is! Joy and bunny rabbits!
348 # All these tests are for C++; save the language and the compiler flags.
349 # Need to do this so that g++ won't try to link in libstdc++
350 ac_test_CFLAGS="${CFLAGS+set}"
351 ac_save_CFLAGS="$CFLAGS"
352 CFLAGS='-x c++ -Wl,--gc-sections'
354 # Check for -Wl,--gc-sections
355 # XXX This test is broken at the moment, as symbols required for linking
356 # are now in libsupc++ (not built yet). In addition, this test has
357 # cored on solaris in the past. In addition, --gc-sections doesn't
358 # really work at the moment (keeps on discarding used sections, first
359 # .eh_frame and now some of the glibc sections for iconv).
360 # Bzzzzt. Thanks for playing, maybe next time.
361 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
369 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
370 if test "$ac_test_CFLAGS" = set; then
371 CFLAGS="$ac_save_CFLAGS"
373 # this is the suspicious part
376 if test "$ac_sectionLDflags" = "yes"; then
377 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
379 AC_MSG_RESULT($ac_sectionLDflags)
382 # Set linker optimization flags.
383 if test x"$with_gnu_ld" = x"yes"; then
384 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
387 AC_SUBST(SECTION_LDFLAGS)
388 AC_SUBST(OPT_LDFLAGS)
393 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
394 dnl the native linker is in use, all variables will be defined to something
395 dnl safe (like an empty string).
398 dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
399 dnl OPT_LDFLAGS='-Wl,-O1' if possible
400 dnl LD (as a side effect of testing)
403 dnl libat_ld_is_gold (possibly)
404 dnl libat_gnu_ld_version (possibly)
406 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
407 dnl set libat_gnu_ld_version to 12345. Zeros cause problems.
409 AC_DEFUN([LIBAT_CHECK_LINKER_FEATURES], [
410 # If we're not using GNU ld, then there's no point in even trying these
411 # tests. Check for that first. We should have already tested for gld
412 # by now (in libtool), but require it now just to be safe...
413 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
414 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
415 AC_REQUIRE([AC_PROG_LD])
416 AC_REQUIRE([AC_PROG_AWK])
418 # The name set by libtool depends on the version of libtool. Shame on us
419 # for depending on an impl detail, but c'est la vie. Older versions used
420 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
421 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
422 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
423 # set (hence we're using an older libtool), then set it.
424 if test x${with_gnu_ld+set} != xset; then
425 if test x${ac_cv_prog_gnu_ld+set} != xset; then
426 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
429 with_gnu_ld=$ac_cv_prog_gnu_ld
433 # Start by getting the version number. I think the libtool test already
434 # does some of this, but throws away the result.
436 if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
440 ldver=`$LD --version 2>/dev/null |
441 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'`
443 libat_gnu_ld_version=`echo $ldver | \
444 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
447 if test "$with_gnu_ld" = "notbroken"; then
448 # GNU ld it is! Joy and bunny rabbits!
450 # All these tests are for C++; save the language and the compiler flags.
451 # Need to do this so that g++ won't try to link in libstdc++
452 ac_test_CFLAGS="${CFLAGS+set}"
453 ac_save_CFLAGS="$CFLAGS"
454 CFLAGS='-x c++ -Wl,--gc-sections'
456 # Check for -Wl,--gc-sections
457 # XXX This test is broken at the moment, as symbols required for linking
458 # are now in libsupc++ (not built yet). In addition, this test has
459 # cored on solaris in the past. In addition, --gc-sections doesn't
460 # really work at the moment (keeps on discarding used sections, first
461 # .eh_frame and now some of the glibc sections for iconv).
462 # Bzzzzt. Thanks for playing, maybe next time.
463 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
471 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
472 if test "$ac_test_CFLAGS" = set; then
473 CFLAGS="$ac_save_CFLAGS"
475 # this is the suspicious part
478 if test "$ac_sectionLDflags" = "yes"; then
479 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
481 AC_MSG_RESULT($ac_sectionLDflags)
484 # Set linker optimization flags.
485 if test x"$with_gnu_ld" = x"yes"; then
486 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
489 AC_SUBST(SECTION_LDFLAGS)
490 AC_SUBST(OPT_LDFLAGS)
495 dnl Add version tags to symbols in shared library (or not), additionally
496 dnl marking other symbols as private/local (or not).
498 dnl --enable-symvers=style adds a version script to the linker call when
499 dnl creating the shared library. The choice of version script is
500 dnl controlled by 'style'.
501 dnl --disable-symvers does not.
502 dnl + Usage: LIBAT_ENABLE_SYMVERS[(DEFAULT)]
503 dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
504 dnl choose a default style based on linker characteristics. Passing
505 dnl 'no' disables versioning.
507 AC_DEFUN([LIBAT_ENABLE_SYMVERS], [
509 LIBAT_ENABLE(symvers,yes,[=STYLE],
510 [enables symbol versioning of the shared library],
511 [permit yes|no|gnu*|sun])
513 # If we never went through the LIBAT_CHECK_LINKER_FEATURES macro, then we
514 # don't know enough about $LD to do tricks...
515 AC_REQUIRE([LIBAT_CHECK_LINKER_FEATURES])
517 # Turn a 'yes' into a suitable default.
518 if test x$enable_symvers = xyes ; then
519 # FIXME The following test is too strict, in theory.
520 if test $enable_shared = no || test "x$LD" = x; then
523 if test $with_gnu_ld = yes ; then
527 # Sun symbol versioning exists since Solaris 2.5.
528 solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
529 enable_symvers=sun ;;
537 # Check if 'sun' was requested on non-Solaris 2 platforms.
538 if test x$enable_symvers = xsun ; then
545 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
546 AC_MSG_WARN([=== you are not targetting Solaris 2.])
547 AC_MSG_WARN([=== Symbol versioning will be disabled.])
553 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
554 if test $enable_symvers != no; then
555 AC_MSG_CHECKING([for shared libgcc])
556 ac_save_CFLAGS="$CFLAGS"
558 AC_TRY_LINK(, [return 0;], libat_shared_libgcc=yes, libat_shared_libgcc=no)
559 CFLAGS="$ac_save_CFLAGS"
560 if test $libat_shared_libgcc = no; then
561 cat > conftest.c <<EOF
562 int main (void) { return 0; }
565 libat_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
566 -shared -shared-libgcc -o conftest.so \
567 conftest.c -v 2>&1 >/dev/null \
568 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
570 rm -f conftest.c conftest.so
571 if test x${libat_libgcc_s_suffix+set} = xset; then
572 CFLAGS=" -lgcc_s$libat_libgcc_s_suffix"
573 AC_TRY_LINK(, [return 0;], libat_shared_libgcc=yes)
574 CFLAGS="$ac_save_CFLAGS"
577 AC_MSG_RESULT($libat_shared_libgcc)
580 # For GNU ld, we need at least this version. The format is described in
581 # LIBAT_CHECK_LINKER_FEATURES above.
582 libat_min_gnu_ld_version=21400
583 # XXXXXXXXXXX libat_gnu_ld_version=21390
585 # Check to see if unspecified "yes" value can win, given results above.
586 # Change "yes" into either "no" or a style name.
587 if test $enable_symvers != no && test $libat_shared_libgcc = yes; then
588 if test $with_gnu_ld = yes; then
589 if test $libat_gnu_ld_version -ge $libat_min_gnu_ld_version ; then
591 elif test $libat_ld_is_gold = yes ; then
594 # The right tools, the right setup, but too old. Fallbacks?
595 AC_MSG_WARN(=== Linker version $libat_gnu_ld_version is too old for)
596 AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
597 AC_MSG_WARN(=== You would need to upgrade your binutils to version)
598 AC_MSG_WARN(=== $libat_min_gnu_ld_version or later and rebuild GCC.)
599 if test $libat_gnu_ld_version -ge 21200 ; then
600 # Globbing fix is present, proper block support is not.
601 dnl AC_MSG_WARN([=== Dude, you are soooo close. Maybe we can fake it.])
602 dnl enable_symvers=???
603 AC_MSG_WARN([=== Symbol versioning will be disabled.])
607 AC_MSG_WARN([=== Symbol versioning will be disabled.])
611 elif test $enable_symvers = sun; then
612 : All interesting versions of Sun ld support sun style symbol versioning.
615 AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
616 AC_MSG_WARN([=== either you are not using a supported linker, or you are])
617 AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
618 AC_MSG_WARN([=== Symbol versioning will be disabled.])
622 if test $enable_symvers = gnu; then
623 AC_DEFINE(LIBAT_GNU_SYMBOL_VERSIONING, 1,
624 [Define to 1 if GNU symbol versioning is used for libatomic.])
627 AM_CONDITIONAL(LIBAT_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
628 AM_CONDITIONAL(LIBAT_BUILD_VERSIONED_SHLIB_GNU, test $enable_symvers = gnu)
629 AM_CONDITIONAL(LIBAT_BUILD_VERSIONED_SHLIB_SUN, test $enable_symvers = sun)
630 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
633 dnl ----------------------------------------------------------------------
634 sinclude(../libtool.m4)
635 dnl The lines below arrange for aclocal not to bring an installed
636 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
637 dnl add a definition of LIBTOOL to Makefile.in.
638 ifelse(,,,[AC_SUBST(LIBTOOL)
639 AC_DEFUN([AM_PROG_LIBTOOL])
640 AC_DEFUN([AC_LIBTOOL_DLOPEN])
641 AC_DEFUN([AC_PROG_LD])