Remove --disable-experimental-malloc option
[glibc.git] / configure.ac
blob48ca0d370741b95abdc862009662d8bc03d59341
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
55 # We need the C++ compiler only for testing.
56 AC_PROG_CXX
57 # It's useless to us if it can't link programs (e.g. missing -lstdc++).
58 AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
59 AC_LANG_PUSH([C++])
60 # Default, dynamic case.
61 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
62                [libc_cv_cxx_link_ok=yes],
63                [libc_cv_cxx_link_ok=no])
64 # Static case.
65 old_LDFLAGS="$LDFLAGS"
66 LDFLAGS="$LDFLAGS -static"
67 AC_LINK_IFELSE([AC_LANG_SOURCE([
68 #include <iostream>
70 int
71 main()
73   std::cout << "Hello, world!";
74   return 0;
76 ])],
77                [],
78                [libc_cv_cxx_link_ok=no])
79 LDFLAGS="$old_LDFLAGS"
80 AC_LANG_POP([C++])])
81 AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
83 if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
84   AC_MSG_ERROR([you must configure in a separate build directory])
87 # This will get text that should go into config.make.
88 config_vars=
90 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
91 AC_ARG_WITH([gd],
92             AS_HELP_STRING([--with-gd=DIR],
93                            [find libgd include dir and library with prefix DIR]),
94             [dnl
95 case "$with_gd" in
96 yes|''|no) ;;
97 *) libgd_include="-I$withval/include"
98    libgd_ldflags="-L$withval/lib" ;;
99 esac
101 AC_ARG_WITH([gd-include],
102             AS_HELP_STRING([--with-gd-include=DIR],
103                            [find libgd include files in DIR]),
104             [dnl
105 case "$with_gd_include" in
106 ''|no) ;;
107 *) libgd_include="-I$withval" ;;
108 esac
110 AC_ARG_WITH([gd-lib],
111             AS_HELP_STRING([--with-gd-lib=DIR],
112                            [find libgd library files in DIR]),
113             [dnl
114 case "$with_gd_lib" in
115 ''|no) ;;
116 *) libgd_ldflags="-L$withval" ;;
117 esac
120 if test -n "$libgd_include"; then
121   config_vars="$config_vars
122 CFLAGS-memusagestat.c = $libgd_include"
124 if test -n "$libgd_ldflags"; then
125   config_vars="$config_vars
126 libgd-LDFLAGS = $libgd_ldflags"
129 dnl Arguments to specify presence of other packages/features.
130 AC_ARG_WITH([binutils],
131             AS_HELP_STRING([--with-binutils=PATH],
132                            [specify location of binutils (as and ld)]),
133             [path_binutils=$withval],
134             [path_binutils=''])
135 AC_ARG_WITH([selinux],
136             AS_HELP_STRING([--with-selinux],
137                            [if building with SELinux support]),
138             [with_selinux=$withval],
139             [with_selinux=auto])
141 AC_ARG_WITH([headers],
142             AS_HELP_STRING([--with-headers=PATH],
143                            [location of system headers to use
144                             (for example /usr/src/linux/include)
145                             @<:@default=compiler default@:>@]),
146             [sysheaders=$withval],
147             [sysheaders=''])
148 AC_SUBST(sysheaders)
150 dnl Additional build flags injection.
151 AC_ARG_WITH([nonshared-cflags],
152             AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
153                            [build nonshared libraries with additional CFLAGS]),
154             [extra_nonshared_cflags=$withval],
155             [extra_nonshared_cflags=])
156 AC_SUBST(extra_nonshared_cflags)
157 AC_ARG_WITH([rtld-early-cflags],
158             AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS],
159                            [build early initialization with additional CFLAGS]),
160             [rtld_early_cflags=$withval],
161             [rtld_early_cflags=])
162 AC_SUBST(rtld_early_cflags)
164 AC_ARG_WITH([timeoutfactor],
165             AS_HELP_STRING([--with-timeoutfactor=NUM],
166                            [specify an integer to scale the timeout]),
167             [timeoutfactor=$withval],
168             [timeoutfactor=1])
169 AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
171 AC_ARG_ENABLE([sanity-checks],
172               AS_HELP_STRING([--disable-sanity-checks],
173                              [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
174               [enable_sanity=$enableval],
175               [enable_sanity=yes])
177 AC_ARG_ENABLE([shared],
178               AS_HELP_STRING([--enable-shared],
179                              [build shared library @<:@default=yes if GNU ld@:>@]),
180               [shared=$enableval],
181               [shared=yes])
182 AC_ARG_ENABLE([profile],
183               AS_HELP_STRING([--enable-profile],
184                              [build profiled library @<:@default=no@:>@]),
185               [profile=$enableval],
186               [profile=no])
187 AC_ARG_ENABLE([default-pie],
188               AS_HELP_STRING([--disable-default-pie],
189                              [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
190               [default_pie=$enableval],
191               [default_pie=yes])
192 AC_ARG_ENABLE([timezone-tools],
193               AS_HELP_STRING([--disable-timezone-tools],
194                              [do not install timezone tools @<:@default=install@:>@]),
195               [enable_timezone_tools=$enableval],
196               [enable_timezone_tools=yes])
197 AC_SUBST(enable_timezone_tools)
199 AC_ARG_ENABLE([hardcoded-path-in-tests],
200               AS_HELP_STRING([--enable-hardcoded-path-in-tests],
201                              [hardcode newly built glibc path in tests @<:@default=no@:>@]),
202               [hardcoded_path_in_tests=$enableval],
203               [hardcoded_path_in_tests=no])
204 AC_SUBST(hardcoded_path_in_tests)
206 AC_ARG_ENABLE([hidden-plt],
207               AS_HELP_STRING([--disable-hidden-plt],
208                              [do not hide internal function calls to avoid PLT]),
209               [hidden=$enableval],
210               [hidden=yes])
211 if test "x$hidden" = xno; then
212   AC_DEFINE(NO_HIDDEN)
215 AC_ARG_ENABLE([bind-now],
216               AS_HELP_STRING([--enable-bind-now],
217                              [disable lazy relocations in DSOs]),
218               [bindnow=$enableval],
219               [bindnow=no])
220 AC_SUBST(bindnow)
221 if test "x$bindnow" = xyes; then
222   AC_DEFINE(BIND_NOW)
225 dnl Build glibc with -fstack-protector, -fstack-protector-all, or
226 dnl -fstack-protector-strong.
227 AC_ARG_ENABLE([stack-protector],
228               AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
229                              [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
230               [enable_stack_protector=$enableval],
231               [enable_stack_protector=no])
232 case "$enable_stack_protector" in
233 all|yes|no|strong) ;;
234 *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
235 esac
237 dnl On some platforms we cannot use dynamic loading.  We must provide
238 dnl static NSS modules.
239 AC_ARG_ENABLE([static-nss],
240               AS_HELP_STRING([--enable-static-nss],
241                              [build static NSS modules @<:@default=no@:>@]),
242               [static_nss=$enableval],
243               [static_nss=no])
244 dnl Enable static NSS also if we build no shared objects.
245 if test x"$static_nss" = xyes || test x"$shared" = xno; then
246   static_nss=yes
247   AC_DEFINE(DO_STATIC_NSS)
250 AC_ARG_ENABLE([force-install],
251               AS_HELP_STRING([--disable-force-install],
252                              [don't force installation of files from this package, even if they are older than the installed files]),
253               [force_install=$enableval],
254               [force_install=yes])
255 AC_SUBST(force_install)
257 AC_ARG_ENABLE([maintainer-mode],
258               AS_HELP_STRING([--enable-maintainer-mode],
259                              [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
260               [maintainer=$enableval],
261               [maintainer=no])
263 dnl On some platforms we allow dropping compatibility with all kernel
264 dnl versions.
265 AC_ARG_ENABLE([kernel],
266               AS_HELP_STRING([--enable-kernel=VERSION],
267                              [compile for compatibility with kernel not older than VERSION]),
268               [minimum_kernel=$enableval],
269               [])
270 dnl Prevent unreasonable values.
271 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
272   # Better nothing than this.
273   minimum_kernel=""
274 else
275   if test "$minimum_kernel" = current; then
276     minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
277   fi
280 dnl For the development we sometimes want gcc to issue even more warnings.
281 dnl This is not the default since many of the extra warnings are not
282 dnl appropriate.
283 AC_ARG_ENABLE([all-warnings],
284               AS_HELP_STRING([--enable-all-warnings],
285                              [enable all useful warnings gcc can issue]),
286               [all_warnings=$enableval],
287               [])
288 AC_SUBST(all_warnings)
290 AC_ARG_ENABLE([werror],
291               AS_HELP_STRING([--disable-werror],
292                              [do not build with -Werror]),
293               [enable_werror=$enableval],
294               [enable_werror=yes])
295 AC_SUBST(enable_werror)
297 AC_ARG_ENABLE([multi-arch],
298               AS_HELP_STRING([--enable-multi-arch],
299                              [enable single DSO with optimizations for multiple architectures]),
300               [multi_arch=$enableval],
301               [multi_arch=default])
303 AC_ARG_ENABLE([memory-tagging],
304               AS_HELP_STRING([--enable-memory-tagging],
305                              [enable memory tagging if supported by the architecture @<:@default=no@:>@]),
306               [memory_tagging=$enableval],
307               [memory_tagging=no])
308 if test "$memory_tagging" = yes; then
309   # Only enable this on architectures that support it.
310   case $host_cpu in
311     aarch64)
312       AC_DEFINE(USE_MTAG)
313       ;;
314   esac
316 AC_SUBST(memory_tagging)
318 AC_ARG_ENABLE([crypt],
319               AS_HELP_STRING([--disable-crypt],
320                              [do not build nor install the passphrase hashing library, libcrypt]),
321               [build_crypt=$enableval],
322               [build_crypt=yes])
323 AC_SUBST(build_crypt)
325 AC_ARG_ENABLE([nss-crypt],
326               AS_HELP_STRING([--enable-nss-crypt],
327                              [enable libcrypt to use nss]),
328               [nss_crypt=$enableval],
329               [nss_crypt=no])
330 if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then
331   AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled])
332   nss_crypt=no
334 if test x$nss_crypt = xyes; then
335   nss_includes=-I$(nss-config --includedir 2>/dev/null)
336   if test $? -ne 0; then
337     AC_MSG_ERROR([cannot find include directory with nss-config])
338   fi
339   nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
340   if test $? -ne 0; then
341     AC_MSG_ERROR([cannot find include directory with nspr-config])
342   fi
343   old_CFLAGS="$CFLAGS"
344   CFLAGS="$CFLAGS $nss_includes $nspr_includes"
345   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
346 #include <hasht.h>
347 #include <nsslowhash.h>
348 void f (void) { NSSLOW_Init (); }])],
349              libc_cv_nss_crypt=yes,
350              AC_MSG_ERROR([
351 cannot find NSS headers with lowlevel hash function interfaces]))
352   old_LIBS="$LIBS"
353   old_LDFLAGS="$LDFLAGS"
354   LIBS="$LIBS -lfreebl3"
355   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
356 #include <hasht.h>
357 #include <nsslowhash.h>],
358                                   [NSSLOW_Init();])],
359                  libc_cv_nss_crypt=yes,
360                  AC_MSG_ERROR([
361 cannot link program using lowlevel NSS hash functions]))
362   # Check to see if there is a static NSS cryptographic library.
363   # If there isn't then we can't link anything with libcrypt.a,
364   # and that might mean disabling some static tests.
365   LDFLAGS="$LDFLAGS -static"
366   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
367 #include <hasht.h>
368 #include <nsslowhash.h>],
369                                   [NSSLOW_Init();])],
370                  libc_cv_static_nss_crypt=yes,
371                  libc_cv_static_nss_crypt=no)
372   LDFLAGS="$old_LDFLAGS"
373   CFLAGS="$old_CFLAGS"
374   LIBS="$old_LIBS"
375 else
376   libc_cv_nss_crypt=no
377   libc_cv_static_nss_crypt=no
379 AC_SUBST(libc_cv_nss_crypt)
380 AC_SUBST(libc_cv_static_nss_crypt)
383 AC_ARG_ENABLE([systemtap],
384               [AS_HELP_STRING([--enable-systemtap],
385                [enable systemtap static probe points @<:@default=no@:>@])],
386               [systemtap=$enableval],
387               [systemtap=no])
388 if test "x$systemtap" != xno; then
389   AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
390   old_CFLAGS="$CFLAGS"
391   CFLAGS="-std=gnu11 $CFLAGS"
392   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
393 void foo (int i, void *p)
395   asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
396        :: STAP_PROBE_ASM_OPERANDS (2, i, p));
397 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
398   CFLAGS="$old_CFLAGS"])
399   if test $libc_cv_sdt = yes; then
400     AC_DEFINE([USE_STAP_PROBE])
401   elif test "x$systemtap" != xauto; then
402     AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
403   fi
406 AC_ARG_ENABLE([build-nscd],
407               [AS_HELP_STRING([--disable-build-nscd],
408                [disable building and installing the nscd daemon])],
409               [build_nscd=$enableval],
410               [build_nscd=default])
411 AC_SUBST(build_nscd)
413 # Note the use of $use_nscd is near the bottom of the file.
414 AC_ARG_ENABLE([nscd],
415               [AS_HELP_STRING([--disable-nscd],
416                [library functions will not contact the nscd daemon])],
417               [use_nscd=$enableval],
418               [use_nscd=yes])
420 AC_ARG_ENABLE([pt_chown],
421               [AS_HELP_STRING([--enable-pt_chown],
422                [Enable building and installing pt_chown])],
423               [build_pt_chown=$enableval],
424               [build_pt_chown=no])
425 AC_SUBST(build_pt_chown)
426 if test "$build_pt_chown" = yes; then
427   AC_DEFINE(HAVE_PT_CHOWN)
430 AC_ARG_ENABLE([tunables],
431               [AS_HELP_STRING([--enable-tunables],
432                [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
433               [have_tunables=$enableval],
434               [have_tunables=yes])
435 AC_SUBST(have_tunables)
436 if test "$have_tunables" = yes; then
437   AC_DEFINE(HAVE_TUNABLES)
440 # The abi-tags file uses a fairly simplistic model for name recognition that
441 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a
442 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
443 # This doesn't get used much beyond that, so it's fairly safe.
444 case "$host_os" in
445 linux*)
446   ;;
447 gnu*)
448   host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
449   ;;
450 esac
452 AC_ARG_ENABLE([mathvec],
453               [AS_HELP_STRING([--enable-mathvec],
454               [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
455               [build_mathvec=$enableval],
456               [build_mathvec=notset])
458 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
459 #ifndef __CET__
460 # error no CET compiler support
461 #endif]])],
462                [libc_cv_compiler_default_cet=yes],
463                [libc_cv_compiler_default_cet=no])
465 AC_ARG_ENABLE([cet],
466               AS_HELP_STRING([--enable-cet],
467                              [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
468               [enable_cet=$enableval],
469               [enable_cet=$libc_cv_compiler_default_cet])
471 AC_ARG_ENABLE([scv],
472               AC_HELP_STRING([--disable-scv],
473                              [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
474               [use_scv=$enableval],
475               [use_scv=yes])
477 AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
479 # We keep the original values in `$config_*' and never modify them, so we
480 # can write them unchanged into config.make.  Everything else uses
481 # $machine, $vendor, and $os, and changes them whenever convenient.
482 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
484 # Don't allow vendor == "unknown"
485 test "$config_vendor" = unknown && config_vendor=
486 config_os="`echo $config_os | sed 's/^unknown-//'`"
488 # Some configurations imply other options.
489 elf=yes
491 # The configure fragment of a port can modify these to supplement
492 # or override the table in the case statement below.  No fragment should
493 # ever change the config_* variables, however.
494 machine=$config_machine
495 vendor=$config_vendor
496 os=$config_os
497 base_os=''
499 submachine=
500 AC_ARG_WITH([cpu],
501             AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
502             [dnl
503   case "$withval" in
504   yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
505   no) ;;
506   *) submachine="$withval" ;;
507   esac
510 # An preconfigure script can set this when it wants to disable the sanity
511 # check below.
512 libc_config_ok=no
514 # A preconfigure script for a system that may or may not use fpu
515 # sysdeps directories sets this to a preprocessor conditional for
516 # whether to use such directories.
517 with_fp_cond=1
519 dnl Let sysdeps/*/preconfigure act here.
520 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
524 ### By using the undocumented --enable-hacker-mode option for configure
525 ### one can skip this test to make the configuration not fail for unsupported
526 ### platforms.
528 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
529   case "$machine-$host_os" in
530   *-linux* | *-gnu*)
531     ;;
532   *)
533     AC_MSG_ERROR([
534 *** The GNU C library is currently unavailable for this platform.
535 *** If you are interested in seeing glibc on this platform visit
536 *** the "How to submit a new port" in the wiki:
537 ***   https://sourceware.org/glibc/wiki/#Development
538 *** and join the community!])
539     ;;
540   esac
543 # Set base_machine if not set by a preconfigure fragment.
544 test -n "$base_machine" || base_machine=$machine
545 AC_SUBST(base_machine)
547 ### Locate tools.
549 AC_PROG_INSTALL
550 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
551   # The makefiles need to use a different form to find it in $srcdir.
552   INSTALL='\$(..)./scripts/install-sh -c'
554 AC_PROG_LN_S
556 LIBC_PROG_BINUTILS
558 # Accept binutils 2.25 or newer.
559 libc_cv_with_lld=no
560 case $($LD --version) in
561   "GNU gold"*)
562   # Accept gold 1.14 or higher
563     AC_CHECK_PROG_VER(LD, $LD, --version,
564                     [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
565                     [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
566                     LD=: critic_missing="$critic_missing GNU gold")
567     ;;
568   "LLD"*)
569   # Accept LLD 13.0.0 or higher
570     AC_CHECK_PROG_VER(LD, $LD, --version,
571                     [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
572                     [1[3-9].*|[2-9][0-9].*],
573                     LD=: critic_missing="$critic_missing LLD")
574     libc_cv_with_lld=yes
575     ;;
576   *)
577     AC_CHECK_PROG_VER(LD, $LD, --version,
578                     [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
579                     [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
580                     LD=: critic_missing="$critic_missing GNU ld")
581     ;;
582 esac
583 LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
585 # These programs are version sensitive.
586 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
587   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
588   [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
590 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
591   [GNU gettext.* \([0-9]*\.[0-9.]*\)],
592   [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
593   MSGFMT=: aux_missing="$aux_missing msgfmt")
594 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
595   [GNU texinfo.* \([0-9][0-9.]*\)],
596   [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
597   MAKEINFO=: aux_missing="$aux_missing makeinfo")
598 AC_CHECK_PROG_VER(SED, sed, --version,
599   [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
600   [3.0[2-9]*|3.[1-9]*|[4-9]*],
601   SED=: aux_missing="$aux_missing sed")
602 AC_CHECK_PROG_VER(AWK, gawk, --version,
603   [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
604   [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
605 AC_CHECK_PROG_VER(BISON, bison, --version,
606   [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
607   [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
609 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
610 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
611 #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
612 #error insufficient compiler
613 #endif]])],
614                [libc_cv_compiler_ok=yes],
615                [libc_cv_compiler_ok=no])])
616 AS_IF([test $libc_cv_compiler_ok != yes],
617       [critic_missing="$critic_missing compiler"])
619 if test "x$maintainer" = "xyes"; then
620   AC_CHECK_PROGS(AUTOCONF, autoconf, no)
621   case "x$AUTOCONF" in
622   xno|x|x:) AUTOCONF=no ;;
623   *)
624     AC_CACHE_CHECK(dnl
625   whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
626     if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
627       libc_cv_autoconf_works=yes
628     else
629       libc_cv_autoconf_works=no
630     fi])
631     test $libc_cv_autoconf_works = yes || AUTOCONF=no
632     ;;
633   esac
634   if test "x$AUTOCONF" = xno; then
635     aux_missing="$aux_missing autoconf"
636   fi
637 else
638   AUTOCONF=no
641 # Check for python3 if available, or else python.
642 AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
643   [Python \([0-9][0-9.]*\)],
644   [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
645   critic_missing="$critic_missing python")
646 PYTHON="$PYTHON_PROG -B"
647 AC_SUBST(PYTHON)
649 test -n "$critic_missing" && AC_MSG_ERROR([
650 *** These critical programs are missing or too old:$critic_missing
651 *** Check the INSTALL file for required versions.])
653 test -n "$aux_missing" && AC_MSG_WARN([
654 *** These auxiliary programs are missing or incompatible versions:$aux_missing
655 *** some features or tests will be disabled.
656 *** Check the INSTALL file for required versions.])
659 # Determine whether to use fpu or nofpu sysdeps directories.
660 AC_CACHE_CHECK([for use of fpu sysdeps directories],
661                libc_cv_with_fp, [dnl
662 cat > conftest.c <<EOF
663 #if $with_fp_cond
664 int dummy;
665 #else
666 # error "no hardware floating point"
667 #endif
669 libc_cv_with_fp=no
670 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
671    1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
672   libc_cv_with_fp=yes
674 rm -f conftest*])
675 AC_SUBST(libc_cv_with_fp)
677 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
678 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
679                    [libc_cv_ssp=yes],
680                    [libc_cv_ssp=no])
683 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
684 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
685                    [libc_cv_ssp_strong=yes],
686                    [libc_cv_ssp_strong=no])
689 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
690 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
691                    [libc_cv_ssp_all=yes],
692                    [libc_cv_ssp_all=no])
695 stack_protector=
696 no_stack_protector=
697 if test "$libc_cv_ssp" = yes; then
698   no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
699   AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
702 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
703   stack_protector="-fstack-protector"
704   AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
705 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
706   stack_protector="-fstack-protector-all"
707   AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
708 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
709   stack_protector="-fstack-protector-strong"
710   AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
711 else
712   stack_protector="-fno-stack-protector"
713   AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
715 AC_SUBST(libc_cv_ssp)
716 AC_SUBST(stack_protector)
717 AC_SUBST(no_stack_protector)
719 if test -n "$stack_protector"; then
720   dnl Don't run configure tests with stack-protection on, to avoid problems with
721   dnl bootstrapping.
722   no_ssp=-fno-stack-protector
723 else
724   no_ssp=
726   if test "$enable_stack_protector" != no; then
727     AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
728   fi
731 # For the multi-arch option we need support in the assembler & linker.
732 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
733                libc_cv_ld_gnu_indirect_function, [dnl
734 cat > conftest.S <<EOF
735 .type foo,%gnu_indirect_function
736 foo:
737 .globl _start
738 _start:
739 .globl __start
740 __start:
741 .data
742 #ifdef _LP64
743 .quad foo
744 #else
745 .long foo
746 #endif
748 libc_cv_ld_gnu_indirect_function=no
749 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
750             -nostartfiles -nostdlib $no_ssp \
751             -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
752   # Do a link to see if the backend supports IFUNC relocs.
753   $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
754   LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
755     libc_cv_ld_gnu_indirect_function=yes
756   }
758 rm -f conftest*])
760 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
761 AC_CACHE_CHECK([for gcc attribute ifunc support],
762                libc_cv_gcc_indirect_function, [dnl
763 cat > conftest.c <<EOF
764 extern int func (int);
765 int used_func (int a)
767   return a;
769 static void *resolver ()
771   return &used_func;
773 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
775 libc_cv_gcc_indirect_function=no
776 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
777    2>&AS_MESSAGE_LOG_FD ; then
778   if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
779     libc_cv_gcc_indirect_function=yes
780   fi
782 rm -f conftest*])
784 # Check if linker supports textrel relocation with ifunc (used on elf/tests).
785 # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
786 AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
787                libc_cv_textrel_ifunc, [dnl
788 cat > conftest.S <<EOF
789 .type foo,%gnu_indirect_function
790 foo:
791 .globl _start
792 _start:
793 .globl __start
794 __start:
795 .data
796 #ifdef _LP64
797 .quad foo
798 #else
799 .long foo
800 #endif
801 .text
802 .globl address
803 address:
804 #ifdef _LP64
805 .quad address
806 #else
807 .long address
808 #endif
810 libc_cv_textrel_ifunc=no
811 if test $libc_cv_ld_gnu_indirect_function = yes; then
812    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
813      libc_cv_textrel_ifunc=yes
814    fi
816 rm -f conftest*])
817 AC_SUBST(libc_cv_textrel_ifunc)
819 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
820 AC_CACHE_CHECK([for GNU attribute retain support],
821                libc_cv_gnu_retain, [dnl
822 cat > conftest.c <<EOF
823 static int var  __attribute__ ((used, retain, section ("__libc_atexit")));
825 libc_cv_gnu_retain=no
826 if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
827    2>&AS_MESSAGE_LOG_FD ; then
828   libc_cv_gnu_retain=yes
830 rm -f conftest*])
831 if test $libc_cv_gnu_retain = yes; then
832   AC_DEFINE(HAVE_GNU_RETAIN)
834 LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
836 # Check if gcc warns about alias for function with incompatible types.
837 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
838                libc_cv_gcc_incompatible_alias, [dnl
839 cat > conftest.c <<EOF
840 int __redirect_foo (const void *s, int c);
842 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
843 __typeof (__redirect_foo) *foo_impl (void)
845   return 0;
848 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
850 libc_cv_gcc_incompatible_alias=yes
851 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
852   libc_cv_gcc_incompatible_alias=no
854 rm -f conftest*])
856 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
857   if test x"$multi_arch" = xyes; then
858     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
859   else
860     multi_arch=no
861   fi
863 if test x"$libc_cv_gcc_indirect_function" != xyes; then
864   # GCC 8+ emits a warning for alias with incompatible types and it might
865   # fail to build ifunc resolvers aliases to either weak or internal
866   # symbols.  Disables multiarch build in this case.
867   if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
868     AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
869     if test x"$multi_arch" = xyes; then
870       AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
871     fi
872     AC_MSG_WARN([Multi-arch is disabled.])
873     multi_arch=no
874   elif test x"$multi_arch" = xyes; then
875     AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
876 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
877   fi
879 multi_arch_d=
880 if test x"$multi_arch" != xno; then
881   multi_arch_d=/multiarch
884 # Compute the list of sysdep directories for this configuration.
885 # This can take a while to compute.
886 sysdep_dir=$srcdir/sysdeps
887 AC_MSG_CHECKING(sysdep dirs)
888 dnl We need to use [ and ] for other purposes for a while now.
889 changequote(,)dnl
890 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
891 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
893 test "x$base_os" != x || case "$os" in
894 gnu*)
895   base_os=mach/hurd ;;
896 linux*)
897   base_os=unix/sysv ;;
898 esac
900 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
901 tail=$os
902 ostry=$os
903 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
904   ostry="$ostry /$o"
905   tail=$o
906 done
907 o=`echo $tail | sed 's/[0-9]*$//'`
908 if test $o != $tail; then
909   ostry="$ostry /$o"
911 # For linux-gnu, try linux-gnu, then linux.
912 o=`echo $tail | sed 's/-.*$//'`
913 if test $o != $tail; then
914   ostry="$ostry /$o"
917 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
918 base=
919 tail=$base_os
920 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
921   set $b
922   base="$base /$1"
923   tail="$2"
924 done
926 # For sparc/sparc32, try sparc/sparc32 and then sparc.
927 mach=
928 tail=$machine${submachine:+/$submachine}
929 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
930   set $m
931   # Prepend the machine's FPU directory unless the architecture specific
932   # preconfigure disables it.
933   if test "$libc_cv_with_fp" = yes; then
934     maybe_fpu=/fpu
935   else
936     maybe_fpu=/nofpu
937   fi
938   # For each machine term, try it with and then without /multiarch.
939   for try_fpu in $maybe_fpu ''; do
940     for try_multi in $multi_arch_d ''; do
941       mach="$mach /$1$try_fpu$try_multi"
942     done
943   done
944   tail="$2"
945 done
947 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
948 changequote([,])dnl
950 # Find what sysdep directories exist.
951 sysnames=
952 for b in $base ''; do
953   for m0 in $mach ''; do
954     for v in /$vendor ''; do
955       test "$v" = / && continue
956       for o in /$ostry ''; do
957         test "$o" = / && continue
958         for m in $mach ''; do
959           try_suffix="$m0$b$v$o$m"
960           if test -n "$try_suffix"; then
961             try_srcdir="${srcdir}/"
962             try="sysdeps$try_suffix"
963             test -n "$enable_debug_configure" &&
964             echo "$0 [DEBUG]: try $try" >&2
965             if test -d "$try_srcdir$try"; then
966               sysnames="$sysnames $try"
967               { test -n "$o" || test -n "$b"; } && os_used=t
968               { test -n "$m" || test -n "$m0"; } && machine_used=t
969               case x${m0:-$m} in
970               x*/$submachine) submachine_used=t ;;
971               esac
972             fi
973           fi
974         done
975       done
976     done
977   done
978 done
980 # If the assembler supports gnu_indirect_function symbol type and the
981 # architecture supports multi-arch, we enable multi-arch by default.
982 case $sysnames in
983 *"$multi_arch_d"*)
984   ;;
986   test x"$multi_arch" = xdefault && multi_arch=no
987   ;;
988 esac
989 if test x"$multi_arch" != xno; then
990   AC_DEFINE(USE_MULTIARCH)
992 AC_SUBST(multi_arch)
994 if test -z "$os_used" && test "$os" != none; then
995   AC_MSG_ERROR(Operating system $os is not supported.)
997 if test -z "$machine_used" && test "$machine" != none; then
998   AC_MSG_ERROR(The $machine is not supported.)
1000 if test -z "$submachine_used" && test -n "$submachine"; then
1001   AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
1003 AC_SUBST(submachine)
1005 # We have now validated the configuration.
1007 # Expand the list of system names into a full list of directories
1008 # from each element's parent name and Implies file (if present).
1009 set $sysnames
1010 names=
1011 while test $# -gt 0; do
1012   name=$1
1013   shift
1015   case " $names " in *" $name "*)
1016     # Already in the list.
1017     continue
1018   esac
1020   # Report each name as we discover it, so there is no long pause in output.
1021   echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
1023   name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
1025   case $name in
1026     /*) xsrcdir= ;;
1027     *)  xsrcdir=$srcdir/ ;;
1028   esac
1029   test -n "$enable_debug_configure" &&
1030   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
1032   for implies_file in Implies Implies-before Implies-after; do
1033     implies_type=`echo $implies_file | sed s/-/_/`
1034     eval ${implies_type}=
1035     if test -f $xsrcdir$name/$implies_file; then
1036       # Collect more names from the `Implies' file (removing comments).
1037       implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
1038       for x in $implied_candidate; do
1039         found=no
1040         if test -d $xsrcdir$name_base/$x; then
1041           eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
1042           found=yes
1043         fi
1044         try="sysdeps/$x"
1045         try_srcdir=$srcdir/
1046         test -n "$enable_debug_configure" &&
1047          echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
1048         if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
1049         then
1050           eval "${implies_type}=\"\$${implies_type} \$try\""
1051           found=yes
1052         fi
1053         if test $found = no; then
1054           AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
1055         fi
1056       done
1057     fi
1058   done
1060   # Add NAME to the list of names.
1061   names="$names $name"
1063   # Find the parent of NAME, using the empty string if it has none.
1064 changequote(,)dnl
1065   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
1066 changequote([,])dnl
1068   test -n "$enable_debug_configure" &&
1069     echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
1070 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
1072   # Add the names implied by NAME, and NAME's parent (if it has one), to
1073   # the list of names to be processed (the argument list).  We prepend the
1074   # implied names to the list and append the parent.  We want implied
1075   # directories to come before further directories inferred from the
1076   # configuration components; this ensures that for sysv4, unix/common
1077   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
1078   # after sysv4).
1079   sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
1080   test -n "$sysnames" && set $sysnames
1081 done
1083 # Add the default directories.
1084 default_sysnames="sysdeps/generic"
1085 sysnames="$names $default_sysnames"
1086 AC_SUBST(sysnames)
1087 # The other names were emitted during the scan.
1088 AC_MSG_RESULT($default_sysnames)
1090 # if using special system headers, find out the compiler's sekrit
1091 # header directory and add that to the list.  NOTE: Only does the right
1092 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
1093 if test -n "$sysheaders"; then
1094   SYSINCLUDES=-nostdinc
1095   for d in include include-fixed; do
1096     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1097     SYSINCLUDES="$SYSINCLUDES -isystem $i"
1098   done
1099   SYSINCLUDES="$SYSINCLUDES \
1100 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1101   if test -n "$CXX"; then
1102     CXX_SYSINCLUDES=
1103     for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1104     | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1105       test "x$cxxheaders" != x &&
1106       CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1107     done
1108   fi
1110 AC_SUBST(SYSINCLUDES)
1111 AC_SUBST(CXX_SYSINCLUDES)
1113 # Obtain some C++ header file paths.  This is used to make a local
1114 # copy of those headers in Makerules.
1115 if test -n "$CXX"; then
1116   find_cxx_header () {
1117     echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
1118          | $AWK '$1 == "."{print $2}'
1119   }
1120   CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1121   CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1122   CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1124 AC_SUBST(CXX_CSTDLIB_HEADER)
1125 AC_SUBST(CXX_CMATH_HEADER)
1126 AC_SUBST(CXX_BITS_STD_ABS_H)
1128 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1129 # since this would lead to problems installing/building glibc.
1130 # LD_LIBRARY_PATH contains the current directory if one of the following
1131 # is true:
1132 # - one of the terminals (":" and ";") is the first or last sign
1133 # - two terminals occur directly after each other
1134 # - the path contains an element with a dot in it
1135 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1136 changequote(,)dnl
1137 case ${LD_LIBRARY_PATH} in
1138   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1139     ld_library_path_setting="contains current directory"
1140     ;;
1141   *)
1142     ld_library_path_setting="ok"
1143     ;;
1144 esac
1145 changequote([,])dnl
1146 AC_MSG_RESULT($ld_library_path_setting)
1147 if test "$ld_library_path_setting" != "ok"; then
1148 AC_MSG_ERROR([
1149 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1150 *** building glibc. Please change the environment variable
1151 *** and run configure again.])
1154 AC_PATH_PROG(BASH_SHELL, bash, no)
1156 AC_PATH_PROG(PERL, perl, no)
1157 if test "$PERL" != no &&
1158    (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1159   PERL=no
1161 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1162              $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1164 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1165 cat > conftest.s <<EOF
1166 .text
1167 foo:
1168 .set glibc_conftest_frobozz,foo
1169 .globl glibc_conftest_frobozz
1171 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1172 # (but it doesn't work), so we must do a linking check to be sure.
1173 cat > conftest1.c <<\EOF
1174 extern int glibc_conftest_frobozz;
1175 void _start() { glibc_conftest_frobozz = 1; }
1177 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1178             -nostartfiles -nostdlib $no_ssp \
1179             -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1180   libc_cv_asm_set_directive=yes
1181 else
1182   libc_cv_asm_set_directive=no
1184 rm -f conftest*])
1185 if test $libc_cv_asm_set_directive = yes; then
1186   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1189 AC_CACHE_CHECK(linker support for protected data symbol,
1190                libc_cv_protected_data,
1191                [cat > conftest.c <<EOF
1192                 int bar __attribute__ ((visibility ("protected"))) = 1;
1194                 libc_cv_protected_data=no
1195                 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1196                   cat > conftest.c <<EOF
1197                   extern int bar;
1198                   int main (void) { return bar; }
1200                   if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1201                     libc_cv_protected_data=yes
1202                   fi
1203                 fi
1204                 rm -f conftest.*
1205                ])
1206 AC_SUBST(libc_cv_protected_data)
1208 AC_CACHE_CHECK(linker support for INSERT in linker script,
1209                libc_cv_insert,
1210                [cat > conftest.c <<EOF
1211                 int __attribute__ ((section(".bar"))) bar = 0x12345678;
1212                 int test (void) { return bar; }
1214                 cat > conftest.t <<EOF
1215                 SECTIONS
1216                 {
1217                   .bar : { *(.bar) }
1218                 }
1219                 INSERT AFTER .rela.dyn;
1221                 libc_cv_insert=no
1222                 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1223                   libc_cv_insert=yes
1224                 fi
1225                 rm -f conftest.*
1226                ])
1227 AC_SUBST(libc_cv_insert)
1229 AC_CACHE_CHECK(for broken __attribute__((alias())),
1230                libc_cv_broken_alias_attribute,
1231                [cat > conftest.c <<EOF
1232                extern int foo (int x) __asm ("xyzzy");
1233                int bar (int x) { return x; }
1234                extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1235                extern int dfoo;
1236                extern __typeof (dfoo) dfoo __asm ("abccb");
1237                int dfoo = 1;
1239                libc_cv_broken_alias_attribute=yes
1240                if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1241                  if grep 'xyzzy' conftest.s >/dev/null &&
1242                     grep 'abccb' conftest.s >/dev/null; then
1243                    libc_cv_broken_alias_attribute=no
1244                  fi
1245                fi
1246                rm -f conftest.c conftest.s
1247                ])
1248 if test $libc_cv_broken_alias_attribute = yes; then
1249   AC_MSG_ERROR(working alias attribute support required)
1252 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1253                libc_cv_have_sdata_section,
1254                [echo "int i;" > conftest.c
1255                 libc_cv_have_sdata_section=no
1256                 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1257                    | grep '\.sdata' >/dev/null; then
1258                   libc_cv_have_sdata_section=yes
1259                 fi
1260                 rm -f conftest.c conftest.so
1261                ])
1262 if test $libc_cv_have_sdata_section = yes; then
1263   AC_DEFINE(HAVE_SDATA_SECTION)
1266 AC_CACHE_CHECK(for libunwind-support in compiler,
1267                libc_cv_cc_with_libunwind, [
1268   cat > conftest.c <<EOF
1269 int main (void) { return 0; }
1271   if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1272      conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1273     libc_cv_cc_with_libunwind=yes
1274   else
1275     libc_cv_cc_with_libunwind=no
1276   fi
1277   rm -f conftest*])
1278 AC_SUBST(libc_cv_cc_with_libunwind)
1279 if test $libc_cv_cc_with_libunwind = yes; then
1280   AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1283 ASFLAGS_config=
1284 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1285                libc_cv_as_noexecstack, [dnl
1286 cat > conftest.c <<EOF
1287 void foo (void) { }
1289 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1290                    -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1291    && grep .note.GNU-stack conftest.s >/dev/null \
1292    && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1293                       -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1294 then
1295   libc_cv_as_noexecstack=yes
1296 else
1297   libc_cv_as_noexecstack=no
1299 rm -f conftest*])
1300 if test $libc_cv_as_noexecstack = yes; then
1301   ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1303 AC_SUBST(ASFLAGS_config)
1305 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1306                     [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1307 AC_SUBST(libc_cv_z_execstack)
1309 LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
1310                     [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
1311 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
1313 LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
1314                     [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
1315 LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
1317 LIBC_LINKER_FEATURE([-z pack-relative-relocs],
1318                     [-Wl,-z,pack-relative-relocs],
1319                     [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
1320 LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
1322 LIBC_LINKER_FEATURE([--no-dynamic-linker],
1323                     [-Wl,--no-dynamic-linker],
1324                     [libc_cv_no_dynamic_linker=yes],
1325                     [libc_cv_no_dynamic_linker=no])
1326 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
1328 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
1329 LIBC_TRY_CC_OPTION([-static-pie],
1330                    [libc_cv_static_pie=yes],
1331                    [libc_cv_static_pie=no])
1333 LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
1335 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1336 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1339 AC_SUBST(libc_cv_fpie)
1341 AC_CACHE_CHECK(for GLOB_DAT reloc,
1342                libc_cv_has_glob_dat, [dnl
1343 cat > conftest.c <<EOF
1344 extern int mumble;
1345 int foo (void) { return mumble; }
1347 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1348                         -fPIC -shared -o conftest.so conftest.c
1349                         -nostdlib -nostartfiles $no_ssp
1350                         1>&AS_MESSAGE_LOG_FD])
1351 then
1352 dnl look for GLOB_DAT relocation.
1353   if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1354     libc_cv_has_glob_dat=yes
1355   else
1356     libc_cv_has_glob_dat=no
1357   fi
1358 else
1359   libc_cv_has_glob_dat=no
1361 rm -f conftest*])
1362 AC_SUBST(libc_cv_has_glob_dat)
1364 AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
1365 [dnl
1366 cat > conftest.c <<EOF
1367 __thread int i;
1368 void foo (void)
1370   i = 10;
1373 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
1374                    conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
1375 then
1376   libc_cv_mtls_dialect_gnu2=yes
1377 else
1378   libc_cv_mtls_dialect_gnu2=no
1380 rm -f conftest*])
1381 AC_SUBST(libc_cv_mtls_dialect_gnu2)
1382 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
1384 dnl clang emits an warning for a double alias redirection, to warn the
1385 dnl original symbol is sed even when weak definition overriddes it.
1386 dnl It is a usual pattern for weak_alias, where multiple alias point to
1387 dnl same symbol.
1388 AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
1389                libc_cv_wno_ignored_attributes, [dnl
1390 cat > conftest.c <<EOF
1391 void __foo (void)
1394 extern __typeof (__foo) foo __attribute__ ((weak, alias ("__foo")));
1395 extern __typeof (__foo) bar __attribute__ ((weak, alias ("foo")));
1397 libc_cv_wno_ignored_attributes=""
1398 if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
1399 then
1400   libc_cv_wno_ignored_attributes="-Wno-ignored-attributes"
1402 rm -f conftest*])
1403 LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes],
1404                 [$libc_cv_wno_ignored_attributes])
1406 AC_CACHE_CHECK(whether cc puts quotes around section names,
1407                libc_cv_have_section_quotes,
1408                [cat > conftest.c <<EOF
1409                 static const int foo
1410                 __attribute__ ((section ("bar"))) = 1;
1412                 if ${CC-cc} -S conftest.c -o conftest.s; then
1413                   if grep '\.section.*"bar"' conftest.s >/dev/null; then
1414                     libc_cv_have_section_quotes=yes
1415                   else
1416                     libc_cv_have_section_quotes=no
1417                   fi
1418                 else
1419                   libc_cv_have_section_quotes=unknown
1420                 fi
1421                 rm -f conftest.{c,s}
1422                 ])
1423 if test $libc_cv_have_section_quotes = yes; then
1424   AC_DEFINE(HAVE_SECTION_QUOTES)
1427 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1428 cat > conftest.c <<\EOF
1429 void zero (void *x)
1431   __builtin_memset (x, 0, 1000);
1435 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1436 then
1437   libc_cv_gcc_builtin_memset=no
1438 else
1439   libc_cv_gcc_builtin_memset=yes
1441 rm -f conftest* ])
1442 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1443   AC_DEFINE(HAVE_BUILTIN_MEMSET)
1446 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1447 cat > conftest.c <<\EOF
1448 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1449 char *foo (const char *a, const char *b)
1451   return __builtin_strstr (a, b);
1455 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
1456 then
1457   libc_cv_gcc_builtin_redirection=yes
1458 else
1459   libc_cv_gcc_builtin_redirection=no
1461 rm -f conftest* ])
1462 if test "$libc_cv_gcc_builtin_redirection" = no; then
1463   AC_MSG_ERROR([support for the symbol redirection needed])
1466 dnl Determine how to disable generation of FMA instructions.
1467 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1468                libc_cv_cc_nofma, [dnl
1469 libc_cv_cc_nofma=
1470 for opt in -ffp-contract=off -mno-fused-madd; do
1471   LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1472 done])
1473 AC_SUBST(libc_cv_cc_nofma)
1475 if test -n "$submachine"; then
1476   AC_CACHE_CHECK([for compiler option for CPU variant],
1477                  libc_cv_cc_submachine, [dnl
1478   libc_cv_cc_submachine=no
1479   for opt in "-march=$submachine" "-mcpu=$submachine"; do
1480     LIBC_TRY_CC_OPTION([$opt], [
1481       libc_cv_cc_submachine="$opt"
1482       break], [])
1483   done])
1484   if test "x$libc_cv_cc_submachine" = xno; then
1485     AC_MSG_ERROR([${CC-cc} does not support $submachine])
1486   fi
1488 AC_SUBST(libc_cv_cc_submachine)
1490 dnl Determine if compiler supports -fsignaling-nans
1491 AC_CACHE_CHECK([for compiler option that -fsignaling-nans],
1492                libc_cv_cc_signaling_nans, [dnl
1493 LIBC_TRY_CC_OPTION([-Werror -fsignaling-nans],
1494                    [libc_cv_cc_signaling_nans=-fsignaling-nans],
1495                    [libc_cv_cc_signaling_nans=])
1497 LIBC_CONFIG_VAR([config-cflags-signaling-nans],
1498                 [$libc_cv_cc_signaling_nans])
1500 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1501 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1502 cat > conftest.c <<EOF
1503 void
1504 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1505 foo (void) {}
1507 libc_cv_cc_loop_to_function=no
1508 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1509 then
1510   libc_cv_cc_loop_to_function=yes
1512 rm -f conftest*])
1513 if test $libc_cv_cc_loop_to_function = yes; then
1514   AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1516 AC_SUBST(libc_cv_cc_loop_to_function)
1518 dnl Check whether we have the gd library available.
1519 AC_MSG_CHECKING(for libgd)
1520 if test "$with_gd" != "no"; then
1521   old_CFLAGS="$CFLAGS"
1522   CFLAGS="$CFLAGS $libgd_include"
1523   old_LDFLAGS="$LDFLAGS"
1524   LDFLAGS="$LDFLAGS $libgd_ldflags"
1525   old_LIBS="$LIBS"
1526   LIBS="$LIBS -lgd -lpng -lz -lm"
1527   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
1528                  [LIBGD=yes], [LIBGD=no])
1529   CFLAGS="$old_CFLAGS"
1530   LDFLAGS="$old_LDFLAGS"
1531   LIBS="$old_LIBS"
1532 else
1533   LIBGD=no
1535 AC_MSG_RESULT($LIBGD)
1536 AC_SUBST(LIBGD)
1538 # SELinux detection
1539 if test x$with_selinux = xno ; then
1540   have_selinux=no;
1541 else
1542   # See if we have the SELinux library
1543   AC_CHECK_LIB(selinux, is_selinux_enabled,
1544                have_selinux=yes, have_selinux=no)
1545   if test x$with_selinux = xyes ; then
1546     if test x$have_selinux = xno ; then
1547       AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1548     fi
1549   fi
1551 # Check if we're building with SELinux support.
1552 if test "x$have_selinux" = xyes; then
1553   AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1555   # See if we have the libaudit library
1556   AC_CHECK_LIB(audit, audit_log_user_avc_message,
1557                have_libaudit=yes, have_libaudit=no)
1558   if test "x$have_libaudit" = xyes; then
1559     AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1560   fi
1561   AC_SUBST(have_libaudit)
1563   # See if we have the libcap library
1564   AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1565   if test "x$have_libcap" = xyes; then
1566     AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1567   fi
1568   AC_SUBST(have_libcap)
1570 AC_SUBST(have_selinux)
1572 CPPUNDEFS=
1573 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1574 dnl Since we are building the implementations of the fortified functions here,
1575 dnl having the macro defined interacts very badly.
1576 dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
1577 dnl and above (see "man FEATURE_TEST_MACROS").
1578 dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
1579 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1580 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1581 #ifdef _FORTIFY_SOURCE
1582 # error bogon
1583 #endif]])],
1584                 [libc_cv_predef_fortify_source=no],
1585                 [libc_cv_predef_fortify_source=yes])])
1586 if test $libc_cv_predef_fortify_source = yes; then
1587   CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1589 AC_SUBST(CPPUNDEFS)
1591 dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
1592 dnl to one symbol (PR 23840).
1593 AC_CACHE_CHECK(whether the assembler requires one version per symbol,
1594                libc_cv_symver_needs_alias, [dnl
1595   cat > conftest.s <<EOF
1596         .text
1597 testfunc:
1598         .globl testfunc
1599         .symver testfunc, testfunc1@VERSION1
1600         .symver testfunc, testfunc1@VERSION2
1602   libc_cv_symver_needs_alias=no
1603   if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
1604     libc_cv_symver_needs_alias=no
1605   else
1606     libc_cv_symver_needs_alias=yes
1607   fi
1608   rm conftest.*
1610 if test "$libc_cv_symver_needs_alias" = yes; then
1611   AC_DEFINE(SYMVER_NEEDS_ALIAS)
1614 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1615                libc_cv_builtin_trap, [dnl
1616 libc_cv_builtin_trap=no
1617 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
1618 libc_undefs=`$NM -u conftest.o |
1619   LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1620     2>&AS_MESSAGE_LOG_FD` || {
1621   AC_MSG_ERROR([confusing output from $NM -u])
1623 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1624 if test -z "$libc_undefs"; then
1625   libc_cv_builtin_trap=yes
1626 fi],[])])
1627 if test $libc_cv_builtin_trap = yes; then
1628   AC_DEFINE([HAVE_BUILTIN_TRAP])
1631 dnl C++ feature tests.
1632 AC_LANG_PUSH([C++])
1634 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1635                libc_cv_cxx_thread_local, [
1636 old_CXXFLAGS="$CXXFLAGS"
1637 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1638 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1639 #include <thread>
1641 // Compiler support.
1642 struct S
1644   S ();
1645   ~S ();
1647 thread_local S s;
1648 S * get () { return &s; }
1650 // libstdc++ support.
1651 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1652 #error __cxa_thread_atexit_impl not supported
1653 #endif
1654 ])],
1655                [libc_cv_cxx_thread_local=yes],
1656                [libc_cv_cxx_thread_local=no])
1657 CXXFLAGS="$old_CXXFLAGS"
1659 AC_SUBST(libc_cv_cxx_thread_local)
1661 AC_LANG_POP([C++])
1662 dnl End of C++ feature tests.
1664 ### End of automated tests.
1665 ### Now run sysdeps configure fragments.
1667 # They also can set these variables.
1668 use_ldconfig=no
1669 ldd_rewrite_script=no
1670 libc_cv_sysconfdir=$sysconfdir
1671 libc_cv_localstatedir=$localstatedir
1672 libc_cv_gcc_unwind_find_fde=no
1673 libc_cv_idn=no
1674 pthread_in_libc=yes
1676 # Iterate over all the sysdep directories we will use, running their
1677 # configure fragments.
1678 for dir in $sysnames; do
1679   case $dir in
1680     /*) dest=$dir ;;
1681     *)  dest=$srcdir/$dir ;;
1682   esac
1683   if test -r $dest/configure; then
1684     AC_MSG_RESULT(running configure fragment for $dir)
1685     . $dest/configure
1686   fi
1687 done
1689 if test x"$build_mathvec" = xnotset; then
1690   build_mathvec=no
1692 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1694 AC_SUBST(libc_extra_cflags)
1695 AC_SUBST(libc_extra_cppflags)
1697 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1698   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1700 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1702 # A sysdeps configure fragment can reset this if IFUNC is not actually
1703 # usable even though the assembler knows how to generate the symbol type.
1704 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1705   AC_DEFINE(HAVE_IFUNC)
1707 LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
1709 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1710   AC_DEFINE(HAVE_GCC_IFUNC)
1712 LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
1714 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1715 # configure fragment can override the value to prevent this AC_DEFINE.
1716 AC_SUBST(use_nscd)
1717 if test "x$use_nscd" != xno; then
1718   AC_DEFINE([USE_NSCD])
1720 if test "x$build_nscd" = xdefault; then
1721   build_nscd=$use_nscd
1724 AC_SUBST(libc_cv_slibdir)
1725 AC_SUBST(libc_cv_rtlddir)
1726 AC_SUBST(libc_cv_complocaledir)
1727 AC_SUBST(libc_cv_sysconfdir)
1728 AC_SUBST(libc_cv_localstatedir)
1729 AC_SUBST(libc_cv_rootsbindir)
1731 if test x$use_ldconfig = xyes; then
1732   AC_DEFINE(USE_LDCONFIG)
1734 AC_SUBST(use_ldconfig)
1735 AC_SUBST(ldd_rewrite_script)
1737 AC_SUBST(static)
1738 AC_SUBST(shared)
1740 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1741 [libc_cv_pic_default=yes
1742 cat > conftest.c <<EOF
1743 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1744 # error PIC is default.
1745 #endif
1747 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1748   libc_cv_pic_default=no
1750 rm -f conftest.*])
1751 LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
1753 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
1754 [libc_cv_cc_pie_default=yes
1755 cat > conftest.c <<EOF
1756 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1757 # error PIE is default.
1758 #endif
1760 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1761   libc_cv_cc_pie_default=no
1763 rm -f conftest.*])
1764 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
1766 AC_MSG_CHECKING(if we can build programs as PIE)
1767 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
1768 # error PIE is not supported
1769 #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
1770 AC_MSG_RESULT($libc_cv_pie_supported)
1771 # Disable build-pie-default if target does not support it or glibc is
1772 # configured with --disable-default-pie.
1773 if test "x$default_pie" = xno; then
1774   build_pie_default=no
1775 else
1776   build_pie_default=$libc_cv_pie_supported
1778 LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
1780 AC_MSG_CHECKING(if we can build static PIE programs)
1781 libc_cv_static_pie_supported=$libc_cv_pie_supported
1782 if test "x$libc_cv_pie_supported" != xno \
1783    -a "$libc_cv_no_dynamic_linker" = yes; then
1784   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
1785 # error static PIE is not supported
1786 #endif]])], [libc_cv_static_pie_supported=yes],
1787             [libc_cv_static_pie_supported=no])
1789 AC_MSG_RESULT($libc_cv_static_pie_supported)
1791 # Enable static-pie only if it is available and glibc isn't configured
1792 # with --disable-default-pie.
1793 if test "x$default_pie" = xno; then
1794   libc_cv_static_pie=no
1795 else
1796   libc_cv_static_pie=$libc_cv_static_pie_supported
1798 if test "$libc_cv_static_pie" = "yes"; then
1799   AC_DEFINE(ENABLE_STATIC_PIE)
1801 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
1803 # Set the `multidir' variable by grabbing the variable from the compiler.
1804 # We do it once and save the result in a generated makefile.
1805 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1806 AC_SUBST(libc_cv_multidir)
1808 AC_SUBST(profile)
1809 AC_SUBST(static_nss)
1811 AC_SUBST(DEFINES)
1813 dnl See sysdeps/mach/configure.ac for this variable.
1814 AC_SUBST(mach_interface_list)
1816 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1817 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1818 AC_SUBST(VERSION)
1819 AC_SUBST(RELEASE)
1821 if test "$pthread_in_libc" = yes; then
1822   AC_DEFINE(PTHREAD_IN_LIBC)
1824 AC_SUBST(pthread_in_libc)
1826 AC_CONFIG_FILES([config.make Makefile])
1827 AC_CONFIG_COMMANDS([default],[[
1828 case $CONFIG_FILES in *config.make*)
1829 echo "$config_vars" >> config.make;;
1830 esac
1831 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
1832 AC_OUTPUT