]> sourceware.org Git - glibc.git/blame - configure.in
Wed Nov 22 12:37:39 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / configure.in
CommitLineData
d586354e 1Dnl Process this file with autoconf to produce a configure script.
ff3d7ed3 2AC_REVISION([$CVSid$])
b8dc6a10 3AC_PREREQ(2.4.2)dnl dnl Minimum Autoconf version required.
28f540f4
RM
4AC_INIT(features.h)
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
RM
36AC_ARG_WITH(fp, dnl
37 --with-fp if using floating-point hardware,
38 with_fp=$withval, with_fp=yes)
28f540f4
RM
39AC_ARG_WITH(gnu-binutils, dnl
40 --with-gnu-binutils if using GNU binutils (as and ld),
335aa320 41 gnu_binutils=$withval, gnu_binutils=no)
28f540f4
RM
42AC_ARG_WITH(gnu-ld, dnl
43 --with-gnu-ld if using GNU ld (in the binutils package),
335aa320 44 gnu_ld=$withval, gnu_ld=no)
28f540f4
RM
45AC_ARG_WITH(gnu-as, dnl
46 --with-gnu-as if using GNU as (in the binutils package),
335aa320 47 gnu_as=$withval, gnu_as=no)
28f540f4
RM
48test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
49AC_ARG_WITH(elf, dnl
50 --with-elf if using the ELF object format,
335aa320 51 elf=$withval, elf=no)
28f540f4
RM
52AC_ARG_WITH(weak-symbols, dnl
53 --with-weak-symbols if weak symbols are available in as and ld,
335aa320 54 weak=$withval, weak=no)
28f540f4 55
deab9dea
RM
56AC_ARG_ENABLE(libio, dnl
57[ --enable-libio build in GNU libio instead of GNU stdio],
96aa2d94 58 stdio=libio, stdio=default)
deab9dea 59
ff3d7ed3
RM
60dnl Arguments to enable or disable building the shared, profiled, and
61dnl -fomit-frame-pointer libraries.
62AC_ARG_ENABLE(shared, dnl
63[ --enable-shared build shared library [default=yes if GNU ld & ELF]],
424f8c09 64 shared=$enableval, shared=default)
ff3d7ed3
RM
65AC_ARG_ENABLE(profile, dnl
66[ --enable-profile build profiled library [default=yes]],
424f8c09 67 profile=$enableval, profile=yes)
ff3d7ed3
RM
68AC_ARG_ENABLE(omitfp, dnl
69[ --enable-omitfp build undebuggable optimized library [default=no]],
424f8c09 70 omitfp=$enableval, omitfp=no)
ff3d7ed3 71
28f540f4
RM
72AC_CANONICAL_HOST
73# We keep the original values in `$config_*' and never modify them, so we
74# can write them unchanged into config.make. Everything else uses
75# $machine, $vendor, and $os, and changes them whenever convenient.
76config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
77
a2fe9c76
RM
78# Some configurations imply other options.
79case "$host_os" in
80gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
81 # These systems always use GNU tools.
82 gnu_ld=yes gnu_as=yes
83esac
84case "$host_os" in
85gnu* | linux* | sysv4* | solaris2*)
86 # These systems always use the ELF format.
87 elf=yes
88esac
89
90# Compute the list of sysdep directories for this configuration.
28f540f4 91sysdep_dir=$srcdir/sysdeps
b8dc6a10 92AC_CACHE_CHECK(sysdep dirs, libc_cv_sysdirs, [dnl
28f540f4
RM
93machine=$config_machine
94vendor=$config_vendor
95os=$config_os
96
97dnl We need to use [ and ] for other purposes for a while now.
98changequote(,)dnl
99# Expand the configuration machine name into a subdirectory by architecture
100# type and particular chip.
101case "$machine" in
8f5ca04b
RM
102a29k | am29000) machine=a29k ;;
103alpha*) machine=alpha/$machine ;;
104hppa*) machine=hppa/$machine ;;
105i[345]86) machine=i386/$machine ;;
106m680?0) machine=m68k/$machine ;;
107m68k) machine=m68k/m68020 ;;
108m88???) machine=m88k/$machine ;;
109m88k) machine=m88k/m88100 ;;
110mips*) machine=mips/$machine ;;
111mips64*) machine=mips/mips64/$machine ;;
112sparc[6789]) machine=sparc/$machine ;;
113supersparc) machine=sparc/sparc8 ;;
28f540f4
RM
114esac
115
116# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
117os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
118
119case "$os" in
120gnu*)
121 base_os=mach/hurd ;;
883bc19b 122netbsd* | 386bsd* | freebsd* | bsdi*)
28f540f4 123 base_os=unix/bsd/bsd4.4 ;;
222c4e71 124osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
28f540f4 125 base_os=unix/bsd ;;
d586354e 126sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
28f540f4 127 base_os=unix/sysv ;;
d586354e 128solaris[2-9]*)
28f540f4
RM
129 base_os=unix/sysv/sysv4 ;;
130none)
131 base_os=standalone ;;
132*)
133 base_os='' ;;
134esac
135
136# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
137tail=$os
138ostry=$os
139while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
140 ostry="$ostry /$o"
141 tail=$o
75914335 142done
28f540f4
RM
143o=`echo $tail | sed 's/[0-9]*$//'`
144if test $o != $tail; then
145 ostry="$ostry /$o"
146fi
147
148# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
149base=
150tail=$base_os
151while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
152 set $b
153 base="$base /$1"
154 tail="$2"
155done
156
157# For sparc/sparc9, try sparc/sparc9 and then sparc.
158mach=
159tail=$machine
160while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
161 set $m
10ceac89
RM
162 # Prepend the machine's FPU directory unless --without-fp.
163 if test "$with_fp" = yes; then
164 mach="$mach /$1/fpu"
82d00cab 165 fi
28f540f4
RM
166 mach="$mach /$1"
167 tail="$2"
168done
169
170dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
171changequote([,])dnl
172
173# Find what sysdep directories exist.
174sysnames=
175for b in $base ''; do
176 for m0 in $mach ''; do
177 for v in /$vendor ''; do
178 for o in /$ostry ''; do
179 for m in $mach ''; do
180 try="$m0$b$v$o$m"
587dbc6f 181 test -n "$enable_debug_configure" && echo "$0 [DEBUG]: try $try" >&2
28f540f4
RM
182 if test -d $sysdep_dir$try; then
183 sysnames="$sysnames $try"
184 { test -n "$o" || test -n "$b"; } && os_used=t
185 { test -n "$m" || test -n "$m0"; } && machine_used=t
186 fi
187 done
188 done
189 done
190 done
191done
192
193if test -z "$os_used" && test "$os" != none; then
194 AC_MSG_ERROR(Operating system $os is not supported.)
195fi
196if test -z "$machine_used" && test "$machine" != none; then
197 AC_MSG_ERROR(The $machine is not supported.)
198fi
199
200# We have now validated the configuration.
201
335aa320 202
10ceac89
RM
203# If using ELF, look for an `elf' subdirectory of each machine directory.
204# We prepend these rather than inserting them whereever the machine appears
205# because things specified by the machine's ELF ABI should override
206# OS-specific things, and should always be the same for any OS on the
207# machine (otherwise what's the point of an ABI?).
208if test "$elf" = yes; then
209 elf_dirs=
28f540f4 210 for m in $mach; do
10ceac89
RM
211 if test -d $sysdep_dir$m/elf; then
212 elf_dirs="$elf_dirs $m/elf"
28f540f4
RM
213 fi
214 done
10ceac89 215 sysnames="`echo $elf_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
28f540f4
RM
216fi
217
335aa320 218
10ceac89
RM
219# Remove the leading slashes.
220sysnames="`echo $sysnames | sed -e 's@^/@@' -e 's@ /@ @g'`"
221
335aa320 222
28f540f4
RM
223# Expand the list of system names into a full list of directories
224# from each element's parent name and Implies file (if present).
225set $sysnames
226while test $# -gt 0; do
227 name=$1
228 shift
229
230 if test -f $sysdep_dir/$name/Implies; then
231 # Collect more names from the `Implies' file (removing comments).
232 implied="`sed 's/#.*$//' < $sysdep_dir/$name/Implies`"
233 for x in $implied; do
234 test -d $sysdep_dir/$x || echo "Warning: $name implies nonexistent $x">&2
235 done
236 else
237 implied=
238 fi
239
240 # Add NAME to the list of names.
241 names="$names $name"
242
243 # Find the parent of NAME, using the empty string if it has none.
244changequote(,)dnl
245 parent="`echo $name | sed -n -e '/\//!q' -e 's=/[^/]*$==p'`"
246changequote([,])dnl
247
248 # Add the names implied by NAME, and NAME's parent (if it has one), to
249 # the list of names to be processed (the argument list). We prepend the
250 # implied names to the list and append the parent. We want implied
251 # directories to come before further directories inferred from the
252 # configuration components; this ensures that for sysv4, unix/common
253 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
254 # after sysv4).
255 sysnames="`echo $implied $* $parent`"
256 test -n "$sysnames" && set $sysnames
257done
258
259# Add the default directories.
260names="$names generic stub"
261
262# Now uniquize the list.
263seen=
264sysnames=
265for name in $names; do
266 if echo "$seen" | fgrep -x $name >/dev/null; then
267 # Already in the list.
268 true;
269 else
270 # A new one.
271 if test -z "$seen"; then
272 seen="$name" sysnames="$name"
273 else
274 seen="$seen
275$name"
276 sysnames="$sysnames $name"
277 fi
278 fi
279done
280libc_cv_sysdirs="$sysnames"])
281AC_SUBST(sysnames) sysnames="$libc_cv_sysdirs"
28f540f4 282
28f540f4
RM
283AC_PROG_INSTALL
284if test "$INSTALL" = "${srcdir}/install-sh"; then
285 # The makefiles need to use a different form to find it in $srcdir.
286 INSTALL='$(..)./install-sh'
287fi
288
ff3d7ed3
RM
289AC_CHECK_TOOL(CC, gcc)
290AC_CHECK_TOOL(AR, ar)
291AC_CHECK_TOOL(RANLIB, ranlib, :)
28f540f4 292AC_PROG_CPP
28f540f4 293
b8dc6a10 294AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
28f540f4
RM
295echo '#include <stddef.h>
296FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
297if eval "$ac_cpp conftest.c 2>/dev/null" \
298| grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
299 libc_cv_signed_size_t=no
300else
301 libc_cv_signed_size_t=yes
302fi
303rm -f conftest*])
28f540f4
RM
304if test $libc_cv_signed_size_t = yes; then
305 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
306 cat >> confdefs.h <<\EOF
307#undef __SIZE_TYPE__
308#define __SIZE_TYPE__ unsigned
309EOF
310fi
311
b8dc6a10 312AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
28f540f4
RM
313AC_TRY_COMPILE(dnl
314[#define __need_size_t
315#define __need_wchar_t
316#include <stddef.h>
317#define __need_NULL
318#include <stddef.h>], [size_t size; wchar_t wchar;
319#ifdef offsetof
320#error stddef.h ignored __need_*
321#endif
322if (&size == NULL || &wchar == NULL) abort ();],
323 libc_cv_friendly_stddef=yes,
324 libc_cv_friendly_stddef=no)])
28f540f4
RM
325if test $libc_cv_friendly_stddef = yes; then
326 config_vars="$config_vars
327override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
328fi
329
b8dc6a10
RM
330AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
331 libc_cv_need_minus_P, [dnl
28f540f4
RM
332cat > conftest.S <<EOF
333#include "confdefs.h"
334/* Nothing whatsoever. */
335EOF
336if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
337 libc_cv_need_minus_P=no
338else
339 libc_cv_need_minus_P=yes
340fi
341rm -f conftest*])
28f540f4
RM
342if test $libc_cv_need_minus_P = yes; then
343 config_vars="$config_vars
344asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
345fi
346
b8dc6a10
RM
347AC_CACHE_CHECK(for assembler global-symbol directive,
348 libc_cv_asm_global_directive, [dnl
9a70fcab
UD
349libc_cv_asm_global_directive=UNKNOWN
350for ac_globl in .globl .global; do
351 cat > conftest.s <<EOF
352.text
353${ac_globl} foo
354foo: .long 0
355EOF
356 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
357 libc_cv_asm_global_directive=${ac_globl}
358 fi
359 rm -f conftest*
360 test $libc_cv_asm_global_directive != UNKNOWN && break
361done])
9a70fcab
UD
362if test $libc_cv_asm_global_directive = UNKNOWN; then
363 AC_MSG_ERROR(cannot determine asm global directive)
364else
365 AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
366fi
367
b8dc6a10 368AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
9a70fcab 369cat > conftest.s <<EOF
e215c478
RM
370.text
371foo: .long 0
df2a0c93 372.set glibc_conftest_frobozz,foo
9a70fcab 373$libc_cv_asm_global_directive glibc_conftest_frobozz
e215c478 374EOF
df2a0c93
RM
375# The alpha-dec-osf1 assembler gives only a warning for `.set'
376# (but it doesn't work), so we must do a linking check to be sure.
377cat > conftest1.c <<\EOF
378extern int glibc_conftest_frobozz;
379main () { printf ("%d\n", glibc_conftest_frobozz); }
380EOF
381if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
cb2f05ed 382 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
e215c478
RM
383 libc_cv_asm_set_directive=yes
384else
385 libc_cv_asm_set_directive=no
386fi
65b3cbcb 387rm -f conftest*])
e215c478
RM
388if test $libc_cv_asm_set_directive = yes; then
389 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
390fi
391
b8dc6a10
RM
392if test $elf != yes; then
393 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
394 [AC_TRY_COMPILE(, [asm (".section .init");
395 asm (".section .fini");],
396 libc_cv_have_initfini=yes,
397 libc_cv_have_initfini=no)])
398 AC_SUBST(libc_cv_have_initfini)dnl
399 if test $libc_cv_have_initfini = yes; then
400 AC_DEFINE(HAVE_INITFINI)
401 fi
402fi
e215c478 403
28f540f4
RM
404# sysdeps configure fragments may set these with files to be linked below.
405libc_link_dests=
406libc_link_sources=
407
408# Iterate over all the sysdep directories we will use, running their
409# configure fragments, and looking for a uname implementation.
410uname=
411for dir in $sysnames; do
412 if test -r $sysdep_dir/$dir/configure; then
413 AC_MSG_RESULT(running configure fragment for $dir)
414 . $sysdep_dir/$dir/configure
415 fi
416 if test -z "$uname"; then
417 { test -r $sysdep_dir/$dir/uname.c || test -r $sysdep_dir/$dir/uname.S; } \
418 && uname=$dir
419 fi
420done
421
422AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
423
424# If we will use the generic uname implementation, we must figure out what
425# it will say by examining the system, and write the results in config-name.h.
426if test "$uname" = generic; then
427
428changequote(,)dnl
429 uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
430changequote([,])dnl
431 if test $uname_sysname != $config_os; then
432 config_release=`echo $config_os | sed s/$uname_sysname//`
433 fi
434dnl
435AC_DEFUN(LIBC_KERNEL_ID, [dnl
436 if test -r /vmunix; then
437 kernel_id=`strings /vmunix | grep UNIX`
438 elif test -r /dynix; then
439 kernel_id=`strings /dynix | grep DYNIX`
440 else
441 kernel_id=
442 fi
443])dnl
444
b8dc6a10 445 AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
28f540f4
RM
446AC_REQUIRE([LIBC_KERNEL_ID])dnl
447changequote(,)dnl
448 kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
449changequote([,])dnl
450 if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
451 != x$config_release; then
452 # The configuration release is a substring of the kernel release.
453 libc_cv_uname_release=$kernel_release
454 elif test x$config_release != x; then
455 libc_cv_uname_release=$config_release
456 elif test x$kernel_release != x; then
457 libc_cv_uname_release=$kernel_release
458 else
459 libc_cv_uname_release=unknown
460 fi])
28f540f4
RM
461 uname_release="$libc_cv_uname_release"
462
b8dc6a10 463 AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
28f540f4
RM
464AC_REQUIRE([LIBC_KERNEL_ID])dnl
465changequote(,)dnl
466 kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
467changequote([,])dnl
468 if test -n "$kernel_version"; then
469 libc_cv_uname_version="$kernel_version"
470 else
471 libc_cv_uname_version=unknown
472 fi])
28f540f4
RM
473 uname_version="$libc_cv_uname_version"
474
475AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
476 config_uname=config-name.h:config-name.in
477else
478 # For non-generic uname, we don't need to create config-name.h at all.
479 config_uname=
480fi
481
96aa2d94
RM
482AC_MSG_CHECKING(stdio selection)
483AC_SUBST(stdio)
484case $stdio in
485libio) AC_DEFINE(USE_IN_LIBIO) ;;
486default) stdio=stdio ;;
487esac
488AC_MSG_RESULT($stdio)
489
28f540f4
RM
490AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(weak)
491if test $gnu_ld = yes; then
492 AC_DEFINE(HAVE_GNU_LD)
493fi
494if test $gnu_as = yes; then
495 AC_DEFINE(HAVE_GNU_AS)
496fi
497if test $elf = yes; then
498 AC_DEFINE(HAVE_ELF)
499fi
500if test $weak = yes; then
501 AC_DEFINE(HAVE_WEAK_SYMBOLS)
502fi
503
ff3d7ed3
RM
504AC_SUBST(shared)
505if test $shared = default; then
506 if test $gnu_ld = yes; then
507 shared=$elf
508 fi
509fi
510AC_SUBST(profile)
511AC_SUBST(omitfp)
512
28f540f4
RM
513if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
514 config_makefile=
515else
516 config_makefile=Makefile
517fi
518
519AC_OUTPUT(config.make ${config_makefile} ${config_uname}, ,
520 [echo '$config_vars' >> config.make])
This page took 0.088985 seconds and 5 git commands to generate.