]> git.ipfire.org Git - thirdparty/glibc.git/blame - configure.in
* configure.in: Grok --without-__thread and disable HAVE___THREAD.
[thirdparty/glibc.git] / configure.in
CommitLineData
f4017d20 1dnl Process this file with autoconf to produce a configure script.
ff3d7ed3 2AC_REVISION([$CVSid$])
2f512715 3AC_PREREQ(2.13)dnl dnl Minimum Autoconf version required.
5107cf1d 4AC_INIT(include/features.h)
28f540f4 5AC_CONFIG_HEADER(config.h)
5bc2f642 6AC_CONFIG_AUX_DIR(scripts)
28f540f4
RM
7
8# This will get text that should go into config.make.
9config_vars=
10
11# Check for a --with-gmp argument and set gmp-srcdir in config.make.
12AC_ARG_WITH(gmp, dnl
13 --with-gmp=DIRECTORY find GMP source code in DIRECTORY (not needed),
14 [dnl
15case "$with_gmp" in
16yes) AC_MSG_ERROR(--with-gmp requires an argument; use --with-gmp=DIRECTORY) ;;
17''|no) ;;
18*) config_vars="$config_vars
19gmp-srcdir = $withval" ;;
20esac
21])
c8f3e6db
UD
22# Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
23AC_ARG_WITH(gd, dnl
24 --with-gd=DIR find libgd include dir and library with prefix DIR,
25 [dnl
26case "$with_gd" in
f5f7239f
UD
27yes|''|no) ;;
28*) libgd_include="-I$withval/include"
c8f3e6db
UD
29 libgd_ldflags="-L$withval/lib" ;;
30esac
31])
f5f7239f
UD
32AC_ARG_WITH(gd-include, dnl
33 --with-gd-include=DIR find libgd include files in DIR,
34 [dnl
35case "$with_gd_include" in
36''|no) ;;
37*) libgd_include="-I$withval" ;;
38esac
39])
40AC_ARG_WITH(gd-lib, dnl
41 --with-gd-lib=DIR find libgd library files in DIR,
42 [dnl
43case "$with_gd_lib" in
44''|no) ;;
45*) libgd_ldflags="-L$withval" ;;
46esac
47])
48
49if test -n "$libgd_include"; then
50 config_vars="$config_vars
cf90163d 51CFLAGS-memusagestat.c = $libgd_include"
f5f7239f
UD
52fi
53if test -n "$libgd_ldflags"; then
54 config_vars="$config_vars
55libgd-LDFLAGS = $libgd_ldflags"
56fi
28f540f4 57
ff3d7ed3 58dnl Arguments to specify presence of other packages/features.
335aa320 59AC_ARG_WITH(fp, dnl
a18f587d 60[ --with-fp if using floating-point hardware [default=yes]],
335aa320 61 with_fp=$withval, with_fp=yes)
675322a5 62AC_SUBST(with_fp)
650425ce 63AC_ARG_WITH(binutils, dnl
a5a0310d 64 --with-binutils=PATH specify location of binutils (as and ld),
650425ce 65 path_binutils=$withval, path_binutils='')
28f540f4
RM
66AC_ARG_WITH(elf, dnl
67 --with-elf if using the ELF object format,
335aa320 68 elf=$withval, elf=no)
5af3245a
UD
69AC_ARG_WITH(xcoff, dnl
70 --with-xcoff if using the XCOFF object format,
71 xcoff=$withval, xcoff=no)
4d06461a 72AC_ARG_WITH(cvs, dnl
4442d7e8 73[ --without-cvs if CVS should not be used],
4d06461a 74 with_cvs=$withval, with_cvs=yes)
6b3f2b3d
UD
75if test "$with_cvs" = yes; then
76 if test -d $srcdir/CVS && grep :pserver: $srcdir/CVS/Root > /dev/null
77 then
78 with_cvs=no
79 fi
4442d7e8 80fi
4d06461a 81AC_SUBST(with_cvs)
28f540f4 82
dbe7a0f5
UD
83AC_ARG_WITH(headers, dnl
84[ --with-headers=PATH location of system headers to use
85 [e.g. /usr/src/linux/include]
86 [default=compiler default]],
87 sysheaders=$withval, sysheaders='')
88
a18f587d
UD
89AC_ARG_ENABLE(sanity-checks, dnl
90[ --disable-sanity-checks really do not use threads (should not be used
91 except in special situations) [default=yes]],
92 enable_sanity=$enableval, enable_sanity=yes)
93
650425ce
UD
94dnl Arguments to enable or disable building the static, shared, profiled,
95dnl and -fomit-frame-pointer libraries.
b38bb8ca
UD
96dnl I've disabled this for now since we cannot build glibc without static
97dnl libraries built in the moment.
98dnl AC_ARG_ENABLE(static, dnl
99dnl [ --enable-static build static library [default=yes]],
100dnl static=$enableval, static=yes)
5c2a0669 101static=yes
ff3d7ed3
RM
102AC_ARG_ENABLE(shared, dnl
103[ --enable-shared build shared library [default=yes if GNU ld & ELF]],
6b3a2224 104 shared=$enableval, shared=default)
ff3d7ed3
RM
105AC_ARG_ENABLE(profile, dnl
106[ --enable-profile build profiled library [default=yes]],
6b3a2224 107 profile=$enableval, profile=yes)
ff3d7ed3 108AC_ARG_ENABLE(omitfp, dnl
6b3a2224
RM
109[ --enable-omitfp build undebuggable optimized library [default=no]],
110 omitfp=$enableval, omitfp=no)
5a97622d
UD
111AC_ARG_ENABLE(bounded, dnl
112[ --enable-bounded build with runtime bounds checking [default=no]],
113 bounded=$enableval, bounded=no)
650425ce
UD
114AC_ARG_ENABLE(versioning, dnl
115[ --disable-versioning do not include versioning information in the
116 library objects [default=yes if supported]],
117 enable_versioning=$enableval, enable_versioning=yes)
6b3a2224 118
62ab42d6
UD
119AC_ARG_ENABLE(oldest-abi, dnl
120[ --enable-oldest-abi=ABI configure the oldest ABI supported [e.g. 2.2]
121 [default=glibc default]],
122 oldest_abi=$enableval, oldest_abi=no)
123if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
124 oldest_abi=default
125else
126 AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
127fi
128AC_SUBST(oldest_abi)
129
6b3a2224
RM
130dnl Generic infrastructure for drop-in additions to libc.
131AC_ARG_ENABLE(add-ons, dnl
73237de3
UD
132[ --enable-add-ons[=DIR1,DIR2]...
133 configure and build add-ons in DIR1,DIR2,...
134 search for add-ons if no parameter given],
61952351 135 [case "$enableval" in
9c4c0024
UD
136 yes) add_ons=`cd $srcdir && echo */configure | sed -e 's!/configure!!g'`
137 test "$add_ons" = "*" && add_ons= ;;
61952351
UD
138 *) add_ons=`echo "$enableval" | sed 's/,/ /g'`;;
139 esac],
140 [add_ons=])
141
8d4b5a8a 142dnl Let the user avoid using TLS. Don't know why but...
9cce206e 143dnl XXX For now we disable support by default.
8d4b5a8a 144AC_ARG_WITH(tls, dnl
9cce206e
UD
145[ --with-tls enable support for TLS],
146 usetls=$withval, usetls=no)
8d4b5a8a 147
5b8f26b4
RM
148AC_ARG_WITH(__thread, dnl
149[ --without-__thread do not use TLS features even when supporting them],
150 use__thread=$withval, use__thread=yes)
151
749a9a4f
RM
152AC_ARG_ENABLE(hidden-plt, dnl
153[ --disable-hidden-plt do not hide internal function calls to avoid PLT],
154 hidden=$enableval, hidden=yes)
155if test "x$hidden" = xno; then
156 AC_DEFINE(NO_HIDDEN)
157fi
158
6b3a2224 159AC_CONFIG_SUBDIRS($add_ons)
57ba7bb4 160add_ons_pfx=
da74e902 161if test x"$add_ons" != x; then
57ba7bb4 162 for f in $add_ons; do
aa44a9de
AJ
163 # Some sanity checks
164 if test "$f" = "crypt"; then
165 AC_MSG_ERROR([
166*** It seems that you're using an old \`crypt' add-on. crypt is now
167*** part of glibc and using the old add-on will not work with this
168*** release. Start again with fresh sources and without the old
169*** \`crypt' add-on.])
170 fi
171 if test "$f" = "localedata"; then
172 AC_MSG_ERROR([
173*** It seems that you're using an old \`localedata' add-on. localedata
174*** is now part of glibc and using the old add-on will not work with
175*** this release. Start again with fresh sources and without the old
176*** \`localedata' add-on.])
177 fi
af6f3906
UD
178 # Test whether such a subdir really exists.
179 if test -d $srcdir/$f; then
180 add_ons_pfx="$add_ons_pfx $f/"
181 else
182 AC_MSG_ERROR(add-on directory \"$f\" does not exist)
183 fi
57ba7bb4
UD
184 done
185fi
ff3d7ed3 186
5107cf1d
UD
187dnl On some platforms we cannot use dynamic loading. We must provide
188dnl static NSS modules.
189AC_ARG_ENABLE(static-nss, dnl
190[ --enable-static-nss build static NSS modules [default=no]],
191 static_nss=$enableval, static_nss=no)
834cef7c
UD
192dnl Enable static NSS also if we build no shared objects.
193if test x"$static_nss" = xyes || test x"$shared" = xno; then
3172f58f 194 static_nss=yes
5107cf1d
UD
195 AC_DEFINE(DO_STATIC_NSS)
196fi
197
73237de3 198AC_ARG_ENABLE(force-install,
310b3460 199[ --disable-force-install don't force installation of files from this package,
73237de3
UD
200 even if they are older than the installed files],
201 force_install=$enableval, force_install=yes)
202AC_SUBST(force_install)
203
958f238f
UD
204dnl On some platforms we allow dropping compatibility with all kernel
205dnl versions.
206AC_ARG_ENABLE(kernel,
b5b53bdb 207[ --enable-kernel=VERSION compile for compatibility with kernel not older
958f238f
UD
208 than VERSION],
209 minimum_kernel=$enableval)
86cfe82d
UD
210dnl Prevent unreasonable values.
211if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
212 # Better nothing than this.
213 minimum_kernel=""
269e369f
UD
214else
215 if test "$minimum_kernel" = current; then
216 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
217 fi
86cfe82d 218fi
958f238f 219
6cc7d725
UD
220dnl For the development we sometimes want gcc to issue even more warnings.
221dnl This is not the default since many of the extra warnings are not
222dnl appropriate.
223AC_ARG_ENABLE(all-warnings,
224[ --enable-all-warnings enable all useful warnings gcc can issue],
225 all_warnings=$enableval)
226AC_SUBST(all_warnings)
227
28f540f4 228AC_CANONICAL_HOST
8a523922
UD
229
230# The way shlib-versions is used to generate soversions.mk uses a
231# fairly simplistic model for name recognition that can't distinguish
232# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
233# of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
234# tell. This doesn't get used much beyond that, so it's fairly safe.
235case "$host_os" in
236linux*)
237 ;;
238gnu*)
239 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
240 ;;
241esac
242
28f540f4
RM
243# We keep the original values in `$config_*' and never modify them, so we
244# can write them unchanged into config.make. Everything else uses
245# $machine, $vendor, and $os, and changes them whenever convenient.
246config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
247
2f64b655
UD
248# Don't allow vendor == "unknown"
249test "$config_vendor" = unknown && config_vendor=
250config_os="`echo $config_os | sed 's/^unknown-//'`"
251
a2fe9c76
RM
252# Some configurations imply other options.
253case "$host_os" in
254gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
255 # These systems always use GNU tools.
c8cf0b14 256 gnu_ld=yes gnu_as=yes ;;
a2fe9c76
RM
257esac
258case "$host_os" in
7799b7b3
UD
259# i586-linuxaout is mangled into i586-pc-linux-gnuaout
260linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
3776d592 261 ;;
ffa8d2a0 262gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
3776d592
RM
263 # These systems (almost) always use the ELF format.
264 elf=yes
84724245 265 ;;
5af3245a
UD
266aix*)
267 # These systems are always xcoff
268 xcoff=yes
a711b01d 269 elf=no
5af3245a 270 ;;
a2fe9c76
RM
271esac
272
28f540f4
RM
273machine=$config_machine
274vendor=$config_vendor
275os=$config_os
276
a808d541
UD
277# config.guess on some IBM machines says `rs6000' instead of `powerpc'.
278# Unify this here.
279if test "$machine" = rs6000; then
280 machine="powerpc"
281fi
282
bdc8eb03
UD
283###
284### I put this here to prevent those annoying emails from people who cannot
285### read and try to compile glibc on unsupported platforms. --drepper
286###
287### By using the undocumented --enable-hacker-mode option for configure
288### one can skip this test to make the configuration not fail for unsupported
289### platforms.
290###
291if test -z "$enable_hacker_mode"; then
292 case "$machine-$host_os" in
75d86c1f 293 *-linux* | *-gnu* | arm*-none* | powerpc-aix4.3.*)
bdc8eb03
UD
294 ;;
295 *)
296 echo "*** The GNU C library is currently not available for this platform."
297 echo "*** So far nobody cared to port it and if there is no volunteer it"
298 echo "*** might never happen. So, if you have interest to see glibc on"
299 echo "*** this platform visit"
300 echo "*** http://www.gnu.org/software/libc/porting.html"
301 echo "*** and join the group of porters"
302 exit 1
303 ;;
304 esac
305fi
306
28f540f4
RM
307dnl We need to use [ and ] for other purposes for a while now.
308changequote(,)dnl
309# Expand the configuration machine name into a subdirectory by architecture
310# type and particular chip.
311case "$machine" in
f0523145
RM
312a29k | am29000) base_machine=a29k machine=a29k ;;
313alpha*) base_machine=alpha machine=alpha/$machine ;;
0c8b61e6 314arm*) base_machine=arm machine=arm/arm32/$machine ;;
60c96635
UD
315c3[012]) base_machine=cx0 machine=cx0/c30 ;;
316c4[04]) base_machine=cx0 machine=cx0/c40 ;;
b15cb495
UD
317hppa*64*) base_machine=hppa machine=hppa/hppa64 ;;
318hppa*) base_machine=hppa machine=hppa/hppa1.1 ;;
a8922de8 319i[3456]86) base_machine=i386 machine=i386/$machine ;;
d64e704c 320ia64) base_machine=ia64 machine=ia64 ;;
f0523145
RM
321m680?0) base_machine=m68k machine=m68k/$machine ;;
322m68k) base_machine=m68k machine=m68k/m68020 ;;
323m88???) base_machine=m88k machine=m88k/$machine ;;
324m88k) base_machine=m88k machine=m88k/m88100 ;;
f0523145 325mips64*) base_machine=mips64 machine=mips/mips64/$machine ;;
2b904739 326mips*) base_machine=mips machine=mips/$machine ;;
92b27c74
UD
327powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
328powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
136d4332
UD
329s390) base_machine=s390 machine=s390/s390-32 ;;
330s390x) base_machine=s390 machine=s390/s390-64 ;;
88615235
UD
331sh3*) base_machine=sh machine=sh/sh3 ;;
332sh4*) base_machine=sh machine=sh/sh4 ;;
ca34d7a7
UD
333sparc | sparcv[67])
334 base_machine=sparc machine=sparc/sparc32 ;;
335sparcv8 | supersparc | hypersparc)
336 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
ae6b8730
RH
337sparcv8plus | sparcv8plusa | sparcv9)
338 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
bb769ab6
UD
339sparcv8plusb | sparcv9b)
340 base_machine=sparc machine=sparc/sparc32/sparcv9b ;;
ca34d7a7
UD
341sparc64 | ultrasparc)
342 base_machine=sparc machine=sparc/sparc64 ;;
bb769ab6
UD
343sparc64b | ultrasparc3)
344 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
0c8b61e6 345thumb*) base_machine=thumb machine=arm/thumb/$machine ;;
3a2832a0 346*) base_machine=$machine ;;
28f540f4 347esac
f0523145
RM
348changequote([,])dnl
349AC_SUBST(base_machine)
28f540f4 350
dfd2257a
UD
351if test "$base_machine" = "i386"; then
352 AC_DEFINE(USE_REGPARMS)
353fi
354
f0523145 355# Compute the list of sysdep directories for this configuration.
f332db02 356# This can take a while to compute.
f0523145 357sysdep_dir=$srcdir/sysdeps
f332db02 358AC_MSG_CHECKING(sysdep dirs)
f0523145
RM
359dnl We need to use [ and ] for other purposes for a while now.
360changequote(,)dnl
28f540f4
RM
361# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
362os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
363
364case "$os" in
365gnu*)
366 base_os=mach/hurd ;;
883bc19b 367netbsd* | 386bsd* | freebsd* | bsdi*)
28f540f4 368 base_os=unix/bsd/bsd4.4 ;;
222c4e71 369osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
28f540f4 370 base_os=unix/bsd ;;
d586354e 371sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
28f540f4 372 base_os=unix/sysv ;;
f802accb
UD
373irix6*)
374 base_os=unix/sysv/irix6/$os ;;
d586354e 375solaris[2-9]*)
28f540f4 376 base_os=unix/sysv/sysv4 ;;
908c3d5b
UD
377hpux*)
378 base_os=unix/sysv/hpux/$os ;;
75d86c1f
UD
379aix4.3*)
380 base_os=unix/sysv/aix/aix4.3 ;;
28f540f4
RM
381none)
382 base_os=standalone ;;
383*)
384 base_os='' ;;
385esac
386
387# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
388tail=$os
389ostry=$os
390while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
391 ostry="$ostry /$o"
392 tail=$o
75914335 393done
28f540f4
RM
394o=`echo $tail | sed 's/[0-9]*$//'`
395if test $o != $tail; then
396 ostry="$ostry /$o"
397fi
ec4b0518
UD
398# For linux-gnu, try linux-gnu, then linux.
399o=`echo $tail | sed 's/-.*$//'`
400if test $o != $tail; then
401 ostry="$ostry /$o"
402fi
28f540f4
RM
403
404# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
405base=
406tail=$base_os
407while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
408 set $b
409 base="$base /$1"
410 tail="$2"
411done
412
ae6b8730 413# For sparc/sparc32, try sparc/sparc32 and then sparc.
28f540f4
RM
414mach=
415tail=$machine
416while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
417 set $m
10ceac89
RM
418 # Prepend the machine's FPU directory unless --without-fp.
419 if test "$with_fp" = yes; then
420 mach="$mach /$1/fpu"
82d00cab 421 fi
28f540f4
RM
422 mach="$mach /$1"
423 tail="$2"
424done
425
426dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
427changequote([,])dnl
428
429# Find what sysdep directories exist.
430sysnames=
57ba7bb4
UD
431IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
432for d in $add_ons_pfx ''; do
433 for b in $base ''; do
434 for m0 in $mach ''; do
435 for v in /$vendor ''; do
ae828bc6 436 test "$v" = / && continue
57ba7bb4 437 for o in /$ostry ''; do
ae828bc6 438 test "$o" = / && continue
57ba7bb4
UD
439 for m in $mach ''; do
440 if test "$m0$b$v$o$m"; then
441 try="${d}sysdeps$m0$b$v$o$m"
442 test -n "$enable_debug_configure" &&
443 echo "$0 [DEBUG]: try $try" >&2
9c4c0024 444 if test -d $srcdir/$try; then
57ba7bb4
UD
445 sysnames="$sysnames $try"
446 { test -n "$o" || test -n "$b"; } && os_used=t
447 { test -n "$m" || test -n "$m0"; } && machine_used=t
448 fi
449 fi
450 done
28f540f4
RM
451 done
452 done
453 done
454 done
455done
57ba7bb4 456IFS="$ac_save_ifs"
28f540f4
RM
457
458if test -z "$os_used" && test "$os" != none; then
459 AC_MSG_ERROR(Operating system $os is not supported.)
460fi
461if test -z "$machine_used" && test "$machine" != none; then
462 AC_MSG_ERROR(The $machine is not supported.)
463fi
464
465# We have now validated the configuration.
466
335aa320 467
10ceac89
RM
468# If using ELF, look for an `elf' subdirectory of each machine directory.
469# We prepend these rather than inserting them whereever the machine appears
470# because things specified by the machine's ELF ABI should override
471# OS-specific things, and should always be the same for any OS on the
472# machine (otherwise what's the point of an ABI?).
473if test "$elf" = yes; then
474 elf_dirs=
57ba7bb4 475 for d in $add_ons_pfx ''; do
57ba7bb4 476 for m in $mach; do
9c4c0024 477 if test -d $srcdir/${d}sysdeps$m/elf; then
c2bb8cab 478 elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
57ba7bb4
UD
479 fi
480 done
28f540f4 481 done
57ba7bb4 482 sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
28f540f4
RM
483fi
484
335aa320 485
28f540f4
RM
486# Expand the list of system names into a full list of directories
487# from each element's parent name and Implies file (if present).
488set $sysnames
e50ec9f9 489names=
28f540f4
RM
490while test $# -gt 0; do
491 name=$1
492 shift
493
e50ec9f9 494 case " $names " in *" $name "*)
f332db02
RM
495 # Already in the list.
496 continue
e50ec9f9 497 esac
f332db02
RM
498
499 # Report each name as we discover it, so there is no long pause in output.
500 echo $ac_n "$name $ac_c" >&AC_FD_MSG
501
57ba7bb4
UD
502 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
503
504 case $name in
505 /*) xsrcdir= ;;
506 *) xsrcdir=$srcdir/ ;;
507 esac
508 test -n "$enable_debug_configure" &&
509 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
510
511 if test -f $xsrcdir$name/Implies; then
28f540f4 512 # Collect more names from the `Implies' file (removing comments).
57ba7bb4
UD
513 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
514 implied=
515 for x in $implied_candidate; do
636ccfc8 516 found=no
57ba7bb4
UD
517 if test -d $xsrcdir$name_base/$x; then
518 implied="$implied $name_base/$x";
636ccfc8
UD
519 found=yes
520 fi
521 for d in $add_ons_pfx ''; do
522 try="${d}sysdeps/$x"
523 case $d in
524 /*) try_srcdir= ;;
525 *) try_srcdir=$srcdir/ ;;
526 esac
527 test -n "$enable_debug_configure" &&
528 echo "[DEBUG]: $name implied $x try($d) {$try_srcdir}$try" >&2
529 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
530 then
531 implied="$implied $try"
532 found=yes
533 fi
534 done
535 if test $found = no; then
57ba7bb4
UD
536 AC_MSG_WARN($name/Implies specifies nonexistent $x)
537 fi
28f540f4
RM
538 done
539 else
540 implied=
541 fi
542
543 # Add NAME to the list of names.
544 names="$names $name"
545
546 # Find the parent of NAME, using the empty string if it has none.
547changequote(,)dnl
57ba7bb4 548 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
28f540f4
RM
549changequote([,])dnl
550
551 # Add the names implied by NAME, and NAME's parent (if it has one), to
552 # the list of names to be processed (the argument list). We prepend the
553 # implied names to the list and append the parent. We want implied
554 # directories to come before further directories inferred from the
555 # configuration components; this ensures that for sysv4, unix/common
556 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
557 # after sysv4).
558 sysnames="`echo $implied $* $parent`"
559 test -n "$sysnames" && set $sysnames
560done
561
562# Add the default directories.
ecdc196c 563default_sysnames=sysdeps/generic
2de7874e 564if test "$elf" = yes; then
ecdc196c 565 default_sysnames="sysdeps/generic/elf $default_sysnames"
2de7874e 566fi
ecdc196c 567sysnames="$names $default_sysnames"
f332db02
RM
568AC_SUBST(sysnames)
569# The other names were emitted during the scan.
ecdc196c 570AC_MSG_RESULT($default_sysnames)
28f540f4 571
f332db02
RM
572
573### Locate tools.
28f540f4 574
28f540f4 575AC_PROG_INSTALL
2b80a372 576if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
28f540f4 577 # The makefiles need to use a different form to find it in $srcdir.
2b80a372 578 INSTALL='\$(..)./scripts/install-sh -c'
28f540f4 579fi
0e3426bb 580AC_PROG_LN_S
ae828bc6 581
a4301d41
UD
582# We need the physical current working directory. We cannot use the
583# "pwd -P" shell builtin since that's not portable. Instead we try to
584# find a pwd binary. Note that assigning to the PWD environment
585# variable might have some interesting side effects, so we don't do
586# that.
587AC_PATH_PROG(PWD_P, pwd, no)
588if test "$PWD_P" = no; then
589 AC_MSG_ERROR(*** A pwd binary could not be found.)
590fi
591
63bda0c1 592# These programs are version sensitive.
4bca4c17
UD
593AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
594AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
90d1d40b
RM
595 [version \([egcygnustpi-]*[0-9.]*\)], [3.[2-9]*],
596 critic_missing="$critic_missing gcc")
22e65f8f 597AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
8fc1e2ca 598 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
6b4e880f 599 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
63bda0c1 600
03616749
AJ
601
602if test -n "$critic_missing"; then
603AC_MSG_ERROR([
aefdff34 604*** These critical programs are missing or too old:$critic_missing
03616749
AJ
605*** Check the INSTALL file for required versions.])
606fi
607
608
22e65f8f 609AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
bdd421cc 610 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
aefdff34
RM
611 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
612 MSGFMT=: aux_missing="$aux_missing msgfmt")
63bda0c1 613AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
8b7fb588 614 [GNU texinfo.* \([0-9][0-9.]*\)],
aefdff34
RM
615 [4.*],
616 MAKEINFO=: aux_missing="$aux_missing makeinfo")
d6a97a28 617AC_CHECK_PROG_VER(SED, sed, --version,
aec103d3 618 [GNU sed version \([0-9]*\.[0-9.]*\)],
aefdff34
RM
619 [3.0[2-9]*|3.[1-9]*|[4-9]*],
620 SED=: aux_missing="$aux_missing sed")
63bda0c1 621
1400de2e
RM
622AC_CHECK_PROGS(AUTOCONF, autoconf, no)
623case "x$AUTOCONF" in
624xno|x|x:) AUTOCONF=no ;;
625*)
626 AC_CACHE_CHECK(dnl
627whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
628 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
629 libc_cv_autoconf_works=yes
630 else
631 libc_cv_autoconf_works=no
632 fi])
633 test $libc_cv_autoconf_works = yes || AUTOCONF=no
634 ;;
635esac
636test "x$AUTOCONF" != xno || aux_missing="$aux_missing autoconf"
637
ea9f119b
AJ
638AC_PROG_CC_LOCAL
639AC_CANONICAL_BUILD
640if test $host != $build; then
641 AC_CHECK_PROGS(BUILD_CC, gcc cc)
642fi
643AC_SUBST(cross_compiling)
644AC_PROG_CPP
645LIBC_PROG_BINUTILS
ac8f8c53 646AC_CHECK_TOOL(MIG, mig, MISSING)
ea9f119b
AJ
647
648# Accept binutils 2.10.1 or newer (and also any ia64 2.9 version)
45ef592d
UD
649# XXX Commented out because it filters out too many good versions.
650# XXX --drepper
651# AC_CHECK_PROG_VER(AS, $AS, --version,
652# [GNU assembler.* \([0-9]*\.[0-9.]*\(-ia64-[0-9]*\)*\)],
653# [2.10.[1-9]* | 2.1[1-9]* | 2.9-ia64-*], AS=: critic_missing=t)
ea9f119b 654
4bca4c17 655test -n "$aux_missing" && AC_MSG_WARN([
9c6fffc0 656*** These auxiliary programs are missing or incompatible versions:$aux_missing
63bda0c1
UD
657*** some features will be disabled.
658*** Check the INSTALL file for required versions.])
28f540f4 659
d01d6319
UD
660# glibcbug.in wants to know the compiler version.
661CCVERSION=`$CC -v 2>&1 | sed -n 's/gcc version //p'`
662AC_SUBST(CCVERSION)
663
dbe7a0f5
UD
664# if using special system headers, find out the compiler's sekrit
665# header directory and add that to the list. NOTE: Only does the right
666# thing on a system that doesn't need fixincludes. (Not presently a problem.)
667if test -n "$sysheaders"; then
668 ccheaders=`$CC -print-file-name=include`
669 SYSINCLUDES="-nostdinc -isystem $ccheaders -isystem $sysheaders"
670fi
671AC_SUBST(SYSINCLUDES)
672
97a47867
UD
673# check if ranlib is necessary
674AC_CACHE_CHECK(whether ranlib is necessary, libc_cv_ranlib_necessary, [dnl
675cat > conftest.c <<EOF
676int a;
677char b;
678void c(void) {}
679EOF
680$CC $CFLAGS -c conftest.c
72d4c33d 681$AR cr conftest.a conftest.o
97a47867
UD
682cp conftest.a conftest2.a
683$RANLIB conftest.a
684if cmp -s conftest.a conftest2.a; then
685 libc_cv_ranlib_necessary=no
f38931a9 686else
97a47867
UD
687 libc_cv_ranlib_necessary=yes
688fi
689rm -rf conftest*])
690if test "$libc_cv_ranlib_necessary" = no; then
691 RANLIB=:
f38931a9 692fi
f38931a9 693
3911660e
UD
694# Test if LD_LIBRARY_PATH contains the notation for the current directory
695# since this would lead to problems installing/building glibc.
696# LD_LIBRARY_PATH contains the current directory if one of the following
697# is true:
698# - one of the terminals (":" and ";") is the first or last sign
699# - two terminals occur directly after each other
700# - the path contains an element with a dot in it
701AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
702changequote(,)dnl
703case ${LD_LIBRARY_PATH} in
704 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
b3a86ae1 705 ld_library_path_setting="contains current directory"
3911660e
UD
706 ;;
707 *)
708 ld_library_path_setting="ok"
709 ;;
710esac
711changequote([,])dnl
712AC_MSG_RESULT($ld_library_path_setting)
713if test "$ld_library_path_setting" != "ok"; then
63bda0c1
UD
714AC_MSG_ERROR([
715*** LD_LIBRARY_PATH shouldn't contain the current directory when
716*** building glibc. Please change the environment variable
717*** and run configure again.])
3911660e 718fi
8e31cf7e 719
74bd2300
UD
720AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
721if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
722 libc_cv_gcc_static_libgcc=
723else
724 libc_cv_gcc_static_libgcc=-static-libgcc
725fi])
726AC_SUBST(libc_cv_gcc_static_libgcc)
727
84384f5b 728AC_PATH_PROG(BASH, bash, no)
a18f587d 729if test "$BASH" != no &&
f43ce637 730 $BASH -c 'test "$BASH_VERSINFO" \
6973fc01 731 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
84384f5b
UD
732 libc_cv_have_bash2=yes
733else
734 libc_cv_have_bash2=no
735fi
736AC_SUBST(libc_cv_have_bash2)
737
5290baf0
UD
738dnl We need a ksh compatible shell for tzselect.
739if test "$BASH" = no; then
740 AC_PATH_PROG(KSH, ksh, no)
741 if test "$KSH" = no; then
742 libc_cv_have_ksh=no
743 else
744 libc_cv_have_ksh=yes
745 fi
746else
747 KSH="$BASH"
748 AC_SUBST(KSH)
749 libc_cv_have_ksh=yes
750fi
751AC_SUBST(libc_cv_have_ksh)
752
5aa8ff62 753AC_PROG_AWK
c0016081 754AC_PATH_PROG(PERL, perl, no)
2fd5d029
RM
755if test "$PERL" != no &&
756 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
757 PERL=no
ecb06196 758fi
2f512715
AS
759AC_PATH_PROG(INSTALL_INFO, install-info, no,
760 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
c0016081
UD
761if test "$INSTALL_INFO" != "no"; then
762AC_CACHE_CHECK(for old Debian install-info, libc_cv_old_debian_install_info,
763 [mkdir conftest.d
764 # There is a hard ^_ on the next line. I am open to better ideas.
765 (echo '\1f'
766 echo 'File: dir Node: Top This is the top of the INFO tree'
767 echo '* Menu:') >conftest.d/dir
768 (echo 'INFO-DIR-SECTION i-d-s works'
769 echo 'START-INFO-DIR-ENTRY'
770 echo '* Prog: (prog). Program.'
771 echo 'END-INFO-DIR-ENTRY') >conftest.d/prog.info
772 if $INSTALL_INFO --info-dir=conftest.d conftest.d/prog.info >&AC_FD_CC 2>&1
d8cceb4f 773 then
c0016081
UD
774 if grep -s 'i-d-s works' conftest.d/dir >/dev/null
775 then libc_cv_old_debian_install_info=no
776 else libc_cv_old_debian_install_info=yes
777 fi
778 else libc_cv_old_debian_install_info=no testfailed=t
779 fi
780 rm -fr conftest.d])
781if test -n "$testfailed"
782then AC_MSG_WARN([install-info errored out, check config.log])
783fi
784OLD_DEBIAN_INSTALL_INFO=$libc_cv_old_debian_install_info
785fi
786AC_SUBST(OLD_DEBIAN_INSTALL_INFO)
a2b08ee5 787
2de00372
UD
788AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
789
b8dc6a10 790AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
28f540f4
RM
791echo '#include <stddef.h>
792FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
793if eval "$ac_cpp conftest.c 2>/dev/null" \
794| grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
795 libc_cv_signed_size_t=no
796else
797 libc_cv_signed_size_t=yes
798fi
799rm -f conftest*])
28f540f4
RM
800if test $libc_cv_signed_size_t = yes; then
801 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
802 cat >> confdefs.h <<\EOF
803#undef __SIZE_TYPE__
804#define __SIZE_TYPE__ unsigned
805EOF
806fi
807
b8dc6a10 808AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
28f540f4
RM
809AC_TRY_COMPILE(dnl
810[#define __need_size_t
811#define __need_wchar_t
812#include <stddef.h>
813#define __need_NULL
814#include <stddef.h>], [size_t size; wchar_t wchar;
815#ifdef offsetof
816#error stddef.h ignored __need_*
817#endif
818if (&size == NULL || &wchar == NULL) abort ();],
819 libc_cv_friendly_stddef=yes,
820 libc_cv_friendly_stddef=no)])
28f540f4
RM
821if test $libc_cv_friendly_stddef = yes; then
822 config_vars="$config_vars
823override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
824fi
825
b8dc6a10
RM
826AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
827 libc_cv_need_minus_P, [dnl
28f540f4
RM
828cat > conftest.S <<EOF
829#include "confdefs.h"
830/* Nothing whatsoever. */
831EOF
832if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
833 libc_cv_need_minus_P=no
834else
835 libc_cv_need_minus_P=yes
836fi
837rm -f conftest*])
28f540f4
RM
838if test $libc_cv_need_minus_P = yes; then
839 config_vars="$config_vars
840asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
841fi
842
2293395f
UD
843AC_MSG_CHECKING(whether .text pseudo-op must be used)
844AC_CACHE_VAL(libc_cv_dot_text, [dnl
845cat > conftest.s <<EOF
846.text
847EOF
848libc_cv_dot_text=
849if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
850 libc_cv_dot_text=.text
851fi
852rm -f conftest*])
853if test -z "$libc_cv_dot_text"; then
854 AC_MSG_RESULT(no)
855else
856 AC_MSG_RESULT(yes)
857fi
858
b8dc6a10
RM
859AC_CACHE_CHECK(for assembler global-symbol directive,
860 libc_cv_asm_global_directive, [dnl
9a70fcab 861libc_cv_asm_global_directive=UNKNOWN
908c3d5b 862for ac_globl in .globl .global .EXPORT; do
9a70fcab 863 cat > conftest.s <<EOF
2293395f 864 ${libc_cv_dot_text}
908c3d5b 865 ${ac_globl} foo
ae1025be 866foo:
9a70fcab
UD
867EOF
868 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
869 libc_cv_asm_global_directive=${ac_globl}
870 fi
871 rm -f conftest*
872 test $libc_cv_asm_global_directive != UNKNOWN && break
873done])
9a70fcab
UD
874if test $libc_cv_asm_global_directive = UNKNOWN; then
875 AC_MSG_ERROR(cannot determine asm global directive)
876else
877 AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
878fi
879
b8dc6a10 880AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
9a70fcab 881cat > conftest.s <<EOF
2293395f 882${libc_cv_dot_text}
ae1025be 883foo:
df2a0c93 884.set glibc_conftest_frobozz,foo
9a70fcab 885$libc_cv_asm_global_directive glibc_conftest_frobozz
e215c478 886EOF
df2a0c93
RM
887# The alpha-dec-osf1 assembler gives only a warning for `.set'
888# (but it doesn't work), so we must do a linking check to be sure.
889cat > conftest1.c <<\EOF
890extern int glibc_conftest_frobozz;
891main () { printf ("%d\n", glibc_conftest_frobozz); }
892EOF
893if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
cb2f05ed 894 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
e215c478
RM
895 libc_cv_asm_set_directive=yes
896else
897 libc_cv_asm_set_directive=no
898fi
65b3cbcb 899rm -f conftest*])
e215c478
RM
900if test $libc_cv_asm_set_directive = yes; then
901 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
902fi
903
b88ac073
RM
904AC_CACHE_CHECK(for assembler .type directive prefix,
905 libc_cv_asm_type_prefix, [dnl
906libc_cv_asm_type_prefix=no
907for ac_try_prefix in '@' '%' '#'; do
908 cat > conftest.s <<EOF
909 ${libc_cv_dot_text}
910 ${libc_cv_asm_global_directive} foo
911 .type foo, ${ac_try_prefix}object
912 .size foo, 1
913foo:
914 .byte 1
915EOF
916 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
917 libc_cv_asm_type_prefix=${ac_try_prefix}
918 fi
919 rm -f conftest*
920 test "x$libc_cv_asm_type_prefix" != xno && break
921done])
922if test "x$libc_cv_asm_type_prefix" != xno; then
923 AC_DEFINE_UNQUOTED(ASM_TYPE_DIRECTIVE_PREFIX, ${libc_cv_asm_type_prefix})
924fi
925
2aa15430 926# The Aix ld uses global .symbol_names instead of symbol_names.
92b27c74
UD
927# Unfortunately also used in the PPC64 ELF ABI.
928case "${os}${machine}" in
929aix4.3* | linux*powerpc/powerpc64*)
2aa15430
UD
930 AC_DEFINE(HAVE_ASM_GLOBAL_DOT_NAME)
931esac
932
377a515b
UD
933AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
934[cat > conftest.s <<EOF
2293395f 935${libc_cv_dot_text}
4cca6b86 936_sym:
377a515b
UD
937.symver _sym,sym@VERS
938EOF
939if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
940 libc_cv_asm_symver_directive=yes
941else
942 libc_cv_asm_symver_directive=no
943fi
944rm -f conftest*])
945AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
946if test $libc_cv_asm_symver_directive = yes; then
947 cat > conftest.s <<EOF
2293395f 948${libc_cv_dot_text}
4cca6b86 949_sym:
377a515b
UD
950.symver _sym,sym@VERS
951EOF
952 cat > conftest.map <<EOF
f43ce637 953VERS_1 {
377a515b
UD
954 global: sym;
955};
f43ce637
UD
956
957VERS_2 {
958 global: sym;
959} VERS_1;
377a515b
UD
960EOF
961 if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
5ae3e846
UD
962 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
963 -nostartfiles -nostdlib
ae1025be
UD
964 -Wl,--version-script,conftest.map
965 1>&AC_FD_CC]);
377a515b
UD
966 then
967 libc_cv_ld_version_script_option=yes
968 else
969 libc_cv_ld_version_script_option=no
970 fi
971 else
972 libc_cv_ld_version_script_option=no
973 fi
974else
975 libc_cv_ld_version_script_option=no
976fi
977rm -f conftest*])
7499a22a
RM
978if test $shared != no &&
979 test $libc_cv_asm_symver_directive = yes &&
650425ce
UD
980 test $libc_cv_ld_version_script_option = yes &&
981 test $enable_versioning = yes; then
377a515b
UD
982 VERSIONING=yes
983 AC_DEFINE(DO_VERSIONING)
984else
985 VERSIONING=no
986fi
987AC_SUBST(VERSIONING)
988
102a3e8f 989if test $elf = yes && test $shared != no && test $VERSIONING = no; then
f43ce637 990 echo "\
f4017d20 991*** WARNING: You should not compile GNU libc without versioning. Not using
f43ce637
UD
992*** versioning will introduce incompatibilities so that old binaries
993*** will not run anymore.
50304ef0 994*** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
f43ce637 995fi
fd26970f
UD
996if test $elf = yes; then
997 AC_CACHE_CHECK(for .previous assembler directive,
998 libc_cv_asm_previous_directive, [dnl
999 cat > conftest.s <<EOF
1000.section foo_section
1001.previous
1002EOF
1003 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
1004 libc_cv_asm_previous_directive=yes
1005 else
1006 libc_cv_asm_previous_directive=no
1007 fi
1008 rm -f conftest*])
1009 if test $libc_cv_asm_previous_directive = yes; then
1010 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1011 else
1012 AC_CACHE_CHECK(for .popsection assembler directive,
1013 libc_cv_asm_popsection_directive, [dnl
1014 cat > conftest.s <<EOF
1015.pushsection foo_section
1016.popsection
1017EOF
1018 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
1019 libc_cv_asm_popsection_directive=yes
1020 else
1021 libc_cv_asm_popsection_directive=no
1022 fi
1023 rm -f conftest*])
1024 if test $libc_cv_asm_popsection_directive = yes; then
1025 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1026 fi
1027 fi
2d499f55
UD
1028 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1029 libc_cv_asm_protected_directive, [dnl
1030 cat > conftest.s <<EOF
1031.protected foo
1032foo:
1033.hidden bar
1034bar:
1035EOF
1036 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
1037 libc_cv_asm_protected_directive=yes
1038 else
1039 libc_cv_asm_protected_directive=no
1040 fi
1041 rm -f conftest*])
1042 AC_SUBST(libc_cv_asm_protected_directive)
5688da55 1043 AC_DEFINE(HAVE_PROTECTED)
9bd64602 1044 AC_DEFINE(HAVE_HIDDEN)
0fb7851f 1045
0d01dace
UD
1046 if test $libc_cv_asm_protected_directive = yes; then
1047 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1048 libc_cv_visibility_attribute,
1049 [cat > conftest.c <<EOF
1050 int foo __attribute__ ((visibility ("hidden"))) = 1;
1051 int bar __attribute__ ((visibility ("protected"))) = 1;
1052EOF
1053 libc_cv_visibility_attribute=no
1054 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
1055 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1056 if grep '\.protected.*bar' conftest.s >/dev/null; then
1057 libc_cv_visibility_attribute=yes
1058 fi
1059 fi
1060 fi
1061 rm -f conftest.[cs]
1062 ])
1063 if test $libc_cv_visibility_attribute = yes; then
1064 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
1065 fi
1066 fi
1067
37ba7d66
UD
1068 if test $libc_cv_visibility_attribute = yes; then
1069 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1070 libc_cv_broken_visibility_attribute,
1071 [cat > conftest.c <<EOF
1072 int foo (int x);
1073 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1074 int bar (int x) { return x; }
1075EOF
1076 libc_cv_broken_visibility_attribute=yes
1077 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
1078changequote(,)dnl
1079 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1080changequote([,])dnl
1081 libc_cv_broken_visibility_attribute=no
1082 fi
1083 fi
1084 rm -f conftest.c conftest.s
1085 ])
1086 if test $libc_cv_broken_visibility_attribute = yes; then
1087 AC_DEFINE(HAVE_BROKEN_VISIBILITY_ATTRIBUTE)
1088 fi
1089 fi
1090
1091 AC_CACHE_CHECK(for broken __attribute__((alias())),
1092 libc_cv_broken_alias_attribute,
1093 [cat > conftest.c <<EOF
1094 extern int foo (int x) __asm ("xyzzy");
1095 int bar (int x) { return x; }
48b8e846
UD
1096 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1097 extern int dfoo;
1098 extern __typeof (dfoo) dfoo __asm ("abccb");
1099 int dfoo = 1;
37ba7d66
UD
1100EOF
1101 libc_cv_broken_alias_attribute=yes
1102 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
48b8e846
UD
1103 if grep 'xyzzy' conftest.s >/dev/null &&
1104 grep 'abccb' conftest.s >/dev/null; then
37ba7d66
UD
1105 libc_cv_broken_alias_attribute=no
1106 fi
1107 fi
1108 rm -f conftest.c conftest.s
1109 ])
1110 if test $libc_cv_broken_alias_attribute = yes; then
1111 AC_DEFINE(HAVE_BROKEN_ALIAS_ATTRIBUTE)
1112 fi
1113
0d01dace
UD
1114 if test $libc_cv_visibility_attribute = yes -a $gnu_ld = yes; then
1115 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1116 libc_cv_have_sdata_section,
1117 [echo "int i;" > conftest.c
1118 libc_cv_have_sdata_section=no
1119 if ${CC-cc} -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1120 | grep '\.sdata' >/dev/null; then
1121 libc_cv_have_sdata_section=yes
1122 fi
1123 rm -f conftest.c conftest.so
1124 ])
1125 if test $libc_cv_have_sdata_section = yes; then
1126 AC_DEFINE(HAVE_SDATA_SECTION)
1127 fi
1128 fi
1129
5241882c
UD
1130 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1131 libc_cv_initfinit_array, [dnl
1132 cat > conftest.c <<EOF
1133int _start (void) { return 0; }
1134int __start (void) { return 0; }
1135int foo (void) { return 1; }
2c617417 1136int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
5241882c
UD
1137EOF
1138 if AC_TRY_COMMAND([${CC-cc} -o conftest conftest.c
1139 -static -nostartfiles -nostdlib 1>&AC_FD_CC])
1140 then
1141 if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
1142 libc_cv_initfinit_array=yes
1143 else
1144 libc_cv_initfinit_array=no
1145 fi
1146 else
1147 libc_cv_initfinit_array=no
1148 fi
1149 rm -f conftest*])
1150 AC_SUBST(libc_cv_initfinit_array)
1151 if test $libc_cv_initfinit_array = yes; then
1152 AC_DEFINE(HAVE_INITFINI_ARRAY)
1153 fi
1154
0fb7851f
UD
1155 AC_CACHE_CHECK(for -z nodelete option,
1156 libc_cv_z_nodelete, [dnl
1157 cat > conftest.c <<EOF
1158int _start (void) { return 42; }
1159EOF
35cd3c97
AJ
1160 if AC_TRY_COMMAND([${CC-cc} -shared -o conftest.so conftest.c
1161 -nostartfiles -nostdlib
1162 -Wl,--enable-new-dtags,-z,nodelete 1>&AC_FD_CC])
0fb7851f
UD
1163 then
1164 libc_cv_z_nodelete=yes
1165 else
1166 libc_cv_z_nodelete=no
1167 fi
1168 rm -f conftest*])
1169 AC_SUBST(libc_cv_z_nodelete)
2f54c82d
UD
1170
1171 AC_CACHE_CHECK(for -z nodlopen option,
1172 libc_cv_z_nodlopen, [dnl
1173 cat > conftest.c <<EOF
1174int _start (void) { return 42; }
1175EOF
35cd3c97
AJ
1176 if AC_TRY_COMMAND([${CC-cc} -shared -o conftest.so conftest.c
1177 -nostartfiles -nostdlib
1178 -Wl,--enable-new-dtags,-z,nodlopen 1>&AC_FD_CC])
2f54c82d
UD
1179 then
1180 libc_cv_z_nodlopen=yes
1181 else
1182 libc_cv_z_nodlopen=no
1183 fi
1184 rm -f conftest*])
1185 AC_SUBST(libc_cv_z_nodlopen)
5d916713
UD
1186
1187 AC_CACHE_CHECK(for -z initfirst option,
1188 libc_cv_z_initfirst, [dnl
1189 cat > conftest.c <<EOF
1190int _start (void) { return 42; }
1191EOF
35cd3c97
AJ
1192 if AC_TRY_COMMAND([${CC-cc} -shared -o conftest.so conftest.c
1193 -nostartfiles -nostdlib
1194 -Wl,--enable-new-dtags,-z,initfirst 1>&AC_FD_CC])
5d916713
UD
1195 then
1196 libc_cv_z_initfirst=yes
1197 else
1198 libc_cv_z_initfirst=no
1199 fi
1200 rm -f conftest*])
1201 AC_SUBST(libc_cv_z_initfirst)
639c3248
UD
1202
1203 AC_CACHE_CHECK(for -Bgroup option,
1204 libc_cv_Bgroup, [dnl
1205 cat > conftest.c <<EOF
1206int _start (void) { return 42; }
1207EOF
1208 if AC_TRY_COMMAND([${CC-cc} -shared -o conftest.so conftest.c -Wl,-Bgroup -nostdlib 1>&AC_FD_CC])
1209 then
1210 libc_cv_Bgroup=yes
1211 else
1212 libc_cv_Bgroup=no
1213 fi
1214 rm -f conftest*])
1215 AC_SUBST(libc_cv_Bgroup)
a711b01d
UD
1216
1217 AC_CACHE_CHECK(for -z combreloc,
1218 libc_cv_z_combreloc, [dnl
1219 cat > conftest.c <<EOF
d555194c
UD
1220extern int bar (int);
1221extern int mumble;
1222int foo (void) { return bar (mumble); }
a711b01d 1223EOF
35cd3c97
AJ
1224 if AC_TRY_COMMAND([${CC-cc} -shared -o conftest.so conftest.c
1225 -nostdlib -nostartfiles
1226 -Wl,-z,combreloc 1>&AC_FD_CC])
a711b01d
UD
1227 then
1228dnl The following test is a bit weak. We must use a tool which can test
1229dnl cross-platform since the gcc used can be a cross compiler. Without
1230dnl introducing new options this is not easily doable. Instead use a tool
1231dnl which always is cross-platform: readelf. To detect whether -z combreloc
1232dnl look for a section named .rel.dyn.
fdde8349
UD
1233 if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1234 libc_cv_z_combreloc=yes
1235 else
1236 libc_cv_z_combreloc=no
a711b01d 1237 fi
fdde8349
UD
1238 else
1239 libc_cv_z_combreloc=no
a711b01d
UD
1240 fi
1241 rm -f conftest*])
fdde8349
UD
1242 if test "$libc_cv_z_combreloc" = yes; then
1243 AC_DEFINE(HAVE_Z_COMBRELOC)
1244 fi
fd26970f 1245fi
f13df7c7 1246AC_SUBST(libc_cv_z_combreloc)
fd26970f 1247
b8dc6a10
RM
1248if test $elf != yes; then
1249 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
1250 [AC_TRY_COMPILE(, [asm (".section .init");
84724245 1251 asm (".section .fini");
2293395f 1252 asm ("${libc_cv_dot_text}");],
b8dc6a10
RM
1253 libc_cv_have_initfini=yes,
1254 libc_cv_have_initfini=no)])
1255 AC_SUBST(libc_cv_have_initfini)dnl
1256 if test $libc_cv_have_initfini = yes; then
1257 AC_DEFINE(HAVE_INITFINI)
1258 fi
1259fi
e215c478 1260
e26dd47f
UD
1261if test $elf = yes -a $gnu_ld = yes; then
1262 AC_CACHE_CHECK(whether cc puts quotes around section names,
1263 libc_cv_have_section_quotes,
1264 [cat > conftest.c <<EOF
1265 static const int foo
1266 __attribute__ ((section ("bar"))) = 1;
1267EOF
1268 if ${CC-cc} -S conftest.c -o conftest.s; then
1269 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1270 libc_cv_have_section_quotes=yes
1271 else
1272 libc_cv_have_section_quotes=no
1273 fi
1274 else
1275 libc_cv_have_section_quotes=unknown
1276 fi
1277 rm -f conftest.[cs]
1278 ])
1279 if test $libc_cv_have_section_quotes = yes; then
1280 AC_DEFINE(HAVE_SECTION_QUOTES)
1281 fi
1282fi
1283
9a0a462c
UD
1284dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1285AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
1286[cat > conftest.$ac_ext <<EOF
1287dnl This sometimes fails to find confdefs.h, for some reason.
1288dnl [#]line __oline__ "[$]0"
1289[#]line __oline__ "configure"
1290#include "confdefs.h"
1291void underscore_test(void) {
1292return; }
1293EOF
1294if AC_TRY_EVAL(ac_compile); then
1295 if grep _underscore_test conftest* >/dev/null; then
1296 ifelse([$1], , :, [rm -f conftest*
1297 $1])
1298 else
1299 ifelse([$2], , , [rm -f conftest*
1300 $2])
1301 fi
1302else
1303 echo "configure: failed program was:" >&AC_FD_CC
1304 cat conftest.$ac_ext >&AC_FD_CC
1305 ifelse([$2], , , [rm -f conftest*
1306 $2])
1307fi
1308rm -f conftest*])
1309
c224a18a
RM
1310if test $elf = yes; then
1311 libc_cv_asm_underscores=no
1312else
9a0a462c
UD
1313 if test $ac_cv_prog_cc_works = yes; then
1314 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1315 [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
1316 libc_cv_asm_underscores=yes,
1317 libc_cv_asm_underscores=no)])
1318 else
1319 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1320 [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
1321 libc_cv_asm_underscores=no)])
1322 fi
c224a18a
RM
1323fi
1324if test $libc_cv_asm_underscores = no; then
1325 AC_DEFINE(NO_UNDERSCORES)
1326fi
1327
1328if test $elf = yes; then
1329 libc_cv_weak_symbols=yes
9a97d1f7
UD
1330fi
1331
1332AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
75d86c1f 1333 [dnl
c224a18a 1334cat > conftest.s <<EOF
2293395f 1335${libc_cv_dot_text}
c224a18a 1336${libc_cv_asm_global_directive} foo
ae1025be 1337foo:
c224a18a
RM
1338.weak foo
1339.weak bar; bar = foo
1340EOF
9a97d1f7
UD
1341if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
1342 libc_cv_asm_weak_directive=yes
1343else
1344 libc_cv_asm_weak_directive=no
1345fi
1346rm -f conftest*])
c224a18a 1347
c8cf0b14 1348if test $libc_cv_asm_weak_directive = no; then
c224a18a
RM
1349 AC_CACHE_CHECK(for assembler .weakext directive,
1350 libc_cv_asm_weakext_directive,
1351 [dnl
1352cat > conftest.s <<EOF
2293395f 1353${libc_cv_dot_text}
c224a18a 1354${libc_cv_asm_global_directive} foo
ae1025be 1355foo:
f802accb
UD
1356.weakext bar foo
1357.weakext baz
1358${libc_cv_asm_global_directive} baz
9a97d1f7 1359baz:
c224a18a
RM
1360EOF
1361 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
1362 libc_cv_asm_weakext_directive=yes
1363 else
1364 libc_cv_asm_weakext_directive=no
1365 fi
1366 rm -f conftest*])
1367
9a97d1f7 1368fi # no .weak
c224a18a 1369
ffcf9634 1370if test $libc_cv_asm_weak_directive = yes; then
c224a18a 1371 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
ffcf9634 1372elif test $libc_cv_asm_weakext_directive = yes; then
c224a18a
RM
1373 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1374fi
1375
b15cb495 1376dnl The standard hppa assembler uses `;' to start comments and `!'
eacde9d0
UD
1377dnl as a line separator. CRIS uses `;' to start comments and `@' for
1378dnl line separator.
b15cb495 1379case "${host_cpu}-${host_os}" in
eacde9d0
UD
1380 cris*)
1381 libc_cv_asm_line_sep='@'
1382 AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep)
1383 ;;
b15cb495
UD
1384 hppa*linux*)
1385 AC_CACHE_CHECK(for assembler line separator,
1386 libc_cv_asm_line_sep, [dnl
1387 cat > conftest.s <<EOF
1388 nop ; is_old_puffin
1389EOF
1390 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
1391 libc_cv_asm_line_sep='!'
1392 else
1393 if test -z "$enable_hacker_mode"; then
1394 echo "*** You need a newer assembler to compile glibc"
1395 rm -f conftest*
1396 exit 1
1397 fi
1398 libc_cv_asm_line_sep=';'
1399 fi
1400 rm -f conftest*])
1401 AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep)
1402 ;;
1403esac
1404
a641835a
RM
1405AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1406cat > conftest.c <<\EOF
5f0e6fc7 1407_start () {}
dcf0671d
UD
1408int __eh_pc;
1409__throw () {}
a641835a 1410EOF
dcea62dd
RM
1411dnl No \ in command here because it ends up inside ''.
1412if AC_TRY_COMMAND([${CC-cc} $CFLAGS
1413 -nostdlib -nostartfiles -Wl,--no-whole-archive
ae1025be 1414 -o conftest conftest.c 1>&AC_FD_CC]); then
a641835a
RM
1415 libc_cv_ld_no_whole_archive=yes
1416else
1417 libc_cv_ld_no_whole_archive=no
1418fi
1419rm -f conftest*])
b17277cf
UD
1420if test $libc_cv_ld_no_whole_archive = yes; then
1421 no_whole_archive=-Wl,--no-whole-archive
1422fi
1423AC_SUBST(no_whole_archive)dnl
a641835a 1424
dff14448 1425AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
b236e99d
UD
1426cat > conftest.c <<\EOF
1427_start () {}
1428int __eh_pc;
1429__throw () {}
1430EOF
1431dnl No \ in command here because it ends up inside ''.
1432if AC_TRY_COMMAND([${CC-cc} $CFLAGS
dff14448 1433 -nostdlib -nostartfiles -fexceptions
ae1025be 1434 -o conftest conftest.c 1>&AC_FD_CC]); then
dff14448 1435 libc_cv_gcc_exceptions=yes
b236e99d 1436else
dff14448 1437 libc_cv_gcc_exceptions=no
b236e99d
UD
1438fi
1439rm -f conftest*])
dff14448
UD
1440if test $libc_cv_gcc_exceptions = yes; then
1441 exceptions=-fexceptions
b17277cf 1442fi
dff14448 1443AC_SUBST(exceptions)dnl
b236e99d 1444
d71b808a
UD
1445if test "$base_machine" = alpha ; then
1446AC_CACHE_CHECK(for function ..ng prefix, libc_cv_gcc_alpha_ng_prefix, [dnl
1447cat > conftest.c <<\EOF
1448foo () { }
1449EOF
1450dnl
9756dfe1 1451if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null]);
d71b808a
UD
1452then
1453 libc_cv_gcc_alpha_ng_prefix=yes
1454else
1455 libc_cv_gcc_alpha_ng_prefix=no
1456fi
1457rm -f conftest* ])
1458if test $libc_cv_gcc_alpha_ng_prefix = yes ; then
1459 AC_DEFINE(ASM_ALPHA_NG_SYMBOL_PREFIX, "$")
1460else
1461 AC_DEFINE(ASM_ALPHA_NG_SYMBOL_PREFIX, "")
1462fi
1463fi
1464
66000494
UD
1465if test "$host_cpu" = powerpc ; then
1466# Check for a bug present in at least versions 2.8.x of GCC
1467# and versions 1.0.x of EGCS.
1468AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
1469AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
1470 libc_cv_c_asmcr0_bug='no',
1471 libc_cv_c_asmcr0_bug='yes')])
1472if test "$libc_cv_c_asmcr0_bug" != 'no'; then
1473 AC_DEFINE(BROKEN_PPC_ASM_CR0)
1474fi
1475fi
1476
650425ce
UD
1477AC_CACHE_CHECK(for DWARF2 unwind info support, libc_cv_gcc_dwarf2_unwind_info,
1478[cat > conftest.c <<EOF
1479#line __oline__ "configure"
2b904739 1480static char *__EH_FRAME_BEGIN__;
650425ce
UD
1481_start ()
1482{
9756dfe1 1483#ifdef CHECK__register_frame
650425ce
UD
1484 __register_frame (__EH_FRAME_BEGIN__);
1485 __deregister_frame (__EH_FRAME_BEGIN__);
9756dfe1
UD
1486#endif
1487#ifdef CHECK__register_frame_info
1488 __register_frame_info (__EH_FRAME_BEGIN__);
1489 __deregister_frame_info (__EH_FRAME_BEGIN__);
1490#endif
650425ce
UD
1491}
1492int __eh_pc;
1493__throw () {}
1494/* FIXME: this is fragile. */
1495malloc () {}
1496strcmp () {}
1497strlen () {}
1498memcpy () {}
1499memset () {}
1500free () {}
1501abort () {}
dfd2257a 1502__bzero () {}
df17727a 1503dl_iterate_phdr () {}
650425ce
UD
1504EOF
1505dnl No \ in command here because it ends up inside ''.
9756dfe1 1506if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
650425ce
UD
1507 -nostdlib -nostartfiles
1508 -o conftest conftest.c -lgcc >&AC_FD_CC]); then
9756dfe1 1509 libc_cv_gcc_dwarf2_unwind_info=static
650425ce
UD
1510else
1511 libc_cv_gcc_dwarf2_unwind_info=no
1512fi
2b904739
AJ
1513if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
1514 -nostdlib -nostartfiles
1515 -o conftest conftest.c -lgcc -lgcc_eh >&AC_FD_CC]); then
1516 if ${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles \
1517 -o conftest conftest.c -lgcc -lgcc_eh -v 2>&1 >/dev/null \
1518 | grep -q -- --eh-frame-hdr; then
1519 libc_cv_gcc_dwarf2_unwind_info=no_registry_needed
1520 else
1521 libc_cv_gcc_dwarf2_unwind_info=static
1522 fi
1523else
1524 libc_cv_gcc_dwarf2_unwind_info=no
1525fi
9756dfe1
UD
1526if test $libc_cv_gcc_dwarf2_unwind_info = no; then
1527 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame
1528 -nostdlib -nostartfiles
1529 -o conftest conftest.c -lgcc >&AC_FD_CC]); then
1530 libc_cv_gcc_dwarf2_unwind_info=yes
1531 else
1532 libc_cv_gcc_dwarf2_unwind_info=no
1533 fi
1534fi
650425ce 1535rm -f conftest*])
9756dfe1
UD
1536case $libc_cv_gcc_dwarf2_unwind_info in
1537yes)
650425ce 1538 AC_DEFINE(HAVE_DWARF2_UNWIND_INFO)
9756dfe1
UD
1539 ;;
1540static)
1541 AC_DEFINE(HAVE_DWARF2_UNWIND_INFO)
1542 AC_DEFINE(HAVE_DWARF2_UNWIND_INFO_STATIC)
1543 ;;
1544esac
650425ce 1545
a8eab8b1
UD
1546dnl Check whether compiler understands __builtin_expect.
1547AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
1548[cat > conftest.c <<EOF
1549#line __oline__ "configure"
1550int foo (int a)
1551{
1552 a = __builtin_expect (a, 10);
1553 return a == 10 ? 0 : 1;
1554}
1555EOF
1556dnl No \ in command here because it ends up inside ''.
1557if AC_TRY_COMMAND([${CC-cc} $CFLAGS -nostdlib -nostartfiles
1558 -o conftest conftest.c -lgcc >&AC_FD_CC]); then
1559 libc_cv_gcc_builtin_expect=yes
1560else
1561 libc_cv_gcc_builtin_expect=no
1562fi
1563rm -f conftest*])
1564if test "$libc_cv_gcc_builtin_expect" = yes; then
1565 AC_DEFINE(HAVE_BUILTIN_EXPECT)
1566fi
1567
d555194c
UD
1568AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1569cat > conftest.c <<\EOF
1570void zero (void *x)
1571{
a52d1562 1572 __builtin_memset (x, 0, 1000);
d555194c
UD
1573}
1574EOF
1575dnl
1576if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1577then
1578 libc_cv_gcc_builtin_memset=no
1579else
1580 libc_cv_gcc_builtin_memset=yes
1581fi
1582rm -f conftest* ])
1583if test "$libc_cv_gcc_builtin_memset" = yes ; then
1584 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1585fi
1586
3d558f4e
UD
1587dnl Check whether the compiler supports subtraction of local labels.
1588AC_CACHE_CHECK(for local label subtraction, libc_cv_gcc_subtract_local_labels,
1589[cat > conftest.c <<EOF
1590changequote(,)dnl
1591#line __oline__ "configure"
1592int foo (int a)
1593{
1594 static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
1595 void *p = &&l1 + ar[a];
1596 goto *p;
1597 l1:
1598 return 1;
1599 l2:
1600 return 2;
1601}
1602changequote([,])dnl
1603EOF
1604dnl No \ in command here because it ends up inside ''.
1605if AC_TRY_COMMAND([${CC-cc} $CFLAGS -nostdlib -nostartfiles
1606 -o conftest conftest.c -lgcc >&AC_FD_CC]); then
1607 libc_cv_gcc_subtract_local_labels=yes
1608else
1609 libc_cv_gcc_subtract_local_labels=no
1610fi
1611rm -f conftest*])
1612if test "$libc_cv_gcc_subtract_local_labels" = yes; then
1613 AC_DEFINE(HAVE_SUBTRACT_LOCAL_LABELS)
1614fi
1615
739d440d 1616dnl Check whether the compiler supports the __thread keyword.
5b8f26b4
RM
1617if test "x$use__thread" != xno; then
1618 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1619 [cat > conftest.c <<\EOF
1620 __thread int a = 42;
1621 EOF
1622 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AC_FD_CC]); then
1623 libc_cv_gcc___thread=yes
1624 else
1625 libc_cv_gcc___thread=no
1626 fi
1627 rm -f conftest*])
1628 if test "$libc_cv_gcc___thread" = yes; then
1629 AC_DEFINE(HAVE___THREAD)
1630 fi
739d440d
UD
1631else
1632 libc_cv_gcc___thread=no
1633fi
739d440d 1634
9b21e6bc
RM
1635if test "$libc_cv_gcc___thread" = yes; then
1636 dnl Check whether the compiler supports the tls_model attribute.
1637 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1638 cat > conftest.c <<\EOF
1639extern __thread int a __attribute__((tls_model ("initial-exec")));
1640EOF
1641 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -S -Werror conftest.c >&AC_FD_CC]); then
1642 libc_cv_gcc_tls_model_attr=yes
1643 else
1644 libc_cv_gcc_tls_model_attr=no
1645 fi
1646 rm -f conftest*])
1647 if test "$libc_cv_gcc_tls_model_attr" = yes; then
1648 AC_DEFINE(HAVE_TLS_MODEL_ATTRIBUTE)
1649 fi
1650fi
739d440d 1651
c8f3e6db
UD
1652dnl Check whether we have the gd library available.
1653AC_MSG_CHECKING(for libgd)
6dab8688
UD
1654if test "$with_gd" != "no"; then
1655 old_CFLAGS="$CFLAGS"
1656 CFLAGS="$CFLAGS $libgd_include"
1657 old_LDFLAGS="$LDFLAGS"
1658 LDFLAGS="$LDFLAGS $libgd_ldflags"
1659 old_LIBS="$LIBS"
1660 LIBS="$LIBS -lgd -lpng -lz -lm"
1661 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1662 CFLAGS="$old_CFLAGS"
1663 LDFLAGS="$old_LDFLAGS"
1664 LIBS="$old_LIBS"
1665else
1666 LIBGD=no
1667fi
c8f3e6db
UD
1668AC_MSG_RESULT($LIBGD)
1669AC_SUBST(LIBGD)
3d558f4e 1670
8ed1e7d5
GK
1671dnl check for the size of 'long double'.
1672AC_CHECK_SIZEOF(long double, 0)
1673sizeof_long_double=$ac_cv_sizeof_long_double
1674AC_SUBST(sizeof_long_double)
1675
c224a18a
RM
1676### End of automated tests.
1677### Now run sysdeps configure fragments.
1678
28f540f4
RM
1679# sysdeps configure fragments may set these with files to be linked below.
1680libc_link_dests=
1681libc_link_sources=
1682
cb343854 1683# They also can set these variables.
591e1ffb 1684use_ldconfig=no
cb343854 1685ldd_rewrite_script=no
77259608 1686libc_cv_sysconfdir=$sysconfdir
74bd2300 1687libc_cv_gcc_unwind_find_fde=no
cb343854 1688
28f540f4
RM
1689# Iterate over all the sysdep directories we will use, running their
1690# configure fragments, and looking for a uname implementation.
1691uname=
1692for dir in $sysnames; do
57ba7bb4
UD
1693 case $dir in
1694 /*) dest=$dir ;;
1695 *) dest=$srcdir/$dir ;;
1696 esac
1697 if test -r $dest/configure; then
1698 AC_MSG_RESULT(running configure fragment for $dest)
1699 . $dest/configure
28f540f4 1700 fi
4ca84cff 1701[
28f540f4 1702 if test -z "$uname"; then
e7f1f046
UD
1703 if test -r $dest/uname.c ||
1704 test -r $dest/uname.S ||
1705 { test -r $dest/syscalls.list &&
1706 grep '^uname[ ]' $dest/syscalls.list >/dev/null; }; then
b86199fb 1707 uname=$dir
4ca84cff 1708 fi
28f540f4 1709 fi
4ca84cff 1710]dnl
28f540f4
RM
1711done
1712
74bd2300
UD
1713if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1714 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1715fi
1716AC_SUBST(libc_cv_gcc_unwind_find_fde)
1717
28f540f4
RM
1718AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
1719
1720# If we will use the generic uname implementation, we must figure out what
1721# it will say by examining the system, and write the results in config-name.h.
e7f1f046 1722if test "$uname" = "sysdeps/generic"; then
28f540f4
RM
1723
1724changequote(,)dnl
1725 uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
1726changequote([,])dnl
1727 if test $uname_sysname != $config_os; then
1728 config_release=`echo $config_os | sed s/$uname_sysname//`
1729 fi
1730dnl
1731AC_DEFUN(LIBC_KERNEL_ID, [dnl
1732 if test -r /vmunix; then
1733 kernel_id=`strings /vmunix | grep UNIX`
1734 elif test -r /dynix; then
1735 kernel_id=`strings /dynix | grep DYNIX`
1736 else
1737 kernel_id=
1738 fi
1739])dnl
1740
b8dc6a10 1741 AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
28f540f4
RM
1742AC_REQUIRE([LIBC_KERNEL_ID])dnl
1743changequote(,)dnl
1744 kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
1745changequote([,])dnl
1746 if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
1747 != x$config_release; then
1748 # The configuration release is a substring of the kernel release.
1749 libc_cv_uname_release=$kernel_release
1750 elif test x$config_release != x; then
1751 libc_cv_uname_release=$config_release
1752 elif test x$kernel_release != x; then
1753 libc_cv_uname_release=$kernel_release
1754 else
1755 libc_cv_uname_release=unknown
1756 fi])
28f540f4
RM
1757 uname_release="$libc_cv_uname_release"
1758
b8dc6a10 1759 AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
28f540f4
RM
1760AC_REQUIRE([LIBC_KERNEL_ID])dnl
1761changequote(,)dnl
1762 kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
1763changequote([,])dnl
1764 if test -n "$kernel_version"; then
1765 libc_cv_uname_version="$kernel_version"
1766 else
1767 libc_cv_uname_version=unknown
1768 fi])
28f540f4
RM
1769 uname_version="$libc_cv_uname_version"
1770
1771AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
1772 config_uname=config-name.h:config-name.in
1773else
1774 # For non-generic uname, we don't need to create config-name.h at all.
1775 config_uname=
1776fi
1777
a8c01776
RM
1778dnl This is tested by existing code and it's simpler to avoid changing it.
1779AC_DEFINE(USE_IN_LIBIO)
96aa2d94 1780
a53bad16
UD
1781# Test for old glibc 2.0.x headers so that they can be removed properly
1782# Search only in includedir.
1783AC_MSG_CHECKING(for old glibc 2.0.x headers)
350eb336 1784if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
a53bad16
UD
1785then
1786 old_glibc_headers=yes
1787else
1788 old_glibc_headers=no
1789fi
1790AC_MSG_RESULT($old_glibc_headers)
1791if test ${old_glibc_headers} = yes; then
1792 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
1793 AC_MSG_WARN(*** be removed.)
1794fi
b195f6bc 1795AC_SUBST(old_glibc_headers)
26b4d766 1796
84384f5b 1797AC_SUBST(libc_cv_slibdir)
a1d84548 1798AC_SUBST(libc_cv_localedir)
77259608 1799AC_SUBST(libc_cv_sysconfdir)
1ef32c3d
UD
1800AC_SUBST(libc_cv_rootsbindir)
1801
591e1ffb 1802AC_SUBST(use_ldconfig)
cb343854 1803AC_SUBST(ldd_rewrite_script)
84384f5b 1804
5af3245a 1805AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(xcoff)
28f540f4
RM
1806if test $gnu_ld = yes; then
1807 AC_DEFINE(HAVE_GNU_LD)
1808fi
1809if test $gnu_as = yes; then
1810 AC_DEFINE(HAVE_GNU_AS)
1811fi
1812if test $elf = yes; then
1813 AC_DEFINE(HAVE_ELF)
1814fi
5af3245a
UD
1815if test $xcoff = yes; then
1816 AC_DEFINE(HAVE_XCOFF)
1817fi
28f540f4 1818
650425ce 1819AC_SUBST(static)
ff3d7ed3
RM
1820AC_SUBST(shared)
1821if test $shared = default; then
1822 if test $gnu_ld = yes; then
1823 shared=$elf
f65fd747
UD
1824 else
1825 # For now we do not assume shared libs are available. In future more
1826 # tests might become available.
1827 shared=no
ff3d7ed3
RM
1828 fi
1829fi
cc3fa755
UD
1830
1831AC_CACHE_CHECK([whether -fPIC is default], pic_default,
1832[pic_default=yes
1833cat > conftest.c <<EOF
9756dfe1 1834#if defined __PIC__ || defined __pic__ || defined PIC || defined pic
cc3fa755
UD
1835# error PIC is default.
1836#endif
1837EOF
1838if eval "${CC-cc} -S conftest.c 2>&AC_FD_CC 1>&AC_FD_CC"; then
1839 pic_default=no
1840fi
1841rm -f conftest.*])
1842AC_SUBST(pic_default)
1843
ff3d7ed3
RM
1844AC_SUBST(profile)
1845AC_SUBST(omitfp)
5a97622d 1846AC_SUBST(bounded)
5107cf1d 1847AC_SUBST(static_nss)
5ae3e846 1848AC_SUBST(nopic_initfini)
ff3d7ed3 1849
edf5b2d7
UD
1850AC_SUBST(DEFINES)
1851
7cabd57c
UD
1852case "$add_ons" in
1853 *door*) linux_doors=yes ;;
1854 *) linux_doors=no ;;
1855esac
1856AC_SUBST(linux_doors)
1857
61c83c3f
RM
1858dnl See sysdeps/mach/configure.in for this variable.
1859AC_SUBST(mach_interface_list)
1860
28f540f4
RM
1861if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
1862 config_makefile=
1863else
1864 config_makefile=Makefile
1865fi
1866
ee74a442
UD
1867VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1868RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
df4ef2ab 1869AC_SUBST(VERSION)
ee74a442 1870AC_SUBST(RELEASE)
df4ef2ab 1871
737547be
UD
1872AC_OUTPUT(config.make glibcbug ${config_makefile} ${config_uname}, [
1873case $CONFIG_FILES in *config.make*)
1874echo "$config_vars" >> config.make;;
1875esac
1876test -d bits || mkdir bits], [config_vars='$config_vars'])