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