math: Use fmin/fmax on hypot
[glibc.git] / configure.ac
blob277d3527d273cbcd67f0cb55b2705d98ed752315
1 dnl Process this file with autoconf to produce a configure script.
2 dnl Note we do not use AC_PREREQ here!  See aclocal.m4 for what we use instead.
3 AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/],
4   [glibc], [https://www.gnu.org/software/glibc/])
5 AC_CONFIG_SRCDIR([include/features.h])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_AUX_DIR([scripts])
9 ACX_PKGVERSION([GNU libc])
10 ACX_BUGURL([https://www.gnu.org/software/libc/bugs.html])
11 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
12                    [Package description])
13 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
14                    [Bug reporting address])
16 # Glibc should not depend on any header files
17 AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
18   [m4_divert_text([DEFAULTS],
19     [ac_includes_default='/* none */'])])
21 # We require GCC, and by default use its preprocessor.  Override AC_PROG_CPP
22 # here to work around the Autoconf issue discussed in
23 # <https://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
24 AC_DEFUN([AC_PROG_CPP],
25 [AC_REQUIRE([AC_PROG_CC])dnl
26 AC_ARG_VAR([CPP],      [C preprocessor])dnl
27 _AC_ARG_VAR_CPPFLAGS()dnl
28 # On Suns, sometimes $CPP names a directory.
29 if test -n "$CPP" && test -d "$CPP"; then
30   CPP=
32 if test -z "$CPP"; then
33   CPP="$CC -E"
35 AC_SUBST(CPP)dnl
36 ])# AC_PROG_CPP
38 # We require GCC.  Override _AC_PROG_CC_C89 here to work around the Autoconf
39 # issue discussed in
40 # <https://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
41 AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
43 dnl This is here so we can set $subdirs directly based on configure fragments.
44 AC_CONFIG_SUBDIRS()
46 AC_CANONICAL_HOST
48 AC_PROG_CC
49 if test $host != $build; then
50   AC_CHECK_PROGS(BUILD_CC, gcc cc)
52 AC_SUBST(cross_compiling)
53 AC_PROG_CPP
54 AC_CHECK_TOOL(READELF, readelf, false)
56 # We need the C++ compiler only for testing.
57 AC_PROG_CXX
58 # It's useless to us if it can't link programs (e.g. missing -lstdc++).
59 AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
60 AC_LANG_PUSH([C++])
61 # Default, dynamic case.
62 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
63                [libc_cv_cxx_link_ok=yes],
64                [libc_cv_cxx_link_ok=no])
65 # Static case.
66 old_LDFLAGS="$LDFLAGS"
67 LDFLAGS="$LDFLAGS -static"
68 AC_LINK_IFELSE([AC_LANG_SOURCE([
69 #include <iostream>
71 int
72 main()
74   std::cout << "Hello, world!";
75   return 0;
77 ])],
78                [],
79                [libc_cv_cxx_link_ok=no])
80 LDFLAGS="$old_LDFLAGS"
81 AC_LANG_POP([C++])])
82 AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
84 if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
85   AC_MSG_ERROR([you must configure in a separate build directory])
88 # This will get text that should go into config.make.
89 config_vars=
91 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
92 AC_ARG_WITH([gd],
93             AS_HELP_STRING([--with-gd=DIR],
94                            [find libgd include dir and library with prefix DIR]),
95             [dnl
96 case "$with_gd" in
97 yes|''|no) ;;
98 *) libgd_include="-I$withval/include"
99    libgd_ldflags="-L$withval/lib" ;;
100 esac
102 AC_ARG_WITH([gd-include],
103             AS_HELP_STRING([--with-gd-include=DIR],
104                            [find libgd include files in DIR]),
105             [dnl
106 case "$with_gd_include" in
107 ''|no) ;;
108 *) libgd_include="-I$withval" ;;
109 esac
111 AC_ARG_WITH([gd-lib],
112             AS_HELP_STRING([--with-gd-lib=DIR],
113                            [find libgd library files in DIR]),
114             [dnl
115 case "$with_gd_lib" in
116 ''|no) ;;
117 *) libgd_ldflags="-L$withval" ;;
118 esac
121 if test -n "$libgd_include"; then
122   config_vars="$config_vars
123 CFLAGS-memusagestat.c = $libgd_include"
125 if test -n "$libgd_ldflags"; then
126   config_vars="$config_vars
127 libgd-LDFLAGS = $libgd_ldflags"
130 dnl Arguments to specify presence of other packages/features.
131 AC_ARG_WITH([binutils],
132             AS_HELP_STRING([--with-binutils=PATH],
133                            [specify location of binutils (as and ld)]),
134             [path_binutils=$withval],
135             [path_binutils=''])
136 AC_ARG_WITH([selinux],
137             AS_HELP_STRING([--with-selinux],
138                            [if building with SELinux support]),
139             [with_selinux=$withval],
140             [with_selinux=auto])
142 AC_ARG_WITH([headers],
143             AS_HELP_STRING([--with-headers=PATH],
144                            [location of system headers to use
145                             (for example /usr/src/linux/include)
146                             @<:@default=compiler default@:>@]),
147             [sysheaders=$withval],
148             [sysheaders=''])
149 AC_SUBST(sysheaders)
151 AC_SUBST(use_default_link)
152 AC_ARG_WITH([default-link],
153             AS_HELP_STRING([--with-default-link],
154                            [do not use explicit linker scripts]),
155             [use_default_link=$withval],
156             [use_default_link=default])
158 dnl Additional build flags injection.
159 AC_ARG_WITH([nonshared-cflags],
160             AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
161                            [build nonshared libraries with additional CFLAGS]),
162             [extra_nonshared_cflags=$withval],
163             [extra_nonshared_cflags=])
164 AC_SUBST(extra_nonshared_cflags)
166 AC_ARG_WITH([timeoutfactor],
167             AS_HELP_STRING([--with-timeoutfactor=NUM],
168                            [specify an integer to scale the timeout]),
169             [timeoutfactor=$withval],
170             [timeoutfactor=1])
171 AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
173 AC_ARG_ENABLE([sanity-checks],
174               AS_HELP_STRING([--disable-sanity-checks],
175                              [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
176               [enable_sanity=$enableval],
177               [enable_sanity=yes])
179 AC_ARG_ENABLE([shared],
180               AS_HELP_STRING([--enable-shared],
181                              [build shared library @<:@default=yes if GNU ld@:>@]),
182               [shared=$enableval],
183               [shared=yes])
184 AC_ARG_ENABLE([profile],
185               AS_HELP_STRING([--enable-profile],
186                              [build profiled library @<:@default=no@:>@]),
187               [profile=$enableval],
188               [profile=no])
189 AC_ARG_ENABLE([default-pie],
190               AS_HELP_STRING([--disable-default-pie],
191                              [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
192               [default_pie=$enableval],
193               [default_pie=yes])
194 AC_ARG_ENABLE([timezone-tools],
195               AS_HELP_STRING([--disable-timezone-tools],
196                              [do not install timezone tools @<:@default=install@:>@]),
197               [enable_timezone_tools=$enableval],
198               [enable_timezone_tools=yes])
199 AC_SUBST(enable_timezone_tools)
201 AC_ARG_ENABLE([hardcoded-path-in-tests],
202               AS_HELP_STRING([--enable-hardcoded-path-in-tests],
203                              [hardcode newly built glibc path in tests @<:@default=no@:>@]),
204               [hardcoded_path_in_tests=$enableval],
205               [hardcoded_path_in_tests=no])
206 AC_SUBST(hardcoded_path_in_tests)
208 AC_ARG_ENABLE([hidden-plt],
209               AS_HELP_STRING([--disable-hidden-plt],
210                              [do not hide internal function calls to avoid PLT]),
211               [hidden=$enableval],
212               [hidden=yes])
213 if test "x$hidden" = xno; then
214   AC_DEFINE(NO_HIDDEN)
217 AC_ARG_ENABLE([bind-now],
218               AS_HELP_STRING([--enable-bind-now],
219                              [disable lazy relocations in DSOs]),
220               [bindnow=$enableval],
221               [bindnow=no])
222 AC_SUBST(bindnow)
223 if test "x$bindnow" = xyes; then
224   AC_DEFINE(BIND_NOW)
227 dnl Build glibc with -fstack-protector, -fstack-protector-all, or
228 dnl -fstack-protector-strong.
229 AC_ARG_ENABLE([stack-protector],
230               AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
231                              [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
232               [enable_stack_protector=$enableval],
233               [enable_stack_protector=no])
234 case "$enable_stack_protector" in
235 all|yes|no|strong) ;;
236 *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
237 esac
239 dnl On some platforms we cannot use dynamic loading.  We must provide
240 dnl static NSS modules.
241 AC_ARG_ENABLE([static-nss],
242               AS_HELP_STRING([--enable-static-nss],
243                              [build static NSS modules @<:@default=no@:>@]),
244               [static_nss=$enableval],
245               [static_nss=no])
246 dnl Enable static NSS also if we build no shared objects.
247 if test x"$static_nss" = xyes || test x"$shared" = xno; then
248   static_nss=yes
249   AC_DEFINE(DO_STATIC_NSS)
252 AC_ARG_ENABLE([force-install],
253               AS_HELP_STRING([--disable-force-install],
254                              [don't force installation of files from this package, even if they are older than the installed files]),
255               [force_install=$enableval],
256               [force_install=yes])
257 AC_SUBST(force_install)
259 AC_ARG_ENABLE([maintainer-mode],
260               AS_HELP_STRING([--enable-maintainer-mode],
261                              [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
262               [maintainer=$enableval],
263               [maintainer=no])
265 dnl On some platforms we allow dropping compatibility with all kernel
266 dnl versions.
267 AC_ARG_ENABLE([kernel],
268               AS_HELP_STRING([--enable-kernel=VERSION],
269                              [compile for compatibility with kernel not older than VERSION]),
270               [minimum_kernel=$enableval],
271               [])
272 dnl Prevent unreasonable values.
273 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
274   # Better nothing than this.
275   minimum_kernel=""
276 else
277   if test "$minimum_kernel" = current; then
278     minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
279   fi
282 dnl For the development we sometimes want gcc to issue even more warnings.
283 dnl This is not the default since many of the extra warnings are not
284 dnl appropriate.
285 AC_ARG_ENABLE([all-warnings],
286               AS_HELP_STRING([--enable-all-warnings],
287                              [enable all useful warnings gcc can issue]),
288               [all_warnings=$enableval],
289               [])
290 AC_SUBST(all_warnings)
292 AC_ARG_ENABLE([werror],
293               AS_HELP_STRING([--disable-werror],
294                              [do not build with -Werror]),
295               [enable_werror=$enableval],
296               [enable_werror=yes])
297 AC_SUBST(enable_werror)
299 AC_ARG_ENABLE([multi-arch],
300               AS_HELP_STRING([--enable-multi-arch],
301                              [enable single DSO with optimizations for multiple architectures]),
302               [multi_arch=$enableval],
303               [multi_arch=default])
305 AC_ARG_ENABLE([experimental-malloc],
306               AS_HELP_STRING([--disable-experimental-malloc],
307                              [disable experimental malloc features]),
308               [experimental_malloc=$enableval],
309               [experimental_malloc=yes])
310 AC_SUBST(experimental_malloc)
312 AC_ARG_ENABLE([memory-tagging],
313               AS_HELP_STRING([--enable-memory-tagging],
314                              [enable memory tagging if supported by the architecture @<:@default=no@:>@]),
315               [memory_tagging=$enableval],
316               [memory_tagging=no])
317 if test "$memory_tagging" = yes; then
318   # Only enable this on architectures that support it.
319   case $host_cpu in
320     aarch64)
321       AC_DEFINE(USE_MTAG)
322       ;;
323   esac
325 AC_SUBST(memory_tagging)
327 AC_ARG_ENABLE([crypt],
328               AS_HELP_STRING([--disable-crypt],
329                              [do not build nor install the passphrase hashing library, libcrypt]),
330               [build_crypt=$enableval],
331               [build_crypt=yes])
332 AC_SUBST(build_crypt)
334 AC_ARG_ENABLE([nss-crypt],
335               AS_HELP_STRING([--enable-nss-crypt],
336                              [enable libcrypt to use nss]),
337               [nss_crypt=$enableval],
338               [nss_crypt=no])
339 if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then
340   AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled])
341   nss_crypt=no
343 if test x$nss_crypt = xyes; then
344   nss_includes=-I$(nss-config --includedir 2>/dev/null)
345   if test $? -ne 0; then
346     AC_MSG_ERROR([cannot find include directory with nss-config])
347   fi
348   nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
349   if test $? -ne 0; then
350     AC_MSG_ERROR([cannot find include directory with nspr-config])
351   fi
352   old_CFLAGS="$CFLAGS"
353   CFLAGS="$CFLAGS $nss_includes $nspr_includes"
354   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
355 #include <hasht.h>
356 #include <nsslowhash.h>
357 void f (void) { NSSLOW_Init (); }])],
358              libc_cv_nss_crypt=yes,
359              AC_MSG_ERROR([
360 cannot find NSS headers with lowlevel hash function interfaces]))
361   old_LIBS="$LIBS"
362   old_LDFLAGS="$LDFLAGS"
363   LIBS="$LIBS -lfreebl3"
364   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
365 #include <hasht.h>
366 #include <nsslowhash.h>],
367                                   [NSSLOW_Init();])],
368                  libc_cv_nss_crypt=yes,
369                  AC_MSG_ERROR([
370 cannot link program using lowlevel NSS hash functions]))
371   # Check to see if there is a static NSS cryptographic library.
372   # If there isn't then we can't link anything with libcrypt.a,
373   # and that might mean disabling some static tests.
374   LDFLAGS="$LDFLAGS -static"
375   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
376 #include <hasht.h>
377 #include <nsslowhash.h>],
378                                   [NSSLOW_Init();])],
379                  libc_cv_static_nss_crypt=yes,
380                  libc_cv_static_nss_crypt=no)
381   LDFLAGS="$old_LDFLAGS"
382   CFLAGS="$old_CFLAGS"
383   LIBS="$old_LIBS"
384 else
385   libc_cv_nss_crypt=no
386   libc_cv_static_nss_crypt=no
388 AC_SUBST(libc_cv_nss_crypt)
389 AC_SUBST(libc_cv_static_nss_crypt)
392 AC_ARG_ENABLE([systemtap],
393               [AS_HELP_STRING([--enable-systemtap],
394                [enable systemtap static probe points @<:@default=no@:>@])],
395               [systemtap=$enableval],
396               [systemtap=no])
397 if test "x$systemtap" != xno; then
398   AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
399   old_CFLAGS="$CFLAGS"
400   CFLAGS="-std=gnu11 $CFLAGS"
401   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
402 void foo (int i, void *p)
404   asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
405        :: STAP_PROBE_ASM_OPERANDS (2, i, p));
406 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
407   CFLAGS="$old_CFLAGS"])
408   if test $libc_cv_sdt = yes; then
409     AC_DEFINE([USE_STAP_PROBE])
410   elif test "x$systemtap" != xauto; then
411     AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
412   fi
415 AC_ARG_ENABLE([build-nscd],
416               [AS_HELP_STRING([--disable-build-nscd],
417                [disable building and installing the nscd daemon])],
418               [build_nscd=$enableval],
419               [build_nscd=default])
420 AC_SUBST(build_nscd)
422 # Note the use of $use_nscd is near the bottom of the file.
423 AC_ARG_ENABLE([nscd],
424               [AS_HELP_STRING([--disable-nscd],
425                [library functions will not contact the nscd daemon])],
426               [use_nscd=$enableval],
427               [use_nscd=yes])
429 AC_ARG_ENABLE([pt_chown],
430               [AS_HELP_STRING([--enable-pt_chown],
431                [Enable building and installing pt_chown])],
432               [build_pt_chown=$enableval],
433               [build_pt_chown=no])
434 AC_SUBST(build_pt_chown)
435 if test "$build_pt_chown" = yes; then
436   AC_DEFINE(HAVE_PT_CHOWN)
439 AC_ARG_ENABLE([tunables],
440               [AS_HELP_STRING([--enable-tunables],
441                [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
442               [have_tunables=$enableval],
443               [have_tunables=yes])
444 AC_SUBST(have_tunables)
445 if test "$have_tunables" = yes; then
446   AC_DEFINE(HAVE_TUNABLES)
449 # The abi-tags file uses a fairly simplistic model for name recognition that
450 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a
451 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
452 # This doesn't get used much beyond that, so it's fairly safe.
453 case "$host_os" in
454 linux*)
455   ;;
456 gnu*)
457   host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
458   ;;
459 esac
461 AC_ARG_ENABLE([mathvec],
462               [AS_HELP_STRING([--enable-mathvec],
463               [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
464               [build_mathvec=$enableval],
465               [build_mathvec=notset])
467 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
468 #ifndef __CET__
469 # error no CET compiler support
470 #endif]])],
471                [libc_cv_compiler_default_cet=yes],
472                [libc_cv_compiler_default_cet=no])
474 AC_ARG_ENABLE([cet],
475               AS_HELP_STRING([--enable-cet],
476                              [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
477               [enable_cet=$enableval],
478               [enable_cet=$libc_cv_compiler_default_cet])
480 AC_ARG_ENABLE([scv],
481               AC_HELP_STRING([--disable-scv],
482                              [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
483               [use_scv=$enableval],
484               [use_scv=yes])
486 AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
488 # We keep the original values in `$config_*' and never modify them, so we
489 # can write them unchanged into config.make.  Everything else uses
490 # $machine, $vendor, and $os, and changes them whenever convenient.
491 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
493 # Don't allow vendor == "unknown"
494 test "$config_vendor" = unknown && config_vendor=
495 config_os="`echo $config_os | sed 's/^unknown-//'`"
497 # Some configurations imply other options.
498 elf=yes
500 # The configure fragment of a port can modify these to supplement
501 # or override the table in the case statement below.  No fragment should
502 # ever change the config_* variables, however.
503 machine=$config_machine
504 vendor=$config_vendor
505 os=$config_os
506 base_os=''
508 submachine=
509 AC_ARG_WITH([cpu],
510             AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
511             [dnl
512   case "$withval" in
513   yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
514   no) ;;
515   *) submachine="$withval" ;;
516   esac
519 # An preconfigure script can set this when it wants to disable the sanity
520 # check below.
521 libc_config_ok=no
523 # A preconfigure script for a system that may or may not use fpu
524 # sysdeps directories sets this to a preprocessor conditional for
525 # whether to use such directories.
526 with_fp_cond=1
528 dnl Let sysdeps/*/preconfigure act here.
529 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
533 ### By using the undocumented --enable-hacker-mode option for configure
534 ### one can skip this test to make the configuration not fail for unsupported
535 ### platforms.
537 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
538   case "$machine-$host_os" in
539   *-linux* | *-gnu*)
540     ;;
541   *)
542     AC_MSG_ERROR([
543 *** The GNU C library is currently unavailable for this platform.
544 *** If you are interested in seeing glibc on this platform visit
545 *** the "How to submit a new port" in the wiki:
546 ***   https://sourceware.org/glibc/wiki/#Development
547 *** and join the community!])
548     ;;
549   esac
552 # Set base_machine if not set by a preconfigure fragment.
553 test -n "$base_machine" || base_machine=$machine
554 AC_SUBST(base_machine)
556 # Determine whether to use fpu or nofpu sysdeps directories.
557 AC_CACHE_CHECK([for use of fpu sysdeps directories],
558                libc_cv_with_fp, [dnl
559 cat > conftest.c <<EOF
560 #if $with_fp_cond
561 int dummy;
562 #else
563 # error "no hardware floating point"
564 #endif
566 libc_cv_with_fp=no
567 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
568    1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
569   libc_cv_with_fp=yes
571 rm -f conftest*])
572 AC_SUBST(libc_cv_with_fp)
574 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
575 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
576                    [libc_cv_ssp=yes],
577                    [libc_cv_ssp=no])
580 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
581 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
582                    [libc_cv_ssp_strong=yes],
583                    [libc_cv_ssp_strong=no])
586 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
587 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
588                    [libc_cv_ssp_all=yes],
589                    [libc_cv_ssp_all=no])
592 stack_protector=
593 no_stack_protector=
594 if test "$libc_cv_ssp" = yes; then
595   no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
596   AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
599 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
600   stack_protector="-fstack-protector"
601   AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
602 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
603   stack_protector="-fstack-protector-all"
604   AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
605 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
606   stack_protector="-fstack-protector-strong"
607   AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
608 else
609   stack_protector="-fno-stack-protector"
610   AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
612 AC_SUBST(libc_cv_ssp)
613 AC_SUBST(stack_protector)
614 AC_SUBST(no_stack_protector)
616 if test -n "$stack_protector"; then
617   dnl Don't run configure tests with stack-protection on, to avoid problems with
618   dnl bootstrapping.
619   no_ssp=-fno-stack-protector
620 else
621   no_ssp=
623   if test "$enable_stack_protector" != no; then
624     AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
625   fi
628 # For the multi-arch option we need support in the assembler & linker.
629 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
630                libc_cv_ld_gnu_indirect_function, [dnl
631 cat > conftest.S <<EOF
632 .type foo,%gnu_indirect_function
633 foo:
634 .globl _start
635 _start:
636 .globl __start
637 __start:
638 .data
639 #ifdef _LP64
640 .quad foo
641 #else
642 .long foo
643 #endif
645 libc_cv_ld_gnu_indirect_function=no
646 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
647             -nostartfiles -nostdlib $no_ssp \
648             -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
649   # Do a link to see if the backend supports IFUNC relocs.
650   $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
651   LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
652     libc_cv_ld_gnu_indirect_function=yes
653   }
655 rm -f conftest*])
657 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
658 AC_CACHE_CHECK([for gcc attribute ifunc support],
659                libc_cv_gcc_indirect_function, [dnl
660 cat > conftest.c <<EOF
661 extern int func (int);
662 int used_func (int a)
664   return a;
666 static void *resolver ()
668   return &used_func;
670 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
672 libc_cv_gcc_indirect_function=no
673 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
674    2>&AS_MESSAGE_LOG_FD ; then
675   if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
676     libc_cv_gcc_indirect_function=yes
677   fi
679 rm -f conftest*])
681 # Check if linker supports textrel relocation with ifunc (used on elf/tests).
682 # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
683 AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
684                libc_cv_textrel_ifunc, [dnl
685 cat > conftest.S <<EOF
686 .type foo,%gnu_indirect_function
687 foo:
688 .globl _start
689 _start:
690 .globl __start
691 __start:
692 .data
693 #ifdef _LP64
694 .quad foo
695 #else
696 .long foo
697 #endif
698 .text
699 .globl address
700 address:
701 #ifdef _LP64
702 .quad address
703 #else
704 .long address
705 #endif
707 libc_cv_textrel_ifunc=no
708 if test $libc_cv_ld_gnu_indirect_function = yes; then
709    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
710      libc_cv_textrel_ifunc=yes
711    fi
713 rm -f conftest*])
714 AC_SUBST(libc_cv_textrel_ifunc)
716 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
717 AC_CACHE_CHECK([for GNU attribute retain support],
718                libc_cv_gnu_retain, [dnl
719 cat > conftest.c <<EOF
720 static int var  __attribute__ ((used, retain, section ("__libc_atexit")));
722 libc_cv_gnu_retain=no
723 if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
724    2>&AS_MESSAGE_LOG_FD ; then
725   libc_cv_gnu_retain=yes
727 rm -f conftest*])
728 if test $libc_cv_gnu_retain = yes; then
729   AC_DEFINE(HAVE_GNU_RETAIN)
731 LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
733 # Check if gcc warns about alias for function with incompatible types.
734 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
735                libc_cv_gcc_incompatible_alias, [dnl
736 cat > conftest.c <<EOF
737 int __redirect_foo (const void *s, int c);
739 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
740 __typeof (__redirect_foo) *foo_impl (void)
742   return 0;
745 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
747 libc_cv_gcc_incompatible_alias=yes
748 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
749   libc_cv_gcc_incompatible_alias=no
751 rm -f conftest*])
753 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
754   if test x"$multi_arch" = xyes; then
755     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
756   else
757     multi_arch=no
758   fi
760 if test x"$libc_cv_gcc_indirect_function" != xyes; then
761   # GCC 8+ emits a warning for alias with incompatible types and it might
762   # fail to build ifunc resolvers aliases to either weak or internal
763   # symbols.  Disables multiarch build in this case.
764   if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
765     AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
766     if test x"$multi_arch" = xyes; then
767       AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
768     fi
769     AC_MSG_WARN([Multi-arch is disabled.])
770     multi_arch=no
771   elif test x"$multi_arch" = xyes; then
772     AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
773 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
774   fi
776 multi_arch_d=
777 if test x"$multi_arch" != xno; then
778   multi_arch_d=/multiarch
781 # Compute the list of sysdep directories for this configuration.
782 # This can take a while to compute.
783 sysdep_dir=$srcdir/sysdeps
784 AC_MSG_CHECKING(sysdep dirs)
785 dnl We need to use [ and ] for other purposes for a while now.
786 changequote(,)dnl
787 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
788 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
790 test "x$base_os" != x || case "$os" in
791 gnu*)
792   base_os=mach/hurd ;;
793 linux*)
794   base_os=unix/sysv ;;
795 esac
797 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
798 tail=$os
799 ostry=$os
800 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
801   ostry="$ostry /$o"
802   tail=$o
803 done
804 o=`echo $tail | sed 's/[0-9]*$//'`
805 if test $o != $tail; then
806   ostry="$ostry /$o"
808 # For linux-gnu, try linux-gnu, then linux.
809 o=`echo $tail | sed 's/-.*$//'`
810 if test $o != $tail; then
811   ostry="$ostry /$o"
814 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
815 base=
816 tail=$base_os
817 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
818   set $b
819   base="$base /$1"
820   tail="$2"
821 done
823 # For sparc/sparc32, try sparc/sparc32 and then sparc.
824 mach=
825 tail=$machine${submachine:+/$submachine}
826 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
827   set $m
828   # Prepend the machine's FPU directory unless the architecture specific
829   # preconfigure disables it.
830   if test "$libc_cv_with_fp" = yes; then
831     maybe_fpu=/fpu
832   else
833     maybe_fpu=/nofpu
834   fi
835   # For each machine term, try it with and then without /multiarch.
836   for try_fpu in $maybe_fpu ''; do
837     for try_multi in $multi_arch_d ''; do
838       mach="$mach /$1$try_fpu$try_multi"
839     done
840   done
841   tail="$2"
842 done
844 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
845 changequote([,])dnl
847 # Find what sysdep directories exist.
848 sysnames=
849 for b in $base ''; do
850   for m0 in $mach ''; do
851     for v in /$vendor ''; do
852       test "$v" = / && continue
853       for o in /$ostry ''; do
854         test "$o" = / && continue
855         for m in $mach ''; do
856           try_suffix="$m0$b$v$o$m"
857           if test -n "$try_suffix"; then
858             try_srcdir="${srcdir}/"
859             try="sysdeps$try_suffix"
860             test -n "$enable_debug_configure" &&
861             echo "$0 [DEBUG]: try $try" >&2
862             if test -d "$try_srcdir$try"; then
863               sysnames="$sysnames $try"
864               { test -n "$o" || test -n "$b"; } && os_used=t
865               { test -n "$m" || test -n "$m0"; } && machine_used=t
866               case x${m0:-$m} in
867               x*/$submachine) submachine_used=t ;;
868               esac
869             fi
870           fi
871         done
872       done
873     done
874   done
875 done
877 # If the assembler supports gnu_indirect_function symbol type and the
878 # architecture supports multi-arch, we enable multi-arch by default.
879 case $sysnames in
880 *"$multi_arch_d"*)
881   ;;
883   test x"$multi_arch" = xdefault && multi_arch=no
884   ;;
885 esac
886 if test x"$multi_arch" != xno; then
887   AC_DEFINE(USE_MULTIARCH)
889 AC_SUBST(multi_arch)
891 if test -z "$os_used" && test "$os" != none; then
892   AC_MSG_ERROR(Operating system $os is not supported.)
894 if test -z "$machine_used" && test "$machine" != none; then
895   AC_MSG_ERROR(The $machine is not supported.)
897 if test -z "$submachine_used" && test -n "$submachine"; then
898   AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
900 AC_SUBST(submachine)
902 # We have now validated the configuration.
904 # Expand the list of system names into a full list of directories
905 # from each element's parent name and Implies file (if present).
906 set $sysnames
907 names=
908 while test $# -gt 0; do
909   name=$1
910   shift
912   case " $names " in *" $name "*)
913     # Already in the list.
914     continue
915   esac
917   # Report each name as we discover it, so there is no long pause in output.
918   echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
920   name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
922   case $name in
923     /*) xsrcdir= ;;
924     *)  xsrcdir=$srcdir/ ;;
925   esac
926   test -n "$enable_debug_configure" &&
927   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
929   for implies_file in Implies Implies-before Implies-after; do
930     implies_type=`echo $implies_file | sed s/-/_/`
931     eval ${implies_type}=
932     if test -f $xsrcdir$name/$implies_file; then
933       # Collect more names from the `Implies' file (removing comments).
934       implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
935       for x in $implied_candidate; do
936         found=no
937         if test -d $xsrcdir$name_base/$x; then
938           eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
939           found=yes
940         fi
941         try="sysdeps/$x"
942         try_srcdir=$srcdir/
943         test -n "$enable_debug_configure" &&
944          echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
945         if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
946         then
947           eval "${implies_type}=\"\$${implies_type} \$try\""
948           found=yes
949         fi
950         if test $found = no; then
951           AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
952         fi
953       done
954     fi
955   done
957   # Add NAME to the list of names.
958   names="$names $name"
960   # Find the parent of NAME, using the empty string if it has none.
961 changequote(,)dnl
962   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
963 changequote([,])dnl
965   test -n "$enable_debug_configure" &&
966     echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
967 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
969   # Add the names implied by NAME, and NAME's parent (if it has one), to
970   # the list of names to be processed (the argument list).  We prepend the
971   # implied names to the list and append the parent.  We want implied
972   # directories to come before further directories inferred from the
973   # configuration components; this ensures that for sysv4, unix/common
974   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
975   # after sysv4).
976   sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
977   test -n "$sysnames" && set $sysnames
978 done
980 # Add the default directories.
981 default_sysnames="sysdeps/generic"
982 sysnames="$names $default_sysnames"
983 AC_SUBST(sysnames)
984 # The other names were emitted during the scan.
985 AC_MSG_RESULT($default_sysnames)
988 ### Locate tools.
990 AC_PROG_INSTALL
991 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
992   # The makefiles need to use a different form to find it in $srcdir.
993   INSTALL='\$(..)./scripts/install-sh -c'
995 AC_PROG_LN_S
997 LIBC_PROG_BINUTILS
999 # Accept binutils 2.25 or newer.
1000 AC_CHECK_PROG_VER(AS, $AS, --version,
1001                   [GNU assembler.* \([0-9]*\.[0-9.]*\)],
1002                   [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
1003                   AS=: critic_missing="$critic_missing as")
1005 libc_cv_with_lld=no
1006 case $($LD --version) in
1007   "GNU gold"*)
1008   # Accept gold 1.14 or higher
1009     AC_CHECK_PROG_VER(LD, $LD, --version,
1010                     [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
1011                     [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
1012                     LD=: critic_missing="$critic_missing GNU gold")
1013     ;;
1014   "LLD"*)
1015   # Accept LLD 13.0.0 or higher
1016     AC_CHECK_PROG_VER(LD, $LD, --version,
1017                     [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
1018                     [1[3-9].*|[2-9][0-9].*],
1019                     LD=: critic_missing="$critic_missing LLD")
1020     libc_cv_with_lld=yes
1021     ;;
1022   *)
1023     AC_CHECK_PROG_VER(LD, $LD, --version,
1024                     [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
1025                     [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
1026                     LD=: critic_missing="$critic_missing GNU ld")
1027     ;;
1028 esac
1029 LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
1031 # These programs are version sensitive.
1032 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
1033   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
1034   [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
1036 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
1037   [GNU gettext.* \([0-9]*\.[0-9.]*\)],
1038   [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
1039   MSGFMT=: aux_missing="$aux_missing msgfmt")
1040 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
1041   [GNU texinfo.* \([0-9][0-9.]*\)],
1042   [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
1043   MAKEINFO=: aux_missing="$aux_missing makeinfo")
1044 AC_CHECK_PROG_VER(SED, sed, --version,
1045   [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
1046   [3.0[2-9]*|3.[1-9]*|[4-9]*],
1047   SED=: aux_missing="$aux_missing sed")
1048 AC_CHECK_PROG_VER(AWK, gawk, --version,
1049   [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
1050   [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
1051 AC_CHECK_PROG_VER(BISON, bison, --version,
1052   [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
1053   [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
1055 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
1056 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
1057 #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
1058 #error insufficient compiler
1059 #endif]])],
1060                [libc_cv_compiler_ok=yes],
1061                [libc_cv_compiler_ok=no])])
1062 AS_IF([test $libc_cv_compiler_ok != yes],
1063       [critic_missing="$critic_missing compiler"])
1065 AC_CHECK_TOOL(NM, nm, false)
1067 if test "x$maintainer" = "xyes"; then
1068   AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1069   case "x$AUTOCONF" in
1070   xno|x|x:) AUTOCONF=no ;;
1071   *)
1072     AC_CACHE_CHECK(dnl
1073   whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
1074     if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
1075       libc_cv_autoconf_works=yes
1076     else
1077       libc_cv_autoconf_works=no
1078     fi])
1079     test $libc_cv_autoconf_works = yes || AUTOCONF=no
1080     ;;
1081   esac
1082   if test "x$AUTOCONF" = xno; then
1083     aux_missing="$aux_missing autoconf"
1084   fi
1085 else
1086   AUTOCONF=no
1089 # Check for python3 if available, or else python.
1090 AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
1091   [Python \([0-9][0-9.]*\)],
1092   [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
1093   critic_missing="$critic_missing python")
1094 PYTHON="$PYTHON_PROG -B"
1095 AC_SUBST(PYTHON)
1097 test -n "$critic_missing" && AC_MSG_ERROR([
1098 *** These critical programs are missing or too old:$critic_missing
1099 *** Check the INSTALL file for required versions.])
1101 test -n "$aux_missing" && AC_MSG_WARN([
1102 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1103 *** some features or tests will be disabled.
1104 *** Check the INSTALL file for required versions.])
1106 # if using special system headers, find out the compiler's sekrit
1107 # header directory and add that to the list.  NOTE: Only does the right
1108 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
1109 if test -n "$sysheaders"; then
1110   SYSINCLUDES=-nostdinc
1111   for d in include include-fixed; do
1112     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1113     SYSINCLUDES="$SYSINCLUDES -isystem $i"
1114   done
1115   SYSINCLUDES="$SYSINCLUDES \
1116 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1117   if test -n "$CXX"; then
1118     CXX_SYSINCLUDES=
1119     for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1120     | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1121       test "x$cxxheaders" != x &&
1122       CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1123     done
1124   fi
1126 AC_SUBST(SYSINCLUDES)
1127 AC_SUBST(CXX_SYSINCLUDES)
1129 # Obtain some C++ header file paths.  This is used to make a local
1130 # copy of those headers in Makerules.
1131 if test -n "$CXX"; then
1132   find_cxx_header () {
1133     echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
1134          | sed -n "\,$1:,{s/:\$//;p}"
1135   }
1136   CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1137   CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1138   CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1140 AC_SUBST(CXX_CSTDLIB_HEADER)
1141 AC_SUBST(CXX_CMATH_HEADER)
1142 AC_SUBST(CXX_BITS_STD_ABS_H)
1144 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1145 # since this would lead to problems installing/building glibc.
1146 # LD_LIBRARY_PATH contains the current directory if one of the following
1147 # is true:
1148 # - one of the terminals (":" and ";") is the first or last sign
1149 # - two terminals occur directly after each other
1150 # - the path contains an element with a dot in it
1151 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1152 changequote(,)dnl
1153 case ${LD_LIBRARY_PATH} in
1154   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1155     ld_library_path_setting="contains current directory"
1156     ;;
1157   *)
1158     ld_library_path_setting="ok"
1159     ;;
1160 esac
1161 changequote([,])dnl
1162 AC_MSG_RESULT($ld_library_path_setting)
1163 if test "$ld_library_path_setting" != "ok"; then
1164 AC_MSG_ERROR([
1165 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1166 *** building glibc. Please change the environment variable
1167 *** and run configure again.])
1170 AC_PATH_PROG(BASH_SHELL, bash, no)
1172 AC_PATH_PROG(PERL, perl, no)
1173 if test "$PERL" != no &&
1174    (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1175   PERL=no
1177 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1178              $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1180 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1181 cat > conftest.s <<EOF
1182 .text
1183 foo:
1184 .set glibc_conftest_frobozz,foo
1185 .globl glibc_conftest_frobozz
1187 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1188 # (but it doesn't work), so we must do a linking check to be sure.
1189 cat > conftest1.c <<\EOF
1190 extern int glibc_conftest_frobozz;
1191 void _start() { glibc_conftest_frobozz = 1; }
1193 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1194             -nostartfiles -nostdlib $no_ssp \
1195             -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1196   libc_cv_asm_set_directive=yes
1197 else
1198   libc_cv_asm_set_directive=no
1200 rm -f conftest*])
1201 if test $libc_cv_asm_set_directive = yes; then
1202   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1205 AC_CACHE_CHECK(linker support for protected data symbol,
1206                libc_cv_protected_data,
1207                [cat > conftest.c <<EOF
1208                 int bar __attribute__ ((visibility ("protected"))) = 1;
1210                 libc_cv_protected_data=no
1211                 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1212                   cat > conftest.c <<EOF
1213                   extern int bar;
1214                   int main (void) { return bar; }
1216                   if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1217                     libc_cv_protected_data=yes
1218                   fi
1219                 fi
1220                 rm -f conftest.*
1221                ])
1222 AC_SUBST(libc_cv_protected_data)
1224 AC_CACHE_CHECK(linker support for INSERT in linker script,
1225                libc_cv_insert,
1226                [cat > conftest.c <<EOF
1227                 int __attribute__ ((section(".bar"))) bar = 0x12345678;
1228                 int test (void) { return bar; }
1230                 cat > conftest.t <<EOF
1231                 SECTIONS
1232                 {
1233                   .bar : { *(.bar) }
1234                 }
1235                 INSERT AFTER .rela.dyn;
1237                 libc_cv_insert=no
1238                 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1239                   libc_cv_insert=yes
1240                 fi
1241                 rm -f conftest.*
1242                ])
1243 AC_SUBST(libc_cv_insert)
1245 AC_CACHE_CHECK(for broken __attribute__((alias())),
1246                libc_cv_broken_alias_attribute,
1247                [cat > conftest.c <<EOF
1248                extern int foo (int x) __asm ("xyzzy");
1249                int bar (int x) { return x; }
1250                extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1251                extern int dfoo;
1252                extern __typeof (dfoo) dfoo __asm ("abccb");
1253                int dfoo = 1;
1255                libc_cv_broken_alias_attribute=yes
1256                if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1257                  if grep 'xyzzy' conftest.s >/dev/null &&
1258                     grep 'abccb' conftest.s >/dev/null; then
1259                    libc_cv_broken_alias_attribute=no
1260                  fi
1261                fi
1262                rm -f conftest.c conftest.s
1263                ])
1264 if test $libc_cv_broken_alias_attribute = yes; then
1265   AC_MSG_ERROR(working alias attribute support required)
1268 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1269                libc_cv_have_sdata_section,
1270                [echo "int i;" > conftest.c
1271                 libc_cv_have_sdata_section=no
1272                 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1273                    | grep '\.sdata' >/dev/null; then
1274                   libc_cv_have_sdata_section=yes
1275                 fi
1276                 rm -f conftest.c conftest.so
1277                ])
1278 if test $libc_cv_have_sdata_section = yes; then
1279   AC_DEFINE(HAVE_SDATA_SECTION)
1282 AC_CACHE_CHECK(for libunwind-support in compiler,
1283                libc_cv_cc_with_libunwind, [
1284   cat > conftest.c <<EOF
1285 int main (void) { return 0; }
1287   if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1288      conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1289     libc_cv_cc_with_libunwind=yes
1290   else
1291     libc_cv_cc_with_libunwind=no
1292   fi
1293   rm -f conftest*])
1294 AC_SUBST(libc_cv_cc_with_libunwind)
1295 if test $libc_cv_cc_with_libunwind = yes; then
1296   AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1299 ASFLAGS_config=
1300 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1301                libc_cv_as_noexecstack, [dnl
1302 cat > conftest.c <<EOF
1303 void foo (void) { }
1305 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1306                    -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1307    && grep .note.GNU-stack conftest.s >/dev/null \
1308    && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1309                       -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1310 then
1311   libc_cv_as_noexecstack=yes
1312 else
1313   libc_cv_as_noexecstack=no
1315 rm -f conftest*])
1316 if test $libc_cv_as_noexecstack = yes; then
1317   ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1319 AC_SUBST(ASFLAGS_config)
1321 AC_CACHE_CHECK(for -z combreloc,
1322                libc_cv_z_combreloc, [dnl
1323 cat > conftest.c <<EOF
1324 extern int bar (int);
1325 extern int mumble;
1326 int foo (void) { return bar (mumble); }
1328 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1329                         -fPIC -shared $no_ssp -o conftest.so conftest.c
1330                         -nostdlib -nostartfiles
1331                         -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1332 then
1333 dnl The following test is a bit weak.  We must use a tool which can test
1334 dnl cross-platform since the gcc used can be a cross compiler.  Without
1335 dnl introducing new options this is not easily doable.  Instead use a tool
1336 dnl which always is cross-platform: readelf.  To detect whether -z combreloc
1337 dnl look for a section named .rel.dyn or .rela.dyn.
1338   if $READELF -S conftest.so | grep -E '.rela?.dyn' > /dev/null; then
1339     libc_cv_z_combreloc=yes
1340   else
1341     libc_cv_z_combreloc=no
1342   fi
1343 else
1344   libc_cv_z_combreloc=no
1346 rm -f conftest*])
1347 if test "$libc_cv_z_combreloc" = yes; then
1348   AC_DEFINE(HAVE_Z_COMBRELOC)
1350 AC_SUBST(libc_cv_z_combreloc)
1352 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1353                     [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1354 AC_SUBST(libc_cv_z_execstack)
1356 LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
1357                     [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
1358 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
1360 LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
1361                     [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
1362 LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
1364 LIBC_LINKER_FEATURE([--no-dynamic-linker],
1365                     [-Wl,--no-dynamic-linker],
1366                     [libc_cv_no_dynamic_linker=yes],
1367                     [libc_cv_no_dynamic_linker=no])
1368 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
1370 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
1371 LIBC_TRY_CC_OPTION([-static-pie],
1372                    [libc_cv_static_pie=yes],
1373                    [libc_cv_static_pie=no])
1375 LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
1377 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1378 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1381 AC_SUBST(libc_cv_fpie)
1383 AC_CACHE_CHECK(for --hash-style option,
1384                libc_cv_hashstyle, [dnl
1385 cat > conftest.c <<EOF
1386 int _start (void) { return 42; }
1388 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
1389                             -fPIC -shared -o conftest.so conftest.c
1390                             -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1391 then
1392   libc_cv_hashstyle=yes
1393 else
1394   libc_cv_hashstyle=no
1396 rm -f conftest*])
1397 AC_SUBST(libc_cv_hashstyle)
1399 # The linker's default -shared behavior is good enough if it
1400 # does these things that our custom linker scripts ensure that
1401 # all allocated NOTE sections come first.
1402 if test "$use_default_link" = default; then
1403   AC_CACHE_CHECK([for sufficient default -shared layout],
1404                   libc_cv_use_default_link, [dnl
1405   libc_cv_use_default_link=no
1406   cat > conftest.s <<\EOF
1407           .section .note.a,"a",%note
1408           .balign 4
1409           .long 4,4,9
1410           .string "GNU"
1411           .string "foo"
1412           .section .note.b,"a",%note
1413           .balign 4
1414           .long 4,4,9
1415           .string "GNU"
1416           .string "bar"
1418   if AC_TRY_COMMAND([dnl
1419   ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1420        ac_try=`$READELF -S conftest.so | sed -n \
1421          ['${x;p;}
1422           s/^ *\[ *[1-9][0-9]*\]  *\([^ ][^ ]*\)  *\([^ ][^ ]*\) .*$/\2 \1/
1423           t a
1424           b
1425           : a
1426           H']`
1427   then
1428     libc_seen_a=no libc_seen_b=no
1429     set -- $ac_try
1430     while test $# -ge 2 -a "$1" = NOTE; do
1431       case "$2" in
1432       .note.a) libc_seen_a=yes ;;
1433       .note.b) libc_seen_b=yes ;;
1434       esac
1435       shift 2
1436     done
1437     case "$libc_seen_a$libc_seen_b" in
1438     yesyes)
1439       libc_cv_use_default_link=yes
1440       ;;
1441     *)
1442       echo >&AS_MESSAGE_LOG_FD "\
1443 $libc_seen_a$libc_seen_b from:
1444 $ac_try"
1445       ;;
1446     esac
1447   fi
1448   rm -f conftest*])
1449   use_default_link=$libc_cv_use_default_link
1452 AC_CACHE_CHECK(for GLOB_DAT reloc,
1453                libc_cv_has_glob_dat, [dnl
1454 cat > conftest.c <<EOF
1455 extern int mumble;
1456 int foo (void) { return mumble; }
1458 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1459                         -fPIC -shared -o conftest.so conftest.c
1460                         -nostdlib -nostartfiles $no_ssp
1461                         1>&AS_MESSAGE_LOG_FD])
1462 then
1463 dnl look for GLOB_DAT relocation.
1464   if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1465     libc_cv_has_glob_dat=yes
1466   else
1467     libc_cv_has_glob_dat=no
1468   fi
1469 else
1470   libc_cv_has_glob_dat=no
1472 rm -f conftest*])
1473 AC_SUBST(libc_cv_has_glob_dat)
1475 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1476 cat > conftest.c <<EOF
1477 int foo;
1479 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1480                             conftest.c 1>&AS_MESSAGE_LOG_FD])
1481 then
1482   libc_cv_fno_toplevel_reorder=yes
1483 else
1484   libc_cv_fno_toplevel_reorder=no
1486 rm -f conftest*])
1487 if test $libc_cv_fno_toplevel_reorder = yes; then
1488   fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1489 else
1490   fno_unit_at_a_time=-fno-unit-at-a-time
1492 AC_SUBST(fno_unit_at_a_time)
1494 AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
1495 [dnl
1496 cat > conftest.c <<EOF
1497 __thread int i;
1498 void foo (void)
1500   i = 10;
1503 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
1504                    conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
1505 then
1506   libc_cv_mtls_dialect_gnu2=yes
1507 else
1508   libc_cv_mtls_dialect_gnu2=no
1510 rm -f conftest*])
1511 AC_SUBST(libc_cv_mtls_dialect_gnu2)
1512 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
1514 AC_CACHE_CHECK(whether cc puts quotes around section names,
1515                libc_cv_have_section_quotes,
1516                [cat > conftest.c <<EOF
1517                 static const int foo
1518                 __attribute__ ((section ("bar"))) = 1;
1520                 if ${CC-cc} -S conftest.c -o conftest.s; then
1521                   if grep '\.section.*"bar"' conftest.s >/dev/null; then
1522                     libc_cv_have_section_quotes=yes
1523                   else
1524                     libc_cv_have_section_quotes=no
1525                   fi
1526                 else
1527                   libc_cv_have_section_quotes=unknown
1528                 fi
1529                 rm -f conftest.{c,s}
1530                 ])
1531 if test $libc_cv_have_section_quotes = yes; then
1532   AC_DEFINE(HAVE_SECTION_QUOTES)
1535 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1536 cat > conftest.c <<\EOF
1537 void zero (void *x)
1539   __builtin_memset (x, 0, 1000);
1543 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1544 then
1545   libc_cv_gcc_builtin_memset=no
1546 else
1547   libc_cv_gcc_builtin_memset=yes
1549 rm -f conftest* ])
1550 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1551   AC_DEFINE(HAVE_BUILTIN_MEMSET)
1554 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1555 cat > conftest.c <<\EOF
1556 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1557 char *foo (const char *a, const char *b)
1559   return __builtin_strstr (a, b);
1563 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
1564 then
1565   libc_cv_gcc_builtin_redirection=yes
1566 else
1567   libc_cv_gcc_builtin_redirection=no
1569 rm -f conftest* ])
1570 if test "$libc_cv_gcc_builtin_redirection" = no; then
1571   AC_MSG_ERROR([support for the symbol redirection needed])
1574 dnl Determine how to disable generation of FMA instructions.
1575 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1576                libc_cv_cc_nofma, [dnl
1577 libc_cv_cc_nofma=
1578 for opt in -ffp-contract=off -mno-fused-madd; do
1579   LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1580 done])
1581 AC_SUBST(libc_cv_cc_nofma)
1583 if test -n "$submachine"; then
1584   AC_CACHE_CHECK([for compiler option for CPU variant],
1585                  libc_cv_cc_submachine, [dnl
1586   libc_cv_cc_submachine=no
1587   for opt in "-march=$submachine" "-mcpu=$submachine"; do
1588     LIBC_TRY_CC_OPTION([$opt], [
1589       libc_cv_cc_submachine="$opt"
1590       break], [])
1591   done])
1592   if test "x$libc_cv_cc_submachine" = xno; then
1593     AC_MSG_ERROR([${CC-cc} does not support $submachine])
1594   fi
1596 AC_SUBST(libc_cv_cc_submachine)
1598 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1599 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1600 cat > conftest.c <<EOF
1601 void
1602 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1603 foo (void) {}
1605 libc_cv_cc_loop_to_function=no
1606 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1607 then
1608   libc_cv_cc_loop_to_function=yes
1610 rm -f conftest*])
1611 if test $libc_cv_cc_loop_to_function = yes; then
1612   AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1614 AC_SUBST(libc_cv_cc_loop_to_function)
1616 dnl Check whether we have the gd library available.
1617 AC_MSG_CHECKING(for libgd)
1618 if test "$with_gd" != "no"; then
1619   old_CFLAGS="$CFLAGS"
1620   CFLAGS="$CFLAGS $libgd_include"
1621   old_LDFLAGS="$LDFLAGS"
1622   LDFLAGS="$LDFLAGS $libgd_ldflags"
1623   old_LIBS="$LIBS"
1624   LIBS="$LIBS -lgd -lpng -lz -lm"
1625   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
1626                  [LIBGD=yes], [LIBGD=no])
1627   CFLAGS="$old_CFLAGS"
1628   LDFLAGS="$old_LDFLAGS"
1629   LIBS="$old_LIBS"
1630 else
1631   LIBGD=no
1633 AC_MSG_RESULT($LIBGD)
1634 AC_SUBST(LIBGD)
1636 # SELinux detection
1637 if test x$with_selinux = xno ; then
1638   have_selinux=no;
1639 else
1640   # See if we have the SELinux library
1641   AC_CHECK_LIB(selinux, is_selinux_enabled,
1642                have_selinux=yes, have_selinux=no)
1643   if test x$with_selinux = xyes ; then
1644     if test x$have_selinux = xno ; then
1645       AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1646     fi
1647   fi
1649 # Check if we're building with SELinux support.
1650 if test "x$have_selinux" = xyes; then
1651   AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1653   # See if we have the libaudit library
1654   AC_CHECK_LIB(audit, audit_log_user_avc_message,
1655                have_libaudit=yes, have_libaudit=no)
1656   if test "x$have_libaudit" = xyes; then
1657     AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1658   fi
1659   AC_SUBST(have_libaudit)
1661   # See if we have the libcap library
1662   AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1663   if test "x$have_libcap" = xyes; then
1664     AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1665   fi
1666   AC_SUBST(have_libcap)
1668 AC_SUBST(have_selinux)
1670 CPPUNDEFS=
1671 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1672 dnl Since we are building the implementations of the fortified functions here,
1673 dnl having the macro defined interacts very badly.
1674 dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
1675 dnl and above (see "man FEATURE_TEST_MACROS").
1676 dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
1677 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1678 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1679 #ifdef _FORTIFY_SOURCE
1680 # error bogon
1681 #endif]])],
1682                 [libc_cv_predef_fortify_source=no],
1683                 [libc_cv_predef_fortify_source=yes])])
1684 if test $libc_cv_predef_fortify_source = yes; then
1685   CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1687 AC_SUBST(CPPUNDEFS)
1689 dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
1690 dnl to one symbol (PR 23840).
1691 AC_CACHE_CHECK(whether the assembler requires one version per symbol,
1692                libc_cv_symver_needs_alias, [dnl
1693   cat > conftest.s <<EOF
1694         .text
1695 testfunc:
1696         .globl testfunc
1697         .symver testfunc, testfunc1@VERSION1
1698         .symver testfunc, testfunc1@VERSION2
1700   libc_cv_symver_needs_alias=no
1701   if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
1702     libc_cv_symver_needs_alias=no
1703   else
1704     libc_cv_symver_needs_alias=yes
1705   fi
1706   rm conftest.*
1708 if test "$libc_cv_symver_needs_alias" = yes; then
1709   AC_DEFINE(SYMVER_NEEDS_ALIAS)
1712 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1713                libc_cv_builtin_trap, [dnl
1714 libc_cv_builtin_trap=no
1715 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
1716 libc_undefs=`$NM -u conftest.o |
1717   LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1718     2>&AS_MESSAGE_LOG_FD` || {
1719   AC_MSG_ERROR([confusing output from $NM -u])
1721 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1722 if test -z "$libc_undefs"; then
1723   libc_cv_builtin_trap=yes
1724 fi],[])])
1725 if test $libc_cv_builtin_trap = yes; then
1726   AC_DEFINE([HAVE_BUILTIN_TRAP])
1729 dnl C++ feature tests.
1730 AC_LANG_PUSH([C++])
1732 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1733                libc_cv_cxx_thread_local, [
1734 old_CXXFLAGS="$CXXFLAGS"
1735 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1736 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1737 #include <thread>
1739 // Compiler support.
1740 struct S
1742   S ();
1743   ~S ();
1745 thread_local S s;
1746 S * get () { return &s; }
1748 // libstdc++ support.
1749 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1750 #error __cxa_thread_atexit_impl not supported
1751 #endif
1752 ])],
1753                [libc_cv_cxx_thread_local=yes],
1754                [libc_cv_cxx_thread_local=no])
1755 CXXFLAGS="$old_CXXFLAGS"
1757 AC_SUBST(libc_cv_cxx_thread_local)
1759 AC_LANG_POP([C++])
1760 dnl End of C++ feature tests.
1762 ### End of automated tests.
1763 ### Now run sysdeps configure fragments.
1765 # They also can set these variables.
1766 use_ldconfig=no
1767 ldd_rewrite_script=no
1768 libc_cv_sysconfdir=$sysconfdir
1769 libc_cv_localstatedir=$localstatedir
1770 libc_cv_gcc_unwind_find_fde=no
1771 libc_cv_idn=no
1772 pthread_in_libc=yes
1774 # Iterate over all the sysdep directories we will use, running their
1775 # configure fragments.
1776 for dir in $sysnames; do
1777   case $dir in
1778     /*) dest=$dir ;;
1779     *)  dest=$srcdir/$dir ;;
1780   esac
1781   if test -r $dest/configure; then
1782     AC_MSG_RESULT(running configure fragment for $dir)
1783     . $dest/configure
1784   fi
1785 done
1787 if test x"$build_mathvec" = xnotset; then
1788   build_mathvec=no
1790 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1792 AC_SUBST(libc_extra_cflags)
1793 AC_SUBST(libc_extra_cppflags)
1795 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1796   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1798 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1800 # A sysdeps configure fragment can reset this if IFUNC is not actually
1801 # usable even though the assembler knows how to generate the symbol type.
1802 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1803   AC_DEFINE(HAVE_IFUNC)
1805 LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
1807 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1808   AC_DEFINE(HAVE_GCC_IFUNC)
1810 LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
1812 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1813 # configure fragment can override the value to prevent this AC_DEFINE.
1814 AC_SUBST(use_nscd)
1815 if test "x$use_nscd" != xno; then
1816   AC_DEFINE([USE_NSCD])
1818 if test "x$build_nscd" = xdefault; then
1819   build_nscd=$use_nscd
1822 AC_SUBST(libc_cv_slibdir)
1823 AC_SUBST(libc_cv_rtlddir)
1824 AC_SUBST(libc_cv_complocaledir)
1825 AC_SUBST(libc_cv_sysconfdir)
1826 AC_SUBST(libc_cv_localstatedir)
1827 AC_SUBST(libc_cv_rootsbindir)
1829 if test x$use_ldconfig = xyes; then
1830   AC_DEFINE(USE_LDCONFIG)
1832 AC_SUBST(use_ldconfig)
1833 AC_SUBST(ldd_rewrite_script)
1835 AC_SUBST(static)
1836 AC_SUBST(shared)
1838 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1839 [libc_cv_pic_default=yes
1840 cat > conftest.c <<EOF
1841 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1842 # error PIC is default.
1843 #endif
1845 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1846   libc_cv_pic_default=no
1848 rm -f conftest.*])
1849 LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
1851 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
1852 [libc_cv_cc_pie_default=yes
1853 cat > conftest.c <<EOF
1854 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1855 # error PIE is default.
1856 #endif
1858 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1859   libc_cv_cc_pie_default=no
1861 rm -f conftest.*])
1862 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
1864 AC_MSG_CHECKING(if we can build programs as PIE)
1865 if test "x$default_pie" != xno; then
1866   # Disable build-pie-default if target does not support it.
1867   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
1868 # error PIE is not supported
1869 #endif]])], [libc_cv_pie_default=yes], [libc_cv_pie_default=no])
1871 AC_MSG_RESULT($libc_cv_pie_default)
1872 LIBC_CONFIG_VAR([build-pie-default], [$libc_cv_pie_default])
1874 AC_MSG_CHECKING(if we can build static PIE programs)
1875 libc_cv_static_pie=$libc_cv_pie_default
1876 if test "x$libc_cv_pie_default" != xno \
1877    -a "$libc_cv_no_dynamic_linker" = yes; then
1878   # Enable static-pie if available
1879   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
1880 # error static PIE is not supported
1881 #endif]])], [libc_cv_static_pie=yes], [libc_cv_static_pie=no])
1882   if test "$libc_cv_static_pie" = "yes"; then
1883     AC_DEFINE(ENABLE_STATIC_PIE)
1884   fi
1886 AC_MSG_RESULT($libc_cv_static_pie)
1887 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
1889 # Set the `multidir' variable by grabbing the variable from the compiler.
1890 # We do it once and save the result in a generated makefile.
1891 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1892 AC_SUBST(libc_cv_multidir)
1894 AC_SUBST(profile)
1895 AC_SUBST(static_nss)
1897 AC_SUBST(DEFINES)
1899 dnl See sysdeps/mach/configure.ac for this variable.
1900 AC_SUBST(mach_interface_list)
1902 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1903 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1904 AC_SUBST(VERSION)
1905 AC_SUBST(RELEASE)
1907 if test "$pthread_in_libc" = yes; then
1908   AC_DEFINE(PTHREAD_IN_LIBC)
1910 AC_SUBST(pthread_in_libc)
1912 AC_CONFIG_FILES([config.make Makefile])
1913 AC_CONFIG_COMMANDS([default],[[
1914 case $CONFIG_FILES in *config.make*)
1915 echo "$config_vars" >> config.make;;
1916 esac
1917 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
1918 AC_OUTPUT