1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.1)dnl dnl Minimum Autoconf version required.
5 AC_CONFIG_HEADER(config.h)
7 # This will get text that should go into config.make.
10 # Check for a --with-gmp argument and set gmp-srcdir in config.make.
12 --with-gmp=DIRECTORY find GMP source code in DIRECTORY (not needed),
15 yes) AC_MSG_ERROR(--with-gmp requires an argument; use --with-gmp=DIRECTORY) ;;
17 *) config_vars="$config_vars
18 gmp-srcdir = $withval" ;;
22 AC_ARG_WITH(gnu-binutils, dnl
23 --with-gnu-binutils if using GNU binutils (as and ld),
24 gnu_binutils=yes, gnu_binutils=no)
25 AC_ARG_WITH(gnu-ld, dnl
26 --with-gnu-ld if using GNU ld (in the binutils package),
27 gnu_ld=yes, gnu_ld=no)
28 AC_ARG_WITH(gnu-as, dnl
29 --with-gnu-as if using GNU as (in the binutils package),
30 gnu_as=yes, gnu_as=no)
31 test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
33 --with-elf if using the ELF object format,
35 AC_ARG_WITH(weak-symbols, dnl
36 --with-weak-symbols if weak symbols are available in as and ld,
40 # We keep the original values in `$config_*' and never modify them, so we
41 # can write them unchanged into config.make. Everything else uses
42 # $machine, $vendor, and $os, and changes them whenever convenient.
43 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
45 sysdep_dir=$srcdir/sysdeps
46 AC_MSG_CHECKING(sysdep dirs)
47 AC_CACHE_VAL(libc_cv_sysdirs, [dnl
48 machine=$config_machine
52 dnl We need to use [ and ] for other purposes for a while now.
54 # Expand the configuration machine name into a subdirectory by architecture
55 # type and particular chip.
58 machine=i386/$machine ;;
60 machine=sparc/$machine ;;
62 machine=m68k/m68020 ;;
64 machine=m68k/$machine ;;
66 machine=m88k/m88100 ;;
68 machine=m88k/$machine ;;
70 machine=mips/mips64/$machine ;;
72 machine=mips/$machine ;;
75 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
76 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
82 base_os=unix/bsd/bsd4.4 ;;
83 osf1* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
85 linux* | sysv* | isc* | esix* | sco* | minix* | irix4*)
88 base_os=unix/sysv/sysv4 ;;
95 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
98 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
102 o=`echo $tail | sed 's/[0-9]*$//'`
103 if test $o != $tail; then
107 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
110 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
116 # For sparc/sparc9, try sparc/sparc9 and then sparc.
119 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
125 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
128 # Find what sysdep directories exist.
130 for b in $base ''; do
131 for m0 in $mach ''; do
132 for v in /$vendor ''; do
133 for o in /$ostry ''; do
134 for m in $mach ''; do
136 if test -d $sysdep_dir$try; then
137 sysnames="$sysnames $try"
138 { test -n "$o" || test -n "$b"; } && os_used=t
139 { test -n "$m" || test -n "$m0"; } && machine_used=t
147 if test -z "$os_used" && test "$os" != none; then
148 AC_MSG_ERROR(Operating system $os is not supported.)
150 if test -z "$machine_used" && test "$machine" != none; then
151 AC_MSG_ERROR(The $machine is not supported.)
154 # We have now validated the configuration.
156 # Remove the leading slashes.
157 sysnames="`echo $sysnames | sed -e 's@^/@@' -e 's@ /@ @g'`"
159 # Prepend the machine's FPU directory unless --without-fp.
160 if test "$with_fp" = no; then
163 if test -d $sysdep_dir$m/fpu; then
164 fpu_dirs="$fpu_dirs $m/fpu"
167 sysnames="`echo $fpu_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
170 # Expand the list of system names into a full list of directories
171 # from each element's parent name and Implies file (if present).
173 while test $# -gt 0; do
177 if test -f $sysdep_dir/$name/Implies; then
178 # Collect more names from the `Implies' file (removing comments).
179 implied="`sed 's/#.*$//' < $sysdep_dir/$name/Implies`"
180 for x in $implied; do
181 test -d $sysdep_dir/$x || echo "Warning: $name implies nonexistent $x">&2
187 # Add NAME to the list of names.
190 # Find the parent of NAME, using the empty string if it has none.
192 parent="`echo $name | sed -n -e '/\//!q' -e 's=/[^/]*$==p'`"
195 # Add the names implied by NAME, and NAME's parent (if it has one), to
196 # the list of names to be processed (the argument list). We prepend the
197 # implied names to the list and append the parent. We want implied
198 # directories to come before further directories inferred from the
199 # configuration components; this ensures that for sysv4, unix/common
200 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
202 sysnames="`echo $implied $* $parent`"
203 test -n "$sysnames" && set $sysnames
206 # Add the default directories.
207 names="$names generic stub"
209 # Now uniquize the list.
212 for name in $names; do
213 if echo "$seen" | fgrep -x $name >/dev/null; then
214 # Already in the list.
218 if test -z "$seen"; then
219 seen="$name" sysnames="$name"
223 sysnames="$sysnames $name"
227 libc_cv_sysdirs="$sysnames"])
228 AC_SUBST(sysnames) sysnames="$libc_cv_sysdirs"
229 AC_MSG_RESULT(${sysnames})
232 gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
233 gnu_ld=yes gnu_as=yes
236 gnu*elf* | linux*elf* | sysv4* | solaris2*)
241 if test "$INSTALL" = "${srcdir}/install-sh"; then
242 # The makefiles need to use a different form to find it in $srcdir.
243 INSTALL='$(..)./install-sh'
248 AC_CHECK_PROG(AR, ar, ar, ar)
251 AC_MSG_CHECKING(signed size_t type)
252 AC_CACHE_VAL(libc_cv_signed_size_t, [dnl
253 echo '#include <stddef.h>
254 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
255 if eval "$ac_cpp conftest.c 2>/dev/null" \
256 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
257 libc_cv_signed_size_t=no
259 libc_cv_signed_size_t=yes
262 AC_MSG_RESULT($libc_cv_signed_size_t)
263 if test $libc_cv_signed_size_t = yes; then
264 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
265 cat >> confdefs.h <<\EOF
267 #define __SIZE_TYPE__ unsigned
271 AC_MSG_CHECKING(libc-friendly stddef.h)
272 AC_CACHE_VAL(libc_cv_friendly_stddef, [dnl
274 [#define __need_size_t
275 #define __need_wchar_t
278 #include <stddef.h>], [size_t size; wchar_t wchar;
280 #error stddef.h ignored __need_*
282 if (&size == NULL || &wchar == NULL) abort ();],
283 libc_cv_friendly_stddef=yes,
284 libc_cv_friendly_stddef=no)])
285 AC_MSG_RESULT($libc_cv_friendly_stddef)
286 if test $libc_cv_friendly_stddef = yes; then
287 config_vars="$config_vars
288 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
291 AC_MSG_CHECKING(whether we need to use -P to assemble .S files)
292 AC_CACHE_VAL(libc_cv_need_minus_P, [dnl
293 cat > conftest.S <<EOF
294 #include "confdefs.h"
295 /* Nothing whatsoever. */
297 if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
298 libc_cv_need_minus_P=no
300 libc_cv_need_minus_P=yes
303 AC_MSG_RESULT($libc_cv_need_minus_P)
304 if test $libc_cv_need_minus_P = yes; then
305 config_vars="$config_vars
306 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
309 # sysdeps configure fragments may set these with files to be linked below.
313 # Iterate over all the sysdep directories we will use, running their
314 # configure fragments, and looking for a uname implementation.
316 for dir in $sysnames; do
317 if test -r $sysdep_dir/$dir/configure; then
318 AC_MSG_RESULT(running configure fragment for $dir)
319 . $sysdep_dir/$dir/configure
321 if test -z "$uname"; then
322 { test -r $sysdep_dir/$dir/uname.c || test -r $sysdep_dir/$dir/uname.S; } \
327 AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
329 # If we will use the generic uname implementation, we must figure out what
330 # it will say by examining the system, and write the results in config-name.h.
331 if test "$uname" = generic; then
334 uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
336 if test $uname_sysname != $config_os; then
337 config_release=`echo $config_os | sed s/$uname_sysname//`
340 AC_DEFUN(LIBC_KERNEL_ID, [dnl
341 if test -r /vmunix; then
342 kernel_id=`strings /vmunix | grep UNIX`
343 elif test -r /dynix; then
344 kernel_id=`strings /dynix | grep DYNIX`
350 AC_MSG_CHECKING(OS release for uname)
351 AC_CACHE_VAL(libc_cv_uname_release, [dnl
352 AC_REQUIRE([LIBC_KERNEL_ID])dnl
354 kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
356 if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
357 != x$config_release; then
358 # The configuration release is a substring of the kernel release.
359 libc_cv_uname_release=$kernel_release
360 elif test x$config_release != x; then
361 libc_cv_uname_release=$config_release
362 elif test x$kernel_release != x; then
363 libc_cv_uname_release=$kernel_release
365 libc_cv_uname_release=unknown
367 AC_MSG_RESULT($libc_cv_uname_release)
368 uname_release="$libc_cv_uname_release"
370 AC_MSG_CHECKING(OS version for uname)
371 AC_CACHE_VAL(libc_cv_uname_version, [dnl
372 AC_REQUIRE([LIBC_KERNEL_ID])dnl
374 kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
376 if test -n "$kernel_version"; then
377 libc_cv_uname_version="$kernel_version"
379 libc_cv_uname_version=unknown
381 AC_MSG_RESULT($libc_cv_uname_version)
382 uname_version="$libc_cv_uname_version"
384 AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
385 config_uname=config-name.h:config-name.in
387 # For non-generic uname, we don't need to create config-name.h at all.
391 AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(weak)
392 if test $gnu_ld = yes; then
393 AC_DEFINE(HAVE_GNU_LD)
395 if test $gnu_as = yes; then
396 AC_DEFINE(HAVE_GNU_AS)
398 if test $elf = yes; then
401 if test $weak = yes; then
402 AC_DEFINE(HAVE_WEAK_SYMBOLS)
406 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
409 config_makefile=Makefile
412 AC_OUTPUT(config.make ${config_makefile} ${config_uname}, ,
413 [echo '$config_vars' >> config.make])