]> git.ipfire.org Git - thirdparty/glibc.git/blame - configure.in
Update.
[thirdparty/glibc.git] / configure.in
CommitLineData
f4017d20 1dnl Process this file with autoconf to produce a configure script.
ff3d7ed3 2AC_REVISION([$CVSid$])
8a523922 3AC_PREREQ(2.11)dnl dnl Minimum Autoconf version required.
5107cf1d 4AC_INIT(include/features.h)
28f540f4
RM
5AC_CONFIG_HEADER(config.h)
6
7# This will get text that should go into config.make.
8config_vars=
9
10# Check for a --with-gmp argument and set gmp-srcdir in config.make.
11AC_ARG_WITH(gmp, dnl
12 --with-gmp=DIRECTORY find GMP source code in DIRECTORY (not needed),
13 [dnl
14case "$with_gmp" in
15yes) AC_MSG_ERROR(--with-gmp requires an argument; use --with-gmp=DIRECTORY) ;;
16''|no) ;;
17*) config_vars="$config_vars
18gmp-srcdir = $withval" ;;
19esac
20])
75914335
RM
21# Check for a --with-gettext argument and set gettext-srcdir in config.make.
22AC_ARG_WITH(gettext, dnl
23 --with-gettext=DIR find GNU gettext source code in DIR (not needed),
24 [dnl
25case "$with_gettext" in
26yes)
27 AC_MSG_ERROR(--with-gettext requires an argument; use --with-gettext=DIR) ;;
28''|no) ;;
29*)
30 config_vars="$config_vars
31gettext-srcdir = $withval" ;;
32esac
33])
28f540f4 34
ff3d7ed3 35dnl Arguments to specify presence of other packages/features.
335aa320 36AC_ARG_WITH(fp, dnl
a18f587d 37[ --with-fp if using floating-point hardware [default=yes]],
335aa320 38 with_fp=$withval, with_fp=yes)
650425ce 39AC_ARG_WITH(binutils, dnl
a5a0310d 40 --with-binutils=PATH specify location of binutils (as and ld),
650425ce 41 path_binutils=$withval, path_binutils='')
28f540f4
RM
42AC_ARG_WITH(elf, dnl
43 --with-elf if using the ELF object format,
335aa320 44 elf=$withval, elf=no)
28f540f4 45
deab9dea
RM
46AC_ARG_ENABLE(libio, dnl
47[ --enable-libio build in GNU libio instead of GNU stdio],
f4482045
RM
48 [if test $enableval = yes; then
49 stdio=libio
50 else
51 stdio=stdio
52 fi],
53 stdio=default)
deab9dea 54
a18f587d
UD
55AC_ARG_ENABLE(sanity-checks, dnl
56[ --disable-sanity-checks really do not use threads (should not be used
57 except in special situations) [default=yes]],
58 enable_sanity=$enableval, enable_sanity=yes)
59
650425ce
UD
60dnl Arguments to enable or disable building the static, shared, profiled,
61dnl and -fomit-frame-pointer libraries.
62AC_ARG_ENABLE(static, dnl
63[ --enable-static build static library [default=yes]],
64 static=$enableval, static=yes)
ff3d7ed3
RM
65AC_ARG_ENABLE(shared, dnl
66[ --enable-shared build shared library [default=yes if GNU ld & ELF]],
6b3a2224 67 shared=$enableval, shared=default)
ff3d7ed3
RM
68AC_ARG_ENABLE(profile, dnl
69[ --enable-profile build profiled library [default=yes]],
6b3a2224 70 profile=$enableval, profile=yes)
ff3d7ed3 71AC_ARG_ENABLE(omitfp, dnl
6b3a2224
RM
72[ --enable-omitfp build undebuggable optimized library [default=no]],
73 omitfp=$enableval, omitfp=no)
5a97622d
UD
74AC_ARG_ENABLE(bounded, dnl
75[ --enable-bounded build with runtime bounds checking [default=no]],
76 bounded=$enableval, bounded=no)
650425ce
UD
77AC_ARG_ENABLE(versioning, dnl
78[ --disable-versioning do not include versioning information in the
79 library objects [default=yes if supported]],
80 enable_versioning=$enableval, enable_versioning=yes)
6b3a2224
RM
81
82dnl Generic infrastructure for drop-in additions to libc.
83AC_ARG_ENABLE(add-ons, dnl
f4017d20 84[ --enable-add-ons=DIR1,DIR2... configure and build named extra directories],
61952351
UD
85 [case "$enableval" in
86 yes) add_ons=`echo $srcdir/*/configure | \
87 sed -e "s!$srcdir/!!g" -e 's!/configure!!g'`;;
88 *) add_ons=`echo "$enableval" | sed 's/,/ /g'`;;
89 esac],
90 [add_ons=])
91
6b3a2224 92AC_CONFIG_SUBDIRS($add_ons)
57ba7bb4 93add_ons_pfx=
da74e902 94if test x"$add_ons" != x; then
57ba7bb4 95 for f in $add_ons; do
af6f3906
UD
96 # Test whether such a subdir really exists.
97 if test -d $srcdir/$f; then
98 add_ons_pfx="$add_ons_pfx $f/"
99 else
100 AC_MSG_ERROR(add-on directory \"$f\" does not exist)
101 fi
57ba7bb4
UD
102 done
103fi
ff3d7ed3 104
5107cf1d
UD
105dnl On some platforms we cannot use dynamic loading. We must provide
106dnl static NSS modules.
107AC_ARG_ENABLE(static-nss, dnl
108[ --enable-static-nss build static NSS modules [default=no]],
109 static_nss=$enableval, static_nss=no)
110if test x"$static_nss" = xyes; then
111 AC_DEFINE(DO_STATIC_NSS)
112fi
113
28f540f4 114AC_CANONICAL_HOST
8a523922
UD
115
116# The way shlib-versions is used to generate soversions.mk uses a
117# fairly simplistic model for name recognition that can't distinguish
118# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
119# of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
120# tell. This doesn't get used much beyond that, so it's fairly safe.
121case "$host_os" in
122linux*)
123 ;;
124gnu*)
125 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
126 ;;
127esac
128
61eb22d3
UD
129###
130### I put this here to prevent those annoying emails from people who cannot
131### read and try to compile glibc on unsupported platforms. --drepper
132###
650425ce
UD
133### By using the undocumented --enable-hacker-mode option for configure
134### one can skip this test to make the configuration not fail for unsupported
135### platforms.
136###
137if test -z "$enable_hacker_mode"; then
138 case "$host_os" in
139 linux* | gnu*)
140 ;;
141 *)
142 echo "*** The GNU C library is currently not available for this platform."
143 echo "*** So far nobody cared to port it and if there is no volunteer it"
144 echo "*** might never happen. So, if you have interest to see glibc on"
145 echo "*** this platform visit"
146 echo "*** http://www.gnu.ai.mit.edu/software/libc/porting.html"
147 echo "*** and join the group of porters"
148 exit 1
149 ;;
150 esac
151fi
61eb22d3 152
28f540f4
RM
153# We keep the original values in `$config_*' and never modify them, so we
154# can write them unchanged into config.make. Everything else uses
155# $machine, $vendor, and $os, and changes them whenever convenient.
156config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
157
a2fe9c76
RM
158# Some configurations imply other options.
159case "$host_os" in
160gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
161 # These systems always use GNU tools.
c8cf0b14 162 gnu_ld=yes gnu_as=yes ;;
a2fe9c76
RM
163esac
164case "$host_os" in
7799b7b3
UD
165# i586-linuxaout is mangled into i586-pc-linux-gnuaout
166linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
3776d592 167 ;;
a2fe9c76 168gnu* | linux* | sysv4* | solaris2*)
3776d592
RM
169 # These systems (almost) always use the ELF format.
170 elf=yes
84724245 171 ;;
a2fe9c76
RM
172esac
173
28f540f4
RM
174machine=$config_machine
175vendor=$config_vendor
176os=$config_os
177
178dnl We need to use [ and ] for other purposes for a while now.
179changequote(,)dnl
180# Expand the configuration machine name into a subdirectory by architecture
181# type and particular chip.
182case "$machine" in
f0523145
RM
183a29k | am29000) base_machine=a29k machine=a29k ;;
184alpha*) base_machine=alpha machine=alpha/$machine ;;
7799b7b3 185arm*) base_machine=arm machine=arm/$machine ;;
60c96635
UD
186c3[012]) base_machine=cx0 machine=cx0/c30 ;;
187c4[04]) base_machine=cx0 machine=cx0/c40 ;;
f0523145 188hppa*) base_machine=hppa machine=hppa/$machine ;;
a8922de8 189i[3456]86) base_machine=i386 machine=i386/$machine ;;
f0523145
RM
190m680?0) base_machine=m68k machine=m68k/$machine ;;
191m68k) base_machine=m68k machine=m68k/m68020 ;;
192m88???) base_machine=m88k machine=m88k/$machine ;;
193m88k) base_machine=m88k machine=m88k/m88100 ;;
f0523145 194mips64*) base_machine=mips64 machine=mips/mips64/$machine ;;
f21acc89 195mips*) base_machine=mips machine=mips/$machine ;;
ca34d7a7
UD
196sparc | sparcv[67])
197 base_machine=sparc machine=sparc/sparc32 ;;
198sparcv8 | supersparc | hypersparc)
199 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
200sparc64 | ultrasparc)
201 base_machine=sparc machine=sparc/sparc64 ;;
28f540f4 202esac
f0523145
RM
203changequote([,])dnl
204AC_SUBST(base_machine)
28f540f4 205
dfd2257a
UD
206if test "$base_machine" = "i386"; then
207 AC_DEFINE(USE_REGPARMS)
208fi
209
f0523145 210# Compute the list of sysdep directories for this configuration.
f332db02 211# This can take a while to compute.
f0523145 212sysdep_dir=$srcdir/sysdeps
f332db02 213AC_MSG_CHECKING(sysdep dirs)
f0523145
RM
214dnl We need to use [ and ] for other purposes for a while now.
215changequote(,)dnl
28f540f4
RM
216# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
217os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
218
219case "$os" in
220gnu*)
221 base_os=mach/hurd ;;
883bc19b 222netbsd* | 386bsd* | freebsd* | bsdi*)
28f540f4 223 base_os=unix/bsd/bsd4.4 ;;
222c4e71 224osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
28f540f4 225 base_os=unix/bsd ;;
d586354e 226sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
28f540f4 227 base_os=unix/sysv ;;
d586354e 228solaris[2-9]*)
28f540f4
RM
229 base_os=unix/sysv/sysv4 ;;
230none)
231 base_os=standalone ;;
232*)
233 base_os='' ;;
234esac
235
236# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
237tail=$os
238ostry=$os
239while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
240 ostry="$ostry /$o"
241 tail=$o
75914335 242done
28f540f4
RM
243o=`echo $tail | sed 's/[0-9]*$//'`
244if test $o != $tail; then
245 ostry="$ostry /$o"
246fi
ec4b0518
UD
247# For linux-gnu, try linux-gnu, then linux.
248o=`echo $tail | sed 's/-.*$//'`
249if test $o != $tail; then
250 ostry="$ostry /$o"
251fi
28f540f4
RM
252
253# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
254base=
255tail=$base_os
256while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
257 set $b
258 base="$base /$1"
259 tail="$2"
260done
261
262# For sparc/sparc9, try sparc/sparc9 and then sparc.
263mach=
264tail=$machine
265while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
266 set $m
10ceac89
RM
267 # Prepend the machine's FPU directory unless --without-fp.
268 if test "$with_fp" = yes; then
269 mach="$mach /$1/fpu"
82d00cab 270 fi
28f540f4
RM
271 mach="$mach /$1"
272 tail="$2"
273done
274
275dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
276changequote([,])dnl
277
278# Find what sysdep directories exist.
279sysnames=
57ba7bb4
UD
280IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
281for d in $add_ons_pfx ''; do
282 for b in $base ''; do
283 for m0 in $mach ''; do
284 for v in /$vendor ''; do
285 for o in /$ostry ''; do
286 for m in $mach ''; do
287 if test "$m0$b$v$o$m"; then
288 try="${d}sysdeps$m0$b$v$o$m"
289 test -n "$enable_debug_configure" &&
290 echo "$0 [DEBUG]: try $try" >&2
291 case $try in
292 /*) dest=$try ;;
293 *) dest=$srcdir/$try ;;
294 esac
295 if test -d $dest; then
296 sysnames="$sysnames $try"
297 { test -n "$o" || test -n "$b"; } && os_used=t
298 { test -n "$m" || test -n "$m0"; } && machine_used=t
299 fi
300 fi
301 done
28f540f4
RM
302 done
303 done
304 done
305 done
306done
57ba7bb4 307IFS="$ac_save_ifs"
28f540f4
RM
308
309if test -z "$os_used" && test "$os" != none; then
310 AC_MSG_ERROR(Operating system $os is not supported.)
311fi
312if test -z "$machine_used" && test "$machine" != none; then
313 AC_MSG_ERROR(The $machine is not supported.)
314fi
315
316# We have now validated the configuration.
317
335aa320 318
10ceac89
RM
319# If using ELF, look for an `elf' subdirectory of each machine directory.
320# We prepend these rather than inserting them whereever the machine appears
321# because things specified by the machine's ELF ABI should override
322# OS-specific things, and should always be the same for any OS on the
323# machine (otherwise what's the point of an ABI?).
324if test "$elf" = yes; then
325 elf_dirs=
57ba7bb4
UD
326 for d in $add_ons_pfx ''; do
327 case $d in
328 /*) xsrcdir= ;;
329 *) xsrcdir=$srcdir/ ;;
330 esac
331 for m in $mach; do
332 if test -d $xsrcdir${d}sysdeps$m/elf; then
c2bb8cab 333 elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
57ba7bb4
UD
334 fi
335 done
28f540f4 336 done
57ba7bb4 337 sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
28f540f4
RM
338fi
339
335aa320 340
28f540f4
RM
341# Expand the list of system names into a full list of directories
342# from each element's parent name and Implies file (if present).
343set $sysnames
e50ec9f9 344names=
28f540f4
RM
345while test $# -gt 0; do
346 name=$1
347 shift
348
e50ec9f9 349 case " $names " in *" $name "*)
f332db02
RM
350 # Already in the list.
351 continue
e50ec9f9 352 esac
f332db02
RM
353
354 # Report each name as we discover it, so there is no long pause in output.
355 echo $ac_n "$name $ac_c" >&AC_FD_MSG
356
57ba7bb4
UD
357 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
358
359 case $name in
360 /*) xsrcdir= ;;
361 *) xsrcdir=$srcdir/ ;;
362 esac
363 test -n "$enable_debug_configure" &&
364 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
365
366 if test -f $xsrcdir$name/Implies; then
28f540f4 367 # Collect more names from the `Implies' file (removing comments).
57ba7bb4
UD
368 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
369 implied=
370 for x in $implied_candidate; do
371 if test -d $xsrcdir$name_base/$x; then
372 implied="$implied $name_base/$x";
373 else
374 AC_MSG_WARN($name/Implies specifies nonexistent $x)
375 fi
28f540f4
RM
376 done
377 else
378 implied=
379 fi
380
381 # Add NAME to the list of names.
382 names="$names $name"
383
384 # Find the parent of NAME, using the empty string if it has none.
385changequote(,)dnl
57ba7bb4 386 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
28f540f4
RM
387changequote([,])dnl
388
389 # Add the names implied by NAME, and NAME's parent (if it has one), to
390 # the list of names to be processed (the argument list). We prepend the
391 # implied names to the list and append the parent. We want implied
392 # directories to come before further directories inferred from the
393 # configuration components; this ensures that for sysv4, unix/common
394 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
395 # after sysv4).
396 sysnames="`echo $implied $* $parent`"
397 test -n "$sysnames" && set $sysnames
398done
399
400# Add the default directories.
f2ea0f5b 401sysnames="$names sysdeps/generic"
f332db02
RM
402AC_SUBST(sysnames)
403# The other names were emitted during the scan.
f2ea0f5b 404AC_MSG_RESULT(sysdeps/generic)
28f540f4 405
f332db02
RM
406
407### Locate tools.
28f540f4 408
28f540f4 409AC_PROG_INSTALL
26761c28 410if test "$INSTALL" = "${srcdir}/install-sh -c"; then
28f540f4 411 # The makefiles need to use a different form to find it in $srcdir.
f41c8091 412 INSTALL='\$(..)./install-sh -c'
28f540f4 413fi
0e3426bb 414AC_PROG_LN_S
c17097f1 415AC_CHECK_PROGS(MSGFMT, msgfmt gmsgfmt, :)
04be94a8
UD
416AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo)
417if test "$MAKEINFO"; then
418changequote(,)dnl Need [] for regexps.
419 if $MAKEINFO --version | grep 'texinfo 3\.[1-9][1-9]' >/dev/null 2>&1
420changequote([,])dnl
421 then : # Makeinfo 3.11 or greater, works.
422 else
423 AC_MSG_WARN([
424*** makeinfo is too old (need version 3.11 or better).
425*** You should install the needed version and re-configure since otherwise
426*** you won't get the info pages installed.])
427 MAKEINFO=
428 fi
429fi
28f540f4 430
ebbad4cc 431AC_PROG_CC_LOCAL
22d57dd3 432AC_CANONICAL_BUILD
072ebcef 433if test $host != $build; then
22d57dd3 434 AC_CHECK_PROGS(BUILD_CC, gcc cc)
072ebcef 435fi
779ae82e 436AC_SUBST(cross_compiling)
7c713e28 437AC_PROG_CPP
650425ce 438LIBC_PROG_BINUTILS
ff3d7ed3
RM
439AC_CHECK_TOOL(AR, ar)
440AC_CHECK_TOOL(RANLIB, ranlib, :)
28f540f4 441
84384f5b 442AC_PATH_PROG(BASH, bash, no)
a18f587d 443if test "$BASH" != no &&
f43ce637 444 $BASH -c 'test "$BASH_VERSINFO" \
6973fc01 445 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
84384f5b
UD
446 libc_cv_have_bash2=yes
447else
448 libc_cv_have_bash2=no
449fi
450AC_SUBST(libc_cv_have_bash2)
451
5290baf0
UD
452dnl We need a ksh compatible shell for tzselect.
453if test "$BASH" = no; then
454 AC_PATH_PROG(KSH, ksh, no)
455 if test "$KSH" = no; then
456 libc_cv_have_ksh=no
457 else
458 libc_cv_have_ksh=yes
459 fi
460else
461 KSH="$BASH"
462 AC_SUBST(KSH)
463 libc_cv_have_ksh=yes
464fi
465AC_SUBST(libc_cv_have_ksh)
466
a2b08ee5
UD
467AC_PATH_PROGS(PERL, perl, no)
468AC_SUBST(PERL)
469
b8dc6a10 470AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
28f540f4
RM
471echo '#include <stddef.h>
472FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
473if eval "$ac_cpp conftest.c 2>/dev/null" \
474| grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
475 libc_cv_signed_size_t=no
476else
477 libc_cv_signed_size_t=yes
478fi
479rm -f conftest*])
28f540f4
RM
480if test $libc_cv_signed_size_t = yes; then
481 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
482 cat >> confdefs.h <<\EOF
483#undef __SIZE_TYPE__
484#define __SIZE_TYPE__ unsigned
485EOF
486fi
487
b8dc6a10 488AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
28f540f4
RM
489AC_TRY_COMPILE(dnl
490[#define __need_size_t
491#define __need_wchar_t
492#include <stddef.h>
493#define __need_NULL
494#include <stddef.h>], [size_t size; wchar_t wchar;
495#ifdef offsetof
496#error stddef.h ignored __need_*
497#endif
498if (&size == NULL || &wchar == NULL) abort ();],
499 libc_cv_friendly_stddef=yes,
500 libc_cv_friendly_stddef=no)])
28f540f4
RM
501if test $libc_cv_friendly_stddef = yes; then
502 config_vars="$config_vars
503override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
504fi
505
b8dc6a10
RM
506AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
507 libc_cv_need_minus_P, [dnl
28f540f4
RM
508cat > conftest.S <<EOF
509#include "confdefs.h"
510/* Nothing whatsoever. */
511EOF
512if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
513 libc_cv_need_minus_P=no
514else
515 libc_cv_need_minus_P=yes
516fi
517rm -f conftest*])
28f540f4
RM
518if test $libc_cv_need_minus_P = yes; then
519 config_vars="$config_vars
520asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
521fi
522
1618c590
UD
523# gcc 2.7.x has a bug where if -pipe is set, the assembler will always
524# be told to read stdin. This causes the compiler to hang when fed an
525# .s file.
526if test $ac_cv_prog_gcc = yes; then
527 case `${CC-cc} -v 2>&1` in
528 *2.7*)
529 # We must check this even if -pipe is not given here, because the user
530 # might do `make CFLAGS=-pipe'.
531 AC_CACHE_CHECK(for gcc 2.7.x -pipe bug, libc_cv_gcc_pipe_bug, [dnl
86187531
UD
532 cp /dev/null conftest.s
533 cat >conftest1.s <<EOF
534.nosuchdirective
1618c590 535EOF
86187531 536 if ${CC-cc} -pipe -c conftest.s <conftest1.s 2>/dev/null; then
1618c590
UD
537 libc_cv_gcc_pipe_bug=no
538 else
539 libc_cv_gcc_pipe_bug=yes
540 fi
541 rm -f conftest*])
542 if test $libc_cv_gcc_pipe_bug = yes; then
543 makeCC="${CC-cc} -B\$(common-objpfx)"
544 makeCFLAGS=$CFLAGS
545 CFLAGS=`echo $CFLAGS |sed 's/-pipe//'`
546 fi;;
547 *) libc_cv_gcc_pipe_bug=no;;
548 esac
549else
550 libc_cv_gcc_pipe_bug=no
551fi
552
b8dc6a10
RM
553AC_CACHE_CHECK(for assembler global-symbol directive,
554 libc_cv_asm_global_directive, [dnl
9a70fcab
UD
555libc_cv_asm_global_directive=UNKNOWN
556for ac_globl in .globl .global; do
557 cat > conftest.s <<EOF
558.text
559${ac_globl} foo
ae1025be 560foo:
9a70fcab
UD
561EOF
562 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
563 libc_cv_asm_global_directive=${ac_globl}
564 fi
565 rm -f conftest*
566 test $libc_cv_asm_global_directive != UNKNOWN && break
567done])
9a70fcab
UD
568if test $libc_cv_asm_global_directive = UNKNOWN; then
569 AC_MSG_ERROR(cannot determine asm global directive)
570else
571 AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
572fi
573
b8dc6a10 574AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
9a70fcab 575cat > conftest.s <<EOF
e215c478 576.text
ae1025be 577foo:
df2a0c93 578.set glibc_conftest_frobozz,foo
9a70fcab 579$libc_cv_asm_global_directive glibc_conftest_frobozz
e215c478 580EOF
df2a0c93
RM
581# The alpha-dec-osf1 assembler gives only a warning for `.set'
582# (but it doesn't work), so we must do a linking check to be sure.
583cat > conftest1.c <<\EOF
584extern int glibc_conftest_frobozz;
585main () { printf ("%d\n", glibc_conftest_frobozz); }
586EOF
587if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
cb2f05ed 588 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
e215c478
RM
589 libc_cv_asm_set_directive=yes
590else
591 libc_cv_asm_set_directive=no
592fi
65b3cbcb 593rm -f conftest*])
e215c478
RM
594if test $libc_cv_asm_set_directive = yes; then
595 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
596fi
597
377a515b
UD
598AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
599[cat > conftest.s <<EOF
600.text
4cca6b86 601_sym:
377a515b
UD
602.symver _sym,sym@VERS
603EOF
604if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
605 libc_cv_asm_symver_directive=yes
606else
607 libc_cv_asm_symver_directive=no
608fi
609rm -f conftest*])
610AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
611if test $libc_cv_asm_symver_directive = yes; then
612 cat > conftest.s <<EOF
613.text
4cca6b86 614_sym:
377a515b
UD
615.symver _sym,sym@VERS
616EOF
617 cat > conftest.map <<EOF
f43ce637 618VERS_1 {
377a515b
UD
619 global: sym;
620};
f43ce637
UD
621
622VERS_2 {
623 global: sym;
624} VERS_1;
377a515b
UD
625EOF
626 if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
5ae3e846
UD
627 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
628 -nostartfiles -nostdlib
ae1025be
UD
629 -Wl,--version-script,conftest.map
630 1>&AC_FD_CC]);
377a515b
UD
631 then
632 libc_cv_ld_version_script_option=yes
633 else
634 libc_cv_ld_version_script_option=no
635 fi
636 else
637 libc_cv_ld_version_script_option=no
638 fi
639else
640 libc_cv_ld_version_script_option=no
641fi
642rm -f conftest*])
643if test $libc_cv_asm_symver_directive = yes &&
650425ce
UD
644 test $libc_cv_ld_version_script_option = yes &&
645 test $enable_versioning = yes; then
377a515b
UD
646 VERSIONING=yes
647 AC_DEFINE(DO_VERSIONING)
648else
649 VERSIONING=no
650fi
651AC_SUBST(VERSIONING)
652
f43ce637
UD
653if test $VERSIONING = no; then
654 echo "\
f4017d20 655*** WARNING: You should not compile GNU libc without versioning. Not using
f43ce637
UD
656*** versioning will introduce incompatibilities so that old binaries
657*** will not run anymore.
658*** For versioning you need recent binutils (binutils-2.8.1.0.17 or newer)."
659fi
fd26970f
UD
660if test $elf = yes; then
661 AC_CACHE_CHECK(for .previous assembler directive,
662 libc_cv_asm_previous_directive, [dnl
663 cat > conftest.s <<EOF
664.section foo_section
665.previous
666EOF
667 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
668 libc_cv_asm_previous_directive=yes
669 else
670 libc_cv_asm_previous_directive=no
671 fi
672 rm -f conftest*])
673 if test $libc_cv_asm_previous_directive = yes; then
674 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
675 else
676 AC_CACHE_CHECK(for .popsection assembler directive,
677 libc_cv_asm_popsection_directive, [dnl
678 cat > conftest.s <<EOF
679.pushsection foo_section
680.popsection
681EOF
682 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
683 libc_cv_asm_popsection_directive=yes
684 else
685 libc_cv_asm_popsection_directive=no
686 fi
687 rm -f conftest*])
688 if test $libc_cv_asm_popsection_directive = yes; then
689 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
690 fi
691 fi
692fi
693
b8dc6a10
RM
694if test $elf != yes; then
695 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
696 [AC_TRY_COMPILE(, [asm (".section .init");
84724245
RM
697 asm (".section .fini");
698 asm (".text");],
b8dc6a10
RM
699 libc_cv_have_initfini=yes,
700 libc_cv_have_initfini=no)])
701 AC_SUBST(libc_cv_have_initfini)dnl
702 if test $libc_cv_have_initfini = yes; then
703 AC_DEFINE(HAVE_INITFINI)
704 fi
705fi
e215c478 706
9a0a462c
UD
707dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
708AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
709[cat > conftest.$ac_ext <<EOF
710dnl This sometimes fails to find confdefs.h, for some reason.
711dnl [#]line __oline__ "[$]0"
712[#]line __oline__ "configure"
713#include "confdefs.h"
714void underscore_test(void) {
715return; }
716EOF
717if AC_TRY_EVAL(ac_compile); then
718 if grep _underscore_test conftest* >/dev/null; then
719 ifelse([$1], , :, [rm -f conftest*
720 $1])
721 else
722 ifelse([$2], , , [rm -f conftest*
723 $2])
724 fi
725else
726 echo "configure: failed program was:" >&AC_FD_CC
727 cat conftest.$ac_ext >&AC_FD_CC
728 ifelse([$2], , , [rm -f conftest*
729 $2])
730fi
731rm -f conftest*])
732
c224a18a
RM
733if test $elf = yes; then
734 libc_cv_asm_underscores=no
735else
9a0a462c
UD
736 if test $ac_cv_prog_cc_works = yes; then
737 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
738 [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
739 libc_cv_asm_underscores=yes,
740 libc_cv_asm_underscores=no)])
741 else
742 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
743 [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
744 libc_cv_asm_underscores=no)])
745 fi
c224a18a
RM
746fi
747if test $libc_cv_asm_underscores = no; then
748 AC_DEFINE(NO_UNDERSCORES)
749fi
750
751if test $elf = yes; then
752 libc_cv_weak_symbols=yes
753 libc_cv_asm_weak_directive=yes
754 libc_cv_asm_weakext_directive=no
755else
756 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
757 [dnl
758cat > conftest.s <<EOF
759.text
760${libc_cv_asm_global_directive} foo
ae1025be 761foo:
c224a18a
RM
762.weak foo
763.weak bar; bar = foo
764EOF
765 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
766 libc_cv_asm_weak_directive=yes
767 else
768 libc_cv_asm_weak_directive=no
769 fi
770 rm -f conftest*])
771
c8cf0b14 772if test $libc_cv_asm_weak_directive = no; then
c224a18a
RM
773 AC_CACHE_CHECK(for assembler .weakext directive,
774 libc_cv_asm_weakext_directive,
775 [dnl
776cat > conftest.s <<EOF
777.text
778${libc_cv_asm_global_directive} foo
ae1025be 779foo:
c224a18a 780.weakext foo
a1470b6f 781.weakext foo, bar
c224a18a
RM
782EOF
783 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
784 libc_cv_asm_weakext_directive=yes
785 else
786 libc_cv_asm_weakext_directive=no
787 fi
788 rm -f conftest*])
789
790 fi # no .weak
791fi # not ELF
792
ffcf9634 793if test $libc_cv_asm_weak_directive = yes; then
c224a18a 794 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
ffcf9634 795elif test $libc_cv_asm_weakext_directive = yes; then
c224a18a
RM
796 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
797fi
798
a641835a
RM
799AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
800cat > conftest.c <<\EOF
5f0e6fc7 801_start () {}
dcf0671d
UD
802int __eh_pc;
803__throw () {}
a641835a 804EOF
dcea62dd
RM
805dnl No \ in command here because it ends up inside ''.
806if AC_TRY_COMMAND([${CC-cc} $CFLAGS
807 -nostdlib -nostartfiles -Wl,--no-whole-archive
ae1025be 808 -o conftest conftest.c 1>&AC_FD_CC]); then
a641835a
RM
809 libc_cv_ld_no_whole_archive=yes
810else
811 libc_cv_ld_no_whole_archive=no
812fi
813rm -f conftest*])
814AC_SUBST(libc_cv_ld_no_whole_archive)dnl
815
b236e99d
UD
816AC_CACHE_CHECK(for gcc -fno-exceptions, libc_cv_gcc_no_exceptions, [dnl
817cat > conftest.c <<\EOF
818_start () {}
819int __eh_pc;
820__throw () {}
821EOF
822dnl No \ in command here because it ends up inside ''.
823if AC_TRY_COMMAND([${CC-cc} $CFLAGS
824 -nostdlib -nostartfiles -fno-exceptions
ae1025be 825 -o conftest conftest.c 1>&AC_FD_CC]); then
b236e99d
UD
826 libc_cv_gcc_no_exceptions=yes
827else
828 libc_cv_gcc_no_exceptions=no
829fi
830rm -f conftest*])
831AC_SUBST(libc_cv_gcc_no_exceptions)dnl
832
650425ce
UD
833AC_CACHE_CHECK(for DWARF2 unwind info support, libc_cv_gcc_dwarf2_unwind_info,
834[cat > conftest.c <<EOF
835#line __oline__ "configure"
836static char __EH_FRAME_BEGIN__[];
837_start ()
838{
839 __register_frame (__EH_FRAME_BEGIN__);
840 __deregister_frame (__EH_FRAME_BEGIN__);
841}
842int __eh_pc;
843__throw () {}
844/* FIXME: this is fragile. */
845malloc () {}
846strcmp () {}
847strlen () {}
848memcpy () {}
849memset () {}
850free () {}
851abort () {}
dfd2257a 852__bzero () {}
650425ce
UD
853EOF
854dnl No \ in command here because it ends up inside ''.
855if AC_TRY_COMMAND([${CC-cc} $CFLAGS
856 -nostdlib -nostartfiles
857 -o conftest conftest.c -lgcc >&AC_FD_CC]); then
858 libc_cv_gcc_dwarf2_unwind_info=yes
859else
860 libc_cv_gcc_dwarf2_unwind_info=no
861fi
862rm -f conftest*])
863if test $libc_cv_gcc_dwarf2_unwind_info = yes; then
864 AC_DEFINE(HAVE_DWARF2_UNWIND_INFO)
865fi
866
c224a18a
RM
867### End of automated tests.
868### Now run sysdeps configure fragments.
869
28f540f4
RM
870# sysdeps configure fragments may set these with files to be linked below.
871libc_link_dests=
872libc_link_sources=
873
874# Iterate over all the sysdep directories we will use, running their
875# configure fragments, and looking for a uname implementation.
876uname=
877for dir in $sysnames; do
57ba7bb4
UD
878 case $dir in
879 /*) dest=$dir ;;
880 *) dest=$srcdir/$dir ;;
881 esac
882 if test -r $dest/configure; then
883 AC_MSG_RESULT(running configure fragment for $dest)
884 . $dest/configure
28f540f4 885 fi
4ca84cff 886[
28f540f4 887 if test -z "$uname"; then
e7f1f046
UD
888 if test -r $dest/uname.c ||
889 test -r $dest/uname.S ||
890 { test -r $dest/syscalls.list &&
891 grep '^uname[ ]' $dest/syscalls.list >/dev/null; }; then
b86199fb 892 uname=$dir
4ca84cff 893 fi
28f540f4 894 fi
4ca84cff 895]dnl
28f540f4
RM
896done
897
898AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
899
900# If we will use the generic uname implementation, we must figure out what
901# it will say by examining the system, and write the results in config-name.h.
e7f1f046 902if test "$uname" = "sysdeps/generic"; then
28f540f4
RM
903
904changequote(,)dnl
905 uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
906changequote([,])dnl
907 if test $uname_sysname != $config_os; then
908 config_release=`echo $config_os | sed s/$uname_sysname//`
909 fi
910dnl
911AC_DEFUN(LIBC_KERNEL_ID, [dnl
912 if test -r /vmunix; then
913 kernel_id=`strings /vmunix | grep UNIX`
914 elif test -r /dynix; then
915 kernel_id=`strings /dynix | grep DYNIX`
916 else
917 kernel_id=
918 fi
919])dnl
920
b8dc6a10 921 AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
28f540f4
RM
922AC_REQUIRE([LIBC_KERNEL_ID])dnl
923changequote(,)dnl
924 kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
925changequote([,])dnl
926 if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
927 != x$config_release; then
928 # The configuration release is a substring of the kernel release.
929 libc_cv_uname_release=$kernel_release
930 elif test x$config_release != x; then
931 libc_cv_uname_release=$config_release
932 elif test x$kernel_release != x; then
933 libc_cv_uname_release=$kernel_release
934 else
935 libc_cv_uname_release=unknown
936 fi])
28f540f4
RM
937 uname_release="$libc_cv_uname_release"
938
b8dc6a10 939 AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
28f540f4
RM
940AC_REQUIRE([LIBC_KERNEL_ID])dnl
941changequote(,)dnl
942 kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
943changequote([,])dnl
944 if test -n "$kernel_version"; then
945 libc_cv_uname_version="$kernel_version"
946 else
947 libc_cv_uname_version=unknown
948 fi])
28f540f4
RM
949 uname_version="$libc_cv_uname_version"
950
951AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
952 config_uname=config-name.h:config-name.in
953else
954 # For non-generic uname, we don't need to create config-name.h at all.
955 config_uname=
956fi
957
96aa2d94
RM
958AC_MSG_CHECKING(stdio selection)
959AC_SUBST(stdio)
960case $stdio in
961libio) AC_DEFINE(USE_IN_LIBIO) ;;
962default) stdio=stdio ;;
963esac
964AC_MSG_RESULT($stdio)
965
26b4d766
UD
966AC_MSG_CHECKING(ldap selection)
967AC_SUBST(LDAP)
968case $add_ons in
969*ldap*)
970 ldap=yes
971 LDAP=ldap ;;
972*) ldap=no
973 LDAP= ;;
974esac
975AC_MSG_RESULT($ldap)
976
84384f5b
UD
977AC_SUBST(libc_cv_slibdir)
978AC_SUBST(libc_cv_sysconfdir)
1ef32c3d
UD
979AC_SUBST(libc_cv_rootsbindir)
980
981AC_SUBST(has_ldconfig)
84384f5b 982
c224a18a 983AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf)
28f540f4
RM
984if test $gnu_ld = yes; then
985 AC_DEFINE(HAVE_GNU_LD)
986fi
987if test $gnu_as = yes; then
988 AC_DEFINE(HAVE_GNU_AS)
989fi
990if test $elf = yes; then
991 AC_DEFINE(HAVE_ELF)
992fi
28f540f4 993
650425ce 994AC_SUBST(static)
ff3d7ed3
RM
995AC_SUBST(shared)
996if test $shared = default; then
997 if test $gnu_ld = yes; then
998 shared=$elf
f65fd747
UD
999 else
1000 # For now we do not assume shared libs are available. In future more
1001 # tests might become available.
1002 shared=no
ff3d7ed3
RM
1003 fi
1004fi
cc3fa755
UD
1005
1006AC_CACHE_CHECK([whether -fPIC is default], pic_default,
1007[pic_default=yes
1008cat > conftest.c <<EOF
1009#if defined(__PIC__) || defined(__pic__) || defined(PIC) || defined(pic)
1010# error PIC is default.
1011#endif
1012EOF
1013if eval "${CC-cc} -S conftest.c 2>&AC_FD_CC 1>&AC_FD_CC"; then
1014 pic_default=no
1015fi
1016rm -f conftest.*])
1017AC_SUBST(pic_default)
1018
ff3d7ed3
RM
1019AC_SUBST(profile)
1020AC_SUBST(omitfp)
5a97622d 1021AC_SUBST(bounded)
5107cf1d 1022AC_SUBST(static_nss)
5ae3e846 1023AC_SUBST(nopic_initfini)
ff3d7ed3 1024
edf5b2d7
UD
1025AC_SUBST(DEFINES)
1026
28f540f4
RM
1027if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
1028 config_makefile=
1029else
1030 config_makefile=Makefile
1031fi
1032
df4ef2ab
UD
1033VERSION=`sed -e 's/^#define VERSION "\([^"]*\)"/\1/p' -e d < $srcdir/version.h`
1034AC_SUBST(VERSION)
1035
1618c590
UD
1036if test $libc_cv_gcc_pipe_bug = yes; then
1037 realCC=$CC
1038 CC=$makeCC
1039 CFLAGS=$makeCFLAGS
1040fi
1041AC_OUTPUT_COMMANDS([
1042if test "$realCC"; then
1043 sed -e 's/%{pipe:-}/%|/g' `$realCC -print-file-name=specs` >specsT
1044 mv specsT specs
1045fi], [realCC=$realCC])
1046
ae1025be 1047AC_OUTPUT(config.make glibcbug ${config_makefile} ${config_uname}, ,
5107cf1d 1048 [echo '$config_vars' >> config.make; test -d bits || mkdir bits])