]> sourceware.org Git - glibc.git/blame - configure.in
Add benchmark inputs for cos and tan
[glibc.git] / configure.in
CommitLineData
f4017d20 1dnl Process this file with autoconf to produce a configure script.
f7934be8 2dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
f318beb8 3AC_INIT([GNU C Library], [(see version.h)], [http://sourceware.org/bugzilla/], [glibc])
5d77b1da 4AC_CONFIG_SRCDIR([include/features.h])
6b7f6183
RM
5AC_CONFIG_HEADERS([config.h])
6AC_CONFIG_AUX_DIR([scripts])
28f540f4 7
8b748aed
JM
8ACX_PKGVERSION([GNU libc])
9ACX_BUGURL([http://www.gnu.org/software/libc/bugs.html])
10AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
11 [Package description])
12AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
13 [Bug reporting address])
14
918b5606
L
15# Glibc should not depend on any header files
16AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
17 [m4_divert_text([DEFAULTS],
18 [ac_includes_default='/* none */'])])
19
bb931195
TS
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# <http://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
23AC_DEFUN([AC_PROG_CPP],
24[AC_REQUIRE([AC_PROG_CC])dnl
25AC_ARG_VAR([CPP], [C preprocessor])dnl
26_AC_ARG_VAR_CPPFLAGS()dnl
27# On Suns, sometimes $CPP names a directory.
28if test -n "$CPP" && test -d "$CPP"; then
29 CPP=
30fi
31if test -z "$CPP"; then
32 CPP="$CC -E"
33fi
34AC_SUBST(CPP)dnl
35])# AC_PROG_CPP
36
b5a5da23
TS
37# We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
38# issue discussed in
39# <http://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
40AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
41
7967983f
RM
42dnl This is here so we can set $subdirs directly based on configure fragments.
43AC_CONFIG_SUBDIRS()
44
c16a054d
AS
45AC_CANONICAL_HOST
46
c0bac8b0
UD
47AC_PROG_CC
48if test $host != $build; then
49 AC_CHECK_PROGS(BUILD_CC, gcc cc)
50fi
51AC_SUBST(cross_compiling)
52AC_PROG_CPP
53# We need the C++ compiler only for testing.
54AC_PROG_CXX
0cae3f4b 55AC_CHECK_TOOL(READELF, readelf, false)
c0bac8b0 56
c72637d4
RM
57if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
58 AC_MSG_ERROR([you must configure in a separate build directory])
59fi
60
28f540f4
RM
61# This will get text that should go into config.make.
62config_vars=
63
c8f3e6db 64# Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
6b7f6183 65AC_ARG_WITH([gd],
77e8bddf
AS
66 AC_HELP_STRING([--with-gd=DIR],
67 [find libgd include dir and library with prefix DIR]),
c8f3e6db
UD
68 [dnl
69case "$with_gd" in
f5f7239f
UD
70yes|''|no) ;;
71*) libgd_include="-I$withval/include"
c8f3e6db
UD
72 libgd_ldflags="-L$withval/lib" ;;
73esac
74])
6b7f6183 75AC_ARG_WITH([gd-include],
77e8bddf
AS
76 AC_HELP_STRING([--with-gd-include=DIR],
77 [find libgd include files in DIR]),
78 [dnl
f5f7239f
UD
79case "$with_gd_include" in
80''|no) ;;
81*) libgd_include="-I$withval" ;;
82esac
83])
6b7f6183 84AC_ARG_WITH([gd-lib],
77e8bddf
AS
85 AC_HELP_STRING([--with-gd-lib=DIR],
86 [find libgd library files in DIR]),
87 [dnl
f5f7239f
UD
88case "$with_gd_lib" in
89''|no) ;;
90*) libgd_ldflags="-L$withval" ;;
91esac
92])
93
94if test -n "$libgd_include"; then
95 config_vars="$config_vars
cf90163d 96CFLAGS-memusagestat.c = $libgd_include"
f5f7239f
UD
97fi
98if test -n "$libgd_ldflags"; then
99 config_vars="$config_vars
100libgd-LDFLAGS = $libgd_ldflags"
101fi
28f540f4 102
ff3d7ed3 103dnl Arguments to specify presence of other packages/features.
6b7f6183 104AC_ARG_WITH([fp],
77e8bddf
AS
105 AC_HELP_STRING([--with-fp],
106 [if using floating-point hardware @<:@default=yes@:>@]),
6b7f6183
RM
107 [with_fp=$withval],
108 [with_fp=yes])
675322a5 109AC_SUBST(with_fp)
6b7f6183 110AC_ARG_WITH([binutils],
77e8bddf
AS
111 AC_HELP_STRING([--with-binutils=PATH],
112 [specify location of binutils (as and ld)]),
6b7f6183
RM
113 [path_binutils=$withval],
114 [path_binutils=''])
2fff3d93 115AC_ARG_WITH([selinux],
77e8bddf
AS
116 AC_HELP_STRING([--with-selinux],
117 [if building with SELinux support]),
2fff3d93
UD
118 [with_selinux=$withval],
119 [with_selinux=auto])
28f540f4 120
6b7f6183 121AC_ARG_WITH([headers],
77e8bddf
AS
122 AC_HELP_STRING([--with-headers=PATH],
123 [location of system headers to use
6b7f6183
RM
124 (for example /usr/src/linux/include)
125 @<:@default=compiler default@:>@]),
126 [sysheaders=$withval],
127 [sysheaders=''])
c91c505f 128AC_SUBST(sysheaders)
dbe7a0f5 129
f781ef40
RM
130AC_SUBST(use_default_link)
131AC_ARG_WITH([default-link],
132 AC_HELP_STRING([--with-default-link],
fd5e21c7 133 [do not use explicit linker scripts]),
f781ef40 134 [use_default_link=$withval],
fd5e21c7 135 [use_default_link=default])
f781ef40 136
6b7f6183 137AC_ARG_ENABLE([sanity-checks],
77e8bddf
AS
138 AC_HELP_STRING([--disable-sanity-checks],
139 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
6b7f6183
RM
140 [enable_sanity=$enableval],
141 [enable_sanity=yes])
a18f587d 142
6b7f6183 143AC_ARG_ENABLE([shared],
77e8bddf 144 AC_HELP_STRING([--enable-shared],
a0da5fe1 145 [build shared library @<:@default=yes if GNU ld@:>@]),
6b7f6183 146 [shared=$enableval],
a0da5fe1 147 [shared=yes])
6b7f6183 148AC_ARG_ENABLE([profile],
77e8bddf
AS
149 AC_HELP_STRING([--enable-profile],
150 [build profiled library @<:@default=no@:>@]),
6b7f6183 151 [profile=$enableval],
11bf311e 152 [profile=no])
6b7f6183 153AC_ARG_ENABLE([versioning],
77e8bddf
AS
154 AC_HELP_STRING([--disable-versioning],
155 [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
6b7f6183
RM
156 [enable_versioning=$enableval],
157 [enable_versioning=yes])
158
159AC_ARG_ENABLE([oldest-abi],
77e8bddf
AS
160 AC_HELP_STRING([--enable-oldest-abi=ABI],
161 [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
6b7f6183
RM
162 [oldest_abi=$enableval],
163 [oldest_abi=no])
62ab42d6
UD
164if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
165 oldest_abi=default
166else
167 AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
168fi
169AC_SUBST(oldest_abi)
170
740b3dbe
L
171AC_ARG_ENABLE([hardcoded-path-in-tests],
172 AC_HELP_STRING([--enable-hardcoded-path-in-tests],
173 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
174 [hardcoded_path_in_tests=$enableval],
175 [hardcoded_path_in_tests=no])
176AC_SUBST(hardcoded_path_in_tests)
177
35f1e827
UD
178AC_ARG_ENABLE([stackguard-randomization],
179 AC_HELP_STRING([--enable-stackguard-randomization],
180 [initialize __stack_chk_guard canary with a random number at program start]),
181 [enable_stackguard_randomize=$enableval],
182 [enable_stackguard_randomize=no])
183if test "$enable_stackguard_randomize" = yes; then
184 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
185fi
186
6b3a2224 187dnl Generic infrastructure for drop-in additions to libc.
6b7f6183 188AC_ARG_ENABLE([add-ons],
77e8bddf
AS
189 AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
190 [configure and build add-ons in DIR1,DIR2,...
191 search for add-ons if no parameter given]),
e0a3ed4f 192 , [enable_add_ons=yes])
61952351 193
6b7f6183 194AC_ARG_ENABLE([hidden-plt],
77e8bddf
AS
195 AC_HELP_STRING([--disable-hidden-plt],
196 [do not hide internal function calls to avoid PLT]),
6b7f6183
RM
197 [hidden=$enableval],
198 [hidden=yes])
749a9a4f
RM
199if test "x$hidden" = xno; then
200 AC_DEFINE(NO_HIDDEN)
201fi
202
4df8c11d
UD
203AC_ARG_ENABLE([bind-now],
204 AC_HELP_STRING([--enable-bind-now],
205 [disable lazy relocations in DSOs]),
206 [bindnow=$enableval],
207 [bindnow=no])
208AC_SUBST(bindnow)
209
5107cf1d
UD
210dnl On some platforms we cannot use dynamic loading. We must provide
211dnl static NSS modules.
6b7f6183 212AC_ARG_ENABLE([static-nss],
77e8bddf
AS
213 AC_HELP_STRING([--enable-static-nss],
214 [build static NSS modules @<:@default=no@:>@]),
6b7f6183
RM
215 [static_nss=$enableval],
216 [static_nss=no])
834cef7c
UD
217dnl Enable static NSS also if we build no shared objects.
218if test x"$static_nss" = xyes || test x"$shared" = xno; then
3172f58f 219 static_nss=yes
5107cf1d
UD
220 AC_DEFINE(DO_STATIC_NSS)
221fi
222
6b7f6183 223AC_ARG_ENABLE([force-install],
77e8bddf
AS
224 AC_HELP_STRING([--disable-force-install],
225 [don't force installation of files from this package, even if they are older than the installed files]),
6b7f6183
RM
226 [force_install=$enableval],
227 [force_install=yes])
73237de3
UD
228AC_SUBST(force_install)
229
958f238f
UD
230dnl On some platforms we allow dropping compatibility with all kernel
231dnl versions.
6b7f6183 232AC_ARG_ENABLE([kernel],
77e8bddf
AS
233 AC_HELP_STRING([--enable-kernel=VERSION],
234 [compile for compatibility with kernel not older than VERSION]),
6b7f6183
RM
235 [minimum_kernel=$enableval],
236 [])
86cfe82d
UD
237dnl Prevent unreasonable values.
238if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
239 # Better nothing than this.
240 minimum_kernel=""
269e369f
UD
241else
242 if test "$minimum_kernel" = current; then
243 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
244 fi
86cfe82d 245fi
958f238f 246
6cc7d725
UD
247dnl For the development we sometimes want gcc to issue even more warnings.
248dnl This is not the default since many of the extra warnings are not
249dnl appropriate.
6b7f6183
RM
250AC_ARG_ENABLE([all-warnings],
251 AC_HELP_STRING([--enable-all-warnings],
77e8bddf 252 [enable all useful warnings gcc can issue]),
6b7f6183
RM
253 [all_warnings=$enableval],
254 [])
6cc7d725
UD
255AC_SUBST(all_warnings)
256
425ce2ed
UD
257AC_ARG_ENABLE([multi-arch],
258 AC_HELP_STRING([--enable-multi-arch],
259 [enable single DSO with optimizations for multiple architectures]),
260 [multi_arch=$enableval],
6f89d2f3 261 [multi_arch=default])
425ce2ed 262
ff886b82
UD
263AC_ARG_ENABLE([nss-crypt],
264 AC_HELP_STRING([--enable-nss-crypt],
265 [enable libcrypt to use nss]),
266 [nss_crypt=$enableval],
267 [nss_crypt=no])
268if test x$nss_crypt = xyes; then
269 nss_includes=-I$(nss-config --includedir 2>/dev/null)
270 if test $? -ne 0; then
271 AC_MSG_ERROR([cannot find include directory with nss-config])
272 fi
273 old_CFLAGS="$CFLAGS"
274 CFLAGS="$CFLAGS $nss_includes"
b68e08db 275 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
ff886b82
UD
276#include <hasht.h>
277#include <nsslowhash.h>
b68e08db 278void f (void) { NSSLOW_Init (); }])],
ff886b82
UD
279 libc_cv_nss_crypt=yes,
280 AC_MSG_ERROR([
281cannot find NSS headers with lowlevel hash function interfaces]))
282 old_LIBS="$LIBS"
283 LIBS="$LIBS -lfreebl3"
284 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
285#include <hasht.h>
286#include <nsslowhash.h>],
287 [NSSLOW_Init();])],
288 libc_cv_nss_crypt=yes,
289 AC_MSG_ERROR([
290cannot link program using lowlevel NSS hash functions]))
291 CFLAGS="$old_CFLAGS"
292 LIBS="$old_LIBS"
293else
294 libc_cv_nss_crypt=no
295fi
296AC_SUBST(libc_cv_nss_crypt)
297
3a097cc7 298
021db4be
AJ
299AC_ARG_ENABLE([obsolete-rpc],
300 AC_HELP_STRING([--enable-obsolete-rpc],
301 [build and install the obsolete RPC code for link-time usage]),
302 [link_obsolete_rpc=$enableval],
303 [link_obsolete_rpc=no])
304AC_SUBST(link_obsolete_rpc)
305
306if test "$link_obsolete_rpc" = yes; then
307 AC_DEFINE(LINK_OBSOLETE_RPC)
308fi
309
3a097cc7
RM
310AC_ARG_ENABLE([systemtap],
311 [AS_HELP_STRING([--enable-systemtap],
312 [enable systemtap static probe points @<:@default=no@:>@])],
313 [systemtap=$enableval],
314 [systemtap=no])
315if test "x$systemtap" != xno; then
316 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
317 old_CFLAGS="$CFLAGS"
318 CFLAGS="-std=gnu99 $CFLAGS"
0e3933b9 319 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
3a097cc7
RM
320void foo (int i, void *p)
321{
322 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
323 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
0e3933b9 324}]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
3a097cc7
RM
325 CFLAGS="$old_CFLAGS"])
326 if test $libc_cv_sdt = yes; then
327 AC_DEFINE([USE_STAP_PROBE])
328 elif test "x$systemtap" != xauto; then
329 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
330 fi
331fi
332
c53d909c
RM
333AC_ARG_ENABLE([build-nscd],
334 [AS_HELP_STRING([--disable-build-nscd],
335 [disable building and installing the nscd daemon])],
336 [build_nscd=$enableval],
337 [build_nscd=default])
338AC_SUBST(build_nscd)
339
3cc3ef96
RM
340# Note the use of $use_nscd is near the bottom of the file.
341AC_ARG_ENABLE([nscd],
342 [AS_HELP_STRING([--disable-nscd],
343 [library functions will not contact the nscd daemon])],
344 [use_nscd=$enableval],
345 [use_nscd=yes])
346
8a523922
UD
347# The way shlib-versions is used to generate soversions.mk uses a
348# fairly simplistic model for name recognition that can't distinguish
349# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
350# of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
351# tell. This doesn't get used much beyond that, so it's fairly safe.
352case "$host_os" in
353linux*)
354 ;;
355gnu*)
356 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
357 ;;
358esac
359
28f540f4
RM
360# We keep the original values in `$config_*' and never modify them, so we
361# can write them unchanged into config.make. Everything else uses
362# $machine, $vendor, and $os, and changes them whenever convenient.
363config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
364
2f64b655
UD
365# Don't allow vendor == "unknown"
366test "$config_vendor" = unknown && config_vendor=
367config_os="`echo $config_os | sed 's/^unknown-//'`"
368
a2fe9c76 369# Some configurations imply other options.
0269750c 370elf=yes
a2fe9c76 371
8f73811b
RM
372# The configure fragment of an add-on port can modify these to supplement
373# or override the table in the case statement below. No fragment should
374# ever change the config_* variables, however.
28f540f4
RM
375machine=$config_machine
376vendor=$config_vendor
377os=$config_os
b22d21b3 378base_os=''
28f540f4 379
a808d541
UD
380# config.guess on some IBM machines says `rs6000' instead of `powerpc'.
381# Unify this here.
382if test "$machine" = rs6000; then
383 machine="powerpc"
384fi
385
f4b07664
RM
386# Braindead PowerPC box with absolutely no FPU.
387case "$machine-$host_os" in
388 powerpc*-*soft)
389 with_fp=no
390 ;;
391esac
392
a01f19c8
CD
393# Configure for i686 if the user asks for i386. We don't support
394# i386 any more but it continues to be common for users to configure
395# 32-bit x86 as i386. We build for i686 instead.
396if test "$machine" = i386; then
397 machine="i686"
398 echo "\
399*** WARNING: Support for i386 is deprecated. Building for i686 instead."
400fi
401
2ceaa76a
RM
402submachine=
403AC_ARG_WITH([cpu],
404 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
405 [dnl
406 case "$withval" in
407 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
408 no) ;;
409 *) submachine="$withval" ;;
410 esac
411])
412
10a803e0
RM
413dnl Let sysdeps/*/preconfigure act here, like they can in add-ons.
414LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
415
e0a3ed4f 416# An add-on can set this when it wants to disable the sanity check below.
8f73811b
RM
417libc_config_ok=no
418
419dnl Having this here, though empty, makes sure that if add-ons' fragments
420dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
421dnl our AC_OUTPUT will actually use it.
422AC_CONFIG_SUBDIRS()
423
e0a3ed4f
RM
424case "$enable_add_ons" in
425''|no) add_ons= ;;
426yes|'*')
427 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
428 sed 's@/[[^/]]*$@@' | sort | uniq`
429 add_ons_automatic=yes
430 ;;
431*) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
432 add_ons_automatic=no ;;
433esac
434
435configured_add_ons=
8f73811b
RM
436add_ons_sfx=
437add_ons_pfx=
438if test x"$add_ons" != x; then
439 for f in $add_ons; do
440 # Some sanity checks
441 case "$f" in
442 crypt)
443 AC_MSG_ERROR([
444*** It seems that you're using an old \`crypt' add-on. crypt is now
445*** part of glibc and using the old add-on will not work with this
446*** release. Start again with fresh sources and without the old
447*** \`crypt' add-on.])
448 ;;
449 localedata)
450 AC_MSG_ERROR([
451*** It seems that you're using an old \`localedata' add-on. localedata
452*** is now part of glibc and using the old add-on will not work with
453*** this release. Start again with fresh sources and without the old
454*** \`localedata' add-on.])
455 ;;
456 esac
8f73811b
RM
457 done
458
9382fcee 459 # Now source each add-on's configure fragment.
c80e931a
RM
460 # The fragments can use $srcdir/$libc_add_on to find themselves,
461 # and test $add_ons_automatic to see if they were explicitly requested.
462 # A fragment can clear (or even change) $libc_add_on to affect
463 # whether it goes into the list to be actually used in the build.
464 use_add_ons=
9382fcee 465 for libc_add_on in $add_ons; do
e0a3ed4f
RM
466 # Test whether such a directory really exists.
467 # It can be absolute, or relative to $srcdir, or relative to the build dir.
468 case "$libc_add_on" in
469 /*)
470 libc_add_on_srcdir=$libc_add_on
471 ;;
472 *)
473 test -d "$srcdir/$libc_add_on" || {
77e8bddf 474 if test -d "$libc_add_on"; then
e0a3ed4f
RM
475 libc_add_on="`pwd`/$libc_add_on"
476 else
477 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
478 fi
479 }
480 libc_add_on_srcdir=$srcdir/$libc_add_on
481 ;;
482 esac
483
484 libc_add_on_frag=$libc_add_on_srcdir/configure
485 libc_add_on_canonical=
7967983f 486 libc_add_on_config_subdirs=
e0a3ed4f
RM
487 if test -r "$libc_add_on_frag"; then
488 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
489 libc_add_on_canonical=unknown
490 libc_add_on_subdirs=
491 . "$libc_add_on_frag"
492 test -z "$libc_add_on" || {
77e8bddf 493 configured_add_ons="$configured_add_ons $libc_add_on"
e0a3ed4f
RM
494 if test "x$libc_add_on_canonical" = xunknown; then
495 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
496 fi
497 for d in $libc_add_on_subdirs; do
498 case "$libc_add_on" in
499 /*) subdir_srcdir="$libc_add_on" ;;
500 *) subdir_srcdir="\$(..)$libc_add_on" ;;
501 esac
502 case "$d" in
503 .)
504 d="${libc_add_on_canonical:-$libc_add_on}"
505 ;;
506 /*)
507 subdir_srcdir="$d"
508 ;;
509 *)
510 subdir_srcdir="$subdir_srcdir/$d"
511 ;;
512 esac
513 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
514 add_on_subdirs="$add_on_subdirs $d"
515 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
516$d-srcdir = $subdir_srcdir"
517 done
7967983f
RM
518 for d in $libc_add_on_config_subdirs; do
519 case "$d" in
520 /*) AC_MSG_ERROR(dnl
521fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
522 esac
523 if test ! -d "$libc_add_on_srcdir/$d"; then
524 AC_MSG_ERROR(fragment wants to configure missing directory $d)
525 fi
526 case "$libc_add_on" in
527 /*) AC_MSG_ERROR(dnl
528relative path required for add-on using \$libc_add_on_config_subdirs) ;;
529 esac
530 subdirs="$subdirs $libc_add_on/$d"
531 done
e0a3ed4f 532 }
8f73811b 533 fi
619f9448 534 if test -n "$libc_add_on"; then
10a803e0 535 LIBC_PRECONFIGURE([$libc_add_on_srcdir], [add-on $libc_add_on for])
619f9448
RM
536 use_add_ons="$use_add_ons $libc_add_on"
537 add_ons_pfx="$add_ons_pfx $libc_add_on/"
e0a3ed4f
RM
538 test -z "$libc_add_on_canonical" ||
539 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
619f9448 540 fi
8f73811b 541 done
c80e931a
RM
542 # Use echo to strip excess whitespace.
543 add_ons="`echo $use_add_ons`"
8f73811b
RM
544fi
545AC_SUBST(add_ons)
e0a3ed4f 546AC_SUBST(add_on_subdirs)
8f73811b
RM
547
548
bdc8eb03
UD
549###
550### I put this here to prevent those annoying emails from people who cannot
551### read and try to compile glibc on unsupported platforms. --drepper
552###
553### By using the undocumented --enable-hacker-mode option for configure
554### one can skip this test to make the configuration not fail for unsupported
555### platforms.
556###
8f73811b 557if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
bdc8eb03 558 case "$machine-$host_os" in
2ce4f015 559 *-linux* | *-gnu*)
bdc8eb03
UD
560 ;;
561 *)
562 echo "*** The GNU C library is currently not available for this platform."
563 echo "*** So far nobody cared to port it and if there is no volunteer it"
564 echo "*** might never happen. So, if you have interest to see glibc on"
565 echo "*** this platform visit"
566 echo "*** http://www.gnu.org/software/libc/porting.html"
567 echo "*** and join the group of porters"
568 exit 1
569 ;;
570 esac
571fi
572
28f540f4
RM
573dnl We need to use [ and ] for other purposes for a while now.
574changequote(,)dnl
575# Expand the configuration machine name into a subdirectory by architecture
8f73811b
RM
576# type and particular chip. If an add-on configure fragment already set
577# base_machine, we don't change it.
578test -n "$base_machine" || case "$machine" in
0b755dc4 579i[34567]86) base_machine=i386 machine=i386/$machine ;;
92b27c74
UD
580powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
581powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
136d4332
UD
582s390) base_machine=s390 machine=s390/s390-32 ;;
583s390x) base_machine=s390 machine=s390/s390-64 ;;
88615235
UD
584sh3*) base_machine=sh machine=sh/sh3 ;;
585sh4*) base_machine=sh machine=sh/sh4 ;;
ca34d7a7
UD
586sparc | sparcv[67])
587 base_machine=sparc machine=sparc/sparc32 ;;
588sparcv8 | supersparc | hypersparc)
589 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
ae6b8730
RH
590sparcv8plus | sparcv8plusa | sparcv9)
591 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
bb769ab6 592sparcv8plusb | sparcv9b)
10c6e709 593 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
2d73656b
RM
594sparcv9v)
595 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
46ae8850
JJ
596sparcv9v2)
597 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
b1ecbed2 598sparc64)
ca34d7a7 599 base_machine=sparc machine=sparc/sparc64 ;;
b1ecbed2 600sparc64b)
bb769ab6 601 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
2d73656b
RM
602sparc64v)
603 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
46ae8850
JJ
604sparc64v2)
605 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
3a2832a0 606*) base_machine=$machine ;;
28f540f4 607esac
f0523145
RM
608changequote([,])dnl
609AC_SUBST(base_machine)
28f540f4 610
dfd2257a
UD
611if test "$base_machine" = "i386"; then
612 AC_DEFINE(USE_REGPARMS)
613fi
614
0cae3f4b
MF
615# For the multi-arch option we need support in the assembler & linker.
616AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
617 libc_cv_ld_gnu_indirect_function, [dnl
786b0b67 618cat > conftest.S <<EOF
84b9230c 619.type foo,%gnu_indirect_function
0cae3f4b
MF
620foo:
621.globl _start
622_start:
623.globl __start
624__start:
625.data
786b0b67
AS
626#ifdef _LP64
627.quad foo
628#else
0cae3f4b 629.long foo
786b0b67 630#endif
84b9230c 631EOF
0cae3f4b
MF
632libc_cv_ld_gnu_indirect_function=no
633if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
634 -nostartfiles -nostdlib \
786b0b67 635 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
0cae3f4b
MF
636 # Do a link to see if the backend supports IFUNC relocs.
637 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
638 LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
639 libc_cv_ld_gnu_indirect_function=yes
640 }
84b9230c
MF
641fi
642rm -f conftest*])
643
644AC_MSG_CHECKING(whether .text pseudo-op must be used)
645AC_CACHE_VAL(libc_cv_dot_text, [dnl
646cat > conftest.s <<EOF
647.text
648EOF
649libc_cv_dot_text=
650if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
651 libc_cv_dot_text=.text
652fi
653rm -f conftest*])
654if test -z "$libc_cv_dot_text"; then
655 AC_MSG_RESULT(no)
656else
657 AC_MSG_RESULT(yes)
658fi
659
0cae3f4b 660if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
84b9230c
MF
661 if test x"$multi_arch" = xyes; then
662 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
663 else
664 multi_arch=no
665 fi
666fi
6270516e 667multi_arch_d=
84b9230c
MF
668if test x"$multi_arch" != xno; then
669 multi_arch_d=/multiarch
670fi
671
f0523145 672# Compute the list of sysdep directories for this configuration.
f332db02 673# This can take a while to compute.
f0523145 674sysdep_dir=$srcdir/sysdeps
f332db02 675AC_MSG_CHECKING(sysdep dirs)
f0523145
RM
676dnl We need to use [ and ] for other purposes for a while now.
677changequote(,)dnl
28f540f4
RM
678# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
679os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
680
b22d21b3 681test "x$base_os" != x || case "$os" in
28f540f4
RM
682gnu*)
683 base_os=mach/hurd ;;
2ce4f015 684linux*)
28f540f4 685 base_os=unix/sysv ;;
28f540f4
RM
686esac
687
688# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
689tail=$os
690ostry=$os
691while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
692 ostry="$ostry /$o"
693 tail=$o
75914335 694done
28f540f4
RM
695o=`echo $tail | sed 's/[0-9]*$//'`
696if test $o != $tail; then
697 ostry="$ostry /$o"
698fi
ec4b0518
UD
699# For linux-gnu, try linux-gnu, then linux.
700o=`echo $tail | sed 's/-.*$//'`
701if test $o != $tail; then
702 ostry="$ostry /$o"
703fi
28f540f4
RM
704
705# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
706base=
707tail=$base_os
708while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
709 set $b
710 base="$base /$1"
711 tail="$2"
712done
713
ae6b8730 714# For sparc/sparc32, try sparc/sparc32 and then sparc.
28f540f4 715mach=
2ceaa76a 716tail=$machine${submachine:+/$submachine}
28f540f4
RM
717while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
718 set $m
10ceac89
RM
719 # Prepend the machine's FPU directory unless --without-fp.
720 if test "$with_fp" = yes; then
6270516e 721 maybe_fpu=/fpu
f4b07664 722 else
6270516e 723 maybe_fpu=/nofpu
82d00cab 724 fi
6270516e
RM
725 # For each machine term, try it with and then without /multiarch.
726 for try_fpu in $maybe_fpu ''; do
727 for try_multi in $multi_arch_d ''; do
728 mach="$mach /$1$try_fpu$try_multi"
729 done
730 done
28f540f4
RM
731 tail="$2"
732done
733
734dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
735changequote([,])dnl
736
737# Find what sysdep directories exist.
e0a3ed4f 738sysnames_add_ons=
28f540f4 739sysnames=
4b69abad
RM
740for b in $base ''; do
741 for m0 in $mach ''; do
742 for v in /$vendor ''; do
743 test "$v" = / && continue
744 for o in /$ostry ''; do
745 test "$o" = / && continue
6270516e 746 for m in $mach ''; do
4b69abad 747 for d in $add_ons_pfx ''; do
8f73811b 748 for a in $add_ons_sfx ''; do
1c9f1a02
RM
749 try_suffix="$m0$b$v$o$m"
750 if test -n "$try_suffix"; then
77e8bddf
AS
751 try_srcdir="${srcdir}/"
752 case "$d" in
e0a3ed4f
RM
753 /*) try_srcdir= ;;
754 esac
1c9f1a02 755 try="${d}sysdeps$try_suffix$a"
8f73811b
RM
756 test -n "$enable_debug_configure" &&
757 echo "$0 [DEBUG]: try $try" >&2
e0a3ed4f 758 if test -d "$try_srcdir$try"; then
8f73811b
RM
759 sysnames="$sysnames $try"
760 { test -n "$o" || test -n "$b"; } && os_used=t
761 { test -n "$m" || test -n "$m0"; } && machine_used=t
4b69abad
RM
762 case x${m0:-$m} in
763 x*/$submachine) submachine_used=t ;;
764 esac
e0a3ed4f
RM
765 if test -n "$d"; then
766 case "$sysnames_add_ons" in
767 *" $d "*) ;;
768 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
769 esac
770 fi
8f73811b 771 fi
57ba7bb4 772 fi
8f73811b 773 done
57ba7bb4 774 done
28f540f4
RM
775 done
776 done
777 done
778 done
4b69abad 779done
28f540f4 780
6f89d2f3
L
781# If the assembler supports gnu_indirect_function symbol type and the
782# architecture supports multi-arch, we enable multi-arch by default.
84b9230c
MF
783case $sysnames_add_ons$sysnames in
784*"$multi_arch_d"*)
785 ;;
786*)
77e8bddf 787 test x"$multi_arch" = xdefault && multi_arch=no
84b9230c
MF
788 ;;
789esac
790if test x"$multi_arch" != xno; then
6f89d2f3
L
791 AC_DEFINE(USE_MULTIARCH)
792fi
793AC_SUBST(multi_arch)
794
28f540f4
RM
795if test -z "$os_used" && test "$os" != none; then
796 AC_MSG_ERROR(Operating system $os is not supported.)
797fi
798if test -z "$machine_used" && test "$machine" != none; then
799 AC_MSG_ERROR(The $machine is not supported.)
800fi
2ceaa76a
RM
801if test -z "$submachine_used" && test -n "$submachine"; then
802 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
803fi
804AC_SUBST(submachine)
28f540f4
RM
805
806# We have now validated the configuration.
807
28f540f4
RM
808# Expand the list of system names into a full list of directories
809# from each element's parent name and Implies file (if present).
810set $sysnames
e50ec9f9 811names=
28f540f4
RM
812while test $# -gt 0; do
813 name=$1
814 shift
815
e50ec9f9 816 case " $names " in *" $name "*)
f332db02
RM
817 # Already in the list.
818 continue
e50ec9f9 819 esac
f332db02
RM
820
821 # Report each name as we discover it, so there is no long pause in output.
0b4ee387 822 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
f332db02 823
57ba7bb4
UD
824 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
825
826 case $name in
827 /*) xsrcdir= ;;
828 *) xsrcdir=$srcdir/ ;;
829 esac
830 test -n "$enable_debug_configure" &&
831 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
832
ba75122d
RM
833 for implies_file in Implies Implies-before Implies-after; do
834 implies_type=`echo $implies_file | sed s/-/_/`
835 eval ${implies_type}=
836 if test -f $xsrcdir$name/$implies_file; then
837 # Collect more names from the `Implies' file (removing comments).
838 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
839 for x in $implied_candidate; do
840 found=no
841 if test -d $xsrcdir$name_base/$x; then
842 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
636ccfc8 843 found=yes
ba75122d
RM
844 fi
845 for d in $add_ons_pfx ''; do
846 try="${d}sysdeps/$x"
847 case $d in
848 /*) try_srcdir= ;;
849 *) try_srcdir=$srcdir/ ;;
e0a3ed4f 850 esac
ba75122d
RM
851 test -n "$enable_debug_configure" &&
852 echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
853 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
854 then
855 eval "${implies_type}=\"\$${implies_type} \$try\""
856 found=yes
857 case "$sysnames_add_ons" in
858 *" $d "*) ;;
859 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
860 esac
861 fi
862 done
863 if test $found = no; then
864 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
636ccfc8
UD
865 fi
866 done
ba75122d
RM
867 fi
868 done
28f540f4
RM
869
870 # Add NAME to the list of names.
871 names="$names $name"
872
873 # Find the parent of NAME, using the empty string if it has none.
874changequote(,)dnl
57ba7bb4 875 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
28f540f4
RM
876changequote([,])dnl
877
ba75122d
RM
878 test -n "$enable_debug_configure" &&
879 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
57633811 880Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
ba75122d 881
28f540f4
RM
882 # Add the names implied by NAME, and NAME's parent (if it has one), to
883 # the list of names to be processed (the argument list). We prepend the
884 # implied names to the list and append the parent. We want implied
885 # directories to come before further directories inferred from the
886 # configuration components; this ensures that for sysv4, unix/common
887 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
888 # after sysv4).
ba75122d 889 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
28f540f4
RM
890 test -n "$sysnames" && set $sysnames
891done
892
893# Add the default directories.
83ef87ba 894default_sysnames="sysdeps/generic"
ecdc196c 895sysnames="$names $default_sysnames"
f332db02
RM
896AC_SUBST(sysnames)
897# The other names were emitted during the scan.
ecdc196c 898AC_MSG_RESULT($default_sysnames)
28f540f4 899
e0a3ed4f
RM
900# Collect the list of add-ons that supply partial sysdeps trees.
901sysdeps_add_ons=
902for add_on in $add_ons; do
903 case "$add_on" in
904 /*) xsrcdir= ;;
905 *) xsrcdir="$srcdir/" ;;
906 esac
907
908 test -d "$xsrcdir$add_on/sysdeps" || {
909 case "$configured_add_ons " in
910 *" $add_on "*) ;;
911 *|'')
912 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
913 ;;
914 esac
915 continue
916 }
917
918 sysdeps_add_ons="$sysdeps_add_ons $add_on"
919 case "$sysnames_add_ons" in
920 *" $add_on/ "*) ;;
921 *|'')
922 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
923 continue ;;
924 esac
925
926 found=no
927 for d in $sysnames; do
928 case "$d" in
929 $add_on/sysdeps/*) ;;
930 *) continue ;;
931 esac
932 (cd "$xsrcdir$d" && for f in *[[!~]]; do
933 case "$f" in
934 sys|bits)
935 for ff in $f/*.h; do
936 test -d "$ff" || { test -e "$ff" && exit 88; }
937 done
938 ;;
939 *)
77e8bddf 940 test -d "$f" || { test -e "$f" && exit 88; }
e0a3ed4f
RM
941 ;;
942 esac
943 done)
944 if test $? -eq 88; then
945 found=yes
946 break
947 fi
948 done
949 if test $found = no; then
950 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
951 fi
952done
953AC_SUBST(sysdeps_add_ons)
954
f332db02
RM
955
956### Locate tools.
28f540f4 957
28f540f4 958AC_PROG_INSTALL
2b80a372 959if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
28f540f4 960 # The makefiles need to use a different form to find it in $srcdir.
2b80a372 961 INSTALL='\$(..)./scripts/install-sh -c'
28f540f4 962fi
0e3426bb 963AC_PROG_LN_S
ae828bc6 964
4baa087a 965LIBC_PROG_BINUTILS
4baa087a 966
bec039bc 967# Accept binutils 2.20 or newer.
4baa087a
RM
968AC_CHECK_PROG_VER(AS, $AS, --version,
969 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
bec039bc 970 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
4baa087a
RM
971AC_CHECK_PROG_VER(LD, $LD, --version,
972 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
bec039bc 973 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
4baa087a 974
63bda0c1 975# These programs are version sensitive.
3a12e572 976AC_CHECK_TOOL_PREFIX
4bca4c17 977AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
0e7727f7 978 [version \([egcygnustpi-]*[0-9.]*\)], [4.[3-9].* | 4.[1-9][0-9].* | [5-9].* ],
90d1d40b 979 critic_missing="$critic_missing gcc")
22e65f8f 980AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
8fc1e2ca 981 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
6b4e880f 982 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
63bda0c1 983
22e65f8f 984AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
bdd421cc 985 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
aefdff34
RM
986 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
987 MSGFMT=: aux_missing="$aux_missing msgfmt")
63bda0c1 988AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
8b7fb588 989 [GNU texinfo.* \([0-9][0-9.]*\)],
6a3951a0 990 [4.[5-9]*|4.[1-9][0-9]*|[5-9].*],
aefdff34 991 MAKEINFO=: aux_missing="$aux_missing makeinfo")
d6a97a28 992AC_CHECK_PROG_VER(SED, sed, --version,
07e51550 993 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
aefdff34
RM
994 [3.0[2-9]*|3.[1-9]*|[4-9]*],
995 SED=: aux_missing="$aux_missing sed")
0786794f
AM
996AC_CHECK_PROG_VER(AWK, gawk, --version,
997 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
998 [[3-9].*], critic_missing="$critic_missing gawk")
63bda0c1 999
30b99d79 1000AC_CHECK_TOOL(NM, nm, false)
d30cf5bb 1001
476e7d78
RM
1002AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1003case "x$AUTOCONF" in
1004xno|x|x:) AUTOCONF=no ;;
1005*)
1006 AC_CACHE_CHECK(dnl
1400de2e 1007whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
476e7d78
RM
1008 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
1009 libc_cv_autoconf_works=yes
1010 else
1011 libc_cv_autoconf_works=no
1012 fi])
1013 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1014 ;;
1015esac
92963737 1016if test "x$AUTOCONF" = xno; then
476e7d78 1017 aux_missing="$aux_missing autoconf"
14519931 1018fi
1400de2e 1019
32a448ed
RM
1020test -n "$critic_missing" && AC_MSG_ERROR([
1021*** These critical programs are missing or too old:$critic_missing
1022*** Check the INSTALL file for required versions.])
1023
4bca4c17 1024test -n "$aux_missing" && AC_MSG_WARN([
9c6fffc0 1025*** These auxiliary programs are missing or incompatible versions:$aux_missing
63bda0c1
UD
1026*** some features will be disabled.
1027*** Check the INSTALL file for required versions.])
28f540f4 1028
dbe7a0f5
UD
1029# if using special system headers, find out the compiler's sekrit
1030# header directory and add that to the list. NOTE: Only does the right
1031# thing on a system that doesn't need fixincludes. (Not presently a problem.)
1032if test -n "$sysheaders"; then
67fbfa5c
RM
1033 SYSINCLUDES=-nostdinc
1034 for d in include include-fixed; do
1035 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1036 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1037 done
1038 SYSINCLUDES="$SYSINCLUDES \
3d6ce23a 1039-isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
ef226fec 1040 if test -n "$CXX"; then
7872cfb0 1041 CXX_SYSINCLUDES=
67060746
AC
1042 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1043 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1044 test "x$cxxheaders" != x &&
1045 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1046 done
ef226fec 1047 fi
dbe7a0f5
UD
1048fi
1049AC_SUBST(SYSINCLUDES)
ef226fec 1050AC_SUBST(CXX_SYSINCLUDES)
dbe7a0f5 1051
3911660e
UD
1052# Test if LD_LIBRARY_PATH contains the notation for the current directory
1053# since this would lead to problems installing/building glibc.
1054# LD_LIBRARY_PATH contains the current directory if one of the following
1055# is true:
1056# - one of the terminals (":" and ";") is the first or last sign
1057# - two terminals occur directly after each other
1058# - the path contains an element with a dot in it
1059AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1060changequote(,)dnl
1061case ${LD_LIBRARY_PATH} in
1062 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
b3a86ae1 1063 ld_library_path_setting="contains current directory"
3911660e
UD
1064 ;;
1065 *)
1066 ld_library_path_setting="ok"
1067 ;;
1068esac
1069changequote([,])dnl
1070AC_MSG_RESULT($ld_library_path_setting)
1071if test "$ld_library_path_setting" != "ok"; then
63bda0c1
UD
1072AC_MSG_ERROR([
1073*** LD_LIBRARY_PATH shouldn't contain the current directory when
1074*** building glibc. Please change the environment variable
1075*** and run configure again.])
3911660e 1076fi
8e31cf7e 1077
74bd2300 1078AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
8175a253 1079if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
74bd2300
UD
1080 libc_cv_gcc_static_libgcc=
1081else
1082 libc_cv_gcc_static_libgcc=-static-libgcc
1083fi])
1084AC_SUBST(libc_cv_gcc_static_libgcc)
1085
26f56c1c
UD
1086AC_PATH_PROG(BASH_SHELL, bash, no)
1087if test "$BASH_SHELL" != no &&
1088 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
6973fc01 1089 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
84384f5b
UD
1090 libc_cv_have_bash2=yes
1091else
1092 libc_cv_have_bash2=no
1093fi
1094AC_SUBST(libc_cv_have_bash2)
1095
5290baf0 1096dnl We need a ksh compatible shell for tzselect.
26f56c1c 1097if test "$BASH_SHELL" = no; then
5290baf0
UD
1098 AC_PATH_PROG(KSH, ksh, no)
1099 if test "$KSH" = no; then
1100 libc_cv_have_ksh=no
1101 else
1102 libc_cv_have_ksh=yes
1103 fi
1104else
26f56c1c 1105 KSH="$BASH_SHELL"
5290baf0
UD
1106 AC_SUBST(KSH)
1107 libc_cv_have_ksh=yes
1108fi
1109AC_SUBST(libc_cv_have_ksh)
1110
c0016081 1111AC_PATH_PROG(PERL, perl, no)
2fd5d029
RM
1112if test "$PERL" != no &&
1113 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1114 PERL=no
ecb06196 1115fi
2f512715
AS
1116AC_PATH_PROG(INSTALL_INFO, install-info, no,
1117 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
2de00372
UD
1118AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1119
b8dc6a10 1120AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
28f540f4
RM
1121AC_TRY_COMPILE(dnl
1122[#define __need_size_t
1123#define __need_wchar_t
1124#include <stddef.h>
1125#define __need_NULL
1126#include <stddef.h>], [size_t size; wchar_t wchar;
1127#ifdef offsetof
1128#error stddef.h ignored __need_*
1129#endif
1130if (&size == NULL || &wchar == NULL) abort ();],
77e8bddf
AS
1131 libc_cv_friendly_stddef=yes,
1132 libc_cv_friendly_stddef=no)])
28f540f4
RM
1133if test $libc_cv_friendly_stddef = yes; then
1134 config_vars="$config_vars
1135override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1136fi
1137
b8dc6a10
RM
1138AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1139 libc_cv_need_minus_P, [dnl
28f540f4
RM
1140cat > conftest.S <<EOF
1141#include "confdefs.h"
1142/* Nothing whatsoever. */
1143EOF
3217788f 1144if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
28f540f4
RM
1145 libc_cv_need_minus_P=no
1146else
1147 libc_cv_need_minus_P=yes
1148fi
1149rm -f conftest*])
28f540f4
RM
1150if test $libc_cv_need_minus_P = yes; then
1151 config_vars="$config_vars
1152asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1153fi
1154
b8dc6a10 1155AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
9a70fcab 1156cat > conftest.s <<EOF
2293395f 1157${libc_cv_dot_text}
ae1025be 1158foo:
df2a0c93 1159.set glibc_conftest_frobozz,foo
7b8e0d49 1160.globl glibc_conftest_frobozz
e215c478 1161EOF
df2a0c93
RM
1162# The alpha-dec-osf1 assembler gives only a warning for `.set'
1163# (but it doesn't work), so we must do a linking check to be sure.
1164cat > conftest1.c <<\EOF
1165extern int glibc_conftest_frobozz;
640f0119 1166void _start() { glibc_conftest_frobozz = 1; }
df2a0c93
RM
1167EOF
1168if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
640f0119 1169 -nostartfiles -nostdlib \
0b4ee387 1170 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
e215c478
RM
1171 libc_cv_asm_set_directive=yes
1172else
1173 libc_cv_asm_set_directive=no
1174fi
65b3cbcb 1175rm -f conftest*])
e215c478
RM
1176if test $libc_cv_asm_set_directive = yes; then
1177 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1178fi
1179
415ac3df
UD
1180AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1181 libc_cv_asm_unique_object, [dnl
1182cat > conftest.s <<EOF
1183${libc_cv_dot_text}
1184_sym:
b67e9372 1185.type _sym, %gnu_unique_object
415ac3df
UD
1186EOF
1187if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1188 libc_cv_asm_unique_object=yes
1189else
1190 libc_cv_asm_unique_object=no
1191fi
1192rm -f conftest*])
1193if test $libc_cv_asm_unique_object = yes; then
1194 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1195fi
1196
377a515b
UD
1197AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1198[cat > conftest.s <<EOF
2293395f 1199${libc_cv_dot_text}
4cca6b86 1200_sym:
377a515b
UD
1201.symver _sym,sym@VERS
1202EOF
3217788f 1203if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
377a515b
UD
1204 libc_cv_asm_symver_directive=yes
1205else
1206 libc_cv_asm_symver_directive=no
1207fi
1208rm -f conftest*])
1209AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1210if test $libc_cv_asm_symver_directive = yes; then
1211 cat > conftest.s <<EOF
2293395f 1212${libc_cv_dot_text}
4cca6b86 1213_sym:
377a515b
UD
1214.symver _sym,sym@VERS
1215EOF
1216 cat > conftest.map <<EOF
f43ce637 1217VERS_1 {
377a515b
UD
1218 global: sym;
1219};
f43ce637
UD
1220
1221VERS_2 {
77e8bddf 1222 global: sym;
f43ce637 1223} VERS_1;
377a515b 1224EOF
3217788f
RM
1225 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1226 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1227 -o conftest.so conftest.o
1228 -nostartfiles -nostdlib
1229 -Wl,--version-script,conftest.map
c2f55635 1230 1>&AS_MESSAGE_LOG_FD]);
377a515b
UD
1231 then
1232 libc_cv_ld_version_script_option=yes
1233 else
1234 libc_cv_ld_version_script_option=no
1235 fi
1236 else
1237 libc_cv_ld_version_script_option=no
1238 fi
1239else
1240 libc_cv_ld_version_script_option=no
1241fi
1242rm -f conftest*])
7499a22a
RM
1243if test $shared != no &&
1244 test $libc_cv_asm_symver_directive = yes &&
650425ce
UD
1245 test $libc_cv_ld_version_script_option = yes &&
1246 test $enable_versioning = yes; then
377a515b
UD
1247 VERSIONING=yes
1248 AC_DEFINE(DO_VERSIONING)
1249else
1250 VERSIONING=no
1251fi
1252AC_SUBST(VERSIONING)
1253
a0da5fe1 1254if test $shared != no && test $VERSIONING = no; then
f43ce637 1255 echo "\
f4017d20 1256*** WARNING: You should not compile GNU libc without versioning. Not using
f43ce637
UD
1257*** versioning will introduce incompatibilities so that old binaries
1258*** will not run anymore.
50304ef0 1259*** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
f43ce637 1260fi
a0da5fe1
UD
1261AC_CACHE_CHECK(for .previous assembler directive,
1262 libc_cv_asm_previous_directive, [dnl
1263cat > conftest.s <<EOF
fd26970f
UD
1264.section foo_section
1265.previous
a0da5fe1
UD
1266EOF
1267if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1268 libc_cv_asm_previous_directive=yes
1269else
1270 libc_cv_asm_previous_directive=no
1271fi
1272rm -f conftest*])
1273if test $libc_cv_asm_previous_directive = yes; then
1274 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1275else
1276 AC_CACHE_CHECK(for .popsection assembler directive,
1277 libc_cv_asm_popsection_directive, [dnl
1278 cat > conftest.s <<EOF
1279.pushsection foo_section
1280.popsection
fd26970f 1281EOF
3217788f 1282 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
a0da5fe1 1283 libc_cv_asm_popsection_directive=yes
fd26970f 1284 else
a0da5fe1 1285 libc_cv_asm_popsection_directive=no
fd26970f
UD
1286 fi
1287 rm -f conftest*])
a0da5fe1
UD
1288 if test $libc_cv_asm_popsection_directive = yes; then
1289 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
fd26970f 1290 fi
a0da5fe1
UD
1291fi
1292AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1293 libc_cv_asm_protected_directive, [dnl
1294cat > conftest.s <<EOF
2d499f55
UD
1295.protected foo
1296foo:
1297.hidden bar
1298bar:
1299EOF
a0da5fe1
UD
1300if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1301 libc_cv_asm_protected_directive=yes
1302else
1303 AC_MSG_ERROR(assembler support for symbol visibility is required)
1304fi
1305rm -f conftest*])
0fb7851f 1306
a0da5fe1
UD
1307if test $libc_cv_asm_protected_directive = yes; then
1308 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
0d01dace
UD
1309 libc_cv_visibility_attribute,
1310 [cat > conftest.c <<EOF
1311 int foo __attribute__ ((visibility ("hidden"))) = 1;
1312 int bar __attribute__ ((visibility ("protected"))) = 1;
1313EOF
1314 libc_cv_visibility_attribute=no
61cea1c3 1315 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
0d01dace
UD
1316 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1317 if grep '\.protected.*bar' conftest.s >/dev/null; then
1318 libc_cv_visibility_attribute=yes
1319 fi
1320 fi
1321 fi
f7d82dc9 1322 rm -f conftest.{c,s}
0d01dace 1323 ])
a0da5fe1
UD
1324 if test $libc_cv_visibility_attribute != yes; then
1325 AC_MSG_ERROR(compiler support for visibility attribute is required)
0d01dace 1326 fi
a0da5fe1 1327fi
0d01dace 1328
a0da5fe1
UD
1329if test $libc_cv_visibility_attribute = yes; then
1330 AC_CACHE_CHECK(for broken __attribute__((visibility())),
37ba7d66
UD
1331 libc_cv_broken_visibility_attribute,
1332 [cat > conftest.c <<EOF
1333 int foo (int x);
1334 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1335 int bar (int x) { return x; }
1336EOF
1337 libc_cv_broken_visibility_attribute=yes
f7d82dc9 1338 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
37ba7d66
UD
1339changequote(,)dnl
1340 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1341changequote([,])dnl
1342 libc_cv_broken_visibility_attribute=no
1343 fi
1344 fi
1345 rm -f conftest.c conftest.s
1346 ])
a0da5fe1
UD
1347 if test $libc_cv_broken_visibility_attribute = yes; then
1348 AC_MSG_ERROR(working compiler support for visibility attribute is required)
37ba7d66 1349 fi
a0da5fe1 1350fi
37ba7d66 1351
a0da5fe1
UD
1352AC_CACHE_CHECK(for broken __attribute__((alias())),
1353 libc_cv_broken_alias_attribute,
1354 [cat > conftest.c <<EOF
1355 extern int foo (int x) __asm ("xyzzy");
1356 int bar (int x) { return x; }
1357 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1358 extern int dfoo;
1359 extern __typeof (dfoo) dfoo __asm ("abccb");
1360 int dfoo = 1;
37ba7d66 1361EOF
a0da5fe1
UD
1362 libc_cv_broken_alias_attribute=yes
1363 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1364 if grep 'xyzzy' conftest.s >/dev/null &&
1365 grep 'abccb' conftest.s >/dev/null; then
1366 libc_cv_broken_alias_attribute=no
1367 fi
1368 fi
1369 rm -f conftest.c conftest.s
1370 ])
1371if test $libc_cv_broken_alias_attribute = yes; then
1372 AC_MSG_ERROR(working alias attribute support required)
1373fi
1374
1375if test $libc_cv_visibility_attribute = yes; then
1376 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
0d01dace
UD
1377 libc_cv_have_sdata_section,
1378 [echo "int i;" > conftest.c
1379 libc_cv_have_sdata_section=no
dbc92dc6 1380 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
0d01dace
UD
1381 | grep '\.sdata' >/dev/null; then
1382 libc_cv_have_sdata_section=yes
1383 fi
1384 rm -f conftest.c conftest.so
1385 ])
a0da5fe1
UD
1386 if test $libc_cv_have_sdata_section = yes; then
1387 AC_DEFINE(HAVE_SDATA_SECTION)
0d01dace 1388 fi
a0da5fe1 1389fi
0d01dace 1390
a0da5fe1
UD
1391AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1392 libc_cv_initfini_array, [dnl
07037eeb 1393LIBC_TRY_LINK_STATIC([
5241882c 1394int foo (void) { return 1; }
2c617417 1395int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
07037eeb
JM
1396],
1397 [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
a0da5fe1 1398 libc_cv_initfini_array=yes
5241882c 1399 else
ce33ee7c 1400 libc_cv_initfini_array=no
07037eeb
JM
1401 fi],
1402 [libc_cv_initfini_array=no])
1403])
a0da5fe1
UD
1404if test $libc_cv_initfini_array != yes; then
1405 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1406fi
62bede13 1407
a0da5fe1
UD
1408AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1409 libc_cv_ctors_header, [dnl
1410 libc_cv_ctors_header=yes
07037eeb
JM
1411 LIBC_TRY_LINK_STATIC([
1412__attribute__ ((constructor)) void ctor (void) { asm (""); }
1413__attribute__ ((destructor)) void dtor (void) { asm (""); }
113ddea4 1414],
a0da5fe1 1415 [dnl
113ddea4 1416 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
92963737 1417 { gsub(/\@<:@ */, "@<:@") }
113ddea4
RM
1418 $2 == ".ctors" || $2 == ".dtors" {
1419 size = strtonum("0x" $6)
1420 align = strtonum("0x" $NF)
1421 seen@<:@$2@:>@ = 1
1422 stub@<:@$2@:>@ = size == align * 2
92963737 1423 }
113ddea4
RM
1424 END {
1425 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1426 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1427 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1428 }
1429 '], [libc_cv_ctors_header=no])
1430 ], [dnl
1431 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1432 ])
a0da5fe1
UD
1433])
1434if test $libc_cv_ctors_header = no; then
1435 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1436fi
5241882c 1437
a0da5fe1
UD
1438AC_CACHE_CHECK(for libunwind-support in compiler,
1439 libc_cv_cc_with_libunwind, [
1440 cat > conftest.c <<EOF
cbdb12de
UD
1441int main (void) { return 0; }
1442EOF
a0da5fe1 1443 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
8175a253 1444 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
a0da5fe1
UD
1445 libc_cv_cc_with_libunwind=yes
1446 else
1447 libc_cv_cc_with_libunwind=no
c776b3d7 1448 fi
a0da5fe1
UD
1449 rm -f conftest*])
1450AC_SUBST(libc_cv_cc_with_libunwind)
1451if test $libc_cv_cc_with_libunwind = yes; then
1452 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1453fi
c776b3d7 1454
6bfea974
L
1455LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
1456 [libc_cv_z_nodelete=yes],
1457 [AC_MSG_ERROR(linker with -z nodelete support required)])
2f54c82d 1458
6bfea974
L
1459LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
1460 [libc_cv_z_nodlopen=yes],
1461 [AC_MSG_ERROR(linker with -z nodlopen support required)])
5d916713 1462
6bfea974
L
1463LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
1464 [libc_cv_z_initfirst=yes],
1465 [AC_MSG_ERROR(linker with -z initfirst support required)])
639c3248 1466
a0da5fe1
UD
1467# Add-on fragments can set these for other machines.
1468libc_commonpagesize=${libc_commonpagesize:-no}
1469libc_relro_required=${libc_relro_required:-no}
1470case "$base_machine" in
1471 i[[34567]]86 | x86_64 | powerpc* | s390*)
1472 libc_commonpagesize=0x1000
1473 libc_relro_required=yes
1474 ;;
1475 sparc*)
1476 libc_commonpagesize=0x2000
1477 libc_relro_required=yes
1478 ;;
a0da5fe1 1479esac
574920b4 1480
a0da5fe1
UD
1481if test $libc_commonpagesize != no; then
1482 AC_CACHE_CHECK(for -z relro option,
1483 libc_cv_z_relro, [dnl
1484 libc_cv_z_relro=no
1485 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
574920b4
RM
1486int _start (void) { return 42; }
1487extern void _exit (int);
9fa2c032
RM
1488/* Since these pointers are const, they should go in rodata.
1489 Since they refer to functions that have to be resolved by
1490 dynamic linking, they should instead go in RELRO data. */
defe9061 1491const void *const relro[] = { &_start, &_exit, 0 };
9fa2c032
RM
1492/* GNU ld fails to produce RELRO data when it's very small and there is no
1493 normal writable data following it, or if only uninitialized (.bss) data
1494 follows it, or only very small writable data. */
1495int data[0x10000] = { 1, };
574920b4 1496]])])
a0da5fe1 1497 cat > conftest.awk <<\EOF
574920b4
RM
1498BEGIN {
1499 result = "no"
1500 commonpagesize = strtonum(commonpagesize)
1501}
1502{ print "LINE:", $0 > "/dev/stderr" }
1503$1 == "GNU_RELRO" {
1504 vaddr = strtonum($3)
1505 memsz = strtonum($6)
1506 end = vaddr + memsz
1507 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1508 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1509 result = (end % commonpagesize == 0) ? "yes" : "broken"
1510}
1511END { print result }
1512EOF
a0da5fe1 1513 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
574920b4
RM
1514 -fPIC -shared -o conftest.so conftest.c
1515 -nostartfiles -nostdlib
1516 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
a0da5fe1
UD
1517 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1518 AC_TRY_COMMAND([
574920b4
RM
1519 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1520 conftest.ph > conftest.cps
1521 ]) &&
a0da5fe1
UD
1522 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1523 rm -f conftest*])
1524 if { test "x$libc_relro_required" = xyes &&
1525 test "x$libc_cv_z_relro" != xyes
1526 }
1527 then
1528 AC_MSG_ERROR(linker with -z relro support required)
574920b4 1529 fi
a0da5fe1
UD
1530else
1531 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1532fi
ed20b3d9 1533
a0da5fe1
UD
1534AC_CACHE_CHECK(for -Bgroup option,
1535 libc_cv_Bgroup, [dnl
1536cat > conftest.c <<EOF
639c3248
UD
1537int _start (void) { return 42; }
1538EOF
a0da5fe1
UD
1539if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1540 -fPIC -shared -o conftest.so conftest.c
1541 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1542then
1543 libc_cv_Bgroup=yes
1544else
1545 libc_cv_Bgroup=no
1546fi
1547rm -f conftest*])
1548AC_SUBST(libc_cv_Bgroup)
a711b01d 1549
a0da5fe1
UD
1550ASFLAGS_config=
1551AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1552 libc_cv_as_noexecstack, [dnl
1553cat > conftest.c <<EOF
35915ec8
UD
1554void foo (void) { }
1555EOF
a0da5fe1
UD
1556if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1557 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
8175a253 1558 && grep .note.GNU-stack conftest.s >/dev/null \
a0da5fe1
UD
1559 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1560 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1561then
1562 libc_cv_as_noexecstack=yes
1563else
1564 libc_cv_as_noexecstack=no
1565fi
1566rm -f conftest*])
1567if test $libc_cv_as_noexecstack = yes; then
1568 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1569fi
1570AC_SUBST(ASFLAGS_config)
2abf9ff1 1571
a0da5fe1
UD
1572AC_CACHE_CHECK(for -z combreloc,
1573 libc_cv_z_combreloc, [dnl
1574cat > conftest.c <<EOF
d555194c
UD
1575extern int bar (int);
1576extern int mumble;
1577int foo (void) { return bar (mumble); }
a711b01d 1578EOF
a0da5fe1 1579if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
dbc92dc6 1580 -fPIC -shared -o conftest.so conftest.c
35cd3c97 1581 -nostdlib -nostartfiles
c2f55635 1582 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
a0da5fe1 1583then
a711b01d
UD
1584dnl The following test is a bit weak. We must use a tool which can test
1585dnl cross-platform since the gcc used can be a cross compiler. Without
1586dnl introducing new options this is not easily doable. Instead use a tool
1587dnl which always is cross-platform: readelf. To detect whether -z combreloc
1588dnl look for a section named .rel.dyn.
a0da5fe1
UD
1589 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1590 libc_cv_z_combreloc=yes
fdde8349
UD
1591 else
1592 libc_cv_z_combreloc=no
a711b01d 1593 fi
a0da5fe1
UD
1594else
1595 libc_cv_z_combreloc=no
1596fi
1597rm -f conftest*])
1598if test "$libc_cv_z_combreloc" = yes; then
1599 AC_DEFINE(HAVE_Z_COMBRELOC)
1600fi
1601AC_SUBST(libc_cv_z_combreloc)
2abf9ff1 1602
6bfea974
L
1603LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1604 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
a0da5fe1 1605AC_SUBST(libc_cv_z_execstack)
c9c60884 1606
a0da5fe1 1607AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
4da0431d
JM
1608LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1609])
c9c60884 1610
a0da5fe1 1611AC_SUBST(libc_cv_fpie)
871b9158 1612
a0da5fe1
UD
1613AC_CACHE_CHECK(for --hash-style option,
1614 libc_cv_hashstyle, [dnl
1615cat > conftest.c <<EOF
871b9158
UD
1616int _start (void) { return 42; }
1617EOF
a0da5fe1
UD
1618if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1619 -fPIC -shared -o conftest.so conftest.c
1620 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1621then
1622 libc_cv_hashstyle=yes
1623else
1624 libc_cv_hashstyle=no
1625fi
1626rm -f conftest*])
1627AC_SUBST(libc_cv_hashstyle)
1628
1629# The linker's default -shared behavior is good enough if it
1630# does these things that our custom linker scripts ensure that
1631# all allocated NOTE sections come first.
1632if test "$use_default_link" = default; then
1633 AC_CACHE_CHECK([for sufficient default -shared layout],
1634 libc_cv_use_default_link, [dnl
1635 libc_cv_use_default_link=no
1636 cat > conftest.s <<\EOF
fd5e21c7
RM
1637 .section .note.a,"a",%note
1638 .balign 4
1639 .long 4,4,9
1640 .string "GNU"
1641 .string "foo"
1642 .section .note.b,"a",%note
1643 .balign 4
1644 .long 4,4,9
1645 .string "GNU"
1646 .string "bar"
1647EOF
a0da5fe1 1648 if AC_TRY_COMMAND([dnl
fd5e21c7
RM
1649 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1650 ac_try=`$READELF -S conftest.so | sed -n \
1651 ['${x;p;}
1652 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1653 t a
1654 b
1655 : a
1656 H']`
a0da5fe1
UD
1657 then
1658 libc_seen_a=no libc_seen_b=no
1659 set -- $ac_try
1660 while test $# -ge 2 -a "$1" = NOTE; do
1661 case "$2" in
1662 .note.a) libc_seen_a=yes ;;
1663 .note.b) libc_seen_b=yes ;;
1664 esac
1665 shift 2
1666 done
1667 case "$libc_seen_a$libc_seen_b" in
1668 yesyes)
1669 libc_cv_use_default_link=yes
1670 ;;
1671 *)
1672 echo >&AS_MESSAGE_LOG_FD "\
fd5e21c7
RM
1673$libc_seen_a$libc_seen_b from:
1674$ac_try"
a0da5fe1
UD
1675 ;;
1676 esac
fd5e21c7 1677 fi
a0da5fe1
UD
1678 rm -f conftest*])
1679 use_default_link=$libc_cv_use_default_link
fd26970f 1680fi
49803108 1681
5c550700
RM
1682AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1683if libc_cv_output_format=`
1684${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1685then
1686 :
1687else
1688 libc_cv_output_format=
1689fi
1690test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1691AC_SUBST(libc_cv_output_format)
1692
22dca1ea 1693AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
49803108
AJ
1694cat > conftest.c <<EOF
1695int foo;
1696EOF
22dca1ea 1697if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
49803108
AJ
1698 conftest.c 1>&AS_MESSAGE_LOG_FD])
1699then
18e2ac6d 1700 libc_cv_fno_toplevel_reorder=yes
49803108 1701else
18e2ac6d 1702 libc_cv_fno_toplevel_reorder=no
49803108
AJ
1703fi
1704rm -f conftest*])
18e2ac6d 1705if test $libc_cv_fno_toplevel_reorder = yes; then
22dca1ea 1706 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
18e2ac6d 1707else
49803108
AJ
1708 fno_unit_at_a_time=-fno-unit-at-a-time
1709fi
1710AC_SUBST(fno_unit_at_a_time)
fd26970f 1711
401a9ec9 1712AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
17228132
TS
1713LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
1714 [libc_cv_ssp=yes],
1715 [libc_cv_ssp=no])
1716])
401a9ec9
UD
1717AC_SUBST(libc_cv_ssp)
1718
b037a293
UD
1719AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1720cat > conftest.c <<EOF
1721int foo;
1722#ifdef __GNUC_GNU_INLINE__
1723main () { return 0;}
1724#else
1725#error
1726#endif
1727EOF
371f84a4
JJ
1728if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1729 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
b037a293
UD
1730then
1731 libc_cv_gnu89_inline=yes
1732else
1733 libc_cv_gnu89_inline=no
1734fi
1735rm -f conftest*])
1736if test $libc_cv_gnu89_inline = yes; then
1c7570ff 1737 gnu89_inline=-fgnu89-inline
b037a293 1738else
1c7570ff 1739 gnu89_inline=
b037a293 1740fi
1c7570ff 1741AC_SUBST(gnu89_inline)
b037a293 1742
a0da5fe1
UD
1743AC_CACHE_CHECK(whether cc puts quotes around section names,
1744 libc_cv_have_section_quotes,
1745 [cat > conftest.c <<EOF
1746 static const int foo
1747 __attribute__ ((section ("bar"))) = 1;
e26dd47f 1748EOF
a0da5fe1
UD
1749 if ${CC-cc} -S conftest.c -o conftest.s; then
1750 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1751 libc_cv_have_section_quotes=yes
e26dd47f 1752 else
a0da5fe1 1753 libc_cv_have_section_quotes=no
e26dd47f 1754 fi
a0da5fe1
UD
1755 else
1756 libc_cv_have_section_quotes=unknown
1757 fi
1758 rm -f conftest.{c,s}
1759 ])
1760if test $libc_cv_have_section_quotes = yes; then
1761 AC_DEFINE(HAVE_SECTION_QUOTES)
9a97d1f7
UD
1762fi
1763
1764AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
75d86c1f 1765 [dnl
c224a18a 1766cat > conftest.s <<EOF
2293395f 1767${libc_cv_dot_text}
7b8e0d49 1768.globl foo
ae1025be 1769foo:
c224a18a
RM
1770.weak foo
1771.weak bar; bar = foo
1772EOF
3217788f 1773if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
9a97d1f7
UD
1774 libc_cv_asm_weak_directive=yes
1775else
1776 libc_cv_asm_weak_directive=no
1777fi
1778rm -f conftest*])
c224a18a 1779
c8cf0b14 1780if test $libc_cv_asm_weak_directive = no; then
c224a18a
RM
1781 AC_CACHE_CHECK(for assembler .weakext directive,
1782 libc_cv_asm_weakext_directive,
1783 [dnl
1784cat > conftest.s <<EOF
2293395f 1785${libc_cv_dot_text}
7b8e0d49 1786.globl foo
ae1025be 1787foo:
f802accb
UD
1788.weakext bar foo
1789.weakext baz
7b8e0d49 1790.globl baz
9a97d1f7 1791baz:
c224a18a 1792EOF
3217788f 1793 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
c224a18a
RM
1794 libc_cv_asm_weakext_directive=yes
1795 else
1796 libc_cv_asm_weakext_directive=no
1797 fi
1798 rm -f conftest*])
1799
9a97d1f7 1800fi # no .weak
c224a18a 1801
ffcf9634 1802if test $libc_cv_asm_weak_directive = yes; then
c224a18a 1803 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
ffcf9634 1804elif test $libc_cv_asm_weakext_directive = yes; then
c224a18a
RM
1805 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1806fi
1807
50189569 1808AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
ced368f7
UD
1809case $machine in
1810 sparc/sparc64*) cfi_offset=2047;;
1811 *) cfi_offset=0;;
1812esac
50189569 1813cat > conftest.s <<EOF
77e8bddf
AS
1814 .text
1815 .type func,%function
50189569 1816func:
77e8bddf 1817 .cfi_startproc
f212e8dc 1818 .cfi_remember_state
ced368f7 1819 .cfi_rel_offset 1, $cfi_offset
77e8bddf 1820 .cfi_endproc
50189569
AJ
1821EOF
1822if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1823 libc_cv_asm_cfi_directives=yes
1824else
1825 libc_cv_asm_cfi_directives=no
1826fi
1827rm -f conftest*])
1828if test $libc_cv_asm_cfi_directives = yes; then
1829 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
bcd5f356 1830fi
50189569 1831
a641835a
RM
1832AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1833cat > conftest.c <<\EOF
5f0e6fc7 1834_start () {}
dcf0671d
UD
1835int __eh_pc;
1836__throw () {}
a641835a 1837EOF
dcea62dd 1838dnl No \ in command here because it ends up inside ''.
3217788f 1839if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
dcea62dd 1840 -nostdlib -nostartfiles -Wl,--no-whole-archive
c2f55635 1841 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
a641835a
RM
1842 libc_cv_ld_no_whole_archive=yes
1843else
1844 libc_cv_ld_no_whole_archive=no
1845fi
1846rm -f conftest*])
3ce1f295
UD
1847if test $libc_cv_ld_no_whole_archive = no; then
1848 AC_MSG_ERROR([support for --no-whole-archive is needed])
b17277cf 1849fi
a641835a 1850
dff14448 1851AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
b236e99d
UD
1852cat > conftest.c <<\EOF
1853_start () {}
1854int __eh_pc;
1855__throw () {}
1856EOF
1857dnl No \ in command here because it ends up inside ''.
3217788f 1858if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
dff14448 1859 -nostdlib -nostartfiles -fexceptions
c2f55635 1860 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
dff14448 1861 libc_cv_gcc_exceptions=yes
b236e99d 1862else
dff14448 1863 libc_cv_gcc_exceptions=no
b236e99d
UD
1864fi
1865rm -f conftest*])
dff14448
UD
1866if test $libc_cv_gcc_exceptions = yes; then
1867 exceptions=-fexceptions
b17277cf 1868fi
dff14448 1869AC_SUBST(exceptions)dnl
b236e99d 1870
66000494
UD
1871if test "$host_cpu" = powerpc ; then
1872# Check for a bug present in at least versions 2.8.x of GCC
1873# and versions 1.0.x of EGCS.
1874AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
1875AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
1876 libc_cv_c_asmcr0_bug='no',
1877 libc_cv_c_asmcr0_bug='yes')])
1878if test "$libc_cv_c_asmcr0_bug" != 'no'; then
1879 AC_DEFINE(BROKEN_PPC_ASM_CR0)
1880fi
1881fi
1882
d555194c
UD
1883AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1884cat > conftest.c <<\EOF
1885void zero (void *x)
1886{
a52d1562 1887 __builtin_memset (x, 0, 1000);
d555194c
UD
1888}
1889EOF
1890dnl
1891if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1892then
1893 libc_cv_gcc_builtin_memset=no
1894else
1895 libc_cv_gcc_builtin_memset=yes
1896fi
1897rm -f conftest* ])
1898if test "$libc_cv_gcc_builtin_memset" = yes ; then
1899 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1900fi
1901
85dd1003
UD
1902AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1903cat > conftest.c <<\EOF
1904extern char *strstr (const char *, const char *) __asm ("my_strstr");
1905char *foo (const char *a, const char *b)
1906{
1907 return __builtin_strstr (a, b);
1908}
1909EOF
1910dnl
1911if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
1912then
1913 libc_cv_gcc_builtin_redirection=yes
1914else
1915 libc_cv_gcc_builtin_redirection=no
1916fi
1917rm -f conftest* ])
3ce1f295
UD
1918if test "$libc_cv_gcc_builtin_redirection" = no; then
1919 AC_MSG_ERROR([support for the symbol redirection needed])
85dd1003
UD
1920fi
1921
739d440d 1922dnl Check whether the compiler supports the __thread keyword.
3ce1f295
UD
1923AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1924[cat > conftest.c <<\EOF
fbb18522
RM
1925__thread int a = 42;
1926EOF
3ce1f295
UD
1927if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
1928 libc_cv_gcc___thread=yes
739d440d
UD
1929else
1930 libc_cv_gcc___thread=no
1931fi
3ce1f295
UD
1932rm -f conftest*])
1933if test "$libc_cv_gcc___thread" = no; then
1934 AC_MSG_ERROR([support for the __thread keyword is required])
1935fi
739d440d 1936
3ce1f295
UD
1937dnl Check whether the compiler supports the tls_model attribute.
1938AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1939cat > conftest.c <<\EOF
9b21e6bc
RM
1940extern __thread int a __attribute__((tls_model ("initial-exec")));
1941EOF
3ce1f295
UD
1942if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
1943 libc_cv_gcc_tls_model_attr=yes
1944else
1945 libc_cv_gcc_tls_model_attr=no
1946fi
1947rm -f conftest*])
1948if test "$libc_cv_gcc_tls_model_attr" = no; then
1949 AC_MSG_ERROR([support for the tls_model attribute is required])
9b21e6bc 1950fi
739d440d 1951
7998fa78
AS
1952dnl Determine how to disable generation of FMA instructions.
1953AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1954 libc_cv_cc_nofma, [dnl
1955libc_cv_cc_nofma=
1956for opt in -ffp-contract=off -mno-fused-madd; do
1957 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1958done])
bef0b507 1959AC_SUBST(libc_cv_cc_nofma)
7998fa78 1960
2cf9ad57
RM
1961if test -n "$submachine"; then
1962 AC_CACHE_CHECK([for compiler option for CPU variant],
f7d82dc9 1963 libc_cv_cc_submachine, [dnl
2cf9ad57
RM
1964 libc_cv_cc_submachine=no
1965 for opt in "-march=$submachine" "-mcpu=$submachine"; do
40b601fb 1966 LIBC_TRY_CC_OPTION([$opt], [
2cf9ad57 1967 libc_cv_cc_submachine="$opt"
40b601fb 1968 break], [])
2cf9ad57
RM
1969 done])
1970 if test "x$libc_cv_cc_submachine" = xno; then
1971 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1972 fi
1973fi
1974AC_SUBST(libc_cv_cc_submachine)
1975
c8f3e6db
UD
1976dnl Check whether we have the gd library available.
1977AC_MSG_CHECKING(for libgd)
6dab8688
UD
1978if test "$with_gd" != "no"; then
1979 old_CFLAGS="$CFLAGS"
1980 CFLAGS="$CFLAGS $libgd_include"
1981 old_LDFLAGS="$LDFLAGS"
1982 LDFLAGS="$LDFLAGS $libgd_ldflags"
1983 old_LIBS="$LIBS"
1984 LIBS="$LIBS -lgd -lpng -lz -lm"
1985 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1986 CFLAGS="$old_CFLAGS"
1987 LDFLAGS="$old_LDFLAGS"
1988 LIBS="$old_LIBS"
1989else
1990 LIBGD=no
1991fi
c8f3e6db
UD
1992AC_MSG_RESULT($LIBGD)
1993AC_SUBST(LIBGD)
3d558f4e 1994
2fff3d93
UD
1995# SELinux detection
1996if test x$with_selinux = xno ; then
1997 have_selinux=no;
1998else
1999 # See if we have the SELinux library
2000 AC_CHECK_LIB(selinux, is_selinux_enabled,
2001 have_selinux=yes, have_selinux=no)
2002 # See if we have the SELinux header with the NSCD permissions in it.
2003 if test x$have_selinux = xyes ; then
2004 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2005 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2006 [#ifdef NSCD__SHMEMHOST
2007 return 0;
2008 #else
2009 #error NSCD__SHMEMHOST not defined
2010 #endif],
2011 have_selinux=yes, have_selinux=no)
2012 AC_MSG_RESULT($have_selinux)
2013 fi
2014
49155d51 2015 if test x$with_selinux = xyes ; then
2fff3d93 2016 if test x$have_selinux = xno ; then
49155d51 2017 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2fff3d93
UD
2018 fi
2019 fi
2020fi
2021# Check if we're building with SELinux support.
2022if test "x$have_selinux" = xyes; then
943db9eb 2023 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
ec23b9be
UD
2024
2025 # See if we have the libaudit library
943db9eb 2026 AC_CHECK_LIB(audit, audit_log_user_avc_message,
77e8bddf 2027 have_libaudit=yes, have_libaudit=no)
ec23b9be 2028 if test "x$have_libaudit" = xyes; then
943db9eb 2029 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
ec23b9be
UD
2030 fi
2031 AC_SUBST(have_libaudit)
1f063dca
UD
2032
2033 # See if we have the libcap library
2034 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2035 if test "x$have_libcap" = xyes; then
2036 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2037 fi
2038 AC_SUBST(have_libcap)
2fff3d93
UD
2039fi
2040AC_SUBST(have_selinux)
2041
8ed1e7d5
GK
2042dnl check for the size of 'long double'.
2043AC_CHECK_SIZEOF(long double, 0)
2044sizeof_long_double=$ac_cv_sizeof_long_double
2045AC_SUBST(sizeof_long_double)
2046
61653dfb
RM
2047CPPUNDEFS=
2048dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
2049dnl Since we are building the implementations of the fortified functions here,
2050dnl having the macro defined interacts very badly.
2051AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
2052[AC_TRY_COMPILE([], [
2053#ifdef _FORTIFY_SOURCE
2054# error bogon
2055#endif],
2056 [libc_cv_predef_fortify_source=no],
2057 [libc_cv_predef_fortify_source=yes])])
2058if test $libc_cv_predef_fortify_source = yes; then
2059 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
2060fi
2061AC_SUBST(CPPUNDEFS)
2062
30b99d79
RM
2063dnl Check for silly hacked compilers inserting -fstack-protector.
2064dnl This breaks badly for the early startup code we compile, since
2065dnl the compiled code can refer to a magic machine-dependent location
2066dnl for the canary value before we have sufficient setup for that to
2067dnl work. It's also questionable to build all of libc with this flag
2068dnl even when you're doing that for most applications you build, since
2069dnl libc's code is so heavily-used and performance-sensitive. If we
2070dnl ever really want to make that work, it should be enabled explicitly
2071dnl in the libc build, not inherited from implicit compiler settings.
2072AC_CACHE_CHECK([whether $CC implicitly enables -fstack-protector],
2073 libc_cv_predef_stack_protector, [
2074AC_TRY_COMPILE([extern void foobar (char *);],
2075 [char large_array[2048]; foobar (large_array);], [
2076libc_undefs=`$NM -u conftest.o |
2077 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
2078 2>&AS_MESSAGE_LOG_FD` || {
2079 AC_MSG_ERROR([confusing output from $NM -u])
2080}
2081echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
59f0c22e
JM
2082# On some architectures, there are architecture-specific undefined
2083# symbols (resolved by the linker), so filter out unknown symbols.
2084# This will fail to produce the correct result if the compiler
2085# defaults to -fstack-protector but this produces an undefined symbol
2086# other than __stack_chk_fail. However, compilers like that have not
2087# been encountered in practice.
2088libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
30b99d79
RM
2089case "$libc_undefs" in
2090foobar) libc_cv_predef_stack_protector=no ;;
2091'__stack_chk_fail
2092foobar') libc_cv_predef_stack_protector=yes ;;
2093*) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
2094esac],
2095 [AC_MSG_ERROR([test compilation failed])])
2096])
2097libc_extra_cflags=
2098if test $libc_cv_predef_stack_protector = yes; then
2099 libc_extra_cflags=-fno-stack-protector
2100fi
2101AC_SUBST(libc_extra_cflags)
2102
c224a18a
RM
2103### End of automated tests.
2104### Now run sysdeps configure fragments.
2105
cb343854 2106# They also can set these variables.
591e1ffb 2107use_ldconfig=no
cb343854 2108ldd_rewrite_script=no
77259608 2109libc_cv_sysconfdir=$sysconfdir
4248b1b1 2110libc_cv_localstatedir=$localstatedir
74bd2300 2111libc_cv_gcc_unwind_find_fde=no
e2fd3cbe 2112libc_cv_idn=no
cb343854 2113
28f540f4 2114# Iterate over all the sysdep directories we will use, running their
09055553 2115# configure fragments.
28f540f4 2116for dir in $sysnames; do
57ba7bb4
UD
2117 case $dir in
2118 /*) dest=$dir ;;
2119 *) dest=$srcdir/$dir ;;
2120 esac
2121 if test -r $dest/configure; then
d1149385 2122 AC_MSG_RESULT(running configure fragment for $dir)
57ba7bb4 2123 . $dest/configure
28f540f4 2124 fi
28f540f4
RM
2125done
2126
74bd2300
UD
2127if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2128 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2129fi
2130AC_SUBST(libc_cv_gcc_unwind_find_fde)
2131
6e6249d0
RM
2132# A sysdeps configure fragment can reset this if IFUNC is not actually
2133# usable even though the assembler knows how to generate the symbol type.
2134if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
2135 AC_DEFINE(HAVE_IFUNC)
2136fi
2137
3cc3ef96
RM
2138# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
2139# configure fragment can override the value to prevent this AC_DEFINE.
2140AC_SUBST(use_nscd)
2141if test "x$use_nscd" != xno; then
2142 AC_DEFINE([USE_NSCD])
2143fi
c53d909c
RM
2144if test "x$build_nscd" = xdefault; then
2145 build_nscd=$use_nscd
2146fi
3cc3ef96 2147
a53bad16
UD
2148# Test for old glibc 2.0.x headers so that they can be removed properly
2149# Search only in includedir.
2150AC_MSG_CHECKING(for old glibc 2.0.x headers)
350eb336 2151if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
a53bad16
UD
2152then
2153 old_glibc_headers=yes
2154else
2155 old_glibc_headers=no
2156fi
2157AC_MSG_RESULT($old_glibc_headers)
2158if test ${old_glibc_headers} = yes; then
2159 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2160 AC_MSG_WARN(*** be removed.)
2161fi
b195f6bc 2162AC_SUBST(old_glibc_headers)
26b4d766 2163
84384f5b 2164AC_SUBST(libc_cv_slibdir)
aaa8cb4b 2165AC_SUBST(libc_cv_rtlddir)
a1d84548 2166AC_SUBST(libc_cv_localedir)
77259608 2167AC_SUBST(libc_cv_sysconfdir)
4248b1b1 2168AC_SUBST(libc_cv_localstatedir)
1ef32c3d 2169AC_SUBST(libc_cv_rootsbindir)
bcd5f356 2170AC_SUBST(libc_cv_forced_unwind)
1ef32c3d 2171
f57f8055
RM
2172if test x$use_ldconfig = xyes; then
2173 AC_DEFINE(USE_LDCONFIG)
2174fi
591e1ffb 2175AC_SUBST(use_ldconfig)
cb343854 2176AC_SUBST(ldd_rewrite_script)
84384f5b 2177
650425ce 2178AC_SUBST(static)
ff3d7ed3 2179AC_SUBST(shared)
a334319f 2180
ff886b82
UD
2181AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2182[libc_cv_pic_default=yes
cc3fa755 2183cat > conftest.c <<EOF
9756dfe1 2184#if defined __PIC__ || defined __pic__ || defined PIC || defined pic
cc3fa755
UD
2185# error PIC is default.
2186#endif
2187EOF
0b4ee387 2188if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
ff886b82 2189 libc_cv_pic_default=no
cc3fa755
UD
2190fi
2191rm -f conftest.*])
ff886b82 2192AC_SUBST(libc_cv_pic_default)
cc3fa755 2193
ff3d7ed3 2194AC_SUBST(profile)
5107cf1d 2195AC_SUBST(static_nss)
ff3d7ed3 2196
edf5b2d7
UD
2197AC_SUBST(DEFINES)
2198
61c83c3f
RM
2199dnl See sysdeps/mach/configure.in for this variable.
2200AC_SUBST(mach_interface_list)
2201
ee74a442
UD
2202VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2203RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
df4ef2ab 2204AC_SUBST(VERSION)
ee74a442 2205AC_SUBST(RELEASE)
df4ef2ab 2206
728e272a 2207AC_CONFIG_FILES([config.make Makefile])
c118d634 2208AC_CONFIG_COMMANDS([default],[[
737547be
UD
2209case $CONFIG_FILES in *config.make*)
2210echo "$config_vars" >> config.make;;
2211esac
c118d634
RM
2212test -d bits || mkdir bits]],[[config_vars='$config_vars']])
2213AC_OUTPUT
This page took 0.702056 seconds and 5 git commands to generate.