]> git.ipfire.org Git - thirdparty/glibc.git/blame - configure.in
Sun Mar 12 18:21:10 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[thirdparty/glibc.git] / configure.in
CommitLineData
28f540f4 1dnl Process this file with autoconf to produce a configure script.
ff3d7ed3
RM
2AC_REVISION([$CVSid$])
3AC_PREREQ(2.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])
21
ff3d7ed3 22dnl Arguments to specify presence of other packages/features.
28f540f4
RM
23AC_ARG_WITH(gnu-binutils, dnl
24 --with-gnu-binutils if using GNU binutils (as and ld),
25 gnu_binutils=yes, gnu_binutils=no)
26AC_ARG_WITH(gnu-ld, dnl
27 --with-gnu-ld if using GNU ld (in the binutils package),
28 gnu_ld=yes, gnu_ld=no)
29AC_ARG_WITH(gnu-as, dnl
30 --with-gnu-as if using GNU as (in the binutils package),
31 gnu_as=yes, gnu_as=no)
32test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
33AC_ARG_WITH(elf, dnl
34 --with-elf if using the ELF object format,
35 elf=yes, elf=no)
36AC_ARG_WITH(weak-symbols, dnl
37 --with-weak-symbols if weak symbols are available in as and ld,
38 weak=yes, weak=no)
39
ff3d7ed3
RM
40dnl Arguments to enable or disable building the shared, profiled, and
41dnl -fomit-frame-pointer libraries.
42AC_ARG_ENABLE(shared, dnl
43[ --enable-shared build shared library [default=yes if GNU ld & ELF]],
424f8c09 44 shared=$enableval, shared=default)
ff3d7ed3
RM
45AC_ARG_ENABLE(profile, dnl
46[ --enable-profile build profiled library [default=yes]],
424f8c09 47 profile=$enableval, profile=yes)
ff3d7ed3
RM
48AC_ARG_ENABLE(omitfp, dnl
49[ --enable-omitfp build undebuggable optimized library [default=no]],
424f8c09 50 omitfp=$enableval, omitfp=no)
ff3d7ed3 51
28f540f4
RM
52AC_CANONICAL_HOST
53# We keep the original values in `$config_*' and never modify them, so we
54# can write them unchanged into config.make. Everything else uses
55# $machine, $vendor, and $os, and changes them whenever convenient.
56config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
57
58sysdep_dir=$srcdir/sysdeps
59AC_MSG_CHECKING(sysdep dirs)
60AC_CACHE_VAL(libc_cv_sysdirs, [dnl
61machine=$config_machine
62vendor=$config_vendor
63os=$config_os
64
65dnl We need to use [ and ] for other purposes for a while now.
66changequote(,)dnl
67# Expand the configuration machine name into a subdirectory by architecture
68# type and particular chip.
69case "$machine" in
70i[345]86)
71 machine=i386/$machine ;;
72sparc[6789])
73 machine=sparc/$machine ;;
74m68k)
75 machine=m68k/m68020 ;;
76m680?0)
77 machine=m68k/$machine ;;
78m88k)
79 machine=m88k/m88100 ;;
80m88???)
81 machine=m88k/$machine ;;
82mips64*)
83 machine=mips/mips64/$machine ;;
84mips*)
85 machine=mips/$machine ;;
86esac
87
88# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
89os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
90
91case "$os" in
92gnu*)
93 base_os=mach/hurd ;;
94netbsd* | 386bsd*)
95 base_os=unix/bsd/bsd4.4 ;;
222c4e71 96osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
28f540f4
RM
97 base_os=unix/bsd ;;
98linux* | sysv* | isc* | esix* | sco* | minix* | irix4*)
99 base_os=unix/sysv ;;
100solaris[2-9]*)
101 base_os=unix/sysv/sysv4 ;;
102none)
103 base_os=standalone ;;
104*)
105 base_os='' ;;
106esac
107
108# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
109tail=$os
110ostry=$os
111while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
112 ostry="$ostry /$o"
113 tail=$o
114done
115o=`echo $tail | sed 's/[0-9]*$//'`
116if test $o != $tail; then
117 ostry="$ostry /$o"
118fi
119
120# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
121base=
122tail=$base_os
123while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
124 set $b
125 base="$base /$1"
126 tail="$2"
127done
128
129# For sparc/sparc9, try sparc/sparc9 and then sparc.
130mach=
131tail=$machine
132while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
133 set $m
134 mach="$mach /$1"
135 tail="$2"
136done
137
138dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
139changequote([,])dnl
140
141# Find what sysdep directories exist.
142sysnames=
143for b in $base ''; do
144 for m0 in $mach ''; do
145 for v in /$vendor ''; do
146 for o in /$ostry ''; do
147 for m in $mach ''; do
148 try="$m0$b$v$o$m"
149 if test -d $sysdep_dir$try; then
150 sysnames="$sysnames $try"
151 { test -n "$o" || test -n "$b"; } && os_used=t
152 { test -n "$m" || test -n "$m0"; } && machine_used=t
153 fi
154 done
155 done
156 done
157 done
158done
159
160if test -z "$os_used" && test "$os" != none; then
161 AC_MSG_ERROR(Operating system $os is not supported.)
162fi
163if test -z "$machine_used" && test "$machine" != none; then
164 AC_MSG_ERROR(The $machine is not supported.)
165fi
166
167# We have now validated the configuration.
168
169# Remove the leading slashes.
170sysnames="`echo $sysnames | sed -e 's@^/@@' -e 's@ /@ @g'`"
171
172# Prepend the machine's FPU directory unless --without-fp.
173if test "$with_fp" = no; then
174 fpu_dirs=
175 for m in $mach; do
176 if test -d $sysdep_dir$m/fpu; then
177 fpu_dirs="$fpu_dirs $m/fpu"
178 fi
179 done
180 sysnames="`echo $fpu_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
181fi
182
183# Expand the list of system names into a full list of directories
184# from each element's parent name and Implies file (if present).
185set $sysnames
186while test $# -gt 0; do
187 name=$1
188 shift
189
190 if test -f $sysdep_dir/$name/Implies; then
191 # Collect more names from the `Implies' file (removing comments).
192 implied="`sed 's/#.*$//' < $sysdep_dir/$name/Implies`"
193 for x in $implied; do
194 test -d $sysdep_dir/$x || echo "Warning: $name implies nonexistent $x">&2
195 done
196 else
197 implied=
198 fi
199
200 # Add NAME to the list of names.
201 names="$names $name"
202
203 # Find the parent of NAME, using the empty string if it has none.
204changequote(,)dnl
205 parent="`echo $name | sed -n -e '/\//!q' -e 's=/[^/]*$==p'`"
206changequote([,])dnl
207
208 # Add the names implied by NAME, and NAME's parent (if it has one), to
209 # the list of names to be processed (the argument list). We prepend the
210 # implied names to the list and append the parent. We want implied
211 # directories to come before further directories inferred from the
212 # configuration components; this ensures that for sysv4, unix/common
213 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
214 # after sysv4).
215 sysnames="`echo $implied $* $parent`"
216 test -n "$sysnames" && set $sysnames
217done
218
219# Add the default directories.
220names="$names generic stub"
221
222# Now uniquize the list.
223seen=
224sysnames=
225for name in $names; do
226 if echo "$seen" | fgrep -x $name >/dev/null; then
227 # Already in the list.
228 true;
229 else
230 # A new one.
231 if test -z "$seen"; then
232 seen="$name" sysnames="$name"
233 else
234 seen="$seen
235$name"
236 sysnames="$sysnames $name"
237 fi
238 fi
239done
240libc_cv_sysdirs="$sysnames"])
241AC_SUBST(sysnames) sysnames="$libc_cv_sysdirs"
242AC_MSG_RESULT(${sysnames})
243
244case "$host_os" in
245gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
246 gnu_ld=yes gnu_as=yes
247esac
248case "$host_os" in
249gnu*elf* | linux*elf* | sysv4* | solaris2*)
250 elf=yes
251esac
252
253AC_PROG_INSTALL
254if test "$INSTALL" = "${srcdir}/install-sh"; then
255 # The makefiles need to use a different form to find it in $srcdir.
256 INSTALL='$(..)./install-sh'
257fi
258
ff3d7ed3
RM
259AC_CHECK_TOOL(CC, gcc)
260AC_CHECK_TOOL(AR, ar)
261AC_CHECK_TOOL(RANLIB, ranlib, :)
28f540f4 262AC_PROG_CPP
28f540f4
RM
263
264AC_MSG_CHECKING(signed size_t type)
265AC_CACHE_VAL(libc_cv_signed_size_t, [dnl
266echo '#include <stddef.h>
267FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
268if eval "$ac_cpp conftest.c 2>/dev/null" \
269| grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
270 libc_cv_signed_size_t=no
271else
272 libc_cv_signed_size_t=yes
273fi
274rm -f conftest*])
275AC_MSG_RESULT($libc_cv_signed_size_t)
276if test $libc_cv_signed_size_t = yes; then
277 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
278 cat >> confdefs.h <<\EOF
279#undef __SIZE_TYPE__
280#define __SIZE_TYPE__ unsigned
281EOF
282fi
283
284AC_MSG_CHECKING(libc-friendly stddef.h)
285AC_CACHE_VAL(libc_cv_friendly_stddef, [dnl
286AC_TRY_COMPILE(dnl
287[#define __need_size_t
288#define __need_wchar_t
289#include <stddef.h>
290#define __need_NULL
291#include <stddef.h>], [size_t size; wchar_t wchar;
292#ifdef offsetof
293#error stddef.h ignored __need_*
294#endif
295if (&size == NULL || &wchar == NULL) abort ();],
296 libc_cv_friendly_stddef=yes,
297 libc_cv_friendly_stddef=no)])
298AC_MSG_RESULT($libc_cv_friendly_stddef)
299if test $libc_cv_friendly_stddef = yes; then
300 config_vars="$config_vars
301override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
302fi
303
304AC_MSG_CHECKING(whether we need to use -P to assemble .S files)
305AC_CACHE_VAL(libc_cv_need_minus_P, [dnl
306cat > conftest.S <<EOF
307#include "confdefs.h"
308/* Nothing whatsoever. */
309EOF
310if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
311 libc_cv_need_minus_P=no
312else
313 libc_cv_need_minus_P=yes
314fi
315rm -f conftest*])
316AC_MSG_RESULT($libc_cv_need_minus_P)
317if test $libc_cv_need_minus_P = yes; then
318 config_vars="$config_vars
319asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
320fi
321
322# sysdeps configure fragments may set these with files to be linked below.
323libc_link_dests=
324libc_link_sources=
325
326# Iterate over all the sysdep directories we will use, running their
327# configure fragments, and looking for a uname implementation.
328uname=
329for dir in $sysnames; do
330 if test -r $sysdep_dir/$dir/configure; then
331 AC_MSG_RESULT(running configure fragment for $dir)
332 . $sysdep_dir/$dir/configure
333 fi
334 if test -z "$uname"; then
335 { test -r $sysdep_dir/$dir/uname.c || test -r $sysdep_dir/$dir/uname.S; } \
336 && uname=$dir
337 fi
338done
339
340AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
341
342# If we will use the generic uname implementation, we must figure out what
343# it will say by examining the system, and write the results in config-name.h.
344if test "$uname" = generic; then
345
346changequote(,)dnl
347 uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
348changequote([,])dnl
349 if test $uname_sysname != $config_os; then
350 config_release=`echo $config_os | sed s/$uname_sysname//`
351 fi
352dnl
353AC_DEFUN(LIBC_KERNEL_ID, [dnl
354 if test -r /vmunix; then
355 kernel_id=`strings /vmunix | grep UNIX`
356 elif test -r /dynix; then
357 kernel_id=`strings /dynix | grep DYNIX`
358 else
359 kernel_id=
360 fi
361])dnl
362
363 AC_MSG_CHECKING(OS release for uname)
364 AC_CACHE_VAL(libc_cv_uname_release, [dnl
365AC_REQUIRE([LIBC_KERNEL_ID])dnl
366changequote(,)dnl
367 kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
368changequote([,])dnl
369 if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
370 != x$config_release; then
371 # The configuration release is a substring of the kernel release.
372 libc_cv_uname_release=$kernel_release
373 elif test x$config_release != x; then
374 libc_cv_uname_release=$config_release
375 elif test x$kernel_release != x; then
376 libc_cv_uname_release=$kernel_release
377 else
378 libc_cv_uname_release=unknown
379 fi])
380 AC_MSG_RESULT($libc_cv_uname_release)
381 uname_release="$libc_cv_uname_release"
382
383 AC_MSG_CHECKING(OS version for uname)
384 AC_CACHE_VAL(libc_cv_uname_version, [dnl
385AC_REQUIRE([LIBC_KERNEL_ID])dnl
386changequote(,)dnl
387 kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
388changequote([,])dnl
389 if test -n "$kernel_version"; then
390 libc_cv_uname_version="$kernel_version"
391 else
392 libc_cv_uname_version=unknown
393 fi])
394 AC_MSG_RESULT($libc_cv_uname_version)
395 uname_version="$libc_cv_uname_version"
396
397AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
398 config_uname=config-name.h:config-name.in
399else
400 # For non-generic uname, we don't need to create config-name.h at all.
401 config_uname=
402fi
403
404AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(weak)
405if test $gnu_ld = yes; then
406 AC_DEFINE(HAVE_GNU_LD)
407fi
408if test $gnu_as = yes; then
409 AC_DEFINE(HAVE_GNU_AS)
410fi
411if test $elf = yes; then
412 AC_DEFINE(HAVE_ELF)
413fi
414if test $weak = yes; then
415 AC_DEFINE(HAVE_WEAK_SYMBOLS)
416fi
417
ff3d7ed3
RM
418AC_SUBST(shared)
419if test $shared = default; then
420 if test $gnu_ld = yes; then
421 shared=$elf
422 fi
423fi
424AC_SUBST(profile)
425AC_SUBST(omitfp)
426
28f540f4
RM
427
428if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
429 config_makefile=
430else
431 config_makefile=Makefile
432fi
433
434AC_OUTPUT(config.make ${config_makefile} ${config_uname}, ,
435 [echo '$config_vars' >> config.make])