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