OSDN Git Service

ca24ef96c5b9243e950c8b3db744bb8bf6d44004
[pf3gnuchains/gcc-fork.git] / libiberty / configure
1 #! /bin/sh
2
3 # Guess values for system-dependent variables and create Makefiles.
4 # Generated automatically using autoconf version 2.13 
5 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
6 #
7 # This configure script is free software; the Free Software Foundation
8 # gives unlimited permission to copy, distribute and modify it.
9
10 # Defaults:
11 ac_help=
12 ac_default_prefix=/usr/local
13 # Any additions from configure.in:
14 ac_help="$ac_help
15   --with-target-subdir=SUBDIR      Configuring in a subdirectory"
16 ac_help="$ac_help
17   --with-cross-host=HOST           Configuring with a cross compiler"
18 ac_help="$ac_help
19   --with-newlib                    Configuring with newlib"
20
21 # Initialize some variables set by options.
22 # The variables have the same names as the options, with
23 # dashes changed to underlines.
24 build=NONE
25 cache_file=./config.cache
26 exec_prefix=NONE
27 host=NONE
28 no_create=
29 nonopt=NONE
30 no_recursion=
31 prefix=NONE
32 program_prefix=NONE
33 program_suffix=NONE
34 program_transform_name=s,x,x,
35 silent=
36 site=
37 srcdir=
38 target=NONE
39 verbose=
40 x_includes=NONE
41 x_libraries=NONE
42 bindir='${exec_prefix}/bin'
43 sbindir='${exec_prefix}/sbin'
44 libexecdir='${exec_prefix}/libexec'
45 datadir='${prefix}/share'
46 sysconfdir='${prefix}/etc'
47 sharedstatedir='${prefix}/com'
48 localstatedir='${prefix}/var'
49 libdir='${exec_prefix}/lib'
50 includedir='${prefix}/include'
51 oldincludedir='/usr/include'
52 infodir='${prefix}/info'
53 mandir='${prefix}/man'
54
55 # Initialize some other variables.
56 subdirs=
57 MFLAGS= MAKEFLAGS=
58 SHELL=${CONFIG_SHELL-/bin/sh}
59 # Maximum number of lines to put in a shell here document.
60 ac_max_here_lines=12
61
62 ac_prev=
63 for ac_option
64 do
65
66   # If the previous option needs an argument, assign it.
67   if test -n "$ac_prev"; then
68     eval "$ac_prev=\$ac_option"
69     ac_prev=
70     continue
71   fi
72
73   case "$ac_option" in
74   -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
75   *) ac_optarg= ;;
76   esac
77
78   # Accept the important Cygnus configure options, so we can diagnose typos.
79
80   case "$ac_option" in
81
82   -bindir | --bindir | --bindi | --bind | --bin | --bi)
83     ac_prev=bindir ;;
84   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
85     bindir="$ac_optarg" ;;
86
87   -build | --build | --buil | --bui | --bu)
88     ac_prev=build ;;
89   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
90     build="$ac_optarg" ;;
91
92   -cache-file | --cache-file | --cache-fil | --cache-fi \
93   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
94     ac_prev=cache_file ;;
95   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
96   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
97     cache_file="$ac_optarg" ;;
98
99   -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
100     ac_prev=datadir ;;
101   -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
102   | --da=*)
103     datadir="$ac_optarg" ;;
104
105   -disable-* | --disable-*)
106     ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
107     # Reject names that are not valid shell variable names.
108     if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
109       { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
110     fi
111     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
112     eval "enable_${ac_feature}=no" ;;
113
114   -enable-* | --enable-*)
115     ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
116     # Reject names that are not valid shell variable names.
117     if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
118       { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
119     fi
120     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
121     case "$ac_option" in
122       *=*) ;;
123       *) ac_optarg=yes ;;
124     esac
125     eval "enable_${ac_feature}='$ac_optarg'" ;;
126
127   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
128   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
129   | --exec | --exe | --ex)
130     ac_prev=exec_prefix ;;
131   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
132   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
133   | --exec=* | --exe=* | --ex=*)
134     exec_prefix="$ac_optarg" ;;
135
136   -gas | --gas | --ga | --g)
137     # Obsolete; use --with-gas.
138     with_gas=yes ;;
139
140   -help | --help | --hel | --he)
141     # Omit some internal or obsolete options to make the list less imposing.
142     # This message is too long to be a string in the A/UX 3.1 sh.
143     cat << EOF
144 Usage: configure [options] [host]
145 Options: [defaults in brackets after descriptions]
146 Configuration:
147   --cache-file=FILE       cache test results in FILE
148   --help                  print this message
149   --no-create             do not create output files
150   --quiet, --silent       do not print \`checking...' messages
151   --version               print the version of autoconf that created configure
152 Directory and file names:
153   --prefix=PREFIX         install architecture-independent files in PREFIX
154                           [$ac_default_prefix]
155   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
156                           [same as prefix]
157   --bindir=DIR            user executables in DIR [EPREFIX/bin]
158   --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
159   --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
160   --datadir=DIR           read-only architecture-independent data in DIR
161                           [PREFIX/share]
162   --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
163   --sharedstatedir=DIR    modifiable architecture-independent data in DIR
164                           [PREFIX/com]
165   --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
166   --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
167   --includedir=DIR        C header files in DIR [PREFIX/include]
168   --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
169   --infodir=DIR           info documentation in DIR [PREFIX/info]
170   --mandir=DIR            man documentation in DIR [PREFIX/man]
171   --srcdir=DIR            find the sources in DIR [configure dir or ..]
172   --program-prefix=PREFIX prepend PREFIX to installed program names
173   --program-suffix=SUFFIX append SUFFIX to installed program names
174   --program-transform-name=PROGRAM
175                           run sed PROGRAM on installed program names
176 EOF
177     cat << EOF
178 Host type:
179   --build=BUILD           configure for building on BUILD [BUILD=HOST]
180   --host=HOST             configure for HOST [guessed]
181   --target=TARGET         configure for TARGET [TARGET=HOST]
182 Features and packages:
183   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
184   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
185   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
186   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
187   --x-includes=DIR        X include files are in DIR
188   --x-libraries=DIR       X library files are in DIR
189 EOF
190     if test -n "$ac_help"; then
191       echo "--enable and --with options recognized:$ac_help"
192     fi
193     exit 0 ;;
194
195   -host | --host | --hos | --ho)
196     ac_prev=host ;;
197   -host=* | --host=* | --hos=* | --ho=*)
198     host="$ac_optarg" ;;
199
200   -includedir | --includedir | --includedi | --included | --include \
201   | --includ | --inclu | --incl | --inc)
202     ac_prev=includedir ;;
203   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
204   | --includ=* | --inclu=* | --incl=* | --inc=*)
205     includedir="$ac_optarg" ;;
206
207   -infodir | --infodir | --infodi | --infod | --info | --inf)
208     ac_prev=infodir ;;
209   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
210     infodir="$ac_optarg" ;;
211
212   -libdir | --libdir | --libdi | --libd)
213     ac_prev=libdir ;;
214   -libdir=* | --libdir=* | --libdi=* | --libd=*)
215     libdir="$ac_optarg" ;;
216
217   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
218   | --libexe | --libex | --libe)
219     ac_prev=libexecdir ;;
220   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
221   | --libexe=* | --libex=* | --libe=*)
222     libexecdir="$ac_optarg" ;;
223
224   -localstatedir | --localstatedir | --localstatedi | --localstated \
225   | --localstate | --localstat | --localsta | --localst \
226   | --locals | --local | --loca | --loc | --lo)
227     ac_prev=localstatedir ;;
228   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
229   | --localstate=* | --localstat=* | --localsta=* | --localst=* \
230   | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
231     localstatedir="$ac_optarg" ;;
232
233   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
234     ac_prev=mandir ;;
235   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
236     mandir="$ac_optarg" ;;
237
238   -nfp | --nfp | --nf)
239     # Obsolete; use --without-fp.
240     with_fp=no ;;
241
242   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
243   | --no-cr | --no-c)
244     no_create=yes ;;
245
246   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
247   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
248     no_recursion=yes ;;
249
250   -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
251   | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
252   | --oldin | --oldi | --old | --ol | --o)
253     ac_prev=oldincludedir ;;
254   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
255   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
256   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
257     oldincludedir="$ac_optarg" ;;
258
259   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
260     ac_prev=prefix ;;
261   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
262     prefix="$ac_optarg" ;;
263
264   -program-prefix | --program-prefix | --program-prefi | --program-pref \
265   | --program-pre | --program-pr | --program-p)
266     ac_prev=program_prefix ;;
267   -program-prefix=* | --program-prefix=* | --program-prefi=* \
268   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
269     program_prefix="$ac_optarg" ;;
270
271   -program-suffix | --program-suffix | --program-suffi | --program-suff \
272   | --program-suf | --program-su | --program-s)
273     ac_prev=program_suffix ;;
274   -program-suffix=* | --program-suffix=* | --program-suffi=* \
275   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
276     program_suffix="$ac_optarg" ;;
277
278   -program-transform-name | --program-transform-name \
279   | --program-transform-nam | --program-transform-na \
280   | --program-transform-n | --program-transform- \
281   | --program-transform | --program-transfor \
282   | --program-transfo | --program-transf \
283   | --program-trans | --program-tran \
284   | --progr-tra | --program-tr | --program-t)
285     ac_prev=program_transform_name ;;
286   -program-transform-name=* | --program-transform-name=* \
287   | --program-transform-nam=* | --program-transform-na=* \
288   | --program-transform-n=* | --program-transform-=* \
289   | --program-transform=* | --program-transfor=* \
290   | --program-transfo=* | --program-transf=* \
291   | --program-trans=* | --program-tran=* \
292   | --progr-tra=* | --program-tr=* | --program-t=*)
293     program_transform_name="$ac_optarg" ;;
294
295   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
296   | -silent | --silent | --silen | --sile | --sil)
297     silent=yes ;;
298
299   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
300     ac_prev=sbindir ;;
301   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
302   | --sbi=* | --sb=*)
303     sbindir="$ac_optarg" ;;
304
305   -sharedstatedir | --sharedstatedir | --sharedstatedi \
306   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
307   | --sharedst | --shareds | --shared | --share | --shar \
308   | --sha | --sh)
309     ac_prev=sharedstatedir ;;
310   -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
311   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
312   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
313   | --sha=* | --sh=*)
314     sharedstatedir="$ac_optarg" ;;
315
316   -site | --site | --sit)
317     ac_prev=site ;;
318   -site=* | --site=* | --sit=*)
319     site="$ac_optarg" ;;
320
321   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
322     ac_prev=srcdir ;;
323   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
324     srcdir="$ac_optarg" ;;
325
326   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
327   | --syscon | --sysco | --sysc | --sys | --sy)
328     ac_prev=sysconfdir ;;
329   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
330   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
331     sysconfdir="$ac_optarg" ;;
332
333   -target | --target | --targe | --targ | --tar | --ta | --t)
334     ac_prev=target ;;
335   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
336     target="$ac_optarg" ;;
337
338   -v | -verbose | --verbose | --verbos | --verbo | --verb)
339     verbose=yes ;;
340
341   -version | --version | --versio | --versi | --vers)
342     echo "configure generated by autoconf version 2.13"
343     exit 0 ;;
344
345   -with-* | --with-*)
346     ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
347     # Reject names that are not valid shell variable names.
348     if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
349       { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
350     fi
351     ac_package=`echo $ac_package| sed 's/-/_/g'`
352     case "$ac_option" in
353       *=*) ;;
354       *) ac_optarg=yes ;;
355     esac
356     eval "with_${ac_package}='$ac_optarg'" ;;
357
358   -without-* | --without-*)
359     ac_package=`echo $ac_option|sed -e 's/-*without-//'`
360     # Reject names that are not valid shell variable names.
361     if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
362       { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
363     fi
364     ac_package=`echo $ac_package| sed 's/-/_/g'`
365     eval "with_${ac_package}=no" ;;
366
367   --x)
368     # Obsolete; use --with-x.
369     with_x=yes ;;
370
371   -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
372   | --x-incl | --x-inc | --x-in | --x-i)
373     ac_prev=x_includes ;;
374   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
375   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
376     x_includes="$ac_optarg" ;;
377
378   -x-libraries | --x-libraries | --x-librarie | --x-librari \
379   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
380     ac_prev=x_libraries ;;
381   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
382   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
383     x_libraries="$ac_optarg" ;;
384
385   -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
386     ;;
387
388   *)
389     if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
390       echo "configure: warning: $ac_option: invalid host type" 1>&2
391     fi
392     if test "x$nonopt" != xNONE; then
393       { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
394     fi
395     nonopt="$ac_option"
396     ;;
397
398   esac
399 done
400
401 if test -n "$ac_prev"; then
402   { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
403 fi
404
405 trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
406
407 # File descriptor usage:
408 # 0 standard input
409 # 1 file creation
410 # 2 errors and warnings
411 # 3 some systems may open it to /dev/tty
412 # 4 used on the Kubota Titan
413 # 6 checking for... messages and results
414 # 5 compiler messages saved in config.log
415 if test "$silent" = yes; then
416   exec 6>/dev/null
417 else
418   exec 6>&1
419 fi
420 exec 5>./config.log
421
422 echo "\
423 This file contains any messages produced by compilers while
424 running configure, to aid debugging if configure makes a mistake.
425 " 1>&5
426
427 # Strip out --no-create and --no-recursion so they do not pile up.
428 # Also quote any args containing shell metacharacters.
429 ac_configure_args=
430 for ac_arg
431 do
432   case "$ac_arg" in
433   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
434   | --no-cr | --no-c) ;;
435   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
436   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
437   *" "*|*"      "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
438   ac_configure_args="$ac_configure_args '$ac_arg'" ;;
439   *) ac_configure_args="$ac_configure_args $ac_arg" ;;
440   esac
441 done
442
443 # NLS nuisances.
444 # Only set these to C if already set.  These must not be set unconditionally
445 # because not all systems understand e.g. LANG=C (notably SCO).
446 # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
447 # Non-C LC_CTYPE values break the ctype check.
448 if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
449 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
450 if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
451 if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
452
453 # confdefs.h avoids OS command line length limits that DEFS can exceed.
454 rm -rf conftest* confdefs.h
455 # AIX cpp loses on an empty file, so make sure it contains at least a newline.
456 echo > confdefs.h
457
458 # A filename unique to this package, relative to the directory that
459 # configure is in, which we can look for to find out if srcdir is correct.
460 ac_unique_file=pexecute.c
461
462 # Find the source files, if location was not specified.
463 if test -z "$srcdir"; then
464   ac_srcdir_defaulted=yes
465   # Try the directory containing this script, then its parent.
466   ac_prog=$0
467   ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
468   test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
469   srcdir=$ac_confdir
470   if test ! -r $srcdir/$ac_unique_file; then
471     srcdir=..
472   fi
473 else
474   ac_srcdir_defaulted=no
475 fi
476 if test ! -r $srcdir/$ac_unique_file; then
477   if test "$ac_srcdir_defaulted" = yes; then
478     { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
479   else
480     { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
481   fi
482 fi
483 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
484
485 # Prefer explicitly selected file to automatically selected ones.
486 if test -z "$CONFIG_SITE"; then
487   if test "x$prefix" != xNONE; then
488     CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
489   else
490     CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
491   fi
492 fi
493 for ac_site_file in $CONFIG_SITE; do
494   if test -r "$ac_site_file"; then
495     echo "loading site script $ac_site_file"
496     . "$ac_site_file"
497   fi
498 done
499
500 if test -r "$cache_file"; then
501   echo "loading cache $cache_file"
502   . $cache_file
503 else
504   echo "creating cache $cache_file"
505   > $cache_file
506 fi
507
508 ac_ext=c
509 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
510 ac_cpp='$CPP $CPPFLAGS'
511 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
512 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
513 cross_compiling=$ac_cv_prog_cc_cross
514
515 ac_exeext=
516 ac_objext=o
517 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
518   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
519   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
520     ac_n= ac_c='
521 ' ac_t='        '
522   else
523     ac_n=-n ac_c= ac_t=
524   fi
525 else
526   ac_n= ac_c='\c' ac_t=
527 fi
528
529
530
531 # Check whether --with-target-subdir or --without-target-subdir was given.
532 if test "${with_target_subdir+set}" = set; then
533   withval="$with_target_subdir"
534   :
535 fi
536
537 # Check whether --with-cross-host or --without-cross-host was given.
538 if test "${with_cross_host+set}" = set; then
539   withval="$with_cross_host"
540   :
541 fi
542
543 # Check whether --with-newlib or --without-newlib was given.
544 if test "${with_newlib+set}" = set; then
545   withval="$with_newlib"
546   :
547 fi
548
549
550 if test "${srcdir}" = "."; then
551   if test -z "${with_target_subdir}"; then
552     libiberty_topdir="${srcdir}/.."
553   else
554     if test "${with_target_subdir}" != "."; then
555       libiberty_topdir="${srcdir}/${with_multisrctop}../.."
556     else
557       libiberty_topdir="${srcdir}/${with_multisrctop}.."
558     fi
559   fi
560 else
561   libiberty_topdir="${srcdir}/.."
562 fi
563 ac_aux_dir=
564 for ac_dir in $libiberty_topdir $srcdir/$libiberty_topdir; do
565   if test -f $ac_dir/install-sh; then
566     ac_aux_dir=$ac_dir
567     ac_install_sh="$ac_aux_dir/install-sh -c"
568     break
569   elif test -f $ac_dir/install.sh; then
570     ac_aux_dir=$ac_dir
571     ac_install_sh="$ac_aux_dir/install.sh -c"
572     break
573   fi
574 done
575 if test -z "$ac_aux_dir"; then
576   { echo "configure: error: can not find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" 1>&2; exit 1; }
577 fi
578 ac_config_guess=$ac_aux_dir/config.guess
579 ac_config_sub=$ac_aux_dir/config.sub
580 ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
581
582
583
584 # Make sure we can run config.sub.
585 if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
586 else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
587 fi
588
589 echo $ac_n "checking host system type""... $ac_c" 1>&6
590 echo "configure:591: checking host system type" >&5
591
592 host_alias=$host
593 case "$host_alias" in
594 NONE)
595   case $nonopt in
596   NONE)
597     if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
598     else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
599     fi ;;
600   *) host_alias=$nonopt ;;
601   esac ;;
602 esac
603
604 host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
605 host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
606 host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
607 host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
608 echo "$ac_t""$host" 1>&6
609
610
611
612 echo $ac_n "checking build system type""... $ac_c" 1>&6
613 echo "configure:614: checking build system type" >&5
614
615 build_alias=$build
616 case "$build_alias" in
617 NONE)
618   case $nonopt in
619   NONE) build_alias=$host_alias ;;
620   *) build_alias=$nonopt ;;
621   esac ;;
622 esac
623
624 build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
625 build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
626 build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
627 build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
628 echo "$ac_t""$build" 1>&6
629
630 if test $host != $build; then
631   ac_tool_prefix=${host_alias}-
632 else
633   ac_tool_prefix=
634 fi
635
636 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
637 set dummy ${ac_tool_prefix}ar; ac_word=$2
638 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
639 echo "configure:640: checking for $ac_word" >&5
640 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
641   echo $ac_n "(cached) $ac_c" 1>&6
642 else
643   if test -n "$AR"; then
644   ac_cv_prog_AR="$AR" # Let the user override the test.
645 else
646   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
647   ac_dummy="$PATH"
648   for ac_dir in $ac_dummy; do
649     test -z "$ac_dir" && ac_dir=.
650     if test -f $ac_dir/$ac_word; then
651       ac_cv_prog_AR="${ac_tool_prefix}ar"
652       break
653     fi
654   done
655   IFS="$ac_save_ifs"
656   test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
657 fi
658 fi
659 AR="$ac_cv_prog_AR"
660 if test -n "$AR"; then
661   echo "$ac_t""$AR" 1>&6
662 else
663   echo "$ac_t""no" 1>&6
664 fi
665
666
667
668 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
669 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
670 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
671 echo "configure:672: checking for $ac_word" >&5
672 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
673   echo $ac_n "(cached) $ac_c" 1>&6
674 else
675   if test -n "$RANLIB"; then
676   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
677 else
678   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
679   ac_dummy="$PATH"
680   for ac_dir in $ac_dummy; do
681     test -z "$ac_dir" && ac_dir=.
682     if test -f $ac_dir/$ac_word; then
683       ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
684       break
685     fi
686   done
687   IFS="$ac_save_ifs"
688 fi
689 fi
690 RANLIB="$ac_cv_prog_RANLIB"
691 if test -n "$RANLIB"; then
692   echo "$ac_t""$RANLIB" 1>&6
693 else
694   echo "$ac_t""no" 1>&6
695 fi
696
697
698 if test -z "$ac_cv_prog_RANLIB"; then
699 if test -n "$ac_tool_prefix"; then
700   # Extract the first word of "ranlib", so it can be a program name with args.
701 set dummy ranlib; ac_word=$2
702 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
703 echo "configure:704: checking for $ac_word" >&5
704 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
705   echo $ac_n "(cached) $ac_c" 1>&6
706 else
707   if test -n "$RANLIB"; then
708   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
709 else
710   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
711   ac_dummy="$PATH"
712   for ac_dir in $ac_dummy; do
713     test -z "$ac_dir" && ac_dir=.
714     if test -f $ac_dir/$ac_word; then
715       ac_cv_prog_RANLIB="ranlib"
716       break
717     fi
718   done
719   IFS="$ac_save_ifs"
720   test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
721 fi
722 fi
723 RANLIB="$ac_cv_prog_RANLIB"
724 if test -n "$RANLIB"; then
725   echo "$ac_t""$RANLIB" 1>&6
726 else
727   echo "$ac_t""no" 1>&6
728 fi
729
730 else
731   RANLIB=":"
732 fi
733 fi
734
735
736
737 # Extract the first word of "gcc", so it can be a program name with args.
738 set dummy gcc; ac_word=$2
739 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
740 echo "configure:741: checking for $ac_word" >&5
741 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
742   echo $ac_n "(cached) $ac_c" 1>&6
743 else
744   if test -n "$CC"; then
745   ac_cv_prog_CC="$CC" # Let the user override the test.
746 else
747   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
748   ac_dummy="$PATH"
749   for ac_dir in $ac_dummy; do
750     test -z "$ac_dir" && ac_dir=.
751     if test -f $ac_dir/$ac_word; then
752       ac_cv_prog_CC="gcc"
753       break
754     fi
755   done
756   IFS="$ac_save_ifs"
757 fi
758 fi
759 CC="$ac_cv_prog_CC"
760 if test -n "$CC"; then
761   echo "$ac_t""$CC" 1>&6
762 else
763   echo "$ac_t""no" 1>&6
764 fi
765
766 if test -z "$CC"; then
767   # Extract the first word of "cc", so it can be a program name with args.
768 set dummy cc; ac_word=$2
769 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
770 echo "configure:771: checking for $ac_word" >&5
771 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
772   echo $ac_n "(cached) $ac_c" 1>&6
773 else
774   if test -n "$CC"; then
775   ac_cv_prog_CC="$CC" # Let the user override the test.
776 else
777   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
778   ac_prog_rejected=no
779   ac_dummy="$PATH"
780   for ac_dir in $ac_dummy; do
781     test -z "$ac_dir" && ac_dir=.
782     if test -f $ac_dir/$ac_word; then
783       if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
784         ac_prog_rejected=yes
785         continue
786       fi
787       ac_cv_prog_CC="cc"
788       break
789     fi
790   done
791   IFS="$ac_save_ifs"
792 if test $ac_prog_rejected = yes; then
793   # We found a bogon in the path, so make sure we never use it.
794   set dummy $ac_cv_prog_CC
795   shift
796   if test $# -gt 0; then
797     # We chose a different compiler from the bogus one.
798     # However, it has the same basename, so the bogon will be chosen
799     # first if we set CC to just the basename; use the full file name.
800     shift
801     set dummy "$ac_dir/$ac_word" "$@"
802     shift
803     ac_cv_prog_CC="$@"
804   fi
805 fi
806 fi
807 fi
808 CC="$ac_cv_prog_CC"
809 if test -n "$CC"; then
810   echo "$ac_t""$CC" 1>&6
811 else
812   echo "$ac_t""no" 1>&6
813 fi
814
815   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
816 fi
817
818 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
819 echo "configure:820: checking whether we are using GNU C" >&5
820 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
821   echo $ac_n "(cached) $ac_c" 1>&6
822 else
823   cat > conftest.c <<EOF
824 #ifdef __GNUC__
825   yes;
826 #endif
827 EOF
828 if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
829   ac_cv_prog_gcc=yes
830 else
831   ac_cv_prog_gcc=no
832 fi
833 fi
834
835 echo "$ac_t""$ac_cv_prog_gcc" 1>&6
836
837 if test $ac_cv_prog_gcc = yes; then
838   GCC=yes
839   ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
840   ac_test_CFLAGS="${CFLAGS+set}"
841   ac_save_CFLAGS="$CFLAGS"
842   CFLAGS=
843   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
844 echo "configure:845: checking whether ${CC-cc} accepts -g" >&5
845 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
846   echo $ac_n "(cached) $ac_c" 1>&6
847 else
848   echo 'void f(){}' > conftest.c
849 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
850   ac_cv_prog_cc_g=yes
851 else
852   ac_cv_prog_cc_g=no
853 fi
854 rm -f conftest*
855
856 fi
857
858 echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
859   if test "$ac_test_CFLAGS" = set; then
860     CFLAGS="$ac_save_CFLAGS"
861   elif test $ac_cv_prog_cc_g = yes; then
862     CFLAGS="-g -O2"
863   else
864     CFLAGS="-O2"
865   fi
866 else
867   GCC=
868   ac_libiberty_warn_cflags=
869   test "${CFLAGS+set}" = set || CFLAGS="-g"
870 fi
871
872
873
874 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
875 echo "configure:876: checking for POSIXized ISC" >&5
876 if test -d /etc/conf/kconfig.d &&
877   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
878 then
879   echo "$ac_t""yes" 1>&6
880   ISC=yes # If later tests want to check for ISC.
881   cat >> confdefs.h <<\EOF
882 #define _POSIX_SOURCE 1
883 EOF
884
885   if test "$GCC" = yes; then
886     CC="$CC -posix"
887   else
888     CC="$CC -Xp"
889   fi
890 else
891   echo "$ac_t""no" 1>&6
892   ISC=
893 fi
894
895 echo $ac_n "checking for working const""... $ac_c" 1>&6
896 echo "configure:897: checking for working const" >&5
897 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
898   echo $ac_n "(cached) $ac_c" 1>&6
899 else
900   cat > conftest.$ac_ext <<EOF
901 #line 902 "configure"
902 #include "confdefs.h"
903
904 int main() {
905
906 /* Ultrix mips cc rejects this.  */
907 typedef int charset[2]; const charset x;
908 /* SunOS 4.1.1 cc rejects this.  */
909 char const *const *ccp;
910 char **p;
911 /* NEC SVR4.0.2 mips cc rejects this.  */
912 struct point {int x, y;};
913 static struct point const zero = {0,0};
914 /* AIX XL C 1.02.0.0 rejects this.
915    It does not let you subtract one const X* pointer from another in an arm
916    of an if-expression whose if-part is not a constant expression */
917 const char *g = "string";
918 ccp = &g + (g ? g-g : 0);
919 /* HPUX 7.0 cc rejects these. */
920 ++ccp;
921 p = (char**) ccp;
922 ccp = (char const *const *) p;
923 { /* SCO 3.2v4 cc rejects this.  */
924   char *t;
925   char const *s = 0 ? (char *) 0 : (char const *) 0;
926
927   *t++ = 0;
928 }
929 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
930   int x[] = {25, 17};
931   const int *foo = &x[0];
932   ++foo;
933 }
934 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
935   typedef const int *iptr;
936   iptr p = 0;
937   ++p;
938 }
939 { /* AIX XL C 1.02.0.0 rejects this saying
940      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
941   struct s { int j; const int *ap[3]; };
942   struct s *b; b->j = 5;
943 }
944 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
945   const int foo = 10;
946 }
947
948 ; return 0; }
949 EOF
950 if { (eval echo configure:951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
951   rm -rf conftest*
952   ac_cv_c_const=yes
953 else
954   echo "configure: failed program was:" >&5
955   cat conftest.$ac_ext >&5
956   rm -rf conftest*
957   ac_cv_c_const=no
958 fi
959 rm -f conftest*
960 fi
961
962 echo "$ac_t""$ac_cv_c_const" 1>&6
963 if test $ac_cv_c_const = no; then
964   cat >> confdefs.h <<\EOF
965 #define const 
966 EOF
967
968 fi
969
970 echo $ac_n "checking for inline""... $ac_c" 1>&6
971 echo "configure:972: checking for inline" >&5
972 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
973   echo $ac_n "(cached) $ac_c" 1>&6
974 else
975   ac_cv_c_inline=no
976 for ac_kw in inline __inline__ __inline; do
977   cat > conftest.$ac_ext <<EOF
978 #line 979 "configure"
979 #include "confdefs.h"
980
981 int main() {
982 } $ac_kw foo() {
983 ; return 0; }
984 EOF
985 if { (eval echo configure:986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
986   rm -rf conftest*
987   ac_cv_c_inline=$ac_kw; break
988 else
989   echo "configure: failed program was:" >&5
990   cat conftest.$ac_ext >&5
991 fi
992 rm -f conftest*
993 done
994
995 fi
996
997 echo "$ac_t""$ac_cv_c_inline" 1>&6
998 case "$ac_cv_c_inline" in
999   inline | yes) ;;
1000   no) cat >> confdefs.h <<\EOF
1001 #define inline 
1002 EOF
1003  ;;
1004   *)  cat >> confdefs.h <<EOF
1005 #define inline $ac_cv_c_inline
1006 EOF
1007  ;;
1008 esac
1009
1010
1011
1012
1013
1014
1015
1016 # Find a good install program.  We prefer a C program (faster),
1017 # so one script is as good as another.  But avoid the broken or
1018 # incompatible versions:
1019 # SysV /etc/install, /usr/sbin/install
1020 # SunOS /usr/etc/install
1021 # IRIX /sbin/install
1022 # AIX /bin/install
1023 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
1024 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
1025 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
1026 # ./install, which can be erroneously created by make from ./install.sh.
1027 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
1028 echo "configure:1029: checking for a BSD compatible install" >&5
1029 if test -z "$INSTALL"; then
1030 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
1031   echo $ac_n "(cached) $ac_c" 1>&6
1032 else
1033     IFS="${IFS=         }"; ac_save_IFS="$IFS"; IFS=":"
1034   for ac_dir in $PATH; do
1035     # Account for people who put trailing slashes in PATH elements.
1036     case "$ac_dir/" in
1037     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
1038     *)
1039       # OSF1 and SCO ODT 3.0 have their own names for install.
1040       # Don't use installbsd from OSF since it installs stuff as root
1041       # by default.
1042       for ac_prog in ginstall scoinst install; do
1043         if test -f $ac_dir/$ac_prog; then
1044           if test $ac_prog = install &&
1045             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
1046             # AIX install.  It has an incompatible calling convention.
1047             :
1048           else
1049             ac_cv_path_install="$ac_dir/$ac_prog -c"
1050             break 2
1051           fi
1052         fi
1053       done
1054       ;;
1055     esac
1056   done
1057   IFS="$ac_save_IFS"
1058
1059 fi
1060   if test "${ac_cv_path_install+set}" = set; then
1061     INSTALL="$ac_cv_path_install"
1062   else
1063     # As a last resort, use the slow shell script.  We don't cache a
1064     # path for INSTALL within a source directory, because that will
1065     # break other packages using the cache if that directory is
1066     # removed, or if the path is relative.
1067     INSTALL="$ac_install_sh"
1068   fi
1069 fi
1070 echo "$ac_t""$INSTALL" 1>&6
1071
1072 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
1073 # It thinks the first close brace ends the variable substitution.
1074 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
1075
1076 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
1077
1078 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
1079
1080
1081 . ${srcdir}/config.table
1082 host_makefile_frag=${frag}
1083
1084
1085 # It's OK to check for header files.  Although the compiler may not be
1086 # able to link anything, it had better be able to at least compile
1087 # something.
1088 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
1089 echo "configure:1090: checking how to run the C preprocessor" >&5
1090 # On Suns, sometimes $CPP names a directory.
1091 if test -n "$CPP" && test -d "$CPP"; then
1092   CPP=
1093 fi
1094 if test -z "$CPP"; then
1095 if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
1096   echo $ac_n "(cached) $ac_c" 1>&6
1097 else
1098     # This must be in double quotes, not single quotes, because CPP may get
1099   # substituted into the Makefile and "${CC-cc}" will confuse make.
1100   CPP="${CC-cc} -E"
1101   # On the NeXT, cc -E runs the code through the compiler's parser,
1102   # not just through cpp.
1103   cat > conftest.$ac_ext <<EOF
1104 #line 1105 "configure"
1105 #include "confdefs.h"
1106 #include <assert.h>
1107 Syntax Error
1108 EOF
1109 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1110 { (eval echo configure:1111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1111 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1112 if test -z "$ac_err"; then
1113   :
1114 else
1115   echo "$ac_err" >&5
1116   echo "configure: failed program was:" >&5
1117   cat conftest.$ac_ext >&5
1118   rm -rf conftest*
1119   CPP="${CC-cc} -E -traditional-cpp"
1120   cat > conftest.$ac_ext <<EOF
1121 #line 1122 "configure"
1122 #include "confdefs.h"
1123 #include <assert.h>
1124 Syntax Error
1125 EOF
1126 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1127 { (eval echo configure:1128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1128 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1129 if test -z "$ac_err"; then
1130   :
1131 else
1132   echo "$ac_err" >&5
1133   echo "configure: failed program was:" >&5
1134   cat conftest.$ac_ext >&5
1135   rm -rf conftest*
1136   CPP="${CC-cc} -nologo -E"
1137   cat > conftest.$ac_ext <<EOF
1138 #line 1139 "configure"
1139 #include "confdefs.h"
1140 #include <assert.h>
1141 Syntax Error
1142 EOF
1143 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1144 { (eval echo configure:1145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1145 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1146 if test -z "$ac_err"; then
1147   :
1148 else
1149   echo "$ac_err" >&5
1150   echo "configure: failed program was:" >&5
1151   cat conftest.$ac_ext >&5
1152   rm -rf conftest*
1153   CPP=/lib/cpp
1154 fi
1155 rm -f conftest*
1156 fi
1157 rm -f conftest*
1158 fi
1159 rm -f conftest*
1160   ac_cv_prog_CPP="$CPP"
1161 fi
1162   CPP="$ac_cv_prog_CPP"
1163 else
1164   ac_cv_prog_CPP="$CPP"
1165 fi
1166 echo "$ac_t""$CPP" 1>&6
1167
1168 for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h
1169 do
1170 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
1171 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
1172 echo "configure:1173: checking for $ac_hdr" >&5
1173 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1174   echo $ac_n "(cached) $ac_c" 1>&6
1175 else
1176   cat > conftest.$ac_ext <<EOF
1177 #line 1178 "configure"
1178 #include "confdefs.h"
1179 #include <$ac_hdr>
1180 EOF
1181 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1182 { (eval echo configure:1183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1183 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1184 if test -z "$ac_err"; then
1185   rm -rf conftest*
1186   eval "ac_cv_header_$ac_safe=yes"
1187 else
1188   echo "$ac_err" >&5
1189   echo "configure: failed program was:" >&5
1190   cat conftest.$ac_ext >&5
1191   rm -rf conftest*
1192   eval "ac_cv_header_$ac_safe=no"
1193 fi
1194 rm -f conftest*
1195 fi
1196 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1197   echo "$ac_t""yes" 1>&6
1198     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
1199   cat >> confdefs.h <<EOF
1200 #define $ac_tr_hdr 1
1201 EOF
1202  
1203 else
1204   echo "$ac_t""no" 1>&6
1205 fi
1206 done
1207
1208 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
1209 echo "configure:1210: checking for sys/wait.h that is POSIX.1 compatible" >&5
1210 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
1211   echo $ac_n "(cached) $ac_c" 1>&6
1212 else
1213   cat > conftest.$ac_ext <<EOF
1214 #line 1215 "configure"
1215 #include "confdefs.h"
1216 #include <sys/types.h>
1217 #include <sys/wait.h>
1218 #ifndef WEXITSTATUS
1219 #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
1220 #endif
1221 #ifndef WIFEXITED
1222 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
1223 #endif
1224 int main() {
1225 int s;
1226 wait (&s);
1227 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
1228 ; return 0; }
1229 EOF
1230 if { (eval echo configure:1231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1231   rm -rf conftest*
1232   ac_cv_header_sys_wait_h=yes
1233 else
1234   echo "configure: failed program was:" >&5
1235   cat conftest.$ac_ext >&5
1236   rm -rf conftest*
1237   ac_cv_header_sys_wait_h=no
1238 fi
1239 rm -f conftest*
1240 fi
1241
1242 echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
1243 if test $ac_cv_header_sys_wait_h = yes; then
1244   cat >> confdefs.h <<\EOF
1245 #define HAVE_SYS_WAIT_H 1
1246 EOF
1247
1248 fi
1249
1250 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
1251 echo "configure:1252: checking whether time.h and sys/time.h may both be included" >&5
1252 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
1253   echo $ac_n "(cached) $ac_c" 1>&6
1254 else
1255   cat > conftest.$ac_ext <<EOF
1256 #line 1257 "configure"
1257 #include "confdefs.h"
1258 #include <sys/types.h>
1259 #include <sys/time.h>
1260 #include <time.h>
1261 int main() {
1262 struct tm *tp;
1263 ; return 0; }
1264 EOF
1265 if { (eval echo configure:1266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1266   rm -rf conftest*
1267   ac_cv_header_time=yes
1268 else
1269   echo "configure: failed program was:" >&5
1270   cat conftest.$ac_ext >&5
1271   rm -rf conftest*
1272   ac_cv_header_time=no
1273 fi
1274 rm -f conftest*
1275 fi
1276
1277 echo "$ac_t""$ac_cv_header_time" 1>&6
1278 if test $ac_cv_header_time = yes; then
1279   cat >> confdefs.h <<\EOF
1280 #define TIME_WITH_SYS_TIME 1
1281 EOF
1282
1283 fi
1284
1285
1286 echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6
1287 echo "configure:1288: checking whether errno must be declared" >&5
1288 if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then
1289   echo $ac_n "(cached) $ac_c" 1>&6
1290 else
1291   cat > conftest.$ac_ext <<EOF
1292 #line 1293 "configure"
1293 #include "confdefs.h"
1294 #include <errno.h>
1295 int main() {
1296 int x = errno;
1297 ; return 0; }
1298 EOF
1299 if { (eval echo configure:1300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1300   rm -rf conftest*
1301   libiberty_cv_declare_errno=no
1302 else
1303   echo "configure: failed program was:" >&5
1304   cat conftest.$ac_ext >&5
1305   rm -rf conftest*
1306   libiberty_cv_declare_errno=yes
1307 fi
1308 rm -f conftest*
1309 fi
1310
1311 echo "$ac_t""$libiberty_cv_declare_errno" 1>&6
1312 if test $libiberty_cv_declare_errno = yes
1313 then cat >> confdefs.h <<\EOF
1314 #define NEED_DECLARATION_ERRNO 1
1315 EOF
1316
1317 fi
1318
1319
1320 # This is the list of functions which libiberty will provide if they
1321 # are not available on the host.
1322
1323 funcs="asprintf"
1324 funcs="$funcs atexit"
1325 funcs="$funcs basename"
1326 funcs="$funcs bcmp"
1327 funcs="$funcs bcopy"
1328 funcs="$funcs bsearch"
1329 funcs="$funcs bzero"
1330 funcs="$funcs calloc"
1331 funcs="$funcs clock"
1332 funcs="$funcs getcwd"
1333 funcs="$funcs getpagesize"
1334 funcs="$funcs index"
1335 funcs="$funcs insque"
1336 funcs="$funcs memchr"
1337 funcs="$funcs memcmp"
1338 funcs="$funcs memcpy"
1339 funcs="$funcs memmove"
1340 funcs="$funcs memset"
1341 funcs="$funcs mkstemps"
1342 funcs="$funcs putenv"
1343 funcs="$funcs random"
1344 funcs="$funcs rename"
1345 funcs="$funcs rindex"
1346 funcs="$funcs setenv"
1347 funcs="$funcs sigsetmask"
1348 funcs="$funcs strcasecmp"
1349 funcs="$funcs strchr"
1350 funcs="$funcs strdup"
1351 funcs="$funcs strncasecmp"
1352 funcs="$funcs strrchr"
1353 funcs="$funcs strstr"
1354 funcs="$funcs strtod"
1355 funcs="$funcs strtol"
1356 funcs="$funcs strtoul"
1357 funcs="$funcs tmpnam"
1358 funcs="$funcs vasprintf"
1359 funcs="$funcs vfprintf"
1360 funcs="$funcs vprintf"
1361 funcs="$funcs vsprintf"
1362 funcs="$funcs waitpid"
1363
1364 # Also in the old function.def file: alloca, vfork, getopt.
1365
1366 vars="sys_errlist sys_nerr sys_siglist"
1367
1368 checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
1369
1370 # These are neither executed nor required, but they help keep
1371 # autoheader happy without adding a bunch of text to acconfig.h.
1372 if test "x" = "y"; then
1373   for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock
1374 do
1375 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1376 echo "configure:1377: checking for $ac_func" >&5
1377 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1378   echo $ac_n "(cached) $ac_c" 1>&6
1379 else
1380   cat > conftest.$ac_ext <<EOF
1381 #line 1382 "configure"
1382 #include "confdefs.h"
1383 /* System header to define __stub macros and hopefully few prototypes,
1384     which can conflict with char $ac_func(); below.  */
1385 #include <assert.h>
1386 /* Override any gcc2 internal prototype to avoid an error.  */
1387 /* We use char because int might match the return type of a gcc2
1388     builtin and then its argument prototype would still apply.  */
1389 char $ac_func();
1390
1391 int main() {
1392
1393 /* The GNU C library defines this for functions which it implements
1394     to always fail with ENOSYS.  Some functions are actually named
1395     something starting with __ and the normal name is an alias.  */
1396 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1397 choke me
1398 #else
1399 $ac_func();
1400 #endif
1401
1402 ; return 0; }
1403 EOF
1404 if { (eval echo configure:1405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1405   rm -rf conftest*
1406   eval "ac_cv_func_$ac_func=yes"
1407 else
1408   echo "configure: failed program was:" >&5
1409   cat conftest.$ac_ext >&5
1410   rm -rf conftest*
1411   eval "ac_cv_func_$ac_func=no"
1412 fi
1413 rm -f conftest*
1414 fi
1415
1416 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1417   echo "$ac_t""yes" 1>&6
1418     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1419   cat >> confdefs.h <<EOF
1420 #define $ac_tr_func 1
1421 EOF
1422  
1423 else
1424   echo "$ac_t""no" 1>&6
1425 fi
1426 done
1427
1428   for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy
1429 do
1430 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1431 echo "configure:1432: checking for $ac_func" >&5
1432 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1433   echo $ac_n "(cached) $ac_c" 1>&6
1434 else
1435   cat > conftest.$ac_ext <<EOF
1436 #line 1437 "configure"
1437 #include "confdefs.h"
1438 /* System header to define __stub macros and hopefully few prototypes,
1439     which can conflict with char $ac_func(); below.  */
1440 #include <assert.h>
1441 /* Override any gcc2 internal prototype to avoid an error.  */
1442 /* We use char because int might match the return type of a gcc2
1443     builtin and then its argument prototype would still apply.  */
1444 char $ac_func();
1445
1446 int main() {
1447
1448 /* The GNU C library defines this for functions which it implements
1449     to always fail with ENOSYS.  Some functions are actually named
1450     something starting with __ and the normal name is an alias.  */
1451 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1452 choke me
1453 #else
1454 $ac_func();
1455 #endif
1456
1457 ; return 0; }
1458 EOF
1459 if { (eval echo configure:1460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1460   rm -rf conftest*
1461   eval "ac_cv_func_$ac_func=yes"
1462 else
1463   echo "configure: failed program was:" >&5
1464   cat conftest.$ac_ext >&5
1465   rm -rf conftest*
1466   eval "ac_cv_func_$ac_func=no"
1467 fi
1468 rm -f conftest*
1469 fi
1470
1471 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1472   echo "$ac_t""yes" 1>&6
1473     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1474   cat >> confdefs.h <<EOF
1475 #define $ac_tr_func 1
1476 EOF
1477  
1478 else
1479   echo "$ac_t""no" 1>&6
1480 fi
1481 done
1482
1483   for ac_func in memmove memset putenv random rename rindex sigsetmask
1484 do
1485 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1486 echo "configure:1487: checking for $ac_func" >&5
1487 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1488   echo $ac_n "(cached) $ac_c" 1>&6
1489 else
1490   cat > conftest.$ac_ext <<EOF
1491 #line 1492 "configure"
1492 #include "confdefs.h"
1493 /* System header to define __stub macros and hopefully few prototypes,
1494     which can conflict with char $ac_func(); below.  */
1495 #include <assert.h>
1496 /* Override any gcc2 internal prototype to avoid an error.  */
1497 /* We use char because int might match the return type of a gcc2
1498     builtin and then its argument prototype would still apply.  */
1499 char $ac_func();
1500
1501 int main() {
1502
1503 /* The GNU C library defines this for functions which it implements
1504     to always fail with ENOSYS.  Some functions are actually named
1505     something starting with __ and the normal name is an alias.  */
1506 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1507 choke me
1508 #else
1509 $ac_func();
1510 #endif
1511
1512 ; return 0; }
1513 EOF
1514 if { (eval echo configure:1515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1515   rm -rf conftest*
1516   eval "ac_cv_func_$ac_func=yes"
1517 else
1518   echo "configure: failed program was:" >&5
1519   cat conftest.$ac_ext >&5
1520   rm -rf conftest*
1521   eval "ac_cv_func_$ac_func=no"
1522 fi
1523 rm -f conftest*
1524 fi
1525
1526 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1527   echo "$ac_t""yes" 1>&6
1528     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1529   cat >> confdefs.h <<EOF
1530 #define $ac_tr_func 1
1531 EOF
1532  
1533 else
1534   echo "$ac_t""no" 1>&6
1535 fi
1536 done
1537
1538   for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr
1539 do
1540 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1541 echo "configure:1542: checking for $ac_func" >&5
1542 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1543   echo $ac_n "(cached) $ac_c" 1>&6
1544 else
1545   cat > conftest.$ac_ext <<EOF
1546 #line 1547 "configure"
1547 #include "confdefs.h"
1548 /* System header to define __stub macros and hopefully few prototypes,
1549     which can conflict with char $ac_func(); below.  */
1550 #include <assert.h>
1551 /* Override any gcc2 internal prototype to avoid an error.  */
1552 /* We use char because int might match the return type of a gcc2
1553     builtin and then its argument prototype would still apply.  */
1554 char $ac_func();
1555
1556 int main() {
1557
1558 /* The GNU C library defines this for functions which it implements
1559     to always fail with ENOSYS.  Some functions are actually named
1560     something starting with __ and the normal name is an alias.  */
1561 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1562 choke me
1563 #else
1564 $ac_func();
1565 #endif
1566
1567 ; return 0; }
1568 EOF
1569 if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1570   rm -rf conftest*
1571   eval "ac_cv_func_$ac_func=yes"
1572 else
1573   echo "configure: failed program was:" >&5
1574   cat conftest.$ac_ext >&5
1575   rm -rf conftest*
1576   eval "ac_cv_func_$ac_func=no"
1577 fi
1578 rm -f conftest*
1579 fi
1580
1581 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1582   echo "$ac_t""yes" 1>&6
1583     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1584   cat >> confdefs.h <<EOF
1585 #define $ac_tr_func 1
1586 EOF
1587  
1588 else
1589   echo "$ac_t""no" 1>&6
1590 fi
1591 done
1592
1593   for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf
1594 do
1595 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1596 echo "configure:1597: checking for $ac_func" >&5
1597 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1598   echo $ac_n "(cached) $ac_c" 1>&6
1599 else
1600   cat > conftest.$ac_ext <<EOF
1601 #line 1602 "configure"
1602 #include "confdefs.h"
1603 /* System header to define __stub macros and hopefully few prototypes,
1604     which can conflict with char $ac_func(); below.  */
1605 #include <assert.h>
1606 /* Override any gcc2 internal prototype to avoid an error.  */
1607 /* We use char because int might match the return type of a gcc2
1608     builtin and then its argument prototype would still apply.  */
1609 char $ac_func();
1610
1611 int main() {
1612
1613 /* The GNU C library defines this for functions which it implements
1614     to always fail with ENOSYS.  Some functions are actually named
1615     something starting with __ and the normal name is an alias.  */
1616 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1617 choke me
1618 #else
1619 $ac_func();
1620 #endif
1621
1622 ; return 0; }
1623 EOF
1624 if { (eval echo configure:1625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1625   rm -rf conftest*
1626   eval "ac_cv_func_$ac_func=yes"
1627 else
1628   echo "configure: failed program was:" >&5
1629   cat conftest.$ac_ext >&5
1630   rm -rf conftest*
1631   eval "ac_cv_func_$ac_func=no"
1632 fi
1633 rm -f conftest*
1634 fi
1635
1636 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1637   echo "$ac_t""yes" 1>&6
1638     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1639   cat >> confdefs.h <<EOF
1640 #define $ac_tr_func 1
1641 EOF
1642  
1643 else
1644   echo "$ac_t""no" 1>&6
1645 fi
1646 done
1647
1648   for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal
1649 do
1650 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1651 echo "configure:1652: checking for $ac_func" >&5
1652 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1653   echo $ac_n "(cached) $ac_c" 1>&6
1654 else
1655   cat > conftest.$ac_ext <<EOF
1656 #line 1657 "configure"
1657 #include "confdefs.h"
1658 /* System header to define __stub macros and hopefully few prototypes,
1659     which can conflict with char $ac_func(); below.  */
1660 #include <assert.h>
1661 /* Override any gcc2 internal prototype to avoid an error.  */
1662 /* We use char because int might match the return type of a gcc2
1663     builtin and then its argument prototype would still apply.  */
1664 char $ac_func();
1665
1666 int main() {
1667
1668 /* The GNU C library defines this for functions which it implements
1669     to always fail with ENOSYS.  Some functions are actually named
1670     something starting with __ and the normal name is an alias.  */
1671 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1672 choke me
1673 #else
1674 $ac_func();
1675 #endif
1676
1677 ; return 0; }
1678 EOF
1679 if { (eval echo configure:1680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1680   rm -rf conftest*
1681   eval "ac_cv_func_$ac_func=yes"
1682 else
1683   echo "configure: failed program was:" >&5
1684   cat conftest.$ac_ext >&5
1685   rm -rf conftest*
1686   eval "ac_cv_func_$ac_func=no"
1687 fi
1688 rm -f conftest*
1689 fi
1690
1691 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1692   echo "$ac_t""yes" 1>&6
1693     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1694   cat >> confdefs.h <<EOF
1695 #define $ac_tr_func 1
1696 EOF
1697  
1698 else
1699   echo "$ac_t""no" 1>&6
1700 fi
1701 done
1702
1703   for ac_func in sysconf times sbrk gettimeofday
1704 do
1705 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1706 echo "configure:1707: checking for $ac_func" >&5
1707 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1708   echo $ac_n "(cached) $ac_c" 1>&6
1709 else
1710   cat > conftest.$ac_ext <<EOF
1711 #line 1712 "configure"
1712 #include "confdefs.h"
1713 /* System header to define __stub macros and hopefully few prototypes,
1714     which can conflict with char $ac_func(); below.  */
1715 #include <assert.h>
1716 /* Override any gcc2 internal prototype to avoid an error.  */
1717 /* We use char because int might match the return type of a gcc2
1718     builtin and then its argument prototype would still apply.  */
1719 char $ac_func();
1720
1721 int main() {
1722
1723 /* The GNU C library defines this for functions which it implements
1724     to always fail with ENOSYS.  Some functions are actually named
1725     something starting with __ and the normal name is an alias.  */
1726 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1727 choke me
1728 #else
1729 $ac_func();
1730 #endif
1731
1732 ; return 0; }
1733 EOF
1734 if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1735   rm -rf conftest*
1736   eval "ac_cv_func_$ac_func=yes"
1737 else
1738   echo "configure: failed program was:" >&5
1739   cat conftest.$ac_ext >&5
1740   rm -rf conftest*
1741   eval "ac_cv_func_$ac_func=no"
1742 fi
1743 rm -f conftest*
1744 fi
1745
1746 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1747   echo "$ac_t""yes" 1>&6
1748     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1749   cat >> confdefs.h <<EOF
1750 #define $ac_tr_func 1
1751 EOF
1752  
1753 else
1754   echo "$ac_t""no" 1>&6
1755 fi
1756 done
1757
1758   cat >> confdefs.h <<\EOF
1759 #define HAVE_SYS_ERRLIST 1
1760 EOF
1761
1762   cat >> confdefs.h <<\EOF
1763 #define HAVE_SYS_NERR 1
1764 EOF
1765
1766   cat >> confdefs.h <<\EOF
1767 #define HAVE_SYS_SIGLIST 1
1768 EOF
1769
1770 fi
1771
1772 # For each of these functions, if the host does not provide the
1773 # function we want to put FN.o in LIBOBJS, and if the host does
1774 # provide the function, we want to define HAVE_FN in config.h.  Also,
1775 # if the host does not provide alloca, we set ALLOCA to alloca.o
1776
1777 setobjs=
1778 CHECK=
1779 if test -n "${with_target_subdir}"; then
1780
1781   # We are being configured as a target library.  AC_REPLACE_FUNCS
1782   # may not work correctly, because the compiler may not be able to
1783   # link executables.  Note that we may still be being configured
1784   # native.
1785
1786   # If we are being configured for newlib, we know which functions
1787   # newlib provide and which ones we will be expected to provide.
1788
1789   if test "x${with_newlib}" = "xyes"; then
1790     ALLOCA="alloca.o"
1791     LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
1792
1793     for f in $funcs; do
1794       case "$f" in
1795         asprintf | basename | insque | random | strdup | vasprintf)
1796           ;;
1797         *)
1798           n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1799           cat >> confdefs.h <<EOF
1800 #define $n 1
1801 EOF
1802
1803           ;;
1804       esac
1805     done
1806
1807     # newlib doesnt provide any of the variables in $vars, so we
1808     # dont have to check them here.
1809
1810     # Of the functions in $checkfuncs, newlib only has strerror.
1811     cat >> confdefs.h <<\EOF
1812 #define HAVE_STRERROR 1
1813 EOF
1814
1815
1816     setobjs=yes
1817
1818   fi
1819
1820 else
1821
1822    # Not a target library, so we set things up to run the test suite.
1823    CHECK=check-cplus-dem
1824
1825 fi
1826
1827
1828
1829 if test -z "${setobjs}"; then
1830   case "${host}" in
1831
1832   *-*-vxworks*)
1833     # Handle VxWorks configuration specially, since on VxWorks the
1834     # libraries are actually on the target board, not in the file
1835     # system.
1836     LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
1837     LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
1838     for f in $funcs; do
1839       case "$f" in
1840         basename | getpagesize | insque | random | strcasecmp)
1841           ;;
1842         strncasecmp | strdup | vfork | waitpid | vasprintf)
1843           ;;
1844         *)
1845           n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1846           cat >> confdefs.h <<EOF
1847 #define $n 1
1848 EOF
1849
1850           ;;
1851       esac
1852     done
1853
1854     # VxWorks doesn't provide any of the variables in $vars, so we
1855     # don't have to check them here.
1856
1857     # Of the functions in $checkfuncs, VxWorks only has strerror.
1858     cat >> confdefs.h <<\EOF
1859 #define HAVE_STRERROR 1
1860 EOF
1861
1862
1863     setobjs=yes
1864     ;;
1865
1866   esac
1867 fi
1868
1869 if test -z "${setobjs}"; then
1870
1871   case "${host}" in
1872
1873   *-*-cygwin*)
1874     # The Cygwin library actually uses a couple of files from
1875     # libiberty when it is built.  If we are building a native
1876     # Cygwin, and we run the tests, we will appear to have these
1877     # files.  However, when we go on to build winsup, we will wind up
1878     # with a library which does not have the files, since they should
1879     # have come from libiberty.
1880
1881     # We handle this by removing the functions the winsup library
1882     # provides from our shell variables, so that they appear to be
1883     # missing.
1884
1885     # DJ - only if we're *building* cygwin, not just building *with* cygwin
1886   
1887     if test -n "${with_target_subdir}"
1888     then
1889       funcs="`echo $funcs | sed -e 's/random//'`"
1890       LIBOBJS="$LIBOBJS random.o"
1891       vars="`echo $vars | sed -e 's/sys_siglist//'`"
1892       checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
1893     fi
1894     ;;
1895
1896   *-*-mingw32*)
1897     # Under mingw32, sys_nerr and sys_errlist exist, but they are
1898     # macros, so the test below won't find them.
1899     libiberty_cv_var_sys_nerr=yes
1900     libiberty_cv_var_sys_errlist=yes
1901     ;;
1902
1903   *-*-uwin*)
1904     # Under some versions of uwin, vfork is notoriously buggy and the test 
1905     # can hang configure; on other versions, vfork exists just as a stub.
1906     # FIXME: This should be removed once vfork in uwin's runtime is fixed.
1907     ac_cv_func_vfork_works=no
1908     # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
1909     # macros (actually, these are imported from a DLL, but the end effect 
1910     # is the same), so the test below won't find them.
1911     libiberty_cv_var_sys_nerr=yes
1912     libiberty_cv_var_sys_errlist=yes
1913     ;;
1914
1915   esac
1916
1917   # We haven't set the list of objects yet.  Use the standard autoconf
1918   # tests.  This will only work if the compiler works.
1919   echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
1920 echo "configure:1921: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
1921
1922 ac_ext=c
1923 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
1924 ac_cpp='$CPP $CPPFLAGS'
1925 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
1926 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
1927 cross_compiling=$ac_cv_prog_cc_cross
1928
1929 cat > conftest.$ac_ext << EOF
1930
1931 #line 1932 "configure"
1932 #include "confdefs.h"
1933
1934 main(){return(0);}
1935 EOF
1936 if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1937   ac_cv_prog_cc_works=yes
1938   # If we can't run a trivial program, we are probably using a cross compiler.
1939   if (./conftest; exit) 2>/dev/null; then
1940     ac_cv_prog_cc_cross=no
1941   else
1942     ac_cv_prog_cc_cross=yes
1943   fi
1944 else
1945   echo "configure: failed program was:" >&5
1946   cat conftest.$ac_ext >&5
1947   ac_cv_prog_cc_works=no
1948 fi
1949 rm -fr conftest*
1950 ac_ext=c
1951 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
1952 ac_cpp='$CPP $CPPFLAGS'
1953 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
1954 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
1955 cross_compiling=$ac_cv_prog_cc_cross
1956
1957 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
1958 if test $ac_cv_prog_cc_works = no; then
1959   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
1960 fi
1961 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
1962 echo "configure:1963: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
1963 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
1964 cross_compiling=$ac_cv_prog_cc_cross
1965
1966   for ac_func in $funcs
1967 do
1968 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1969 echo "configure:1970: checking for $ac_func" >&5
1970 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1971   echo $ac_n "(cached) $ac_c" 1>&6
1972 else
1973   cat > conftest.$ac_ext <<EOF
1974 #line 1975 "configure"
1975 #include "confdefs.h"
1976 /* System header to define __stub macros and hopefully few prototypes,
1977     which can conflict with char $ac_func(); below.  */
1978 #include <assert.h>
1979 /* Override any gcc2 internal prototype to avoid an error.  */
1980 /* We use char because int might match the return type of a gcc2
1981     builtin and then its argument prototype would still apply.  */
1982 char $ac_func();
1983
1984 int main() {
1985
1986 /* The GNU C library defines this for functions which it implements
1987     to always fail with ENOSYS.  Some functions are actually named
1988     something starting with __ and the normal name is an alias.  */
1989 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1990 choke me
1991 #else
1992 $ac_func();
1993 #endif
1994
1995 ; return 0; }
1996 EOF
1997 if { (eval echo configure:1998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1998   rm -rf conftest*
1999   eval "ac_cv_func_$ac_func=yes"
2000 else
2001   echo "configure: failed program was:" >&5
2002   cat conftest.$ac_ext >&5
2003   rm -rf conftest*
2004   eval "ac_cv_func_$ac_func=no"
2005 fi
2006 rm -f conftest*
2007 fi
2008
2009 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
2010   echo "$ac_t""yes" 1>&6
2011     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2012   cat >> confdefs.h <<EOF
2013 #define $ac_tr_func 1
2014 EOF
2015  
2016 else
2017   echo "$ac_t""no" 1>&6
2018 LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
2019 fi
2020 done
2021
2022
2023
2024   case "${host}" in
2025   *-*-interix)
2026     # On Interix, it wrongly concludes that the MSVC compiler supports alloca.
2027     # (MSVC does on Win32, not on Interix.)
2028     # This should be temporary.
2029
2030     ac_cv_header_alloca_h=no
2031     ac_cv_func_alloca_works=no
2032     ALLOCA=alloca.o
2033     cat >> confdefs.h <<\EOF
2034 #define C_ALLOCA 1
2035 EOF
2036     cat >> confdefs.h <<EOF
2037 #define STACK_DIRECTION -1
2038 EOF
2039     ;;
2040   *)
2041     # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
2042 # for constant arguments.  Useless!
2043 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
2044 echo "configure:2045: checking for working alloca.h" >&5
2045 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
2046   echo $ac_n "(cached) $ac_c" 1>&6
2047 else
2048   cat > conftest.$ac_ext <<EOF
2049 #line 2050 "configure"
2050 #include "confdefs.h"
2051 #include <alloca.h>
2052 int main() {
2053 char *p = alloca(2 * sizeof(int));
2054 ; return 0; }
2055 EOF
2056 if { (eval echo configure:2057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2057   rm -rf conftest*
2058   ac_cv_header_alloca_h=yes
2059 else
2060   echo "configure: failed program was:" >&5
2061   cat conftest.$ac_ext >&5
2062   rm -rf conftest*
2063   ac_cv_header_alloca_h=no
2064 fi
2065 rm -f conftest*
2066 fi
2067
2068 echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
2069 if test $ac_cv_header_alloca_h = yes; then
2070   cat >> confdefs.h <<\EOF
2071 #define HAVE_ALLOCA_H 1
2072 EOF
2073
2074 fi
2075
2076 echo $ac_n "checking for alloca""... $ac_c" 1>&6
2077 echo "configure:2078: checking for alloca" >&5
2078 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
2079   echo $ac_n "(cached) $ac_c" 1>&6
2080 else
2081   cat > conftest.$ac_ext <<EOF
2082 #line 2083 "configure"
2083 #include "confdefs.h"
2084
2085 #ifdef __GNUC__
2086 # define alloca __builtin_alloca
2087 #else
2088 # ifdef _MSC_VER
2089 #  include <malloc.h>
2090 #  define alloca _alloca
2091 # else
2092 #  if HAVE_ALLOCA_H
2093 #   include <alloca.h>
2094 #  else
2095 #   ifdef _AIX
2096  #pragma alloca
2097 #   else
2098 #    ifndef alloca /* predefined by HP cc +Olibcalls */
2099 char *alloca ();
2100 #    endif
2101 #   endif
2102 #  endif
2103 # endif
2104 #endif
2105
2106 int main() {
2107 char *p = (char *) alloca(1);
2108 ; return 0; }
2109 EOF
2110 if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2111   rm -rf conftest*
2112   ac_cv_func_alloca_works=yes
2113 else
2114   echo "configure: failed program was:" >&5
2115   cat conftest.$ac_ext >&5
2116   rm -rf conftest*
2117   ac_cv_func_alloca_works=no
2118 fi
2119 rm -f conftest*
2120 fi
2121
2122 echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
2123 if test $ac_cv_func_alloca_works = yes; then
2124   cat >> confdefs.h <<\EOF
2125 #define HAVE_ALLOCA 1
2126 EOF
2127
2128 fi
2129
2130 if test $ac_cv_func_alloca_works = no; then
2131   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
2132   # that cause trouble.  Some versions do not even contain alloca or
2133   # contain a buggy version.  If you still want to use their alloca,
2134   # use ar to extract alloca.o from them instead of compiling alloca.c.
2135   ALLOCA=alloca.${ac_objext}
2136   cat >> confdefs.h <<\EOF
2137 #define C_ALLOCA 1
2138 EOF
2139
2140
2141 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
2142 echo "configure:2143: checking whether alloca needs Cray hooks" >&5
2143 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
2144   echo $ac_n "(cached) $ac_c" 1>&6
2145 else
2146   cat > conftest.$ac_ext <<EOF
2147 #line 2148 "configure"
2148 #include "confdefs.h"
2149 #if defined(CRAY) && ! defined(CRAY2)
2150 webecray
2151 #else
2152 wenotbecray
2153 #endif
2154
2155 EOF
2156 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
2157   egrep "webecray" >/dev/null 2>&1; then
2158   rm -rf conftest*
2159   ac_cv_os_cray=yes
2160 else
2161   rm -rf conftest*
2162   ac_cv_os_cray=no
2163 fi
2164 rm -f conftest*
2165
2166 fi
2167
2168 echo "$ac_t""$ac_cv_os_cray" 1>&6
2169 if test $ac_cv_os_cray = yes; then
2170 for ac_func in _getb67 GETB67 getb67; do
2171   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
2172 echo "configure:2173: checking for $ac_func" >&5
2173 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
2174   echo $ac_n "(cached) $ac_c" 1>&6
2175 else
2176   cat > conftest.$ac_ext <<EOF
2177 #line 2178 "configure"
2178 #include "confdefs.h"
2179 /* System header to define __stub macros and hopefully few prototypes,
2180     which can conflict with char $ac_func(); below.  */
2181 #include <assert.h>
2182 /* Override any gcc2 internal prototype to avoid an error.  */
2183 /* We use char because int might match the return type of a gcc2
2184     builtin and then its argument prototype would still apply.  */
2185 char $ac_func();
2186
2187 int main() {
2188
2189 /* The GNU C library defines this for functions which it implements
2190     to always fail with ENOSYS.  Some functions are actually named
2191     something starting with __ and the normal name is an alias.  */
2192 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
2193 choke me
2194 #else
2195 $ac_func();
2196 #endif
2197
2198 ; return 0; }
2199 EOF
2200 if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2201   rm -rf conftest*
2202   eval "ac_cv_func_$ac_func=yes"
2203 else
2204   echo "configure: failed program was:" >&5
2205   cat conftest.$ac_ext >&5
2206   rm -rf conftest*
2207   eval "ac_cv_func_$ac_func=no"
2208 fi
2209 rm -f conftest*
2210 fi
2211
2212 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
2213   echo "$ac_t""yes" 1>&6
2214   cat >> confdefs.h <<EOF
2215 #define CRAY_STACKSEG_END $ac_func
2216 EOF
2217
2218   break
2219 else
2220   echo "$ac_t""no" 1>&6
2221 fi
2222
2223 done
2224 fi
2225
2226 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
2227 echo "configure:2228: checking stack direction for C alloca" >&5
2228 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
2229   echo $ac_n "(cached) $ac_c" 1>&6
2230 else
2231   if test "$cross_compiling" = yes; then
2232   ac_cv_c_stack_direction=0
2233 else
2234   cat > conftest.$ac_ext <<EOF
2235 #line 2236 "configure"
2236 #include "confdefs.h"
2237 find_stack_direction ()
2238 {
2239   static char *addr = 0;
2240   auto char dummy;
2241   if (addr == 0)
2242     {
2243       addr = &dummy;
2244       return find_stack_direction ();
2245     }
2246   else
2247     return (&dummy > addr) ? 1 : -1;
2248 }
2249 main ()
2250 {
2251   exit (find_stack_direction() < 0);
2252 }
2253 EOF
2254 if { (eval echo configure:2255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
2255 then
2256   ac_cv_c_stack_direction=1
2257 else
2258   echo "configure: failed program was:" >&5
2259   cat conftest.$ac_ext >&5
2260   rm -fr conftest*
2261   ac_cv_c_stack_direction=-1
2262 fi
2263 rm -fr conftest*
2264 fi
2265
2266 fi
2267
2268 echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
2269 cat >> confdefs.h <<EOF
2270 #define STACK_DIRECTION $ac_cv_c_stack_direction
2271 EOF
2272
2273 fi
2274
2275     ;;
2276   esac
2277
2278   echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
2279 echo "configure:2280: checking for ANSI C header files" >&5
2280 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
2281   echo $ac_n "(cached) $ac_c" 1>&6
2282 else
2283   cat > conftest.$ac_ext <<EOF
2284 #line 2285 "configure"
2285 #include "confdefs.h"
2286 #include <stdlib.h>
2287 #include <stdarg.h>
2288 #include <string.h>
2289 #include <float.h>
2290 EOF
2291 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
2292 { (eval echo configure:2293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
2293 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
2294 if test -z "$ac_err"; then
2295   rm -rf conftest*
2296   ac_cv_header_stdc=yes
2297 else
2298   echo "$ac_err" >&5
2299   echo "configure: failed program was:" >&5
2300   cat conftest.$ac_ext >&5
2301   rm -rf conftest*
2302   ac_cv_header_stdc=no
2303 fi
2304 rm -f conftest*
2305
2306 if test $ac_cv_header_stdc = yes; then
2307   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
2308 cat > conftest.$ac_ext <<EOF
2309 #line 2310 "configure"
2310 #include "confdefs.h"
2311 #include <string.h>
2312 EOF
2313 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
2314   egrep "memchr" >/dev/null 2>&1; then
2315   :
2316 else
2317   rm -rf conftest*
2318   ac_cv_header_stdc=no
2319 fi
2320 rm -f conftest*
2321
2322 fi
2323
2324 if test $ac_cv_header_stdc = yes; then
2325   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
2326 cat > conftest.$ac_ext <<EOF
2327 #line 2328 "configure"
2328 #include "confdefs.h"
2329 #include <stdlib.h>
2330 EOF
2331 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
2332   egrep "free" >/dev/null 2>&1; then
2333   :
2334 else
2335   rm -rf conftest*
2336   ac_cv_header_stdc=no
2337 fi
2338 rm -f conftest*
2339
2340 fi
2341
2342 if test $ac_cv_header_stdc = yes; then
2343   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
2344 if test "$cross_compiling" = yes; then
2345   :
2346 else
2347   cat > conftest.$ac_ext <<EOF
2348 #line 2349 "configure"
2349 #include "confdefs.h"
2350 #include <ctype.h>
2351 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
2352 #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
2353 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
2354 int main () { int i; for (i = 0; i < 256; i++)
2355 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
2356 exit (0); }
2357
2358 EOF
2359 if { (eval echo configure:2360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
2360 then
2361   :
2362 else
2363   echo "configure: failed program was:" >&5
2364   cat conftest.$ac_ext >&5
2365   rm -fr conftest*
2366   ac_cv_header_stdc=no
2367 fi
2368 rm -fr conftest*
2369 fi
2370
2371 fi
2372 fi
2373
2374 echo "$ac_t""$ac_cv_header_stdc" 1>&6
2375 if test $ac_cv_header_stdc = yes; then
2376   cat >> confdefs.h <<\EOF
2377 #define STDC_HEADERS 1
2378 EOF
2379
2380 fi
2381
2382 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
2383 echo "configure:2384: checking for pid_t" >&5
2384 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
2385   echo $ac_n "(cached) $ac_c" 1>&6
2386 else
2387   cat > conftest.$ac_ext <<EOF
2388 #line 2389 "configure"
2389 #include "confdefs.h"
2390 #include <sys/types.h>
2391 #if STDC_HEADERS
2392 #include <stdlib.h>
2393 #include <stddef.h>
2394 #endif
2395 EOF
2396 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
2397   egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
2398   rm -rf conftest*
2399   ac_cv_type_pid_t=yes
2400 else
2401   rm -rf conftest*
2402   ac_cv_type_pid_t=no
2403 fi
2404 rm -f conftest*
2405
2406 fi
2407 echo "$ac_t""$ac_cv_type_pid_t" 1>&6
2408 if test $ac_cv_type_pid_t = no; then
2409   cat >> confdefs.h <<\EOF
2410 #define pid_t int
2411 EOF
2412
2413 fi
2414
2415 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
2416 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
2417 echo "configure:2418: checking for vfork.h" >&5
2418 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
2419   echo $ac_n "(cached) $ac_c" 1>&6
2420 else
2421   cat > conftest.$ac_ext <<EOF
2422 #line 2423 "configure"
2423 #include "confdefs.h"
2424 #include <vfork.h>
2425 EOF
2426 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
2427 { (eval echo configure:2428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
2428 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
2429 if test -z "$ac_err"; then
2430   rm -rf conftest*
2431   eval "ac_cv_header_$ac_safe=yes"
2432 else
2433   echo "$ac_err" >&5
2434   echo "configure: failed program was:" >&5
2435   cat conftest.$ac_ext >&5
2436   rm -rf conftest*
2437   eval "ac_cv_header_$ac_safe=no"
2438 fi
2439 rm -f conftest*
2440 fi
2441 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
2442   echo "$ac_t""yes" 1>&6
2443   cat >> confdefs.h <<\EOF
2444 #define HAVE_VFORK_H 1
2445 EOF
2446
2447 else
2448   echo "$ac_t""no" 1>&6
2449 fi
2450
2451 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
2452 echo "configure:2453: checking for working vfork" >&5
2453 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
2454   echo $ac_n "(cached) $ac_c" 1>&6
2455 else
2456   if test "$cross_compiling" = yes; then
2457   echo $ac_n "checking for vfork""... $ac_c" 1>&6
2458 echo "configure:2459: checking for vfork" >&5
2459 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
2460   echo $ac_n "(cached) $ac_c" 1>&6
2461 else
2462   cat > conftest.$ac_ext <<EOF
2463 #line 2464 "configure"
2464 #include "confdefs.h"
2465 /* System header to define __stub macros and hopefully few prototypes,
2466     which can conflict with char vfork(); below.  */
2467 #include <assert.h>
2468 /* Override any gcc2 internal prototype to avoid an error.  */
2469 /* We use char because int might match the return type of a gcc2
2470     builtin and then its argument prototype would still apply.  */
2471 char vfork();
2472
2473 int main() {
2474
2475 /* The GNU C library defines this for functions which it implements
2476     to always fail with ENOSYS.  Some functions are actually named
2477     something starting with __ and the normal name is an alias.  */
2478 #if defined (__stub_vfork) || defined (__stub___vfork)
2479 choke me
2480 #else
2481 vfork();
2482 #endif
2483
2484 ; return 0; }
2485 EOF
2486 if { (eval echo configure:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2487   rm -rf conftest*
2488   eval "ac_cv_func_vfork=yes"
2489 else
2490   echo "configure: failed program was:" >&5
2491   cat conftest.$ac_ext >&5
2492   rm -rf conftest*
2493   eval "ac_cv_func_vfork=no"
2494 fi
2495 rm -f conftest*
2496 fi
2497
2498 if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
2499   echo "$ac_t""yes" 1>&6
2500   :
2501 else
2502   echo "$ac_t""no" 1>&6
2503 fi
2504
2505 ac_cv_func_vfork_works=$ac_cv_func_vfork
2506 else
2507   cat > conftest.$ac_ext <<EOF
2508 #line 2509 "configure"
2509 #include "confdefs.h"
2510 /* Thanks to Paul Eggert for this test.  */
2511 #include <stdio.h>
2512 #include <sys/types.h>
2513 #include <sys/stat.h>
2514 #ifdef HAVE_UNISTD_H
2515 #include <unistd.h>
2516 #endif
2517 #ifdef HAVE_VFORK_H
2518 #include <vfork.h>
2519 #endif
2520 /* On some sparc systems, changes by the child to local and incoming
2521    argument registers are propagated back to the parent.
2522    The compiler is told about this with #include <vfork.h>,
2523    but some compilers (e.g. gcc -O) don't grok <vfork.h>.
2524    Test for this by using a static variable whose address
2525    is put into a register that is clobbered by the vfork.  */
2526 static
2527 #ifdef __cplusplus
2528 sparc_address_test (int arg)
2529 #else
2530 sparc_address_test (arg) int arg;
2531 #endif
2532 {
2533   static pid_t child;
2534   if (!child) {
2535     child = vfork ();
2536     if (child < 0) {
2537       perror ("vfork");
2538       _exit(2);
2539     }
2540     if (!child) {
2541       arg = getpid();
2542       write(-1, "", 0);
2543       _exit (arg);
2544     }
2545   }
2546 }
2547 main() {
2548   pid_t parent = getpid ();
2549   pid_t child;
2550
2551   sparc_address_test ();
2552
2553   child = vfork ();
2554
2555   if (child == 0) {
2556     /* Here is another test for sparc vfork register problems.
2557        This test uses lots of local variables, at least
2558        as many local variables as main has allocated so far
2559        including compiler temporaries.  4 locals are enough for
2560        gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
2561        A buggy compiler should reuse the register of parent
2562        for one of the local variables, since it will think that
2563        parent can't possibly be used any more in this routine.
2564        Assigning to the local variable will thus munge parent
2565        in the parent process.  */
2566     pid_t
2567       p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
2568       p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
2569     /* Convince the compiler that p..p7 are live; otherwise, it might
2570        use the same hardware register for all 8 local variables.  */
2571     if (p != p1 || p != p2 || p != p3 || p != p4
2572         || p != p5 || p != p6 || p != p7)
2573       _exit(1);
2574
2575     /* On some systems (e.g. IRIX 3.3),
2576        vfork doesn't separate parent from child file descriptors.
2577        If the child closes a descriptor before it execs or exits,
2578        this munges the parent's descriptor as well.
2579        Test for this by closing stdout in the child.  */
2580     _exit(close(fileno(stdout)) != 0);
2581   } else {
2582     int status;
2583     struct stat st;
2584
2585     while (wait(&status) != child)
2586       ;
2587     exit(
2588          /* Was there some problem with vforking?  */
2589          child < 0
2590
2591          /* Did the child fail?  (This shouldn't happen.)  */
2592          || status
2593
2594          /* Did the vfork/compiler bug occur?  */
2595          || parent != getpid()
2596
2597          /* Did the file descriptor bug occur?  */
2598          || fstat(fileno(stdout), &st) != 0
2599          );
2600   }
2601 }
2602 EOF
2603 if { (eval echo configure:2604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
2604 then
2605   ac_cv_func_vfork_works=yes
2606 else
2607   echo "configure: failed program was:" >&5
2608   cat conftest.$ac_ext >&5
2609   rm -fr conftest*
2610   ac_cv_func_vfork_works=no
2611 fi
2612 rm -fr conftest*
2613 fi
2614
2615 fi
2616
2617 echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
2618 if test $ac_cv_func_vfork_works = no; then
2619   cat >> confdefs.h <<\EOF
2620 #define vfork fork
2621 EOF
2622
2623 fi
2624
2625   if test $ac_cv_func_vfork_works = no; then
2626     LIBOBJS="$LIBOBJS vfork.o"
2627   fi
2628   for v in $vars; do
2629     echo $ac_n "checking for $v""... $ac_c" 1>&6
2630 echo "configure:2631: checking for $v" >&5
2631     if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
2632   echo $ac_n "(cached) $ac_c" 1>&6
2633 else
2634   cat > conftest.$ac_ext <<EOF
2635 #line 2636 "configure"
2636 #include "confdefs.h"
2637 int *p;
2638 int main() {
2639 extern int $v; p = &$v;
2640 ; return 0; }
2641 EOF
2642 if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2643   rm -rf conftest*
2644   eval "libiberty_cv_var_$v=yes"
2645 else
2646   echo "configure: failed program was:" >&5
2647   cat conftest.$ac_ext >&5
2648   rm -rf conftest*
2649   eval "libiberty_cv_var_$v=no"
2650 fi
2651 rm -f conftest*
2652 fi
2653
2654     if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
2655       echo "$ac_t""yes" 1>&6
2656       n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2657       cat >> confdefs.h <<EOF
2658 #define $n 1
2659 EOF
2660
2661     else
2662       echo "$ac_t""no" 1>&6
2663     fi
2664   done
2665   for ac_func in $checkfuncs
2666 do
2667 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
2668 echo "configure:2669: checking for $ac_func" >&5
2669 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
2670   echo $ac_n "(cached) $ac_c" 1>&6
2671 else
2672   cat > conftest.$ac_ext <<EOF
2673 #line 2674 "configure"
2674 #include "confdefs.h"
2675 /* System header to define __stub macros and hopefully few prototypes,
2676     which can conflict with char $ac_func(); below.  */
2677 #include <assert.h>
2678 /* Override any gcc2 internal prototype to avoid an error.  */
2679 /* We use char because int might match the return type of a gcc2
2680     builtin and then its argument prototype would still apply.  */
2681 char $ac_func();
2682
2683 int main() {
2684
2685 /* The GNU C library defines this for functions which it implements
2686     to always fail with ENOSYS.  Some functions are actually named
2687     something starting with __ and the normal name is an alias.  */
2688 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
2689 choke me
2690 #else
2691 $ac_func();
2692 #endif
2693
2694 ; return 0; }
2695 EOF
2696 if { (eval echo configure:2697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2697   rm -rf conftest*
2698   eval "ac_cv_func_$ac_func=yes"
2699 else
2700   echo "configure: failed program was:" >&5
2701   cat conftest.$ac_ext >&5
2702   rm -rf conftest*
2703   eval "ac_cv_func_$ac_func=no"
2704 fi
2705 rm -f conftest*
2706 fi
2707
2708 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
2709   echo "$ac_t""yes" 1>&6
2710     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2711   cat >> confdefs.h <<EOF
2712 #define $ac_tr_func 1
2713 EOF
2714  
2715 else
2716   echo "$ac_t""no" 1>&6
2717 fi
2718 done
2719
2720 fi
2721
2722 for ac_hdr in unistd.h
2723 do
2724 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
2725 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
2726 echo "configure:2727: checking for $ac_hdr" >&5
2727 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
2728   echo $ac_n "(cached) $ac_c" 1>&6
2729 else
2730   cat > conftest.$ac_ext <<EOF
2731 #line 2732 "configure"
2732 #include "confdefs.h"
2733 #include <$ac_hdr>
2734 EOF
2735 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
2736 { (eval echo configure:2737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
2737 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
2738 if test -z "$ac_err"; then
2739   rm -rf conftest*
2740   eval "ac_cv_header_$ac_safe=yes"
2741 else
2742   echo "$ac_err" >&5
2743   echo "configure: failed program was:" >&5
2744   cat conftest.$ac_ext >&5
2745   rm -rf conftest*
2746   eval "ac_cv_header_$ac_safe=no"
2747 fi
2748 rm -f conftest*
2749 fi
2750 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
2751   echo "$ac_t""yes" 1>&6
2752     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
2753   cat >> confdefs.h <<EOF
2754 #define $ac_tr_hdr 1
2755 EOF
2756  
2757 else
2758   echo "$ac_t""no" 1>&6
2759 fi
2760 done
2761
2762 for ac_func in getpagesize
2763 do
2764 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
2765 echo "configure:2766: checking for $ac_func" >&5
2766 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
2767   echo $ac_n "(cached) $ac_c" 1>&6
2768 else
2769   cat > conftest.$ac_ext <<EOF
2770 #line 2771 "configure"
2771 #include "confdefs.h"
2772 /* System header to define __stub macros and hopefully few prototypes,
2773     which can conflict with char $ac_func(); below.  */
2774 #include <assert.h>
2775 /* Override any gcc2 internal prototype to avoid an error.  */
2776 /* We use char because int might match the return type of a gcc2
2777     builtin and then its argument prototype would still apply.  */
2778 char $ac_func();
2779
2780 int main() {
2781
2782 /* The GNU C library defines this for functions which it implements
2783     to always fail with ENOSYS.  Some functions are actually named
2784     something starting with __ and the normal name is an alias.  */
2785 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
2786 choke me
2787 #else
2788 $ac_func();
2789 #endif
2790
2791 ; return 0; }
2792 EOF
2793 if { (eval echo configure:2794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2794   rm -rf conftest*
2795   eval "ac_cv_func_$ac_func=yes"
2796 else
2797   echo "configure: failed program was:" >&5
2798   cat conftest.$ac_ext >&5
2799   rm -rf conftest*
2800   eval "ac_cv_func_$ac_func=no"
2801 fi
2802 rm -f conftest*
2803 fi
2804
2805 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
2806   echo "$ac_t""yes" 1>&6
2807     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2808   cat >> confdefs.h <<EOF
2809 #define $ac_tr_func 1
2810 EOF
2811  
2812 else
2813   echo "$ac_t""no" 1>&6
2814 fi
2815 done
2816
2817 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
2818 echo "configure:2819: checking for working mmap" >&5
2819 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
2820   echo $ac_n "(cached) $ac_c" 1>&6
2821 else
2822   if test "$cross_compiling" = yes; then
2823   ac_cv_func_mmap_fixed_mapped=no
2824 else
2825   cat > conftest.$ac_ext <<EOF
2826 #line 2827 "configure"
2827 #include "confdefs.h"
2828
2829 /* Thanks to Mike Haertel and Jim Avera for this test.
2830    Here is a matrix of mmap possibilities:
2831         mmap private not fixed
2832         mmap private fixed at somewhere currently unmapped
2833         mmap private fixed at somewhere already mapped
2834         mmap shared not fixed
2835         mmap shared fixed at somewhere currently unmapped
2836         mmap shared fixed at somewhere already mapped
2837    For private mappings, we should verify that changes cannot be read()
2838    back from the file, nor mmap's back from the file at a different
2839    address.  (There have been systems where private was not correctly
2840    implemented like the infamous i386 svr4.0, and systems where the
2841    VM page cache was not coherent with the filesystem buffer cache
2842    like early versions of FreeBSD and possibly contemporary NetBSD.)
2843    For shared mappings, we should conversely verify that changes get
2844    propogated back to all the places they're supposed to be.
2845
2846    Grep wants private fixed already mapped.
2847    The main things grep needs to know about mmap are:
2848    * does it exist and is it safe to write into the mmap'd area
2849    * how to use it (BSD variants)  */
2850 #include <sys/types.h>
2851 #include <fcntl.h>
2852 #include <sys/mman.h>
2853
2854 /* This mess was copied from the GNU getpagesize.h.  */
2855 #ifndef HAVE_GETPAGESIZE
2856 # ifdef HAVE_UNISTD_H
2857 #  include <unistd.h>
2858 # endif
2859
2860 /* Assume that all systems that can run configure have sys/param.h.  */
2861 # ifndef HAVE_SYS_PARAM_H
2862 #  define HAVE_SYS_PARAM_H 1
2863 # endif
2864
2865 # ifdef _SC_PAGESIZE
2866 #  define getpagesize() sysconf(_SC_PAGESIZE)
2867 # else /* no _SC_PAGESIZE */
2868 #  ifdef HAVE_SYS_PARAM_H
2869 #   include <sys/param.h>
2870 #   ifdef EXEC_PAGESIZE
2871 #    define getpagesize() EXEC_PAGESIZE
2872 #   else /* no EXEC_PAGESIZE */
2873 #    ifdef NBPG
2874 #     define getpagesize() NBPG * CLSIZE
2875 #     ifndef CLSIZE
2876 #      define CLSIZE 1
2877 #     endif /* no CLSIZE */
2878 #    else /* no NBPG */
2879 #     ifdef NBPC
2880 #      define getpagesize() NBPC
2881 #     else /* no NBPC */
2882 #      ifdef PAGESIZE
2883 #       define getpagesize() PAGESIZE
2884 #      endif /* PAGESIZE */
2885 #     endif /* no NBPC */
2886 #    endif /* no NBPG */
2887 #   endif /* no EXEC_PAGESIZE */
2888 #  else /* no HAVE_SYS_PARAM_H */
2889 #   define getpagesize() 8192   /* punt totally */
2890 #  endif /* no HAVE_SYS_PARAM_H */
2891 # endif /* no _SC_PAGESIZE */
2892
2893 #endif /* no HAVE_GETPAGESIZE */
2894
2895 #ifdef __cplusplus
2896 extern "C" { void *malloc(unsigned); }
2897 #else
2898 char *malloc();
2899 #endif
2900
2901 int
2902 main()
2903 {
2904         char *data, *data2, *data3;
2905         int i, pagesize;
2906         int fd;
2907
2908         pagesize = getpagesize();
2909
2910         /*
2911          * First, make a file with some known garbage in it.
2912          */
2913         data = malloc(pagesize);
2914         if (!data)
2915                 exit(1);
2916         for (i = 0; i < pagesize; ++i)
2917                 *(data + i) = rand();
2918         umask(0);
2919         fd = creat("conftestmmap", 0600);
2920         if (fd < 0)
2921                 exit(1);
2922         if (write(fd, data, pagesize) != pagesize)
2923                 exit(1);
2924         close(fd);
2925
2926         /*
2927          * Next, try to mmap the file at a fixed address which
2928          * already has something else allocated at it.  If we can,
2929          * also make sure that we see the same garbage.
2930          */
2931         fd = open("conftestmmap", O_RDWR);
2932         if (fd < 0)
2933                 exit(1);
2934         data2 = malloc(2 * pagesize);
2935         if (!data2)
2936                 exit(1);
2937         data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
2938         if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
2939             MAP_PRIVATE | MAP_FIXED, fd, 0L))
2940                 exit(1);
2941         for (i = 0; i < pagesize; ++i)
2942                 if (*(data + i) != *(data2 + i))
2943                         exit(1);
2944
2945         /*
2946          * Finally, make sure that changes to the mapped area
2947          * do not percolate back to the file as seen by read().
2948          * (This is a bug on some variants of i386 svr4.0.)
2949          */
2950         for (i = 0; i < pagesize; ++i)
2951                 *(data2 + i) = *(data2 + i) + 1;
2952         data3 = malloc(pagesize);
2953         if (!data3)
2954                 exit(1);
2955         if (read(fd, data3, pagesize) != pagesize)
2956                 exit(1);
2957         for (i = 0; i < pagesize; ++i)
2958                 if (*(data + i) != *(data3 + i))
2959                         exit(1);
2960         close(fd);
2961         unlink("conftestmmap");
2962         exit(0);
2963 }
2964
2965 EOF
2966 if { (eval echo configure:2967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
2967 then
2968   ac_cv_func_mmap_fixed_mapped=yes
2969 else
2970   echo "configure: failed program was:" >&5
2971   cat conftest.$ac_ext >&5
2972   rm -fr conftest*
2973   ac_cv_func_mmap_fixed_mapped=no
2974 fi
2975 rm -fr conftest*
2976 fi
2977
2978 fi
2979
2980 echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
2981 if test $ac_cv_func_mmap_fixed_mapped = yes; then
2982   cat >> confdefs.h <<\EOF
2983 #define HAVE_MMAP 1
2984 EOF
2985
2986 fi
2987
2988
2989 echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
2990 echo "configure:2991: checking for working strncmp" >&5
2991 if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
2992   echo $ac_n "(cached) $ac_c" 1>&6
2993 else
2994   if test "$cross_compiling" = yes; then
2995   ac_cv_func_strncmp_works=no
2996 else
2997   cat > conftest.$ac_ext <<EOF
2998 #line 2999 "configure"
2999 #include "confdefs.h"
3000
3001 /* Test by Jim Wilson and Kaveh Ghazi.
3002    Check whether strncmp reads past the end of its string parameters. */
3003 #include <sys/types.h>
3004
3005 #ifdef HAVE_FCNTL_H
3006 #include <fcntl.h>
3007 #endif
3008
3009 #ifdef HAVE_SYS_MMAN_H
3010 #include <sys/mman.h>
3011 #endif
3012
3013 #ifndef MAP_ANON
3014 #ifdef MAP_ANONYMOUS
3015 #define MAP_ANON MAP_ANONYMOUS
3016 #else
3017 #define MAP_ANON MAP_FILE
3018 #endif
3019 #endif
3020
3021 #ifndef MAP_FILE
3022 #define MAP_FILE 0
3023 #endif
3024 #ifndef O_RDONLY
3025 #define O_RDONLY 0
3026 #endif
3027
3028 #define MAP_LEN 0x10000
3029
3030 main ()
3031 {
3032 #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
3033   char *p;
3034   int dev_zero;
3035
3036   dev_zero = open ("/dev/zero", O_RDONLY);
3037   if (dev_zero < 0)
3038     exit (1);
3039   
3040   p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
3041                      MAP_ANON|MAP_PRIVATE, dev_zero, 0);
3042   if (p == (char *)-1)
3043     exit (2);
3044   else
3045     {
3046       char *string = "__si_type_info";
3047       char *q = (char *) p + MAP_LEN - strlen (string) - 2;
3048       char *r = (char *) p + 0xe;
3049
3050       strcpy (q, string);
3051       strcpy (r, string);
3052       strncmp (r, q, 14);
3053     }
3054 #endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
3055   exit (0);
3056 }
3057
3058 EOF
3059 if { (eval echo configure:3060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
3060 then
3061   ac_cv_func_strncmp_works=yes
3062 else
3063   echo "configure: failed program was:" >&5
3064   cat conftest.$ac_ext >&5
3065   rm -fr conftest*
3066   ac_cv_func_strncmp_works=no
3067 fi
3068 rm -fr conftest*
3069 fi
3070
3071 rm -f core core.* *.core
3072 fi
3073
3074 echo "$ac_t""$ac_cv_func_strncmp_works" 1>&6
3075 if test $ac_cv_func_strncmp_works = no ; then
3076   LIBOBJS="$LIBOBJS strncmp.o"
3077 fi
3078
3079
3080 # Install a library built with a cross compiler in $(tooldir) rather
3081 # than $(libdir).
3082 if test -z "${with_cross_host}"; then
3083   INSTALL_DEST=libdir
3084 else
3085   INSTALL_DEST=tooldir
3086 fi
3087
3088
3089 # We need multilib support, but only if configuring for the target.
3090 trap '' 1 2 15
3091 cat > confcache <<\EOF
3092 # This file is a shell script that caches the results of configure
3093 # tests run on this system so they can be shared between configure
3094 # scripts and configure runs.  It is not useful on other systems.
3095 # If it contains results you don't want to keep, you may remove or edit it.
3096 #
3097 # By default, configure uses ./config.cache as the cache file,
3098 # creating it if it does not exist already.  You can give configure
3099 # the --cache-file=FILE option to use a different cache file; that is
3100 # what configure does when it calls configure scripts in
3101 # subdirectories, so they share the cache.
3102 # Giving --cache-file=/dev/null disables caching, for debugging configure.
3103 # config.status only pays attention to the cache file if you give it the
3104 # --recheck option to rerun configure.
3105 #
3106 EOF
3107 # The following way of writing the cache mishandles newlines in values,
3108 # but we know of no workaround that is simple, portable, and efficient.
3109 # So, don't put newlines in cache variables' values.
3110 # Ultrix sh set writes to stderr and can't be redirected directly,
3111 # and sets the high bit in the cache file unless we assign to the vars.
3112 (set) 2>&1 |
3113   case `(ac_space=' '; set | grep ac_space) 2>&1` in
3114   *ac_space=\ *)
3115     # `set' does not quote correctly, so add quotes (double-quote substitution
3116     # turns \\\\ into \\, and sed turns \\ into \).
3117     sed -n \
3118       -e "s/'/'\\\\''/g" \
3119       -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
3120     ;;
3121   *)
3122     # `set' quotes correctly as required by POSIX, so do not add quotes.
3123     sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
3124     ;;
3125   esac >> confcache
3126 if cmp -s $cache_file confcache; then
3127   :
3128 else
3129   if test -w $cache_file; then
3130     echo "updating cache $cache_file"
3131     cat confcache > $cache_file
3132   else
3133     echo "not updating unwritable cache $cache_file"
3134   fi
3135 fi
3136 rm -f confcache
3137
3138 trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
3139
3140 test "x$prefix" = xNONE && prefix=$ac_default_prefix
3141 # Let make expand exec_prefix.
3142 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
3143
3144 # Any assignment to VPATH causes Sun make to only execute
3145 # the first set of double-colon rules, so remove it if not needed.
3146 # If there is a colon in the path, we need to keep it.
3147 if test "x$srcdir" = x.; then
3148   ac_vpsub='/^[         ]*VPATH[        ]*=[^:]*$/d'
3149 fi
3150
3151 trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
3152
3153 DEFS=-DHAVE_CONFIG_H
3154
3155 # Without the "./", some shells look in PATH for config.status.
3156 : ${CONFIG_STATUS=./config.status}
3157
3158 echo creating $CONFIG_STATUS
3159 rm -f $CONFIG_STATUS
3160 cat > $CONFIG_STATUS <<EOF
3161 #! /bin/sh
3162 # Generated automatically by configure.
3163 # Run this file to recreate the current configuration.
3164 # This directory was configured as follows,
3165 # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
3166 #
3167 # $0 $ac_configure_args
3168 #
3169 # Compiler output produced by configure, useful for debugging
3170 # configure, is in ./config.log if it exists.
3171
3172 ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
3173 for ac_option
3174 do
3175   case "\$ac_option" in
3176   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
3177     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
3178     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
3179   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
3180     echo "$CONFIG_STATUS generated by autoconf version 2.13"
3181     exit 0 ;;
3182   -help | --help | --hel | --he | --h)
3183     echo "\$ac_cs_usage"; exit 0 ;;
3184   *) echo "\$ac_cs_usage"; exit 1 ;;
3185   esac
3186 done
3187
3188 ac_given_srcdir=$srcdir
3189 ac_given_INSTALL="$INSTALL"
3190
3191 trap 'rm -fr `echo "Makefile testsuite/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
3192 EOF
3193 cat >> $CONFIG_STATUS <<EOF
3194
3195 # Protect against being on the right side of a sed subst in config.status.
3196 sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
3197  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
3198 $ac_vpsub
3199 $extrasub
3200 s%@SHELL@%$SHELL%g
3201 s%@CFLAGS@%$CFLAGS%g
3202 s%@CPPFLAGS@%$CPPFLAGS%g
3203 s%@CXXFLAGS@%$CXXFLAGS%g
3204 s%@FFLAGS@%$FFLAGS%g
3205 s%@DEFS@%$DEFS%g
3206 s%@LDFLAGS@%$LDFLAGS%g
3207 s%@LIBS@%$LIBS%g
3208 s%@exec_prefix@%$exec_prefix%g
3209 s%@prefix@%$prefix%g
3210 s%@program_transform_name@%$program_transform_name%g
3211 s%@bindir@%$bindir%g
3212 s%@sbindir@%$sbindir%g
3213 s%@libexecdir@%$libexecdir%g
3214 s%@datadir@%$datadir%g
3215 s%@sysconfdir@%$sysconfdir%g
3216 s%@sharedstatedir@%$sharedstatedir%g
3217 s%@localstatedir@%$localstatedir%g
3218 s%@libdir@%$libdir%g
3219 s%@includedir@%$includedir%g
3220 s%@oldincludedir@%$oldincludedir%g
3221 s%@infodir@%$infodir%g
3222 s%@mandir@%$mandir%g
3223 s%@host@%$host%g
3224 s%@host_alias@%$host_alias%g
3225 s%@host_cpu@%$host_cpu%g
3226 s%@host_vendor@%$host_vendor%g
3227 s%@host_os@%$host_os%g
3228 s%@build@%$build%g
3229 s%@build_alias@%$build_alias%g
3230 s%@build_cpu@%$build_cpu%g
3231 s%@build_vendor@%$build_vendor%g
3232 s%@build_os@%$build_os%g
3233 s%@AR@%$AR%g
3234 s%@RANLIB@%$RANLIB%g
3235 s%@CC@%$CC%g
3236 s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g
3237 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
3238 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
3239 s%@INSTALL_DATA@%$INSTALL_DATA%g
3240 /@host_makefile_frag@/r $host_makefile_frag
3241 s%@host_makefile_frag@%%g
3242 s%@CPP@%$CPP%g
3243 s%@CHECK@%$CHECK%g
3244 s%@LIBOBJS@%$LIBOBJS%g
3245 s%@ALLOCA@%$ALLOCA%g
3246 s%@INSTALL_DEST@%$INSTALL_DEST%g
3247
3248 CEOF
3249 EOF
3250
3251 cat >> $CONFIG_STATUS <<\EOF
3252
3253 # Split the substitutions into bite-sized pieces for seds with
3254 # small command number limits, like on Digital OSF/1 and HP-UX.
3255 ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
3256 ac_file=1 # Number of current file.
3257 ac_beg=1 # First line for current file.
3258 ac_end=$ac_max_sed_cmds # Line after last line for current file.
3259 ac_more_lines=:
3260 ac_sed_cmds=""
3261 while $ac_more_lines; do
3262   if test $ac_beg -gt 1; then
3263     sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
3264   else
3265     sed "${ac_end}q" conftest.subs > conftest.s$ac_file
3266   fi
3267   if test ! -s conftest.s$ac_file; then
3268     ac_more_lines=false
3269     rm -f conftest.s$ac_file
3270   else
3271     if test -z "$ac_sed_cmds"; then
3272       ac_sed_cmds="sed -f conftest.s$ac_file"
3273     else
3274       ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
3275     fi
3276     ac_file=`expr $ac_file + 1`
3277     ac_beg=$ac_end
3278     ac_end=`expr $ac_end + $ac_max_sed_cmds`
3279   fi
3280 done
3281 if test -z "$ac_sed_cmds"; then
3282   ac_sed_cmds=cat
3283 fi
3284 EOF
3285
3286 cat >> $CONFIG_STATUS <<EOF
3287
3288 CONFIG_FILES=\${CONFIG_FILES-"Makefile testsuite/Makefile"}
3289 EOF
3290 cat >> $CONFIG_STATUS <<\EOF
3291 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
3292   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
3293   case "$ac_file" in
3294   *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
3295        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
3296   *) ac_file_in="${ac_file}.in" ;;
3297   esac
3298
3299   # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
3300
3301   # Remove last slash and all that follows it.  Not all systems have dirname.
3302   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
3303   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
3304     # The file is in a subdirectory.
3305     test ! -d "$ac_dir" && mkdir "$ac_dir"
3306     ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
3307     # A "../" for each directory in $ac_dir_suffix.
3308     ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
3309   else
3310     ac_dir_suffix= ac_dots=
3311   fi
3312
3313   case "$ac_given_srcdir" in
3314   .)  srcdir=.
3315       if test -z "$ac_dots"; then top_srcdir=.
3316       else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
3317   /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
3318   *) # Relative path.
3319     srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
3320     top_srcdir="$ac_dots$ac_given_srcdir" ;;
3321   esac
3322
3323   case "$ac_given_INSTALL" in
3324   [/$]*) INSTALL="$ac_given_INSTALL" ;;
3325   *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
3326   esac
3327
3328   echo creating "$ac_file"
3329   rm -f "$ac_file"
3330   configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
3331   case "$ac_file" in
3332   *Makefile*) ac_comsub="1i\\
3333 # $configure_input" ;;
3334   *) ac_comsub= ;;
3335   esac
3336
3337   ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
3338   sed -e "$ac_comsub
3339 s%@configure_input@%$configure_input%g
3340 s%@srcdir@%$srcdir%g
3341 s%@top_srcdir@%$top_srcdir%g
3342 s%@INSTALL@%$INSTALL%g
3343 " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
3344 fi; done
3345 rm -f conftest.s*
3346
3347 # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
3348 # NAME is the cpp macro being defined and VALUE is the value it is being given.
3349 #
3350 # ac_d sets the value in "#define NAME VALUE" lines.
3351 ac_dA='s%^\([   ]*\)#\([        ]*define[       ][      ]*\)'
3352 ac_dB='\([      ][      ]*\)[^  ]*%\1#\2'
3353 ac_dC='\3'
3354 ac_dD='%g'
3355 # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
3356 ac_uA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
3357 ac_uB='\([      ]\)%\1#\2define\3'
3358 ac_uC=' '
3359 ac_uD='\4%g'
3360 # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
3361 ac_eA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
3362 ac_eB='$%\1#\2define\3'
3363 ac_eC=' '
3364 ac_eD='%g'
3365
3366 if test "${CONFIG_HEADERS+set}" != set; then
3367 EOF
3368 cat >> $CONFIG_STATUS <<EOF
3369   CONFIG_HEADERS="config.h:config.in"
3370 EOF
3371 cat >> $CONFIG_STATUS <<\EOF
3372 fi
3373 for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
3374   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
3375   case "$ac_file" in
3376   *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
3377        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
3378   *) ac_file_in="${ac_file}.in" ;;
3379   esac
3380
3381   echo creating $ac_file
3382
3383   rm -f conftest.frag conftest.in conftest.out
3384   ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
3385   cat $ac_file_inputs > conftest.in
3386
3387 EOF
3388
3389 # Transform confdefs.h into a sed script conftest.vals that substitutes
3390 # the proper values into config.h.in to produce config.h.  And first:
3391 # Protect against being on the right side of a sed subst in config.status.
3392 # Protect against being in an unquoted here document in config.status.
3393 rm -f conftest.vals
3394 cat > conftest.hdr <<\EOF
3395 s/[\\&%]/\\&/g
3396 s%[\\$`]%\\&%g
3397 s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
3398 s%ac_d%ac_u%gp
3399 s%ac_u%ac_e%gp
3400 EOF
3401 sed -n -f conftest.hdr confdefs.h > conftest.vals
3402 rm -f conftest.hdr
3403
3404 # This sed command replaces #undef with comments.  This is necessary, for
3405 # example, in the case of _POSIX_SOURCE, which is predefined and required
3406 # on some systems where configure will not decide to define it.
3407 cat >> conftest.vals <<\EOF
3408 s%^[    ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
3409 EOF
3410
3411 # Break up conftest.vals because some shells have a limit on
3412 # the size of here documents, and old seds have small limits too.
3413
3414 rm -f conftest.tail
3415 while :
3416 do
3417   ac_lines=`grep -c . conftest.vals`
3418   # grep -c gives empty output for an empty file on some AIX systems.
3419   if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
3420   # Write a limited-size here document to conftest.frag.
3421   echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
3422   sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
3423   echo 'CEOF
3424   sed -f conftest.frag conftest.in > conftest.out
3425   rm -f conftest.in
3426   mv conftest.out conftest.in
3427 ' >> $CONFIG_STATUS
3428   sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
3429   rm -f conftest.vals
3430   mv conftest.tail conftest.vals
3431 done
3432 rm -f conftest.vals
3433
3434 cat >> $CONFIG_STATUS <<\EOF
3435   rm -f conftest.frag conftest.h
3436   echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
3437   cat conftest.in >> conftest.h
3438   rm -f conftest.in
3439   if cmp -s $ac_file conftest.h 2>/dev/null; then
3440     echo "$ac_file is unchanged"
3441     rm -f conftest.h
3442   else
3443     # Remove last slash and all that follows it.  Not all systems have dirname.
3444       ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
3445       if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
3446       # The file is in a subdirectory.
3447       test ! -d "$ac_dir" && mkdir "$ac_dir"
3448     fi
3449     rm -f $ac_file
3450     mv conftest.h $ac_file
3451   fi
3452 fi; done
3453
3454 EOF
3455 cat >> $CONFIG_STATUS <<EOF
3456 srcdir=${srcdir}
3457 host=${host}
3458 target=${target}
3459 with_target_subdir=${with_target_subdir}
3460 with_multisubdir=${with_multisubdir}
3461 ac_configure_args="--enable-multilib ${ac_configure_args}"
3462 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
3463 libiberty_topdir=${libiberty_topdir}
3464
3465 EOF
3466 cat >> $CONFIG_STATUS <<\EOF
3467 test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
3468 if test -n "$CONFIG_FILES"; then
3469   if test -n "${with_target_subdir}"; then
3470     # FIXME: We shouldn't need to set ac_file
3471     ac_file=Makefile
3472     . ${libiberty_topdir}/config-ml.in
3473   fi
3474 fi
3475 exit 0
3476 EOF
3477 chmod +x $CONFIG_STATUS
3478 rm -fr confdefs* $ac_clean_files
3479 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
3480