(Dynamic Allocation and C): Say global variables are like static.
[glibc.git] / configure.in
blob6805f8d33c800c94234ce717f4df9f5f2d4e326e
1 dnl Autoconf sets the quotes to [ and ], which hoses shell commands.
2 dnl We get rid of the quotes altogether, and turn them on for AC_*.
3 changequote(,)dnl
4 #! /bin/sh
6 # Configuration script for the GNU C Library.
7 dnl You can ignore the following line if you are reading this sentence.
8 # DO NOT EDIT!  This script is generated from configure.in; edit that instead.
10 # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
11 # This file is part of the GNU C Library.
13 # The GNU C Library is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU Library General Public License as
15 # published by the Free Software Foundation; either version 2 of the
16 # License, or (at your option) any later version.
18 # The GNU C Library is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 # Library General Public License for more details.
23 # You should have received a copy of the GNU Library General Public
24 # License along with the GNU C Library; see the file COPYING.LIB.  If
25 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
26 # Cambridge, MA 02139, USA.
29 #       Configure the GNU C Library.
32 prog="`basename $0`"
34 # All the standard GNU configure options are accepted but only
35 # --nfp, --with-gnu-ld, and --with-gnu-as are meaningful.
36 nfp=
37 gnu_ld=
38 gnu_as=
39 prefix=
40 exec_prefix=
41 verbose=
43 next=
44 lose=
45 for arg in $*; do
46   if [ x$next != x ]; then
47     eval "$next=\$arg"
48     next=
49   else
50     case $arg in
51     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
52        srcdir=`echo $arg | sed 's/-*s[a-z]*=//'`
53        ;;
54     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
55        next=srcdir
56        ;;
57     -target | --target | --targe | --targ | --tar | --ta | --t)
58        next=target
59        ;;
60     -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
61        target=`echo $arg | sed 's/-*t[a-z]*=//'`
62        ;; 
64     -with-gnu-ld | --with-gnu-ld | --with-gnu-l)
65        gnu_ld=--with-gnu-ld
66        ;;
68     -gas | --gas | --ga | --g | -with-gnu-as | --with-gnu-as | -with-gnu-a)
69        gnu_as=--with-gnu-as
70        ;;
72     -nfp | --nfp | --nf | --n)
73        nfp=--nfp
74        ;;
76     -with-* | --with-*)
77       # For `--with-foo=bar', do "with_foo='bar'".
78       # For `--with-fnord', do "with_fnord=yes".
79       # These variables may be examined by sysdep configure fragments.
80       eval `echo "$arg" | sed '{s/^-*//;s/-/_/g
81 s/^\([^=]*\)=\(.*\)$/\1='\''\2'\''/;s/^\([^=]*\)$/\1=yes/;}'`
82       ;;
84     -x | --x)
85       ;; # ignored
87     # For backward compatibility, also recognize exact --exec_prefix.
88     -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
89        exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'`
90        ;;
91     -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
92        next=exec_prefix
93        ;;
95     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
96        prefix=`echo $arg | sed 's/[-a-z_]*=//'`
97        ;;
98     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
99        next=prefix
100        ;;
102     -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
103       # Autoconf-generated code below will test this.
104       verbose=yes
105       ;;
107     -*)
108        echo "Invalid option \`$arg'" 1>&2
109        lose=yes
110        ;;
111     *)
112        if [ ! "$target" ]; then
113          target=$arg
114        else
115          lose=yes
116        fi
117        ;;
118     esac
119   fi
120 done
122 # NEXT will be set iff we have seen an option that wants an arg, but no arg.
123 if [ "$next" ]; then
124   echo "$0: the \`--${next}' option requires an argument" >&2
125   lose=yes
128 dnl This deals with setting srcdir if it needs to be set.
129 changequote([,])
130 AC_PREPARE(features.h)
131 AC_LANG_C
132 changequote(,)
134 # Decanonicalize srcdir so we can tell when we are configuring in srcdir.
135 if [ "`(cd ${srcdir}; pwd)`" = "`pwd`" ]; then
136   srcdir=.
139 if [ ! "$target" ]; then
140   target=`$srcdir/config.guess`
141   test -n "$target" && echo "No target given; guessing target is ${target}."
144 if [ "$lose" = yes -o ! "$target" ]; then
145   echo "\
146 Usage: $prog [--srcdir=DIR] [--prefix=DIR] [--exec-prefix=DIR]
147              [--nfp] [--with-gnu-ld] [--with-gnu-as] TARGET" >&2
148   if [ -r config.status ]; then
149     cat config.status >&2
150   fi
151   exit 1
154 # Done parsing the arguments.
156 # This will get text that should go into config.make.
157 config_vars=
159 # Check for a --with-gmp argument and set gmp-srcdir in config.make.
160 case "$with_gmp" in
161 yes) echo "$prog: --with-gmp requires an argument; use --with-gmp=DIRECTORY"
162      exit 1 ;;
163 '') ;;
164 *) config_vars="$config_vars
165 gmp-srcdir = $with_gmp" ;;
166 esac
168 # Canonicalize the configuration name.
169 config=`$srcdir/config.sub $target`
170 if [ ! "$config" ]; then
171   # config.sub has written an error message.
172   exit 1
175 sysdep_dir=$srcdir/sysdeps
177 # machine-vendor-os
178 eval "`echo $config | \
179        sed 's/^\(.*\)-\(.*\)-\(.*\)$/\
180 config_machine=\1 config_vendor=\2 config_os=\3/'`"
182 # We keep the original values in `$config_*' and never modify them, so we
183 # can write them unchanged into config.make.  Everything else uses
184 # $machine, $vendor, and $os, and changes them whenever convenient.
185 machine=$config_machine
186 vendor=$config_vendor
187 os=$config_os
189 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
190 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
192 # Expand the configuration machine name into a subdirectory by architecture
193 # type and particular chip.
194 case "$machine" in
195 i[345]86)
196   machine=i386/$machine ;;
197 sparc[6789])
198   machine=sparc/$machine ;;
199 m68k)
200   machine=m68k/m68020 ;;
201 m680?0)
202   machine=m68k/$machine ;;
203 m88k)
204   machine=m88k/m88100 ;;
205 m88???)
206   machine=m88k/$machine ;;
207 mips|r2000)
208   machine=mips/r3000 ;;
209 r[34]000)
210   machine=mips/$machine ;;
211 esac
213 case "$os" in
214 gnu*)
215   base_os=mach/hurd ;;
216 netbsd* | 386bsd*)
217   base_os=unix/bsd/bsd4.4 ;;
218 osf1* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
219   base_os=unix/bsd ;;
220 linux* | sysv* | isc* | esix* | sco* | minix* | irix4*)
221   base_os=unix/sysv ;;
222 solaris[2-9]*)
223   base_os=unix/sysv/sysv4 ;;
224 none)
225   base_os=standalone ;;
226 esac
228 case "$os:$base_os" in
229 gnu* | linux* | bsd4.4* | *:bsd4.4)
230   gnu_ld=--with-gnu-ld
231   gnu_as=--with-gnu-as
232 esac
234 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
235 tail=$os
236 ostry=$os
237 while o=`echo $tail | sed 's/\.[^.]*$//'`; [ $o != $tail ]; do
238   ostry="$ostry /$o"
239   tail=$o
240 done  
241 o=`echo $tail | sed 's/[0-9]*$//'`
242 if [ $o != $tail ]; then
243   ostry="$ostry /$o"
246 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
247 base=
248 tail=$base_os
249 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; [ "$b" ]; do
250   set $b
251   base="$base /$1"
252   tail="$2"
253 done
255 # For sparc/sparc9, try sparc/sparc9 and then sparc.
256 mach=
257 tail=$machine
258 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; [ "$m" ]; do
259   set $m
260   mach="$mach /$1"
261   tail="$2"
262 done
264 # Find what sysdep directories exist.
265 sysnames=
266 for b in $base ''; do
267   for v in /$vendor ''; do
268     for o in /$ostry ''; do
269       for m in $mach ''; do
270         if [ -d $sysdep_dir$b$v$o$m ]; then
271           sysnames="$sysnames $b$v$o$m"
272           [ "$o" -o "$b" ] && os_used=t
273           [ "$m" ] && machine_used=t
274         fi
275       done
276     done
277   done
278 done
280 if [ ! "$os_used" -a "$os" != none ]; then
281   echo Operating system $os is not supported. >&2
282   exit 1
284 if [ ! "$machine_used" -a "$machine" != none ]; then
285   echo The $machine is not supported. >&2
286   exit 1
289 # We have now validated the configuration.
291 PWD=`pwd`
292 echo Configuring the GNU C library in $PWD
293 echo on `(hostname || uname -n) 2>/dev/null | sed 1q` for ${config}.
295 # Remove the leading slashes.
296 sysnames="`echo $sysnames | sed -e 's@^/@@' -e 's@ /@ @g'`"
298 # Prepend the machine's FPU directory unless --nfp.
299 if [ ! "$nfp" ]; then
300   fpu_dirs=
301   for m in $mach; do
302     if [ -d $sysdep_dir$m/fpu ]; then
303       fpu_dirs="$fpu_dirs $m/fpu"
304     fi
305   done
306   sysnames="`echo $fpu_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
309 # Expand the list of system names into a full list of directories
310 # from each element's parent name and Implies file (if present).
311 set $sysnames
312 while [ $# -gt 0 ]; do
313   name=$1
314   shift
316   if [ -f $sysdep_dir/$name/Implies ]; then
317     # Collect more names from the `Implies' file (removing comments).
318     implied="`sed 's/#.*$//' < $sysdep_dir/$name/Implies`"
319     for x in $implied; do
320       test -d $sysdep_dir/$x || echo "Warning: $name implies nonexistent $x">&2
321     done
322   else
323     implied=
324   fi
326   # Add NAME to the list of names.
327   names="$names $name"
329   # Find the parent of NAME, using the empty string if it has none.
330   parent="`echo $name | sed -n -e '/\//!q' -e 's=/[^/]*$==p'`"
332   # Add the names implied by NAME, and NAME's parent (if it has one), to
333   # the list of names to be processed (the argument list).  We prepend the
334   # implied names to the list and append the parent.  We want implied
335   # directories to come before further directories inferred from the
336   # configuration components; this ensures that for sysv4, unix/common
337   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
338   # after sysv4).
339   sysnames="`echo $implied $* $parent`"
340   if [ "$sysnames" != "" ]; then
341     set $sysnames
342   fi
343 done
345 # Add the default directories.
346 names="$names generic stub"
348 # Now uniquize the list.
349 seen=
350 sysnames=
351 for name in $names; do
352   if echo "$seen" | fgrep -x $name >/dev/null; then
353     # Already in the list.
354     true;
355   else
356     # A new one.
357     if [ "$seen" = "" ]; then
358       seen="$name" sysnames="$name"
359     else
360       seen="$seen
361 $name"
362       sysnames="$sysnames $name"
363     fi
364   fi
365 done
367 echo Using system-dependent files from directories:
368 for dir in $sysnames; do echo " $dir"; done
370 changequote([,])dnl The world is now safe for m4, and unsafe for shell.
371 dnl Be sure to add each macro used here to aclocal.m4 (which see).
373 AC_PROG_INSTALL
374 [if [ "$INSTALL" = "${srcdir}/install.sh" ]; then
375   # The makefiles need to use a different form to find it in $srcdir.
376   INSTALL='$(..)./install.sh'
378 AC_PROG_RANLIB
380 AC_PROG_CC
381 AC_PROG_CPP
383 echo checking for signed size_t type
384 echo '#include <stddef.h>
385 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
386 eval "$CPP conftest.c 2>/dev/null" \
387 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null \
388 || {
389   dnl Do this by hand instead of AC_DEFINE so we can use -U to avoid warnings.
390   DEFS="$DEFS -U__SIZE_TYPE__ -D__SIZE_TYPE__=unsigned"
391   (echo '#undef __SIZE_TYPE__';
392    echo '#define __SIZE_TYPE__ unsigned') >> confdefs.h
393   test -n "$verbose" && echo '  using unsigned int for size_t'
395 rm -f conftest*
397 AC_COMPILE_CHECK([libc-friendly stddef.h],
398 [#define __need_size_t
399 #define __need_wchar_t
400 #include <stddef.h>
401 #define __need_NULL
402 #include <stddef.h>], [size_t size; wchar_t wchar;
403 #ifdef offsetof
404 #error stddef.h ignored __need_*
405 #endif
406 if (&size == NULL || &wchar == NULL) abort ();],
407 [config_vars="$config_vars
408 stddef.h = # The installed <stddef.h> seems to be libc-friendly."
409 test -n "$verbose" && echo '    installed stddef.h looks friendly'])
411 changequote(,)dnl The world is again safe for shell scripts.
413 echo 'checking for need to use -P to assemble .S files'
414 cat > conftest.S <<EOF
415 #include "confdefs.h"
416 /* Nothing whatsoever.  */
418 ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null || {
419   config_vars="$config_vars
420 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
421   test -n "$verbose" && echo '  using -P flag'
423 rm -f conftest*
425 # Iterate over all the sysdep directories we will use, running their
426 # configure fragments, and looking for a uname implementation.
427 uname=
428 for dir in $sysnames; do
429   if test -r $sysdep_dir/$dir/configure; then
430     echo running configure fragment for $dir
431     . $sysdep_dir/$dir/configure
432   fi
433   test ! "$uname" && \
434   test -r $sysdep_dir/$dir/uname.c -o -r $sysdep_dir/$dir/uname.S && uname=$dir
435 done
437 # If we will use the generic uname implementation, we must figure out what
438 # it will say by examining the system, and write the results in config-name.h.
439 if [ "$uname" = generic ]; then
441   echo trying to guess OS release and version for uname
443   kernel_release=
444   kernel_version=
446   if [ ! "$release" -o ! "$version" ]; then
447     if [ -r /vmunix ]; then
448       kernel_id=`strings /vmunix | grep UNIX`
449     elif [ -r /dynix ]; then
450       kernel_id=`strings /dynix | grep DYNIX`
451     else
452       kernel_id=
453     fi
454     if [ "$kernel_id" ]; then
455       kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
456       kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
457     fi
458   fi
460   sysname=`echo $os | sed 's/[0-9.]*$//'`
461   if [ $sysname != $os ]; then
462     config_release=`echo $os | sed s/$sysname//`
463   fi
465   if [ "$release" ]; then
466     # All is well.
467     true
468   elif [ x`echo "$config_release" | sed "s/^$kernel_release//"` \
469          != x$config_release ]; then
470     # The configuration release is a substring of the kernel release.
471     release=$kernel_release
472   elif [ x$config_release != x ]; then
473     release=$config_release
474   elif [ x$kernel_release != x ]; then
475     release=$kernel_release
476   else
477     cat <<END
478 I don't know what release of $sysname you are using.  Please enter the
479 release number now.  This information is used only for the \`uname' function,
480 so it is not critical.
482     read release
483     if [ ! "$release" ]; then
484       release=unknown
485     fi
486   fi
488   if [ "$version" ]; then
489     # All is well.
490     true
491   elif [ ! "$kernel_version" ]; then
492     cat <<END
493 I don't know what version of $sysname $release you are using.  Please enter
494 the version number now.  This information is used only for the uname
495 function, so it is not critical.
497     read version
498     if [ ! "$version" ]; then
499       version=unknown
500     fi
501   else
502     version=$kernel_version
503   fi
505   cat > config-name.h <<END
506 /* This file was generated automatically by configure.  Do not edit.
507    This is used by the generic uname function.  */
508 #define UNAME_SYSNAME "${sysname}"
509 #define UNAME_RELEASE "${release}"
510 #define UNAME_VERSION "${version}"
511 #define UNAME_MACHINE "${config_machine}-${config_vendor}"
514   system_name="$sysname $release version $version on $vendor $machine"
515 else
516   # Not generic uname.  We don't need config-name.h at all.
517   system_name=$config
520 if [ "$gnu_ld" ]; then
521   DEFS="$DEFS -DHAVE_GNU_LD"
523 if [ "$gnu_as" ]; then
524   DEFS="$DEFS -DHAVE_GNU_AS"
528   echo '# This file was generated automatically by configure.  Do not edit.'
529   echo '# Put configuration parameters in configparms instead.'
530   echo "config-machine = ${config_machine}"
531   echo "config-vendor = ${config_vendor}"
532   echo "config-os = ${config_os}"
533   echo "config-sysdirs = ${sysnames}"
534   if [ "$prefix" ]; then
535     echo "prefix = ${prefix}"
536   fi
537   if [ "$exec_prefix" ]; then
538     echo "exec_prefix = ${exec_prefix}"
539   fi
540   echo "config-defines = ${DEFS}"
541   for var in INSTALL INSTALL_PROGRAM INSTALL_DATA RANLIB; do
542     eval "echo \"${var} = \${$var}\""
543   done
544   echo "$config_vars"
545 ) > config.make
546 echo "Wrote config.make in $PWD."
548 if [ $srcdir != . ]; then
549   if [ $srcdir = .. ]; then
550     cwd=`pwd`
551     objdir=`basename $cwd`
552   else
553     objdir=`pwd`
554   fi
555   cat > Makefile <<END
556 # This file was generated automatically by configure.  Do not edit.
557 srcdir = $srcdir
559 all .DEFAULT:
560         \$(MAKE) -C \$(srcdir) objdir=\`pwd\` \$@
563 echo "Wrote Makefile in $PWD."
566 cat > config.status <<END
567 #!/bin/sh
568 # This file was generated automatically by configure.  Do not edit.
569 # The GNU C library was configured in $PWD for
570 # $system_name as follows:
571 release=$release version=$version $0 $configure_args \$*
573 chmod a+x config.status
574 echo "Wrote config.status in $PWD."
576 exit 0
577 dnl This gets rid of the random stuff autoconf has stuffed in weird places.
578 divert(-1)dnl AC_This is here so I can search for `AC_' to find the frobs.
579 dnl Local Variables:
580 dnl compile-command: "autoconf"
581 dnl End: