hppa/vdso: Provide 64-bit clock_gettime() vDSO only
[glibc.git] / configure.ac
blobe48957f318055e6c3d68226f8d1def2e61790910
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 # This will get text that should go into config.make.
56 config_vars=
58 AC_ARG_ENABLE([static-c++-tests],
59               AS_HELP_STRING([--disable-static-c++-tests],
60                              [disable static C++ tests@<:@default=no@:>@]),
61               [static_cxx_tests=$enableval],
62               [static_cxx_tests=yes])
63 LIBC_CONFIG_VAR([static-cxx-tests], [$static_cxx_tests])
65 AC_ARG_ENABLE([static-c++-link-check],
66               AS_HELP_STRING([--disable-static-c++-link-check],
67                              [disable static C++ link check @<:@default=no@:>@]),
68               [static_cxx_link_check=$enableval],
69               [static_cxx_link_check=yes])
71 # We need the C++ compiler only for testing.
72 AC_PROG_CXX
73 # It's useless to us if it can't link programs (e.g. missing -lstdc++).
74 AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
75 AC_LANG_PUSH([C++])
76 # Default, dynamic case.
77 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
78                [libc_cv_cxx_link_ok=yes],
79                [libc_cv_cxx_link_ok=no])
80 if test $static_cxx_link_check$static_cxx_tests = yesyes; then
81   # Static case.
82   old_LDFLAGS="$LDFLAGS"
83   LDFLAGS="$LDFLAGS -static"
84   AC_LINK_IFELSE([AC_LANG_SOURCE([
85 #include <iostream>
87 int
88 main()
90   std::cout << "Hello, world!";
91   return 0;
93 ])],
94                  [],
95                  [libc_cv_cxx_link_ok=no])
96   LDFLAGS="$old_LDFLAGS"
98 AC_LANG_POP([C++])])
99 AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
101 if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
102   AC_MSG_ERROR([you must configure in a separate build directory])
105 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
106 AC_ARG_WITH([gd],
107             AS_HELP_STRING([--with-gd=DIR],
108                            [find libgd include dir and library with prefix DIR]),
109             [dnl
110 case "$with_gd" in
111 yes|''|no) ;;
112 *) libgd_include="-I$withval/include"
113    libgd_ldflags="-L$withval/lib" ;;
114 esac
116 AC_ARG_WITH([gd-include],
117             AS_HELP_STRING([--with-gd-include=DIR],
118                            [find libgd include files in DIR]),
119             [dnl
120 case "$with_gd_include" in
121 ''|no) ;;
122 *) libgd_include="-I$withval" ;;
123 esac
125 AC_ARG_WITH([gd-lib],
126             AS_HELP_STRING([--with-gd-lib=DIR],
127                            [find libgd library files in DIR]),
128             [dnl
129 case "$with_gd_lib" in
130 ''|no) ;;
131 *) libgd_ldflags="-L$withval" ;;
132 esac
135 if test -n "$libgd_include"; then
136   config_vars="$config_vars
137 CFLAGS-memusagestat.c = $libgd_include"
139 if test -n "$libgd_ldflags"; then
140   config_vars="$config_vars
141 libgd-LDFLAGS = $libgd_ldflags"
144 dnl Arguments to specify presence of other packages/features.
145 AC_ARG_WITH([binutils],
146             AS_HELP_STRING([--with-binutils=PATH],
147                            [specify location of binutils (as and ld)]),
148             [path_binutils=$withval],
149             [path_binutils=''])
150 AC_ARG_WITH([selinux],
151             AS_HELP_STRING([--with-selinux],
152                            [if building with SELinux support]),
153             [with_selinux=$withval],
154             [with_selinux=auto])
156 AC_ARG_WITH([headers],
157             AS_HELP_STRING([--with-headers=PATH],
158                            [location of system headers to use
159                             (for example /usr/src/linux/include)
160                             @<:@default=compiler default@:>@]),
161             [sysheaders=$withval],
162             [sysheaders=''])
163 AC_SUBST(sysheaders)
165 dnl Additional build flags injection.
166 AC_ARG_WITH([nonshared-cflags],
167             AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
168                            [build nonshared libraries with additional CFLAGS]),
169             [extra_nonshared_cflags=$withval],
170             [extra_nonshared_cflags=])
171 AC_SUBST(extra_nonshared_cflags)
172 AC_ARG_WITH([rtld-early-cflags],
173             AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS],
174                            [build early initialization with additional CFLAGS]),
175             [rtld_early_cflags=$withval],
176             [rtld_early_cflags=])
177 AC_SUBST(rtld_early_cflags)
179 AC_ARG_WITH([timeoutfactor],
180             AS_HELP_STRING([--with-timeoutfactor=NUM],
181                            [specify an integer to scale the timeout]),
182             [timeoutfactor=$withval],
183             [timeoutfactor=1])
184 AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
186 AC_ARG_ENABLE([sanity-checks],
187               AS_HELP_STRING([--disable-sanity-checks],
188                              [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
189               [enable_sanity=$enableval],
190               [enable_sanity=yes])
192 AC_ARG_ENABLE([shared],
193               AS_HELP_STRING([--enable-shared],
194                              [build shared library @<:@default=yes if GNU ld@:>@]),
195               [shared=$enableval],
196               [shared=yes])
197 AC_ARG_ENABLE([profile],
198               AS_HELP_STRING([--enable-profile],
199                              [build profiled library @<:@default=no@:>@]),
200               [profile=$enableval],
201               [profile=no])
202 AC_ARG_ENABLE([default-pie],
203               AS_HELP_STRING([--disable-default-pie],
204                              [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
205               [default_pie=$enableval],
206               [default_pie=yes])
207 AC_ARG_ENABLE([timezone-tools],
208               AS_HELP_STRING([--disable-timezone-tools],
209                              [do not install timezone tools @<:@default=install@:>@]),
210               [enable_timezone_tools=$enableval],
211               [enable_timezone_tools=yes])
212 AC_SUBST(enable_timezone_tools)
214 AC_ARG_ENABLE([hardcoded-path-in-tests],
215               AS_HELP_STRING([--enable-hardcoded-path-in-tests],
216                              [hardcode newly built glibc path in tests @<:@default=no@:>@]),
217               [hardcoded_path_in_tests=$enableval],
218               [hardcoded_path_in_tests=no])
219 AC_SUBST(hardcoded_path_in_tests)
221 AC_ARG_ENABLE([hidden-plt],
222               AS_HELP_STRING([--disable-hidden-plt],
223                              [do not hide internal function calls to avoid PLT]),
224               [hidden=$enableval],
225               [hidden=yes])
226 if test "x$hidden" = xno; then
227   AC_DEFINE(NO_HIDDEN)
230 AC_ARG_ENABLE([bind-now],
231               AS_HELP_STRING([--enable-bind-now],
232                              [disable lazy relocations in DSOs]),
233               [bindnow=$enableval],
234               [bindnow=no])
235 AC_SUBST(bindnow)
236 if test "x$bindnow" = xyes; then
237   AC_DEFINE(BIND_NOW)
240 dnl Build glibc with -fstack-protector, -fstack-protector-all, or
241 dnl -fstack-protector-strong.
242 AC_ARG_ENABLE([stack-protector],
243               AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
244                              [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
245               [enable_stack_protector=$enableval],
246               [enable_stack_protector=no])
247 case "$enable_stack_protector" in
248 all|yes|no|strong) ;;
249 *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: "$enable_stack_protector"]);;
250 esac
252 dnl On some platforms we cannot use dynamic loading.  We must provide
253 dnl static NSS modules.
254 AC_ARG_ENABLE([static-nss],
255               AS_HELP_STRING([--enable-static-nss],
256                              [build static NSS modules @<:@default=no@:>@]),
257               [static_nss=$enableval],
258               [static_nss=no])
259 dnl Enable static NSS also if we build no shared objects.
260 if test x"$static_nss" = xyes || test x"$shared" = xno; then
261   static_nss=yes
262   AC_DEFINE(DO_STATIC_NSS)
265 AC_ARG_ENABLE([force-install],
266               AS_HELP_STRING([--disable-force-install],
267                              [don't force installation of files from this package, even if they are older than the installed files]),
268               [force_install=$enableval],
269               [force_install=yes])
270 AC_SUBST(force_install)
272 AC_ARG_ENABLE([maintainer-mode],
273               AS_HELP_STRING([--enable-maintainer-mode],
274                              [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
275               [maintainer=$enableval],
276               [maintainer=no])
278 dnl On some platforms we allow dropping compatibility with all kernel
279 dnl versions.
280 AC_ARG_ENABLE([kernel],
281               AS_HELP_STRING([--enable-kernel=VERSION],
282                              [compile for compatibility with kernel not older than VERSION]),
283               [minimum_kernel=$enableval],
284               [])
285 dnl Prevent unreasonable values.
286 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
287   # Better nothing than this.
288   minimum_kernel=""
289 else
290   if test "$minimum_kernel" = current; then
291     minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
292   fi
295 AC_ARG_ENABLE([werror],
296               AS_HELP_STRING([--disable-werror],
297                              [do not build with -Werror]),
298               [enable_werror=$enableval],
299               [enable_werror=yes])
300 AC_SUBST(enable_werror)
302 AC_ARG_ENABLE([multi-arch],
303               AS_HELP_STRING([--enable-multi-arch],
304                              [enable single DSO with optimizations for multiple architectures]),
305               [multi_arch=$enableval],
306               [multi_arch=default])
308 AC_ARG_ENABLE([memory-tagging],
309               AS_HELP_STRING([--enable-memory-tagging],
310                              [enable memory tagging if supported by the architecture @<:@default=no@:>@]),
311               [memory_tagging=$enableval],
312               [memory_tagging=no])
313 if test "$memory_tagging" = yes; then
314   # Only enable this on architectures that support it.
315   case $host_cpu in
316     aarch64)
317       AC_DEFINE(USE_MTAG)
318       ;;
319   esac
321 AC_SUBST(memory_tagging)
323 AC_ARG_ENABLE([systemtap],
324               [AS_HELP_STRING([--enable-systemtap],
325                [enable systemtap static probe points @<:@default=no@:>@])],
326               [systemtap=$enableval],
327               [systemtap=no])
328 if test "x$systemtap" != xno; then
329   AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
330   old_CFLAGS="$CFLAGS"
331   CFLAGS="-std=gnu11 $CFLAGS"
332   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
333 void foo (int i, void *p)
335   asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
336        :: STAP_PROBE_ASM_OPERANDS (2, i, p));
337 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
338   CFLAGS="$old_CFLAGS"])
339   if test $libc_cv_sdt = yes; then
340     AC_DEFINE([USE_STAP_PROBE])
341   elif test "x$systemtap" != xauto; then
342     AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
343   fi
346 AC_ARG_ENABLE([build-nscd],
347               [AS_HELP_STRING([--disable-build-nscd],
348                [disable building and installing the nscd daemon])],
349               [build_nscd=$enableval],
350               [build_nscd=default])
351 AC_SUBST(build_nscd)
353 # Note the use of $use_nscd is near the bottom of the file.
354 AC_ARG_ENABLE([nscd],
355               [AS_HELP_STRING([--disable-nscd],
356                [library functions will not contact the nscd daemon])],
357               [use_nscd=$enableval],
358               [use_nscd=yes])
360 AC_ARG_ENABLE([pt_chown],
361               [AS_HELP_STRING([--enable-pt_chown],
362                [Enable building and installing pt_chown])],
363               [build_pt_chown=$enableval],
364               [build_pt_chown=no])
365 AC_SUBST(build_pt_chown)
366 if test "$build_pt_chown" = yes; then
367   AC_DEFINE(HAVE_PT_CHOWN)
370 # The abi-tags file uses a fairly simplistic model for name recognition that
371 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a
372 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
373 # This doesn't get used much beyond that, so it's fairly safe.
374 case "$host_os" in
375 linux*)
376   ;;
377 gnu*)
378   host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
379   ;;
380 esac
382 AC_ARG_ENABLE([mathvec],
383               [AS_HELP_STRING([--enable-mathvec],
384               [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
385               [build_mathvec=$enableval],
386               [build_mathvec=notset])
388 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
389 #ifndef __CET__
390 # error no CET compiler support
391 #endif]])],
392                [libc_cv_compiler_default_cet=yes],
393                [libc_cv_compiler_default_cet=no])
395 AC_ARG_ENABLE([cet],
396               AS_HELP_STRING([--enable-cet],
397                              [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
398               [enable_cet=$enableval],
399               [enable_cet=$libc_cv_compiler_default_cet])
401 AC_ARG_ENABLE([scv],
402               AS_HELP_STRING([--disable-scv],
403                              [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
404               [use_scv=$enableval],
405               [use_scv=yes])
407 AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
409 dnl Build glibc with _FORTIFY_SOURCE
410 AC_ARG_ENABLE(fortify-source,
411               AS_HELP_STRING([--enable-fortify-source@<:@=1|2|3@:>@],
412                              [Use -D_FORTIFY_SOURCE=[1|2|3] to control code hardening, defaults to highest possible value supported by the build compiler.]),
413               [enable_fortify_source=$enableval],
414               [enable_fortify_source=no])
415 case "$enable_fortify_source" in
416 1|2|3|no|yes) ;;
417 *) AC_MSG_ERROR([Not a valid argument for --enable-fortify-source: "$enable_fortify_source"]);;
418 esac
420 # We keep the original values in `$config_*' and never modify them, so we
421 # can write them unchanged into config.make.  Everything else uses
422 # $machine, $vendor, and $os, and changes them whenever convenient.
423 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
425 # Don't allow vendor == "unknown"
426 test "$config_vendor" = unknown && config_vendor=
427 config_os="`echo $config_os | sed 's/^unknown-//'`"
429 # Some configurations imply other options.
430 elf=yes
432 # The configure fragment of a port can modify these to supplement
433 # or override the table in the case statement below.  No fragment should
434 # ever change the config_* variables, however.
435 machine=$config_machine
436 vendor=$config_vendor
437 os=$config_os
438 base_os=''
440 submachine=
441 AC_ARG_WITH([cpu],
442             AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
443             [dnl
444   case "$withval" in
445   yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
446   no) ;;
447   *) submachine="$withval" ;;
448   esac
451 # An preconfigure script can set this when it wants to disable the sanity
452 # check below.
453 libc_config_ok=no
455 # A preconfigure script for a system that may or may not use fpu
456 # sysdeps directories sets this to a preprocessor conditional for
457 # whether to use such directories.
458 with_fp_cond=1
460 # A preconfigure script may define another name to TLS descriptor variant
461 mtls_descriptor=gnu2
463 dnl Let sysdeps/*/preconfigure act here.
464 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
468 ### By using the undocumented --enable-hacker-mode option for configure
469 ### one can skip this test to make the configuration not fail for unsupported
470 ### platforms.
472 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
473   case "$machine-$host_os" in
474   *-linux* | *-gnu*)
475     ;;
476   *)
477     AC_MSG_ERROR([
478 *** The GNU C library is currently unavailable for this platform.
479 *** If you are interested in seeing glibc on this platform visit
480 *** the "How to submit a new port" in the wiki:
481 ***   https://sourceware.org/glibc/wiki/#Development
482 *** and join the community!])
483     ;;
484   esac
487 # Set base_machine if not set by a preconfigure fragment.
488 test -n "$base_machine" || base_machine=$machine
489 AC_SUBST(base_machine)
491 ### Locate tools.
493 AC_PROG_INSTALL
494 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
495   # The makefiles need to use a different form to find it in $srcdir.
496   INSTALL='\$(..)./scripts/install-sh -c'
498 AC_PROG_LN_S
500 LIBC_PROG_BINUTILS
502 # Accept binutils 2.25 or newer.
503 libc_cv_with_lld=no
504 case $($LD --version) in
505   "GNU gold"*)
506   # Accept gold 1.14 or higher
507     AC_CHECK_PROG_VER(LD, $LD, --version,
508                     [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
509                     [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
510                     LD=: critic_missing="$critic_missing GNU gold")
511     ;;
512   "LLD"*)
513   # Accept LLD 13.0.0 or higher
514     AC_CHECK_PROG_VER(LD, $LD, --version,
515                     [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
516                     [1[3-9].*|[2-9][0-9].*],
517                     LD=: critic_missing="$critic_missing LLD")
518     libc_cv_with_lld=yes
519     ;;
520   *)
521     AC_CHECK_PROG_VER(LD, $LD, --version,
522                     [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
523                     [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
524                     LD=: critic_missing="$critic_missing GNU ld")
525     ;;
526 esac
527 LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
529 # These programs are version sensitive.
530 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
531   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
532   [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
534 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
535   [GNU gettext.* \([0-9]*\.[0-9.]*\)],
536   [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
537   MSGFMT=: aux_missing="$aux_missing msgfmt")
538 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
539   [GNU texinfo.* \([0-9][0-9.]*\)],
540   [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
541   MAKEINFO=: aux_missing="$aux_missing makeinfo")
542 AC_CHECK_PROG_VER(SED, sed, --version,
543   [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
544   [3.0[2-9]*|3.[1-9]*|[4-9]*],
545   SED=: aux_missing="$aux_missing sed")
546 AC_CHECK_PROG_VER(AWK, gawk, --version,
547   [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
548   [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
549 AC_CHECK_PROG_VER(BISON, bison, --version,
550   [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
551   [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
553 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
554 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
555 #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
556 #error insufficient compiler
557 #endif]])],
558                [libc_cv_compiler_ok=yes],
559                [libc_cv_compiler_ok=no])])
560 AS_IF([test $libc_cv_compiler_ok != yes],
561       [critic_missing="$critic_missing compiler"])
563 if test "x$maintainer" = "xyes"; then
564   AC_CHECK_PROGS(AUTOCONF, autoconf, no)
565   case "x$AUTOCONF" in
566   xno|x|x:) AUTOCONF=no ;;
567   *)
568     AC_CACHE_CHECK(dnl
569   whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
570     if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
571       libc_cv_autoconf_works=yes
572     else
573       libc_cv_autoconf_works=no
574     fi])
575     test $libc_cv_autoconf_works = yes || AUTOCONF=no
576     ;;
577   esac
578   if test "x$AUTOCONF" = xno; then
579     aux_missing="$aux_missing autoconf"
580   fi
581 else
582   AUTOCONF=no
585 # Check for python3 if available, or else python.
586 AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
587   [Python \([0-9][0-9.]*\)],
588   [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
589   critic_missing="$critic_missing python")
590 PYTHON="$PYTHON_PROG -B"
591 AC_SUBST(PYTHON)
593 test -n "$critic_missing" && AC_MSG_ERROR([
594 *** These critical programs are missing or too old:$critic_missing
595 *** Check the INSTALL file for required versions.])
597 test -n "$aux_missing" && AC_MSG_WARN([
598 *** These auxiliary programs are missing or incompatible versions:$aux_missing
599 *** some features or tests will be disabled.
600 *** Check the INSTALL file for required versions.])
603 # Determine whether to use fpu or nofpu sysdeps directories.
604 AC_CACHE_CHECK([for use of fpu sysdeps directories],
605                libc_cv_with_fp, [dnl
606 cat > conftest.c <<EOF
607 #if $with_fp_cond
608 int dummy;
609 #else
610 # error "no hardware floating point"
611 #endif
613 libc_cv_with_fp=no
614 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
615    1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
616   libc_cv_with_fp=yes
618 rm -f conftest*])
619 AC_SUBST(libc_cv_with_fp)
621 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
622 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
623                    [libc_cv_ssp=yes],
624                    [libc_cv_ssp=no])
627 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
628 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
629                    [libc_cv_ssp_strong=yes],
630                    [libc_cv_ssp_strong=no])
633 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
634 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
635                    [libc_cv_ssp_all=yes],
636                    [libc_cv_ssp_all=no])
639 stack_protector=
640 no_stack_protector=
641 if test "$libc_cv_ssp" = yes; then
642   no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
643   AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
646 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
647   stack_protector="-fstack-protector"
648   AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
649 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
650   stack_protector="-fstack-protector-all"
651   AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
652 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
653   stack_protector="-fstack-protector-strong"
654   AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
655 else
656   stack_protector="-fno-stack-protector"
657   AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
659 AC_SUBST(libc_cv_ssp)
660 AC_SUBST(stack_protector)
661 AC_SUBST(no_stack_protector)
663 if test -n "$stack_protector"; then
664   dnl Don't run configure tests with stack-protection on, to avoid problems with
665   dnl bootstrapping.
666   no_ssp=-fno-stack-protector
667 else
668   no_ssp=
670   if test "$enable_stack_protector" != no; then
671     AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
672   fi
675 # For the multi-arch option we need support in the assembler & linker.
676 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
677                libc_cv_ld_gnu_indirect_function, [dnl
678 cat > conftest.S <<EOF
679 .type foo,%gnu_indirect_function
680 foo:
681 .globl _start
682 _start:
683 .globl __start
684 __start:
685 .data
686 #ifdef _LP64
687 .quad foo
688 #else
689 .long foo
690 #endif
692 libc_cv_ld_gnu_indirect_function=no
693 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
694             -nostartfiles -nostdlib $no_ssp \
695             -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
696   # Do a link to see if the backend supports IFUNC relocs.
697   $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
698   LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
699     libc_cv_ld_gnu_indirect_function=yes
700   }
702 rm -f conftest*])
704 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
705 AC_CACHE_CHECK([for gcc attribute ifunc support],
706                libc_cv_gcc_indirect_function, [dnl
707 cat > conftest.c <<EOF
708 extern int func (int);
709 int used_func (int a)
711   return a;
713 static void *resolver ()
715   return &used_func;
717 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
719 libc_cv_gcc_indirect_function=no
720 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
721    2>&AS_MESSAGE_LOG_FD ; then
722   if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
723     libc_cv_gcc_indirect_function=yes
724   fi
726 rm -f conftest*])
728 # Check if linker supports textrel relocation with ifunc (used on elf/tests).
729 # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
730 AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
731                libc_cv_textrel_ifunc, [dnl
732 cat > conftest.S <<EOF
733 .type foo,%gnu_indirect_function
734 foo:
735 .globl _start
736 _start:
737 .globl __start
738 __start:
739 .data
740 #ifdef _LP64
741 .quad foo
742 #else
743 .long foo
744 #endif
745 .text
746 .globl address
747 address:
748 #ifdef _LP64
749 .quad address
750 #else
751 .long address
752 #endif
754 libc_cv_textrel_ifunc=no
755 if test $libc_cv_ld_gnu_indirect_function = yes; then
756    if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
757      libc_cv_textrel_ifunc=yes
758    fi
760 rm -f conftest*])
761 AC_SUBST(libc_cv_textrel_ifunc)
763 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
764 AC_CACHE_CHECK([for GNU attribute retain support],
765                libc_cv_gnu_retain, [dnl
766 cat > conftest.c <<EOF
767 static int var  __attribute__ ((used, retain, section ("__libc_atexit")));
769 libc_cv_gnu_retain=no
770 if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
771    2>&AS_MESSAGE_LOG_FD ; then
772   libc_cv_gnu_retain=yes
774 rm -f conftest*])
775 if test $libc_cv_gnu_retain = yes; then
776   AC_DEFINE(HAVE_GNU_RETAIN)
778 LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
780 # Check if gcc warns about alias for function with incompatible types.
781 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
782                libc_cv_gcc_incompatible_alias, [dnl
783 cat > conftest.c <<EOF
784 int __redirect_foo (const void *s, int c);
786 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
787 __typeof (__redirect_foo) *foo_impl (void)
789   return 0;
792 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
794 libc_cv_gcc_incompatible_alias=yes
795 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
796   libc_cv_gcc_incompatible_alias=no
798 rm -f conftest*])
800 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
801   if test x"$multi_arch" = xyes; then
802     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
803   else
804     multi_arch=no
805   fi
807 if test x"$libc_cv_gcc_indirect_function" != xyes; then
808   # GCC 8+ emits a warning for alias with incompatible types and it might
809   # fail to build ifunc resolvers aliases to either weak or internal
810   # symbols.  Disables multiarch build in this case.
811   if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
812     AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
813     if test x"$multi_arch" = xyes; then
814       AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
815     fi
816     AC_MSG_WARN([Multi-arch is disabled.])
817     multi_arch=no
818   elif test x"$multi_arch" = xyes; then
819     AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
820 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
821   fi
823 multi_arch_d=
824 if test x"$multi_arch" != xno; then
825   multi_arch_d=/multiarch
828 # Compute the list of sysdep directories for this configuration.
829 # This can take a while to compute.
830 sysdep_dir=$srcdir/sysdeps
831 AC_MSG_CHECKING(sysdep dirs)
832 dnl We need to use [ and ] for other purposes for a while now.
833 changequote(,)dnl
834 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
835 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
837 test "x$base_os" != x || case "$os" in
838 gnu*)
839   base_os=mach/hurd ;;
840 linux*)
841   base_os=unix/sysv ;;
842 esac
844 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
845 tail=$os
846 ostry=$os
847 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
848   ostry="$ostry /$o"
849   tail=$o
850 done
851 o=`echo $tail | sed 's/[0-9]*$//'`
852 if test $o != $tail; then
853   ostry="$ostry /$o"
855 # For linux-gnu, try linux-gnu, then linux.
856 o=`echo $tail | sed 's/-.*$//'`
857 if test $o != $tail; then
858   ostry="$ostry /$o"
861 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
862 base=
863 tail=$base_os
864 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
865   set $b
866   base="$base /$1"
867   tail="$2"
868 done
870 # For sparc/sparc32, try sparc/sparc32 and then sparc.
871 mach=
872 tail=$machine${submachine:+/$submachine}
873 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
874   set $m
875   # Prepend the machine's FPU directory unless the architecture specific
876   # preconfigure disables it.
877   if test "$libc_cv_with_fp" = yes; then
878     maybe_fpu=/fpu
879   else
880     maybe_fpu=/nofpu
881   fi
882   # For each machine term, try it with and then without /multiarch.
883   for try_fpu in $maybe_fpu ''; do
884     for try_multi in $multi_arch_d ''; do
885       mach="$mach /$1$try_fpu$try_multi"
886     done
887   done
888   tail="$2"
889 done
891 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
892 changequote([,])dnl
894 # Find what sysdep directories exist.
895 sysnames=
896 for b in $base ''; do
897   for m0 in $mach ''; do
898     for v in /$vendor ''; do
899       test "$v" = / && continue
900       for o in /$ostry ''; do
901         test "$o" = / && continue
902         for m in $mach ''; do
903           try_suffix="$m0$b$v$o$m"
904           if test -n "$try_suffix"; then
905             try_srcdir="${srcdir}/"
906             try="sysdeps$try_suffix"
907             test -n "$enable_debug_configure" &&
908             echo "$0 [DEBUG]: try $try" >&2
909             if test -d "$try_srcdir$try"; then
910               sysnames="$sysnames $try"
911               { test -n "$o" || test -n "$b"; } && os_used=t
912               { test -n "$m" || test -n "$m0"; } && machine_used=t
913               case x${m0:-$m} in
914               x*/$submachine) submachine_used=t ;;
915               esac
916             fi
917           fi
918         done
919       done
920     done
921   done
922 done
924 # If the assembler supports gnu_indirect_function symbol type and the
925 # architecture supports multi-arch, we enable multi-arch by default.
926 case $sysnames in
927 *"$multi_arch_d"*)
928   ;;
930   test x"$multi_arch" = xdefault && multi_arch=no
931   ;;
932 esac
933 if test x"$multi_arch" != xno; then
934   AC_DEFINE(USE_MULTIARCH)
936 AC_SUBST(multi_arch)
938 if test -z "$os_used" && test "$os" != none; then
939   AC_MSG_ERROR(Operating system $os is not supported.)
941 if test -z "$machine_used" && test "$machine" != none; then
942   AC_MSG_ERROR(The $machine is not supported.)
944 if test -z "$submachine_used" && test -n "$submachine"; then
945   AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
947 AC_SUBST(submachine)
949 # We have now validated the configuration.
951 # Expand the list of system names into a full list of directories
952 # from each element's parent name and Implies file (if present).
953 set $sysnames
954 names=
955 while test $# -gt 0; do
956   name=$1
957   shift
959   case " $names " in *" $name "*)
960     # Already in the list.
961     continue
962   esac
964   # Report each name as we discover it, so there is no long pause in output.
965   echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
967   name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
969   case $name in
970     /*) xsrcdir= ;;
971     *)  xsrcdir=$srcdir/ ;;
972   esac
973   test -n "$enable_debug_configure" &&
974   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
976   for implies_file in Implies Implies-before Implies-after; do
977     implies_type=`echo $implies_file | sed s/-/_/`
978     eval ${implies_type}=
979     if test -f $xsrcdir$name/$implies_file; then
980       # Collect more names from the `Implies' file (removing comments).
981       implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
982       for x in $implied_candidate; do
983         found=no
984         if test -d $xsrcdir$name_base/$x; then
985           eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
986           found=yes
987         fi
988         try="sysdeps/$x"
989         try_srcdir=$srcdir/
990         test -n "$enable_debug_configure" &&
991          echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
992         if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
993         then
994           eval "${implies_type}=\"\$${implies_type} \$try\""
995           found=yes
996         fi
997         if test $found = no; then
998           AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
999         fi
1000       done
1001     fi
1002   done
1004   # Add NAME to the list of names.
1005   names="$names $name"
1007   # Find the parent of NAME, using the empty string if it has none.
1008 changequote(,)dnl
1009   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
1010 changequote([,])dnl
1012   test -n "$enable_debug_configure" &&
1013     echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
1014 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
1016   # Add the names implied by NAME, and NAME's parent (if it has one), to
1017   # the list of names to be processed (the argument list).  We prepend the
1018   # implied names to the list and append the parent.  We want implied
1019   # directories to come before further directories inferred from the
1020   # configuration components; this ensures that for sysv4, unix/common
1021   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
1022   # after sysv4).
1023   sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
1024   test -n "$sysnames" && set $sysnames
1025 done
1027 # Add the default directories.
1028 default_sysnames="sysdeps/generic"
1029 sysnames="$names $default_sysnames"
1030 AC_SUBST(sysnames)
1031 # The other names were emitted during the scan.
1032 AC_MSG_RESULT($default_sysnames)
1034 # if using special system headers, find out the compiler's sekrit
1035 # header directory and add that to the list.  NOTE: Only does the right
1036 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
1037 if test -n "$sysheaders"; then
1038   SYSINCLUDES=-nostdinc
1039   for d in include include-fixed; do
1040     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1041     SYSINCLUDES="$SYSINCLUDES -isystem $i"
1042   done
1043   SYSINCLUDES="$SYSINCLUDES \
1044 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1045   if test -n "$CXX"; then
1046     CXX_SYSINCLUDES=
1047     for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1048     | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1049       test "x$cxxheaders" != x &&
1050       CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1051     done
1052   fi
1054 AC_SUBST(SYSINCLUDES)
1055 AC_SUBST(CXX_SYSINCLUDES)
1057 # Obtain some C++ header file paths.  This is used to make a local
1058 # copy of those headers in Makerules.
1059 if test -n "$CXX"; then
1060   find_cxx_header () {
1061     echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
1062          | $AWK '$1 == "."{print $2}'
1063   }
1064   CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1065   CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1066   CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1068 AC_SUBST(CXX_CSTDLIB_HEADER)
1069 AC_SUBST(CXX_CMATH_HEADER)
1070 AC_SUBST(CXX_BITS_STD_ABS_H)
1072 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1073 # since this would lead to problems installing/building glibc.
1074 # LD_LIBRARY_PATH contains the current directory if one of the following
1075 # is true:
1076 # - one of the terminals (":" and ";") is the first or last sign
1077 # - two terminals occur directly after each other
1078 # - the path contains an element with a dot in it
1079 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1080 changequote(,)dnl
1081 case ${LD_LIBRARY_PATH} in
1082   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1083     ld_library_path_setting="contains current directory"
1084     ;;
1085   *)
1086     ld_library_path_setting="ok"
1087     ;;
1088 esac
1089 changequote([,])dnl
1090 AC_MSG_RESULT($ld_library_path_setting)
1091 if test "$ld_library_path_setting" != "ok"; then
1092 AC_MSG_ERROR([
1093 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1094 *** building glibc. Please change the environment variable
1095 *** and run configure again.])
1098 AC_PATH_PROG(BASH_SHELL, bash, no)
1100 AC_PATH_PROG(PERL, perl, no)
1101 if test "$PERL" != no &&
1102    (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1103   PERL=no
1105 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1106              $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1108 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1109 cat > conftest.s <<EOF
1110 .text
1111 foo:
1112 .set glibc_conftest_frobozz,foo
1113 .globl glibc_conftest_frobozz
1115 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1116 # (but it doesn't work), so we must do a linking check to be sure.
1117 cat > conftest1.c <<\EOF
1118 extern int glibc_conftest_frobozz;
1119 void _start() { glibc_conftest_frobozz = 1; }
1121 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1122             -nostartfiles -nostdlib $no_ssp \
1123             -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1124   libc_cv_asm_set_directive=yes
1125 else
1126   libc_cv_asm_set_directive=no
1128 rm -f conftest*])
1129 if test $libc_cv_asm_set_directive = yes; then
1130   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1133 AC_CACHE_CHECK(linker support for protected data symbol,
1134                libc_cv_protected_data,
1135                [cat > conftest.c <<EOF
1136                 int bar __attribute__ ((visibility ("protected"))) = 1;
1138                 libc_cv_protected_data=no
1139                 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1140                   cat > conftest.c <<EOF
1141                   extern int bar;
1142                   int main (void) { return bar; }
1144                   if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1145                     libc_cv_protected_data=yes
1146                   fi
1147                 fi
1148                 rm -f conftest.*
1149                ])
1150 AC_SUBST(libc_cv_protected_data)
1152 AC_CACHE_CHECK(linker support for INSERT in linker script,
1153                libc_cv_insert,
1154                [cat > conftest.c <<EOF
1155                 int __attribute__ ((section(".bar"))) bar = 0x12345678;
1156                 int test (void) { return bar; }
1158                 cat > conftest.t <<EOF
1159                 SECTIONS
1160                 {
1161                   .bar : { *(.bar) }
1162                 }
1163                 INSERT AFTER .rela.dyn;
1165                 libc_cv_insert=no
1166                 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1167                   libc_cv_insert=yes
1168                 fi
1169                 rm -f conftest.*
1170                ])
1171 AC_SUBST(libc_cv_insert)
1173 AC_CACHE_CHECK(for broken __attribute__((alias())),
1174                libc_cv_broken_alias_attribute,
1175                [cat > conftest.c <<EOF
1176                extern int foo (int x) __asm ("xyzzy");
1177                int bar (int x) { return x; }
1178                extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1179                extern int dfoo;
1180                extern __typeof (dfoo) dfoo __asm ("abccb");
1181                int dfoo = 1;
1183                libc_cv_broken_alias_attribute=yes
1184                if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1185                  if grep 'xyzzy' conftest.s >/dev/null &&
1186                     grep 'abccb' conftest.s >/dev/null; then
1187                    libc_cv_broken_alias_attribute=no
1188                  fi
1189                fi
1190                rm -f conftest.c conftest.s
1191                ])
1192 if test $libc_cv_broken_alias_attribute = yes; then
1193   AC_MSG_ERROR(working alias attribute support required)
1196 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1197                libc_cv_have_sdata_section,
1198                [echo "int i;" > conftest.c
1199                 libc_cv_have_sdata_section=no
1200                 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1201                    | grep '\.sdata' >/dev/null; then
1202                   libc_cv_have_sdata_section=yes
1203                 fi
1204                 rm -f conftest.c conftest.so
1205                ])
1206 if test $libc_cv_have_sdata_section = yes; then
1207   AC_DEFINE(HAVE_SDATA_SECTION)
1210 AC_CACHE_CHECK(for libunwind-support in compiler,
1211                libc_cv_cc_with_libunwind, [
1212   cat > conftest.c <<EOF
1213 int main (void) { return 0; }
1215   if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1216      conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1217     libc_cv_cc_with_libunwind=yes
1218   else
1219     libc_cv_cc_with_libunwind=no
1220   fi
1221   rm -f conftest*])
1222 AC_SUBST(libc_cv_cc_with_libunwind)
1223 if test $libc_cv_cc_with_libunwind = yes; then
1224   AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1227 ASFLAGS_config=
1228 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1229                libc_cv_as_noexecstack, [dnl
1230 cat > conftest.c <<EOF
1231 void foo (void) { }
1233 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1234                    -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1235    && grep .note.GNU-stack conftest.s >/dev/null \
1236    && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1237                       -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1238 then
1239   libc_cv_as_noexecstack=yes
1240 else
1241   libc_cv_as_noexecstack=no
1243 rm -f conftest*])
1244 if test $libc_cv_as_noexecstack = yes; then
1245   ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1247 AC_SUBST(ASFLAGS_config)
1249 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1250                     [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1251 AC_SUBST(libc_cv_z_execstack)
1253 LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
1254                     [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
1255 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
1257 LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
1258                     [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
1259 LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
1261 LIBC_LINKER_FEATURE([-z pack-relative-relocs],
1262                     [-Wl,-z,pack-relative-relocs],
1263                     [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
1264 LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
1266 LIBC_LINKER_FEATURE([--no-dynamic-linker],
1267                     [-Wl,--no-dynamic-linker],
1268                     [libc_cv_no_dynamic_linker=yes],
1269                     [libc_cv_no_dynamic_linker=no])
1270 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
1272 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
1273 LIBC_TRY_CC_OPTION([-static-pie],
1274                    [libc_cv_static_pie=yes],
1275                    [libc_cv_static_pie=no])
1277 LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
1279 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1280 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1283 AC_SUBST(libc_cv_fpie)
1285 AC_CACHE_CHECK(for GLOB_DAT reloc,
1286                libc_cv_has_glob_dat, [dnl
1287 cat > conftest.c <<EOF
1288 extern int mumble;
1289 int foo (void) { return mumble; }
1291 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1292                         -fPIC -shared -o conftest.so conftest.c
1293                         -nostdlib -nostartfiles $no_ssp
1294                         1>&AS_MESSAGE_LOG_FD])
1295 then
1296 dnl look for GLOB_DAT relocation.
1297   if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1298     libc_cv_has_glob_dat=yes
1299   else
1300     libc_cv_has_glob_dat=no
1301   fi
1302 else
1303   libc_cv_has_glob_dat=no
1305 rm -f conftest*])
1306 AC_SUBST(libc_cv_has_glob_dat)
1308 AC_CACHE_CHECK([for tls descriptor support], libc_cv_mtls_descriptor,
1309 [dnl
1310 cat > conftest.c <<EOF
1311 __thread int i;
1312 void foo (void)
1314   i = 10;
1317 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=$mtls_descriptor -nostdlib -nostartfiles
1318                    -shared conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
1319 then
1320   libc_cv_mtls_descriptor=$mtls_descriptor
1321 else
1322   libc_cv_mtls_descriptor=no
1324 rm -f conftest*])
1325 AC_SUBST(libc_cv_mtls_descriptor)
1326 LIBC_CONFIG_VAR([have-mtls-descriptor], [$libc_cv_mtls_descriptor])
1328 dnl clang emits an warning for a double alias redirection, to warn the
1329 dnl original symbol is sed even when weak definition overrides it.
1330 dnl It is a usual pattern for weak_alias, where multiple alias point to
1331 dnl same symbol.
1332 AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
1333                libc_cv_wno_ignored_attributes, [dnl
1334 cat > conftest.c <<EOF
1335 void __foo (void)
1338 extern __typeof (__foo) foo __attribute__ ((weak, alias ("__foo")));
1339 extern __typeof (__foo) bar __attribute__ ((weak, alias ("foo")));
1341 libc_cv_wno_ignored_attributes=""
1342 if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
1343 then
1344   libc_cv_wno_ignored_attributes="-Wno-ignored-attributes"
1346 rm -f conftest*])
1347 LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes],
1348                 [$libc_cv_wno_ignored_attributes])
1350 AC_CACHE_CHECK(whether cc puts quotes around section names,
1351                libc_cv_have_section_quotes,
1352                [cat > conftest.c <<EOF
1353                 static const int foo
1354                 __attribute__ ((section ("bar"))) = 1;
1356                 if ${CC-cc} -S conftest.c -o conftest.s; then
1357                   if grep '\.section.*"bar"' conftest.s >/dev/null; then
1358                     libc_cv_have_section_quotes=yes
1359                   else
1360                     libc_cv_have_section_quotes=no
1361                   fi
1362                 else
1363                   libc_cv_have_section_quotes=unknown
1364                 fi
1365                 rm -f conftest.{c,s}
1366                 ])
1367 if test $libc_cv_have_section_quotes = yes; then
1368   AC_DEFINE(HAVE_SECTION_QUOTES)
1371 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1372 cat > conftest.c <<\EOF
1373 void zero (void *x)
1375   __builtin_memset (x, 0, 1000);
1379 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1380 then
1381   libc_cv_gcc_builtin_memset=no
1382 else
1383   libc_cv_gcc_builtin_memset=yes
1385 rm -f conftest* ])
1386 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1387   AC_DEFINE(HAVE_BUILTIN_MEMSET)
1390 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1391 cat > conftest.c <<\EOF
1392 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1393 char *foo (const char *a, const char *b)
1395   return __builtin_strstr (a, b);
1399 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
1400 then
1401   libc_cv_gcc_builtin_redirection=yes
1402 else
1403   libc_cv_gcc_builtin_redirection=no
1405 rm -f conftest* ])
1406 if test "$libc_cv_gcc_builtin_redirection" = no; then
1407   AC_MSG_ERROR([support for the symbol redirection needed])
1410 dnl Determine how to disable generation of FMA instructions.
1411 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1412                libc_cv_cc_nofma, [dnl
1413 libc_cv_cc_nofma=
1414 for opt in -ffp-contract=off -mno-fused-madd; do
1415   LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1416 done])
1417 AC_SUBST(libc_cv_cc_nofma)
1419 if test -n "$submachine"; then
1420   AC_CACHE_CHECK([for compiler option for CPU variant],
1421                  libc_cv_cc_submachine, [dnl
1422   libc_cv_cc_submachine=no
1423   for opt in "-march=$submachine" "-mcpu=$submachine"; do
1424     LIBC_TRY_CC_OPTION([$opt], [
1425       libc_cv_cc_submachine="$opt"
1426       break], [])
1427   done])
1428   if test "x$libc_cv_cc_submachine" = xno; then
1429     AC_MSG_ERROR([${CC-cc} does not support $submachine])
1430   fi
1432 AC_SUBST(libc_cv_cc_submachine)
1434 dnl Determine if compiler supports -fsignaling-nans
1435 AC_CACHE_CHECK([for compiler option that -fsignaling-nans],
1436                libc_cv_cc_signaling_nans, [dnl
1437 LIBC_TRY_CC_OPTION([-Werror -fsignaling-nans],
1438                    [libc_cv_cc_signaling_nans=-fsignaling-nans],
1439                    [libc_cv_cc_signaling_nans=])
1441 LIBC_CONFIG_VAR([config-cflags-signaling-nans],
1442                 [$libc_cv_cc_signaling_nans])
1444 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1445 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1446 cat > conftest.c <<EOF
1447 void
1448 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1449 foo (void) {}
1451 libc_cv_cc_loop_to_function=no
1452 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1453 then
1454   libc_cv_cc_loop_to_function=yes
1456 rm -f conftest*])
1457 if test $libc_cv_cc_loop_to_function = yes; then
1458   AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1460 AC_SUBST(libc_cv_cc_loop_to_function)
1462 dnl Check whether we have the gd library available.
1463 AC_MSG_CHECKING(for libgd)
1464 if test "$with_gd" != "no"; then
1465   old_CFLAGS="$CFLAGS"
1466   CFLAGS="$CFLAGS $libgd_include"
1467   old_LDFLAGS="$LDFLAGS"
1468   LDFLAGS="$LDFLAGS $libgd_ldflags"
1469   old_LIBS="$LIBS"
1470   LIBS="$LIBS -lgd -lpng -lz -lm"
1471   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
1472                  [LIBGD=yes], [LIBGD=no])
1473   CFLAGS="$old_CFLAGS"
1474   LDFLAGS="$old_LDFLAGS"
1475   LIBS="$old_LIBS"
1476 else
1477   LIBGD=no
1479 AC_MSG_RESULT($LIBGD)
1480 AC_SUBST(LIBGD)
1482 # SELinux detection
1483 if test x$with_selinux = xno ; then
1484   have_selinux=no;
1485 else
1486   # See if we have the SELinux library
1487   AC_CHECK_LIB(selinux, is_selinux_enabled,
1488                have_selinux=yes, have_selinux=no)
1489   if test x$with_selinux = xyes ; then
1490     if test x$have_selinux = xno ; then
1491       AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1492     fi
1493   fi
1495 # Check if we're building with SELinux support.
1496 if test "x$have_selinux" = xyes; then
1497   AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1499   # See if we have the libaudit library
1500   AC_CHECK_LIB(audit, audit_log_user_avc_message,
1501                have_libaudit=yes, have_libaudit=no)
1502   if test "x$have_libaudit" = xyes; then
1503     AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1504   fi
1505   AC_SUBST(have_libaudit)
1507   # See if we have the libcap library
1508   AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1509   if test "x$have_libcap" = xyes; then
1510     AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1511   fi
1512   AC_SUBST(have_libcap)
1514 AC_SUBST(have_selinux)
1516 dnl Check if we support the requested _FORTIFY_SOURCE level
1517 dnl If not, then don't use it.
1518 dnl Note that _FORTIFY_SOURCE may have been set through FLAGS too.
1519 dnl _FORTIFY_SOURCE value will be selectively disabled for function that can't
1520 dnl support it
1521 no_fortify_source="-Wp,-U_FORTIFY_SOURCE"
1522 fortify_source="${no_fortify_source}"
1524 AC_CACHE_CHECK([for maximum supported _FORTIFY_SOURCE level],
1525                [libc_cv_supported_fortify_source], [
1526     AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_dynamic_object_size("", 0)])],
1527         [libc_cv_supported_fortify_source=3],
1528         [libc_cv_supported_fortify_source=2])
1531 AS_CASE([$enable_fortify_source],
1532         [yes], [libc_cv_fortify_source=yes enable_fortify_source=$libc_cv_supported_fortify_source],
1533         [1|2], [libc_cv_fortify_source=yes],
1534         [3], [AS_IF([test $libc_cv_supported_fortify_source = 3],
1535                     [libc_cv_fortify_source=yes],
1536                     [AC_MSG_ERROR([Compiler doesn't provide necessary support for _FORTIFY_SOURCE=3])])],
1537         [libc_cv_fortify_source=no])
1539 AS_IF([test "$libc_cv_fortify_source" = yes],
1540       [fortify_source="${fortify_source},-D_FORTIFY_SOURCE=${enable_fortify_source}"]
1541       )
1543 AC_SUBST(enable_fortify_source)
1544 AC_SUBST(libc_cv_fortify_source)
1545 AC_SUBST(no_fortify_source)
1546 AC_SUBST(fortify_source)
1547 LIBC_CONFIG_VAR([supported-fortify], [$libc_cv_supported_fortify_source])
1549 dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
1550 dnl to one symbol (PR 23840).
1551 AC_CACHE_CHECK(whether the assembler requires one version per symbol,
1552                libc_cv_symver_needs_alias, [dnl
1553   cat > conftest.s <<EOF
1554         .text
1555 testfunc:
1556         .globl testfunc
1557         .symver testfunc, testfunc1@VERSION1
1558         .symver testfunc, testfunc1@VERSION2
1560   libc_cv_symver_needs_alias=no
1561   if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
1562     libc_cv_symver_needs_alias=no
1563   else
1564     libc_cv_symver_needs_alias=yes
1565   fi
1566   rm conftest.*
1568 if test "$libc_cv_symver_needs_alias" = yes; then
1569   AC_DEFINE(SYMVER_NEEDS_ALIAS)
1572 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1573                libc_cv_builtin_trap, [dnl
1574 libc_cv_builtin_trap=no
1575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
1576 libc_undefs=`$NM -u conftest.o |
1577   LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1578     2>&AS_MESSAGE_LOG_FD` || {
1579   AC_MSG_ERROR([confusing output from $NM -u])
1581 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1582 if test -z "$libc_undefs"; then
1583   libc_cv_builtin_trap=yes
1584 fi],[])])
1585 if test $libc_cv_builtin_trap = yes; then
1586   AC_DEFINE([HAVE_BUILTIN_TRAP])
1589 dnl C++ feature tests.
1590 AC_LANG_PUSH([C++])
1592 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1593                libc_cv_cxx_thread_local, [
1594 old_CXXFLAGS="$CXXFLAGS"
1595 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1596 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1597 #include <thread>
1599 // Compiler support.
1600 struct S
1602   S ();
1603   ~S ();
1605 thread_local S s;
1606 S * get () { return &s; }
1608 // libstdc++ support.
1609 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1610 #error __cxa_thread_atexit_impl not supported
1611 #endif
1612 ])],
1613                [libc_cv_cxx_thread_local=yes],
1614                [libc_cv_cxx_thread_local=no])
1615 CXXFLAGS="$old_CXXFLAGS"
1617 AC_SUBST(libc_cv_cxx_thread_local)
1619 AC_LANG_POP([C++])
1620 dnl End of C++ feature tests.
1622 ### End of automated tests.
1623 ### Now run sysdeps configure fragments.
1625 # They also can set these variables.
1626 use_ldconfig=no
1627 ldd_rewrite_script=no
1628 libc_cv_sysconfdir=$sysconfdir
1629 libc_cv_localstatedir=$localstatedir
1630 libc_cv_gcc_unwind_find_fde=no
1631 libc_cv_idn=no
1632 pthread_in_libc=yes
1634 # Iterate over all the sysdep directories we will use, running their
1635 # configure fragments.
1636 for dir in $sysnames; do
1637   case $dir in
1638     /*) dest=$dir ;;
1639     *)  dest=$srcdir/$dir ;;
1640   esac
1641   if test -r $dest/configure; then
1642     AC_MSG_RESULT(running configure fragment for $dir)
1643     . $dest/configure
1644   fi
1645 done
1647 if test x"$build_mathvec" = xnotset; then
1648   build_mathvec=no
1650 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1652 AC_SUBST(libc_extra_cflags)
1653 AC_SUBST(libc_extra_cppflags)
1655 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1656   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1658 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1660 # A sysdeps configure fragment can reset this if IFUNC is not actually
1661 # usable even though the assembler knows how to generate the symbol type.
1662 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1663   AC_DEFINE(HAVE_IFUNC)
1665 LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
1667 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1668   AC_DEFINE(HAVE_GCC_IFUNC)
1670 LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
1672 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1673 # configure fragment can override the value to prevent this AC_DEFINE.
1674 AC_SUBST(use_nscd)
1675 if test "x$use_nscd" != xno; then
1676   AC_DEFINE([USE_NSCD])
1678 if test "x$build_nscd" = xdefault; then
1679   build_nscd=$use_nscd
1682 AC_SUBST(libc_cv_slibdir)
1683 AC_SUBST(libc_cv_rtlddir)
1684 AC_SUBST(libc_cv_complocaledir)
1685 AC_SUBST(libc_cv_sysconfdir)
1686 AC_SUBST(libc_cv_localstatedir)
1687 AC_SUBST(libc_cv_rootsbindir)
1689 if test x$use_ldconfig = xyes; then
1690   AC_DEFINE(USE_LDCONFIG)
1692 AC_SUBST(use_ldconfig)
1693 AC_SUBST(ldd_rewrite_script)
1695 AC_SUBST(static)
1696 AC_SUBST(shared)
1698 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1699 [libc_cv_pic_default=yes
1700 cat > conftest.c <<EOF
1701 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1702 # error PIC is default.
1703 #endif
1705 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1706   libc_cv_pic_default=no
1708 rm -f conftest.*])
1709 LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
1711 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
1712 [libc_cv_cc_pie_default=yes
1713 cat > conftest.c <<EOF
1714 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1715 # error PIE is default.
1716 #endif
1718 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1719   libc_cv_cc_pie_default=no
1721 rm -f conftest.*])
1722 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
1724 AC_MSG_CHECKING(if we can build programs as PIE)
1725 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
1726 # error PIE is not supported
1727 #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
1728 AC_MSG_RESULT($libc_cv_pie_supported)
1729 # Disable build-pie-default if target does not support it or glibc is
1730 # configured with --disable-default-pie.
1731 if test "x$default_pie" = xno; then
1732   build_pie_default=no
1733 else
1734   build_pie_default=$libc_cv_pie_supported
1736 LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
1738 AC_MSG_CHECKING(if we can build static PIE programs)
1739 libc_cv_static_pie_supported=$libc_cv_pie_supported
1740 if test "x$libc_cv_pie_supported" != xno \
1741    -a "$libc_cv_no_dynamic_linker" = yes; then
1742   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
1743 # error static PIE is not supported
1744 #endif]])], [libc_cv_static_pie_supported=yes],
1745             [libc_cv_static_pie_supported=no])
1747 AC_MSG_RESULT($libc_cv_static_pie_supported)
1749 # Enable static-pie only if it is available and glibc isn't configured
1750 # with --disable-default-pie.
1751 if test "x$default_pie" = xno; then
1752   libc_cv_static_pie=no
1753 else
1754   libc_cv_static_pie=$libc_cv_static_pie_supported
1756 if test "$libc_cv_static_pie" = "yes"; then
1757   AC_DEFINE(ENABLE_STATIC_PIE)
1759 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
1761 # Set the `multidir' variable by grabbing the variable from the compiler.
1762 # We do it once and save the result in a generated makefile.
1763 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1764 AC_SUBST(libc_cv_multidir)
1766 AC_SUBST(profile)
1767 AC_SUBST(static_nss)
1769 AC_SUBST(DEFINES)
1771 dnl See sysdeps/mach/configure.ac for this variable.
1772 AC_SUBST(mach_interface_list)
1774 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1775 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1776 AC_SUBST(VERSION)
1777 AC_SUBST(RELEASE)
1779 if test "$pthread_in_libc" = yes; then
1780   AC_DEFINE(PTHREAD_IN_LIBC)
1782 AC_SUBST(pthread_in_libc)
1784 AC_CONFIG_FILES([config.make Makefile])
1785 AC_CONFIG_COMMANDS([default],[[
1786 case $CONFIG_FILES in *config.make*)
1787 echo "$config_vars" >> config.make;;
1788 esac
1789 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
1790 AC_OUTPUT