libgomp: Define config_path for hppa*-*-linux*
[official-gcc.git] / libatomic / acinclude.m4
blobd4f13174e2c92c4fffb86c106840dd26745fb600
1 dnl
2 dnl Unconditionally define a preprocessor macro, translating the shell
3 dnl macro from yes/no to 1/0.
4 dnl
5 AC_DEFUN([LIBAT_DEFINE_YESNO], [
6   yesno=`echo $2 | tr 'yesno' '1  0 '`
7   AC_DEFINE_UNQUOTED([$1], $yesno, [$3])
8 ])
9 dnl
10 dnl Iterate over all of the modes we're prepared to check.
11 dnl
12 AC_DEFUN([LIBAT_FORALL_MODES],
13   [$1(QI,1)
14   $1(HI,2)
15   $1(SI,4)
16   $1(DI,8)
17   $1(TI,16)]
19 dnl
20 dnl Check for builtin types by mode.
21 dnl
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.
25 dnl
26 AC_DEFUN([LIBAT_HAVE_INT_MODE],[
27   AC_CACHE_CHECK([for $2 byte integer],[libat_cv_have_mode_$1],
28     [AC_COMPILE_IFELSE([AC_LANG_SOURCE([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
33     SIZES="$SIZES $2"
34   fi
36 dnl
37 dnl Check for atomic builtins.
38 dnl See:
39 dnl http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
40 dnl
41 dnl This checks to see if the host supports the compiler-generated
42 dnl builtins for atomic operations for various integral sizes.
43 dnl
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
51     case "$host" in
52       *-*-linux* | *-*-uclinux* | *-*-kfreebsd*-gnu | *-*-gnu*)
53         atomic_builtins_link_tests=yes
54         ;;
55     esac
56   fi
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
63         eval $2=yes
64       else
65         eval $2=no
66       fi
67     else
68       old_CFLAGS="$CFLAGS"
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
73           eval $2=no
74         else
75           eval $2=yes
76         fi
77       else
78         eval $2=no
79       fi
80       CFLAGS="$old_CFLAGS"
81     fi
82     rm -f conftest*
83   ])
86 dnl
87 dnl Test if the host assembler supports armv9.4-a LSE128 isns.
88 dnl
89 AC_DEFUN([LIBAT_TEST_FEAT_AARCH64_LSE128],[
90   AC_CACHE_CHECK([for armv9.4-a LSE128 insn support],
91     [libat_cv_have_feat_lse128],[
92     AC_LANG_CONFTEST([AC_LANG_PROGRAM([],[asm(".arch armv9-a+lse128")])])
93     if AC_TRY_EVAL(ac_compile); then
94       eval libat_cv_have_feat_lse128=yes
95     else
96       eval libat_cv_have_feat_lse128=no
97     fi
98     rm -f conftest*
99   ])
100   LIBAT_DEFINE_YESNO([HAVE_FEAT_LSE128], [$libat_cv_have_feat_lse128],
101         [Have LSE128 support for 16 byte integers.])
102   AM_CONDITIONAL([ARCH_AARCH64_HAVE_LSE128], [test x$libat_cv_have_feat_lse128 = xyes])
106 dnl Test if we have __atomic_load and __atomic_store for mode $1, size $2
108 AC_DEFUN([LIBAT_HAVE_ATOMIC_LOADSTORE],[
109   LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_load/store for size $2],
110     [libat_cv_have_at_ldst_$2],
111     [typedef int T __attribute__((mode($1)));
112      T *x; volatile T sink; asm("" : "=g"(x));
113      sink = __atomic_load_n(x, 0);
114      __atomic_store_n(x, sink, 0);])
115   LIBAT_DEFINE_YESNO([HAVE_ATOMIC_LDST_$2], [$libat_cv_have_at_ldst_$2],
116         [Have __atomic_load/store for $2 byte integers.])
117   AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_LDST_$2 HAVE_ATOMIC_LDST_$2])
118   AH_BOTTOM([#define FAST_ATOMIC_LDST_$2 HAVE_ATOMIC_LDST_$2])
122 dnl Test if we have __atomic_test_and_set for mode $1, size $2
124 AC_DEFUN([LIBAT_HAVE_ATOMIC_TAS],[
125   LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_test_and_set for size $2],
126     [libat_cv_have_at_tas_$2],
127     [typedef int T __attribute__((mode($1))); T *x; asm("" : "=g"(x));
128      __atomic_test_and_set(x, 0);])
129   LIBAT_DEFINE_YESNO([HAVE_ATOMIC_TAS_$2], [$libat_cv_have_at_tas_$2],
130         [Have __atomic_test_and_set for $2 byte integers.])
131   AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_TAS_$2 HAVE_ATOMIC_TAS_$2])
135 dnl Test if we have __atomic_exchange for mode $1, size $2
137 AC_DEFUN([LIBAT_HAVE_ATOMIC_EXCHANGE],[
138   LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_exchange for size $2],
139     [libat_cv_have_at_exch_$2],
140     [typedef int T __attribute__((mode($1))); T *x; asm("" : "=g"(x));
141      __atomic_exchange_n(x, 0, 0);])
142   LIBAT_DEFINE_YESNO([HAVE_ATOMIC_EXCHANGE_$2], [$libat_cv_have_at_exch_$2],
143         [Have __atomic_exchange for $2 byte integers.])
144   AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_EXCHANGE_$2 HAVE_ATOMIC_EXCHANGE_$2])
148 dnl Test if we have __atomic_compare_exchange for mode $1, size $2
150 AC_DEFUN([LIBAT_HAVE_ATOMIC_CAS],[
151   LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_compare_exchange for size $2],
152     [libat_cv_have_at_cas_$2],
153     [typedef int T __attribute__((mode($1))); T *x, *y;
154      asm("" : "=g"(x), "=g"(y));
155      __atomic_compare_exchange_n(x, y, 0, 0, 0, 0);])
156   LIBAT_DEFINE_YESNO([HAVE_ATOMIC_CAS_$2], [$libat_cv_have_at_cas_$2],
157         [Have __atomic_compare_exchange for $2 byte integers.])
158   AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_CAS_$2 HAVE_ATOMIC_CAS_$2])
162 dnl Test if we have __atomic_fetch_add for mode $1, size $2
164 AC_DEFUN([LIBAT_HAVE_ATOMIC_FETCH_ADD],[
165   LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_fetch_add for size $2],
166     [libat_cv_have_at_fadd_$2],
167     [typedef int T __attribute__((mode($1))); T *x, y;
168      asm("" : "=g"(x), "=g"(y));
169      __atomic_fetch_add (x, y, 0);
170      __atomic_add_fetch (x, y, 0);])
171   LIBAT_DEFINE_YESNO([HAVE_ATOMIC_FETCH_ADD_$2], [$libat_cv_have_at_fadd_$2],
172         [Have __atomic_fetch_add for $2 byte integers.])
173   AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_FETCH_ADD_$2 HAVE_ATOMIC_FETCH_ADD_$2])
177 dnl Test if we have __atomic_fetch_op for all op for mode $1, size $2
179 AC_DEFUN([LIBAT_HAVE_ATOMIC_FETCH_OP],[
180   LIBAT_TEST_ATOMIC_BUILTIN([for __atomic_fetch_op for size $2],
181     [libat_cv_have_at_fop_$2],
182     [typedef int T __attribute__((mode($1))); T *x, y;
183      asm("" : "=g"(x), "=g"(y));
184      __atomic_fetch_add (x, y, 0); __atomic_add_fetch (x, y, 0);
185      __atomic_fetch_sub (x, y, 0); __atomic_sub_fetch (x, y, 0);
186      __atomic_fetch_and (x, y, 0); __atomic_and_fetch (x, y, 0);
187      __atomic_fetch_nand (x, y, 0); __atomic_nand_fetch (x, y, 0);
188      __atomic_fetch_xor (x, y, 0); __atomic_xor_fetch (x, y, 0);
189      __atomic_fetch_or (x, y, 0);  __atomic_or_fetch (x, y, 0); ])
190   LIBAT_DEFINE_YESNO([HAVE_ATOMIC_FETCH_OP_$2], [$libat_cv_have_at_fop_$2],
191         [Have __atomic_fetch_op for all op for $2 byte integers.])
192   AH_BOTTOM([#define MAYBE_HAVE_ATOMIC_FETCH_OP_$2 HAVE_ATOMIC_FETCH_OP_$2])
196 dnl Test for the size of the target word.
198 AC_DEFUN([LIBAT_WORDSIZE],[
199   AC_CACHE_CHECK([for the word size],[libat_cv_wordsize],
200     [AC_COMPUTE_INT(libat_cv_wordsize,
201       [sizeof(word)], [typedef int word __attribute__((mode(word)));],
202       AC_ERROR([Could not determine word size.]))])
203   AC_DEFINE_UNQUOTED(WORDSIZE, $libat_cv_wordsize,
204     [The word size in bytes of the machine.])
208 dnl Check whether the target supports the ifunc attribute.
210 AC_DEFUN([LIBAT_CHECK_IFUNC], [
211   AC_CACHE_CHECK([whether the target supports the ifunc attribute],
212                  libat_cv_have_ifunc, [
213   save_CFLAGS="$CFLAGS"
214   CFLAGS="$CFLAGS -Werror"
215   AC_TRY_LINK([
216     int foo_alt(void) { return 0; }
217     typedef int F (void);
218     F *foo_sel(void) { return foo_alt; }
219     int foo(void) __attribute__((ifunc("foo_sel")));],
220     [return foo();], libat_cv_have_ifunc=yes, libat_cv_have_ifunc=no)])
221   LIBAT_DEFINE_YESNO([HAVE_IFUNC], [$libat_cv_have_ifunc],
222       [Define to 1 if the target supports __attribute__((ifunc(...))).])
225 dnl ----------------------------------------------------------------------
226 dnl This whole bit snagged from libitm.
228 dnl Check whether the target supports hidden visibility.
229 AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_VISIBILITY], [
230   AC_CACHE_CHECK([whether the target supports hidden visibility],
231                  libat_cv_have_attribute_visibility, [
232   save_CFLAGS="$CFLAGS"
233   CFLAGS="$CFLAGS -Werror"
234   AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
235                  [], libat_cv_have_attribute_visibility=yes,
236                  libat_cv_have_attribute_visibility=no)
237   CFLAGS="$save_CFLAGS"])
238   if test $libat_cv_have_attribute_visibility = yes; then
239     AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
240       [Define to 1 if the target supports __attribute__((visibility(...))).])
241   fi])
243 dnl Check whether the target supports dllexport
244 AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_DLLEXPORT], [
245   AC_CACHE_CHECK([whether the target supports dllexport],
246                  libat_cv_have_attribute_dllexport, [
247   save_CFLAGS="$CFLAGS"
248   CFLAGS="$CFLAGS -Werror"
249   AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
250                  [], libat_cv_have_attribute_dllexport=yes,
251                  libat_cv_have_attribute_dllexport=no)
252   CFLAGS="$save_CFLAGS"])
253   if test $libat_cv_have_attribute_dllexport = yes; then
254     AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
255       [Define to 1 if the target supports __attribute__((dllexport)).])
256   fi])
258 dnl Check whether the target supports symbol aliases.
259 AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_ALIAS], [
260   AC_CACHE_CHECK([whether the target supports symbol aliases],
261                  libat_cv_have_attribute_alias, [
262   AC_TRY_LINK([
263 void foo(void) { }
264 extern void bar(void) __attribute__((alias("foo")));],
265     [bar();], libat_cv_have_attribute_alias=yes, libat_cv_have_attribute_alias=no)])
266   if test $libat_cv_have_attribute_alias = yes; then
267     AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
268       [Define to 1 if the target supports __attribute__((alias(...))).])
269   fi])
271 dnl ----------------------------------------------------------------------
272 dnl This whole bit snagged from libstdc++-v3.
275 dnl LIBAT_ENABLE
276 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
277 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
278 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
280 dnl See docs/html/17_intro/configury.html#enable for documentation.
282 m4_define([LIBAT_ENABLE],[dnl
283 m4_define([_g_switch],[--enable-$1])dnl
284 m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
285  AC_ARG_ENABLE($1,_g_help,
286   m4_bmatch([$5],
287    [^permit ],
288      [[
289       case "$enableval" in
290        m4_bpatsubst([$5],[permit ])) ;;
291        *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
292           dnl Idea for future:  generate a URL pointing to
293           dnl "onlinedocs/configopts.html#whatever"
294       esac
295      ]],
296    [^$],
297      [[
298       case "$enableval" in
299        yes|no) ;;
300        *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
301       esac
302      ]],
303    [[$5]]),
304   [enable_]m4_bpatsubst([$1],-,_)[=][$2])
305 m4_undefine([_g_switch])dnl
306 m4_undefine([_g_help])dnl
310 dnl If GNU ld is in use, check to see if tricky linker opts can be used.  If
311 dnl the native linker is in use, all variables will be defined to something
312 dnl safe (like an empty string).
314 dnl Defines:
315 dnl  SECTION_LDFLAGS='-Wl,--gc-sections' if possible
316 dnl  OPT_LDFLAGS='-Wl,-O1' if possible
317 dnl  LD (as a side effect of testing)
318 dnl Sets:
319 dnl  with_gnu_ld
320 dnl  libat_ld_is_gold (possibly)
321 dnl  libat_ld_is_mold (possibly)
322 dnl  libat_gnu_ld_version (possibly)
324 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
325 dnl set libat_gnu_ld_version to 12345.  Zeros cause problems.
327 AC_DEFUN([LIBAT_CHECK_LINKER_FEATURES], [
328   # If we're not using GNU ld, then there's no point in even trying these
329   # tests.  Check for that first.  We should have already tested for gld
330   # by now (in libtool), but require it now just to be safe...
331   test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
332   test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
333   AC_REQUIRE([AC_PROG_LD])
334   AC_REQUIRE([AC_PROG_AWK])
336   # The name set by libtool depends on the version of libtool.  Shame on us
337   # for depending on an impl detail, but c'est la vie.  Older versions used
338   # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
339   # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
340   # makes sense).  We'll test with_gnu_ld everywhere else, so if that isn't
341   # set (hence we're using an older libtool), then set it.
342   if test x${with_gnu_ld+set} != xset; then
343     if test x${ac_cv_prog_gnu_ld+set} != xset; then
344       # We got through "ac_require(ac_prog_ld)" and still not set?  Huh?
345       with_gnu_ld=no
346     else
347       with_gnu_ld=$ac_cv_prog_gnu_ld
348     fi
349   fi
351   # Start by getting the version number.  I think the libtool test already
352   # does some of this, but throws away the result.
353   libat_ld_is_gold=no
354   libat_ld_is_mold=no
355   if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
356     libat_ld_is_gold=yes
357   elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then
358     libat_ld_is_mold=yes
359   fi
360   changequote(,)
361   ldver=`$LD --version 2>/dev/null |
362          sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'`
363   changequote([,])
364   libat_gnu_ld_version=`echo $ldver | \
365          $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
367   # Set --gc-sections.
368   if test "$with_gnu_ld" = "notbroken"; then
369     # GNU ld it is!  Joy and bunny rabbits!
371     # All these tests are for C++; save the language and the compiler flags.
372     # Need to do this so that g++ won't try to link in libstdc++
373     ac_test_CFLAGS="${CFLAGS+set}"
374     ac_save_CFLAGS="$CFLAGS"
375     CFLAGS='-x c++  -Wl,--gc-sections'
377     # Check for -Wl,--gc-sections
378     # XXX This test is broken at the moment, as symbols required for linking
379     # are now in libsupc++ (not built yet).  In addition, this test has
380     # cored on solaris in the past.  In addition, --gc-sections doesn't
381     # really work at the moment (keeps on discarding used sections, first
382     # .eh_frame and now some of the glibc sections for iconv).
383     # Bzzzzt.  Thanks for playing, maybe next time.
384     AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
385     AC_TRY_RUN([
386      int main(void)
387      {
388        try { throw 1; }
389        catch (...) { };
390        return 0;
391      }
392     ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
393     if test "$ac_test_CFLAGS" = set; then
394       CFLAGS="$ac_save_CFLAGS"
395     else
396       # this is the suspicious part
397       CFLAGS=''
398     fi
399     if test "$ac_sectionLDflags" = "yes"; then
400       SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
401     fi
402     AC_MSG_RESULT($ac_sectionLDflags)
403   fi
405   # Set linker optimization flags.
406   if test x"$with_gnu_ld" = x"yes"; then
407     OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
408   fi
410   AC_SUBST(SECTION_LDFLAGS)
411   AC_SUBST(OPT_LDFLAGS)
416 dnl Add version tags to symbols in shared library (or not), additionally
417 dnl marking other symbols as private/local (or not).
419 dnl --enable-symvers=style adds a version script to the linker call when
420 dnl       creating the shared library.  The choice of version script is
421 dnl       controlled by 'style'.
422 dnl --disable-symvers does not.
423 dnl  +  Usage:  LIBAT_ENABLE_SYMVERS[(DEFAULT)]
424 dnl       Where DEFAULT is either 'yes' or 'no'.  Passing `yes' tries to
425 dnl       choose a default style based on linker characteristics.  Passing
426 dnl       'no' disables versioning.
428 AC_DEFUN([LIBAT_ENABLE_SYMVERS], [
430 LIBAT_ENABLE(symvers,yes,[=STYLE],
431   [enables symbol versioning of the shared library],
432   [permit yes|no|gnu*|sun])
434 # If we never went through the LIBAT_CHECK_LINKER_FEATURES macro, then we
435 # don't know enough about $LD to do tricks...
436 AC_REQUIRE([LIBAT_CHECK_LINKER_FEATURES])
438 # Turn a 'yes' into a suitable default.
439 if test x$enable_symvers = xyes ; then
440   # FIXME  The following test is too strict, in theory.
441   if test $enable_shared = no || test "x$LD" = x; then
442     enable_symvers=no
443   else
444     if test $with_gnu_ld = yes ; then
445       enable_symvers=gnu
446     else
447       case ${target_os} in
448         # Sun symbol versioning exists since Solaris 2.5.
449         solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
450           enable_symvers=sun ;;
451         *)
452           enable_symvers=no ;;
453       esac
454     fi
455   fi
458 # Check if 'sun' was requested on non-Solaris 2 platforms.
459 if test x$enable_symvers = xsun ; then
460   case ${target_os} in
461     solaris2*)
462       # All fine.
463       ;;
464     *)
465       # Unlikely to work.
466       AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
467       AC_MSG_WARN([=== you are not targetting Solaris 2.])
468       AC_MSG_WARN([=== Symbol versioning will be disabled.])
469       enable_symvers=no
470       ;;
471   esac
474 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
475 if test $enable_symvers != no; then
476   AC_MSG_CHECKING([for shared libgcc])
477   ac_save_CFLAGS="$CFLAGS"
478   CFLAGS=' -lgcc_s'
479   AC_TRY_LINK(, [return 0;], libat_shared_libgcc=yes, libat_shared_libgcc=no)
480   CFLAGS="$ac_save_CFLAGS"
481   if test $libat_shared_libgcc = no; then
482     cat > conftest.c <<EOF
483 int main (void) { return 0; }
485 changequote(,)dnl
486     libat_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
487                              -shared -shared-libgcc -o conftest.so \
488                              conftest.c -v 2>&1 >/dev/null \
489                              | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
490 changequote([,])dnl
491     rm -f conftest.c conftest.so
492     if test x${libat_libgcc_s_suffix+set} = xset; then
493       CFLAGS=" -lgcc_s$libat_libgcc_s_suffix"
494       AC_TRY_LINK(, [return 0;], libat_shared_libgcc=yes)
495       CFLAGS="$ac_save_CFLAGS"
496     fi
497   fi
498   AC_MSG_RESULT($libat_shared_libgcc)
501 # For GNU ld, we need at least this version.  The format is described in
502 # LIBAT_CHECK_LINKER_FEATURES above.
503 libat_min_gnu_ld_version=21400
504 # XXXXXXXXXXX libat_gnu_ld_version=21390
506 # Check to see if unspecified "yes" value can win, given results above.
507 # Change "yes" into either "no" or a style name.
508 if test $enable_symvers != no && test $libat_shared_libgcc = yes; then
509   if test $with_gnu_ld = yes; then
510     if test $libat_gnu_ld_version -ge $libat_min_gnu_ld_version ; then
511       enable_symvers=gnu
512     elif test $libat_ld_is_gold = yes ; then
513       enable_symvers=gnu
514     elif test $libat_ld_is_mold = yes ; then
515       enable_symvers=gnu
516     else
517       # The right tools, the right setup, but too old.  Fallbacks?
518       AC_MSG_WARN(=== Linker version $libat_gnu_ld_version is too old for)
519       AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
520       AC_MSG_WARN(=== You would need to upgrade your binutils to version)
521       AC_MSG_WARN(=== $libat_min_gnu_ld_version or later and rebuild GCC.)
522       if test $libat_gnu_ld_version -ge 21200 ; then
523         # Globbing fix is present, proper block support is not.
524         dnl AC_MSG_WARN([=== Dude, you are soooo close.  Maybe we can fake it.])
525         dnl enable_symvers=???
526         AC_MSG_WARN([=== Symbol versioning will be disabled.])
527         enable_symvers=no
528       else
529         # 2.11 or older.
530         AC_MSG_WARN([=== Symbol versioning will be disabled.])
531         enable_symvers=no
532       fi
533     fi
534   elif test $enable_symvers = sun; then
535     : All interesting versions of Sun ld support sun style symbol versioning.
536   else
537     # just fail for now
538     AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
539     AC_MSG_WARN([=== either you are not using a supported linker, or you are])
540     AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
541     AC_MSG_WARN([=== Symbol versioning will be disabled.])
542     enable_symvers=no
543   fi
545 if test $enable_symvers = gnu; then
546   AC_DEFINE(LIBAT_GNU_SYMBOL_VERSIONING, 1,
547             [Define to 1 if GNU symbol versioning is used for libatomic.])
550 AM_CONDITIONAL(LIBAT_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
551 AM_CONDITIONAL(LIBAT_BUILD_VERSIONED_SHLIB_GNU, test $enable_symvers = gnu)
552 AM_CONDITIONAL(LIBAT_BUILD_VERSIONED_SHLIB_SUN, test $enable_symvers = sun)
553 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
556 dnl ----------------------------------------------------------------------
557 sinclude(../libtool.m4)
558 sinclude(../config/enable.m4)
559 sinclude(../config/cet.m4)
560 dnl The lines below arrange for aclocal not to bring an installed
561 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
562 dnl add a definition of LIBTOOL to Makefile.in.
563 ifelse(,,,[AC_SUBST(LIBTOOL)
564 AC_DEFUN([AM_PROG_LIBTOOL])
565 AC_DEFUN([AC_LIBTOOL_DLOPEN])
566 AC_DEFUN([AC_PROG_LD])