1#! /bin/sh
2
3
4
5
6
7
8
9# Guess values for system-dependent variables and create Makefiles.
10# Generated automatically using autoconf version 2.12
11# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
12#
13# This configure script is free software; the Free Software Foundation
14# gives unlimited permission to copy, distribute and modify it.
15
16# Defaults:
17ac_help=
18ac_default_prefix=/usr/local
19# Any additions from configure.in:
20ac_help="$ac_help
21  --enable-path=PaTh      (NOTE: this value isn't used if confstr() and _CS_PATH
22                          are available, or if <paths.h> defines _PATH_DEFPATH)
23                          Use PaTh if PATH isn't specified in the environment
24                          when the shell starts.  A value without . in it is
25                          safest.
26                          The default value is \"/bin:/usr/bin:/usr/ucb\"."
27ac_help="$ac_help
28  --enable-shell={sh,ksh} Specify the kind of shell that is to be built (the
29                          default is ksh).  Specifiying sh compiles out:
30                          command line editing (emacs/vi), history,
31                          a bunch of aliases, [[ .. ]], select, let,
32                          brace-expansion, extended globing (*(..|..), etc.),
33                          co-processes, some special environment variables
34                          (ie, MAIL, MAILCHECK, MAILPATH, RANDOM, SECONDS,
35                          TMOUT)."
36ac_help="$ac_help
37  --disable-emacs         Compile out emacs command line editing (by default,
38                          this is compiled in for ksh, compiled out for sh)."
39ac_help="$ac_help
40  --disable-vi            Compile out vi command line editing (by default,
41                          this is compiled in for ksh, compiled out for sh)."
42ac_help="$ac_help
43  --disable-jobs          Compile out job control support.  If your system
44                          doesn't support job control, this will automatically
45			  be compiled out."
46ac_help="$ac_help
47  --disable-brace-expand  Compile out brace expansion code (a{b,c} -> ab ac)
48                          (by default, this is compiled in for ksh, compiled
49                          out for sh).  Brace expansion can also be disabled
50                          at run time (see set +o braceexpand)."
51ac_help="$ac_help
52  --enable-history={no,simple,complex} By default, simple history is used for
53                          ksh, no history is used for sh.  \`simple' means
54                          history file is read on start-up, written when shell
55                          exists.  \`complex' means history files are updated
56                          after each command so concurrent shells read each
57                          other's commands.  Note: \`complex' history doesn't
58                          work well across NFS; also, it requires the mmap()
59                          and flock() functions - if these aren't available,
60                          \`simple' history is automatically used."
61ac_help="$ac_help
62  --enable-posixly-correct Enable if you want POSIX behavior by default
63                          (otherwise, posix behavior is only turned on if the
64                          environment variable POSIXLY_CORRECT is present or by
65                          using \"set -o posix\"; it can be turned off with
66                          \"set +o posix\").  See the POSIX Mode section in the
67                          man page for details on what this option affects.
68                          NOTE:  posix mode is not compatable with some bourne
69                          sh/at&t ksh scripts."
70ac_help="$ac_help
71  --enable-default-env=FILE Include FILE if ENV parameter is not set when
72                          the shell starts.  This can be useful when used with
73                          rsh(1), which creates a non-login shell (ie, profile
74                          isn't read, so there is no opertunity to set ENV).
75                          Setting ENV to null disables the inclusion of
76                          DEFAULT_ENV.  NOTE: This is a non-standard feature
77                          (ie, at&t ksh has no default environment)."
78ac_help="$ac_help
79  --enable-silly          [A silly option]"
80ac_help="$ac_help
81  --enable-swtch          For use with shell layers (shl(1)).  This has not
82                          been tested for some time."
83
84# Initialize some variables set by options.
85# The variables have the same names as the options, with
86# dashes changed to underlines.
87build=NONE
88cache_file=./config.cache
89exec_prefix=NONE
90host=NONE
91no_create=
92nonopt=NONE
93no_recursion=
94prefix=NONE
95program_prefix=NONE
96program_suffix=NONE
97program_transform_name=s,x,x,
98silent=
99site=
100srcdir=
101target=NONE
102verbose=
103x_includes=NONE
104x_libraries=NONE
105bindir='${exec_prefix}/bin'
106sbindir='${exec_prefix}/sbin'
107libexecdir='${exec_prefix}/libexec'
108datadir='${prefix}/share'
109sysconfdir='${prefix}/etc'
110sharedstatedir='${prefix}/com'
111localstatedir='${prefix}/var'
112libdir='${exec_prefix}/lib'
113includedir='${prefix}/include'
114oldincludedir='/usr/include'
115infodir='${prefix}/info'
116mandir='${prefix}/man'
117
118# Initialize some other variables.
119subdirs=
120MFLAGS= MAKEFLAGS=
121# Maximum number of lines to put in a shell here document.
122ac_max_here_lines=12
123
124ac_prev=
125for ac_option
126do
127
128  # If the previous option needs an argument, assign it.
129  if test -n "$ac_prev"; then
130    eval "$ac_prev=\$ac_option"
131    ac_prev=
132    continue
133  fi
134
135  case "$ac_option" in
136  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
137  *) ac_optarg= ;;
138  esac
139
140  # Accept the important Cygnus configure options, so we can diagnose typos.
141
142  case "$ac_option" in
143
144  -bindir | --bindir | --bindi | --bind | --bin | --bi)
145    ac_prev=bindir ;;
146  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
147    bindir="$ac_optarg" ;;
148
149  -build | --build | --buil | --bui | --bu)
150    ac_prev=build ;;
151  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
152    build="$ac_optarg" ;;
153
154  -cache-file | --cache-file | --cache-fil | --cache-fi \
155  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
156    ac_prev=cache_file ;;
157  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
158  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
159    cache_file="$ac_optarg" ;;
160
161  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
162    ac_prev=datadir ;;
163  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
164  | --da=*)
165    datadir="$ac_optarg" ;;
166
167  -disable-* | --disable-*)
168    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
169    # Reject names that are not valid shell variable names.
170    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
171      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
172    fi
173    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
174    eval "enable_${ac_feature}=no" ;;
175
176  -enable-* | --enable-*)
177    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
178    # Reject names that are not valid shell variable names.
179    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
180      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
181    fi
182    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
183    case "$ac_option" in
184      *=*) ;;
185      *) ac_optarg=yes ;;
186    esac
187    eval "enable_${ac_feature}='$ac_optarg'" ;;
188
189  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
190  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
191  | --exec | --exe | --ex)
192    ac_prev=exec_prefix ;;
193  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
194  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
195  | --exec=* | --exe=* | --ex=*)
196    exec_prefix="$ac_optarg" ;;
197
198  -gas | --gas | --ga | --g)
199    # Obsolete; use --with-gas.
200    with_gas=yes ;;
201
202  -help | --help | --hel | --he)
203    # Omit some internal or obsolete options to make the list less imposing.
204    # This message is too long to be a string in the A/UX 3.1 sh.
205    cat << EOF
206Usage: configure [options] [host]
207Options: [defaults in brackets after descriptions]
208Configuration:
209  --cache-file=FILE       cache test results in FILE
210  --help                  print this message
211  --no-create             do not create output files
212  --quiet, --silent       do not print \`checking...' messages
213  --version               print the version of autoconf that created configure
214Directory and file names:
215  --prefix=PREFIX         install architecture-independent files in PREFIX
216                          [$ac_default_prefix]
217  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
218                          [same as prefix]
219  --bindir=DIR            user executables in DIR [EPREFIX/bin]
220  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
221  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
222  --datadir=DIR           read-only architecture-independent data in DIR
223                          [PREFIX/share]
224  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
225  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
226                          [PREFIX/com]
227  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
228  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
229  --includedir=DIR        C header files in DIR [PREFIX/include]
230  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
231  --infodir=DIR           info documentation in DIR [PREFIX/info]
232  --mandir=DIR            man documentation in DIR [PREFIX/man]
233  --srcdir=DIR            find the sources in DIR [configure dir or ..]
234  --program-prefix=PREFIX prepend PREFIX to installed program names
235  --program-suffix=SUFFIX append SUFFIX to installed program names
236  --program-transform-name=PROGRAM
237                          run sed PROGRAM on installed program names
238EOF
239    cat << EOF
240Host type:
241  --build=BUILD           configure for building on BUILD [BUILD=HOST]
242  --host=HOST             configure for HOST [guessed]
243  --target=TARGET         configure for TARGET [TARGET=HOST]
244Features and packages:
245  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
246  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
247  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
248  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
249  --x-includes=DIR        X include files are in DIR
250  --x-libraries=DIR       X library files are in DIR
251EOF
252    if test -n "$ac_help"; then
253      echo "--enable and --with options recognized:$ac_help"
254    fi
255    exit 0 ;;
256
257  -host | --host | --hos | --ho)
258    ac_prev=host ;;
259  -host=* | --host=* | --hos=* | --ho=*)
260    host="$ac_optarg" ;;
261
262  -includedir | --includedir | --includedi | --included | --include \
263  | --includ | --inclu | --incl | --inc)
264    ac_prev=includedir ;;
265  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
266  | --includ=* | --inclu=* | --incl=* | --inc=*)
267    includedir="$ac_optarg" ;;
268
269  -infodir | --infodir | --infodi | --infod | --info | --inf)
270    ac_prev=infodir ;;
271  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
272    infodir="$ac_optarg" ;;
273
274  -libdir | --libdir | --libdi | --libd)
275    ac_prev=libdir ;;
276  -libdir=* | --libdir=* | --libdi=* | --libd=*)
277    libdir="$ac_optarg" ;;
278
279  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
280  | --libexe | --libex | --libe)
281    ac_prev=libexecdir ;;
282  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
283  | --libexe=* | --libex=* | --libe=*)
284    libexecdir="$ac_optarg" ;;
285
286  -localstatedir | --localstatedir | --localstatedi | --localstated \
287  | --localstate | --localstat | --localsta | --localst \
288  | --locals | --local | --loca | --loc | --lo)
289    ac_prev=localstatedir ;;
290  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
291  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
292  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
293    localstatedir="$ac_optarg" ;;
294
295  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
296    ac_prev=mandir ;;
297  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
298    mandir="$ac_optarg" ;;
299
300  -nfp | --nfp | --nf)
301    # Obsolete; use --without-fp.
302    with_fp=no ;;
303
304  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
305  | --no-cr | --no-c)
306    no_create=yes ;;
307
308  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
309  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
310    no_recursion=yes ;;
311
312  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
313  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
314  | --oldin | --oldi | --old | --ol | --o)
315    ac_prev=oldincludedir ;;
316  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
317  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
318  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
319    oldincludedir="$ac_optarg" ;;
320
321  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
322    ac_prev=prefix ;;
323  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
324    prefix="$ac_optarg" ;;
325
326  -program-prefix | --program-prefix | --program-prefi | --program-pref \
327  | --program-pre | --program-pr | --program-p)
328    ac_prev=program_prefix ;;
329  -program-prefix=* | --program-prefix=* | --program-prefi=* \
330  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
331    program_prefix="$ac_optarg" ;;
332
333  -program-suffix | --program-suffix | --program-suffi | --program-suff \
334  | --program-suf | --program-su | --program-s)
335    ac_prev=program_suffix ;;
336  -program-suffix=* | --program-suffix=* | --program-suffi=* \
337  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
338    program_suffix="$ac_optarg" ;;
339
340  -program-transform-name | --program-transform-name \
341  | --program-transform-nam | --program-transform-na \
342  | --program-transform-n | --program-transform- \
343  | --program-transform | --program-transfor \
344  | --program-transfo | --program-transf \
345  | --program-trans | --program-tran \
346  | --progr-tra | --program-tr | --program-t)
347    ac_prev=program_transform_name ;;
348  -program-transform-name=* | --program-transform-name=* \
349  | --program-transform-nam=* | --program-transform-na=* \
350  | --program-transform-n=* | --program-transform-=* \
351  | --program-transform=* | --program-transfor=* \
352  | --program-transfo=* | --program-transf=* \
353  | --program-trans=* | --program-tran=* \
354  | --progr-tra=* | --program-tr=* | --program-t=*)
355    program_transform_name="$ac_optarg" ;;
356
357  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
358  | -silent | --silent | --silen | --sile | --sil)
359    silent=yes ;;
360
361  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
362    ac_prev=sbindir ;;
363  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
364  | --sbi=* | --sb=*)
365    sbindir="$ac_optarg" ;;
366
367  -sharedstatedir | --sharedstatedir | --sharedstatedi \
368  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
369  | --sharedst | --shareds | --shared | --share | --shar \
370  | --sha | --sh)
371    ac_prev=sharedstatedir ;;
372  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
373  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
374  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
375  | --sha=* | --sh=*)
376    sharedstatedir="$ac_optarg" ;;
377
378  -site | --site | --sit)
379    ac_prev=site ;;
380  -site=* | --site=* | --sit=*)
381    site="$ac_optarg" ;;
382
383  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
384    ac_prev=srcdir ;;
385  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
386    srcdir="$ac_optarg" ;;
387
388  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
389  | --syscon | --sysco | --sysc | --sys | --sy)
390    ac_prev=sysconfdir ;;
391  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
392  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
393    sysconfdir="$ac_optarg" ;;
394
395  -target | --target | --targe | --targ | --tar | --ta | --t)
396    ac_prev=target ;;
397  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
398    target="$ac_optarg" ;;
399
400  -v | -verbose | --verbose | --verbos | --verbo | --verb)
401    verbose=yes ;;
402
403  -version | --version | --versio | --versi | --vers)
404    echo "configure generated by autoconf version 2.12"
405    exit 0 ;;
406
407  -with-* | --with-*)
408    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
409    # Reject names that are not valid shell variable names.
410    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
411      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
412    fi
413    ac_package=`echo $ac_package| sed 's/-/_/g'`
414    case "$ac_option" in
415      *=*) ;;
416      *) ac_optarg=yes ;;
417    esac
418    eval "with_${ac_package}='$ac_optarg'" ;;
419
420  -without-* | --without-*)
421    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
422    # Reject names that are not valid shell variable names.
423    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
424      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
425    fi
426    ac_package=`echo $ac_package| sed 's/-/_/g'`
427    eval "with_${ac_package}=no" ;;
428
429  --x)
430    # Obsolete; use --with-x.
431    with_x=yes ;;
432
433  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
434  | --x-incl | --x-inc | --x-in | --x-i)
435    ac_prev=x_includes ;;
436  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
437  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
438    x_includes="$ac_optarg" ;;
439
440  -x-libraries | --x-libraries | --x-librarie | --x-librari \
441  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
442    ac_prev=x_libraries ;;
443  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
444  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
445    x_libraries="$ac_optarg" ;;
446
447  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
448    ;;
449
450  *)
451    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
452      echo "configure: warning: $ac_option: invalid host type" 1>&2
453    fi
454    if test "x$nonopt" != xNONE; then
455      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
456    fi
457    nonopt="$ac_option"
458    ;;
459
460  esac
461done
462
463if test -n "$ac_prev"; then
464  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
465fi
466
467trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
468
469# File descriptor usage:
470# 0 standard input
471# 1 file creation
472# 2 errors and warnings
473# 3 some systems may open it to /dev/tty
474# 4 used on the Kubota Titan
475# 6 checking for... messages and results
476# 5 compiler messages saved in config.log
477if test "$silent" = yes; then
478  exec 6>/dev/null
479else
480  exec 6>&1
481fi
482exec 5>./config.log
483
484echo "\
485This file contains any messages produced by compilers while
486running configure, to aid debugging if configure makes a mistake.
487" 1>&5
488
489# Strip out --no-create and --no-recursion so they do not pile up.
490# Also quote any args containing shell metacharacters.
491ac_configure_args=
492for ac_arg
493do
494  case "$ac_arg" in
495  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
496  | --no-cr | --no-c) ;;
497  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
498  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
499  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
500  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
501  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
502  esac
503done
504
505# NLS nuisances.
506# Only set these to C if already set.  These must not be set unconditionally
507# because not all systems understand e.g. LANG=C (notably SCO).
508# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
509# Non-C LC_CTYPE values break the ctype check.
510if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
511if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
512if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
513if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
514
515# confdefs.h avoids OS command line length limits that DEFS can exceed.
516rm -rf conftest* confdefs.h
517# AIX cpp loses on an empty file, so make sure it contains at least a newline.
518echo > confdefs.h
519
520# A filename unique to this package, relative to the directory that
521# configure is in, which we can look for to find out if srcdir is correct.
522ac_unique_file=c_ksh.c
523
524# Find the source files, if location was not specified.
525if test -z "$srcdir"; then
526  ac_srcdir_defaulted=yes
527  # Try the directory containing this script, then its parent.
528  ac_prog=$0
529  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
530  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
531  srcdir=$ac_confdir
532  if test ! -r $srcdir/$ac_unique_file; then
533    srcdir=..
534  fi
535else
536  ac_srcdir_defaulted=no
537fi
538if test ! -r $srcdir/$ac_unique_file; then
539  if test "$ac_srcdir_defaulted" = yes; then
540    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
541  else
542    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
543  fi
544fi
545srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
546
547# Prefer explicitly selected file to automatically selected ones.
548if test -z "$CONFIG_SITE"; then
549  if test "x$prefix" != xNONE; then
550    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
551  else
552    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
553  fi
554fi
555for ac_site_file in $CONFIG_SITE; do
556  if test -r "$ac_site_file"; then
557    echo "loading site script $ac_site_file"
558    . "$ac_site_file"
559  fi
560done
561
562if test -r "$cache_file"; then
563  echo "loading cache $cache_file"
564  . $cache_file
565else
566  echo "creating cache $cache_file"
567  > $cache_file
568fi
569
570ac_ext=c
571# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
572ac_cpp='echo $CPP $CPPFLAGS 1>&5;
573$CPP $CPPFLAGS'
574ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5;
575${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
576ac_link='echo ${CC-cc} -o conftest$ac_exe_suffix $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5;
577${CC-cc} -o conftest$ac_exe_suffix $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
578
579if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
580  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
581  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
582    ac_n= ac_c='
583' ac_t='	'
584  else
585    ac_n=-n ac_c= ac_t=
586  fi
587else
588  ac_n= ac_c='\c' ac_t=
589fi
590
591
592
593def_path_unix="/bin:/usr/bin:/usr/ucb"
594def_path_os2="c:/usr/bin;c:/os2;/os2"
595# Check whether --enable-path or --disable-path was given.
596if test "${enable_path+set}" = set; then
597  enableval="$enable_path"
598  :
599else
600  enable_path=default
601fi
602
603case $enable_path:$ksh_cv_os_type in
604 default:OS2_EMX) enable_path="$def_path_os2" ;;
605 default:*) enable_path="$def_path_unix" ;;
606esac
607case $enable_path in
608  \"*\") ;;
609  *)
610    enable_path="\"$enable_path\""
611    ;;
612esac
613cat >> confdefs.h <<EOF
614#define DEFAULT_PATH $enable_path
615EOF
616
617# Check whether --enable-shell or --disable-shell was given.
618if test "${enable_shell+set}" = set; then
619  enableval="$enable_shell"
620  :
621else
622  enable_shell=ksh
623fi
624
625case $enable_shell in
626  ksh) cat >> confdefs.h <<\EOF
627#define KSH 1
628EOF
629 ;;
630  sh) ;;
631  *)
632    { echo "configure: error: bad --enable-shell: must be one of sh or ksh" 1>&2; exit 1; }
633esac
634SHELL_PROG=$enable_shell
635
636# Check whether --enable-emacs or --disable-emacs was given.
637if test "${enable_emacs+set}" = set; then
638  enableval="$enable_emacs"
639  :
640fi
641
642case $enable_emacs:$enable_shell in
643  yes:*|:ksh) enable_emacs=yes; cat >> confdefs.h <<\EOF
644#define EMACS 1
645EOF
646 ;;
647  no:*|:sh) enable_emacs=no;;
648  *) { echo "configure: error: bad --enable-emacs argument" 1>&2; exit 1; }
649esac
650# Check whether --enable-vi or --disable-vi was given.
651if test "${enable_vi+set}" = set; then
652  enableval="$enable_vi"
653  :
654fi
655
656case $enable_vi:$enable_shell in
657  yes:*|:ksh) enable_vi=yes; cat >> confdefs.h <<\EOF
658#define VI 1
659EOF
660 ;;
661  no:*|:sh) enable_vi=no;;
662  *) { echo "configure: error: bad --enable-vi argument" 1>&2; exit 1; }
663esac
664# Check whether --enable-jobs or --disable-jobs was given.
665if test "${enable_jobs+set}" = set; then
666  enableval="$enable_jobs"
667  :
668fi
669
670case $enable_jobs in
671  yes|'') enable_jobs=yes; cat >> confdefs.h <<\EOF
672#define JOBS 1
673EOF
674 ;;
675  no) enable_jobs=no;;
676  *) { echo "configure: error: bad --enable-jobs argument" 1>&2; exit 1; }
677esac
678# Check whether --enable-brace-expand or --disable-brace-expand was given.
679if test "${enable_brace_expand+set}" = set; then
680  enableval="$enable_brace_expand"
681  :
682fi
683
684case $enable_brace_expand:$enable_shell in
685  yes:*|:ksh) enable_brace_expand=yes; cat >> confdefs.h <<\EOF
686#define BRACE_EXPAND 1
687EOF
688 ;;
689  no:*|:sh) enable_brace_expand=no;;
690  *) { echo "configure: error: bad --enable-brace-expand argument" 1>&2; exit 1; }
691esac
692# Check whether --enable-history or --disable-history was given.
693if test "${enable_history+set}" = set; then
694  enableval="$enable_history"
695  :
696fi
697
698case $enable_history:$enable_shell in
699  simple:*|:ksh) enable_history=simple; ;;
700  complex:*) enable_history=complex; cat >> confdefs.h <<\EOF
701#define COMPLEX_HISTORY 1
702EOF
703 ;;
704  no:*|:sh)
705    case $enable_history:$enable_vi:$enable_emacs in
706    no:yes:*|no:*:yes)
707      { echo "configure: error: can't disable history when vi or emacs is enabled" 1>&2; exit 1; } ;;
708    :yes:*|:*:yes)
709      enable_history=yes;;
710    *)
711      enable_history=no;;
712    esac
713    ;;
714  *) { echo "configure: error: bad --enable-history argument" 1>&2; exit 1; }
715esac
716test X"$enable_history" != Xno && cat >> confdefs.h <<\EOF
717#define HISTORY 1
718EOF
719
720# Check whether --enable-posixly_correct or --disable-posixly_correct was given.
721if test "${enable_posixly_correct+set}" = set; then
722  enableval="$enable_posixly_correct"
723  :
724fi
725
726case $enable_posixly_correct:$enable_shell in
727  yes:*) enable_posixly_correct=yes; cat >> confdefs.h <<\EOF
728#define POSIXLY_CORRECT 1
729EOF
730 ;;
731  no:*|:*) enable_posixly_correct=no;;
732  *) { echo "configure: error: bad --enable-posixly_correct argument" 1>&2; exit 1; }
733esac
734# Check whether --enable-default-env or --disable-default-env was given.
735if test "${enable_default_env+set}" = set; then
736  enableval="$enable_default_env"
737  :
738else
739  enable_default_env=no
740fi
741
742if test X"$enable_default_env" != Xno; then
743  # The [a-zA-Z]:/ is for os2 types...
744  case $enable_default_env in
745    /*|[a-zA-Z]:/*)
746      enable_default_env="\"$enable_default_env\""
747      ;;
748    \"/*\"|\"[a-zA-Z]:/*\")
749      ;;
750    *)
751      { echo "configure: error: --enable-default-env argument must be an absolute path (was $enable_default_env)" 1>&2; exit 1; }
752      ;;
753  esac
754  cat >> confdefs.h <<EOF
755#define DEFAULT_ENV $enable_default_env
756EOF
757
758fi
759# Check whether --enable-silly or --disable-silly was given.
760if test "${enable_silly+set}" = set; then
761  enableval="$enable_silly"
762  :
763fi
764
765case $enable_silly:$enable_shell in
766  yes:*) enable_silly=yes; cat >> confdefs.h <<\EOF
767#define SILLY 1
768EOF
769 ;;
770  no:*|:*) enable_silly=no;;
771  *) { echo "configure: error: bad --enable-silly argument" 1>&2; exit 1; }
772esac
773# Check whether --enable-swtch or --disable-swtch was given.
774if test "${enable_swtch+set}" = set; then
775  enableval="$enable_swtch"
776  :
777fi
778
779case $enable_swtch:$enable_shell in
780  yes:*) enable_swtch=yes; cat >> confdefs.h <<\EOF
781#define SWTCH 1
782EOF
783 ;;
784  no:*|:*) enable_swtch=no;;
785  *) { echo "configure: error: bad --enable-swtch argument" 1>&2; exit 1; }
786esac
787# Extract the first word of "gcc", so it can be a program name with args.
788set dummy gcc; ac_word=$2
789echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
790echo "configure:791: checking for $ac_word" >&5
791if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
792  echo $ac_n "(cached) $ac_c" 1>&6
793else
794  if test -n "$CC"; then
795  ac_cv_prog_CC="$CC" # Let the user override the test.
796else
797  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
798  for ac_dir in $PATH; do
799    test -z "$ac_dir" && ac_dir=.
800    if test -f $ac_dir/$ac_word; then
801      ac_cv_prog_CC="gcc"
802      break
803    fi
804  done
805  IFS="$ac_save_ifs"
806  test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
807fi
808fi
809CC="$ac_cv_prog_CC"
810if test -n "$CC"; then
811  echo "$ac_t""$CC" 1>&6
812else
813  echo "$ac_t""no" 1>&6
814fi
815
816
817echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
818echo "configure:819: checking whether we are using GNU C" >&5
819if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
820  echo $ac_n "(cached) $ac_c" 1>&6
821else
822  cat > conftest.c <<EOF
823#ifdef __GNUC__
824  yes;
825#endif
826EOF
827if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then
828  ac_cv_prog_gcc=yes
829else
830  ac_cv_prog_gcc=no
831fi
832fi
833
834echo "$ac_t""$ac_cv_prog_gcc" 1>&6
835if test $ac_cv_prog_gcc = yes; then
836  GCC=yes
837  if test "${CFLAGS+set}" != set; then
838    echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
839echo "configure:840: checking whether ${CC-cc} accepts -g" >&5
840if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
841  echo $ac_n "(cached) $ac_c" 1>&6
842else
843  echo 'int main(){ return 0; }' > conftest.c
844if test -z "`${CC-cc} -g conftest.c 2>&1`"; then
845  ac_cv_prog_gcc_g=yes
846else
847  ac_cv_prog_gcc_g=no
848fi
849rm -f conftest*
850
851fi
852
853echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
854    if test $ac_cv_prog_gcc_g = yes; then
855      CFLAGS="-g -O"
856    else
857      CFLAGS="-O"
858    fi
859  fi
860else
861  GCC=
862  test "${CFLAGS+set}" = set || CFLAGS="-g"
863fi
864
865echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
866echo "configure:867: checking how to run the C preprocessor" >&5
867# On Suns, sometimes $CPP names a directory.
868if test -n "$CPP" && test -d "$CPP"; then
869  CPP=
870fi
871if test -z "$CPP"; then
872if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
873  echo $ac_n "(cached) $ac_c" 1>&6
874else
875    # This must be in double quotes, not single quotes, because CPP may get
876  # substituted into the Makefile and "${CC-cc}" will confuse make.
877  CPP="${CC-cc} -E"
878  # On the NeXT, cc -E runs the code through the compiler's parser,
879  # not just through cpp.
880  cat > conftest.$ac_ext <<EOF
881#line 882 "configure"
882#include "confdefs.h"
883#include <assert.h>
884Syntax Error
885EOF
886ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
887{ (eval echo configure:888: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
888ac_err=`grep -v '^ *+' conftest.out`
889if test -z "$ac_err"; then
890  :
891else
892  echo "$ac_err" >&5
893  echo "configure: failed program was:" >&5
894  cat conftest.$ac_ext >&5
895  rm -rf conftest*
896  CPP="${CC-cc} -E -traditional-cpp"
897  cat > conftest.$ac_ext <<EOF
898#line 899 "configure"
899#include "confdefs.h"
900#include <assert.h>
901Syntax Error
902EOF
903ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
904{ (eval echo configure:905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
905ac_err=`grep -v '^ *+' conftest.out`
906if test -z "$ac_err"; then
907  :
908else
909  echo "$ac_err" >&5
910  echo "configure: failed program was:" >&5
911  cat conftest.$ac_ext >&5
912  rm -rf conftest*
913  CPP=/lib/cpp
914fi
915rm -f conftest*
916fi
917rm -f conftest*
918  ac_cv_prog_CPP="$CPP"
919fi
920  CPP="$ac_cv_prog_CPP"
921else
922  ac_cv_prog_CPP="$CPP"
923fi
924echo "$ac_t""$CPP" 1>&6
925
926if test $ac_cv_prog_gcc = yes; then
927    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
928echo "configure:929: checking whether ${CC-cc} needs -traditional" >&5
929if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
930  echo $ac_n "(cached) $ac_c" 1>&6
931else
932    ac_pattern="Autoconf.*'x'"
933  cat > conftest.$ac_ext <<EOF
934#line 935 "configure"
935#include "confdefs.h"
936#include <sgtty.h>
937Autoconf TIOCGETP
938EOF
939if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
940  egrep "$ac_pattern" >/dev/null 2>&1; then
941  rm -rf conftest*
942  ac_cv_prog_gcc_traditional=yes
943else
944  rm -rf conftest*
945  ac_cv_prog_gcc_traditional=no
946fi
947rm -f conftest*
948
949
950  if test $ac_cv_prog_gcc_traditional = no; then
951    cat > conftest.$ac_ext <<EOF
952#line 953 "configure"
953#include "confdefs.h"
954#include <termio.h>
955Autoconf TCGETA
956EOF
957if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
958  egrep "$ac_pattern" >/dev/null 2>&1; then
959  rm -rf conftest*
960  ac_cv_prog_gcc_traditional=yes
961fi
962rm -f conftest*
963
964  fi
965fi
966
967echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
968  if test $ac_cv_prog_gcc_traditional = yes; then
969    CC="$CC -traditional"
970  fi
971fi
972
973if test X"$GCC" = Xyes && test -f $srcdir/Warn-flags; then
974  CFLAGS="${CFLAGS+$CFLAGS }`cat $srcdir/Warn-flags`"
975fi
976
977LDSTATIC=${LDSTATIC-}
978test X"$LDSTATIC" != X && LDFLAGS="${LDFLAGS+$LDFLAGS }$LDSTATIC"
979
980      echo $ac_n "checking if this is a problematic os""... $ac_c" 1>&6
981echo "configure:982: checking if this is a problematic os" >&5
982if eval "test \"`echo '$''{'ksh_cv_os_type'+set}'`\" = set"; then
983  echo $ac_n "(cached) $ac_c" 1>&6
984else
985   ksh_cv_os_type=no
986      # Some tests below add -C to CPPFLAGS
987      saveCPPFLAGS="$CPPFLAGS"
988      for i in AIX ISC MINIX SCO OS2_EMX TITANOS NEXT HPUX; do
989	case $i in	#((
990	  AIX)
991	    cat > conftest.$ac_ext <<EOF
992#line 993 "configure"
993#include "confdefs.h"
994
995#ifdef _AIX
996yes
997#endif
998	       
999EOF
1000if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1001  egrep "yes" >/dev/null 2>&1; then
1002  rm -rf conftest*
1003  ksh_cv_os_type=$i
1004fi
1005rm -f conftest*
1006
1007	    ;;	#(
1008	  ISC)
1009	    # Both native ISC cpp and gcc understand this (leave comments in)
1010	    CPPFLAGS="$CPPFLAGS -C"
1011	    #XXX grep part won't work if cross-compiling...
1012	    cat > conftest.$ac_ext <<EOF
1013#line 1014 "configure"
1014#include "confdefs.h"
1015#include <unistd.h>
1016EOF
1017if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1018  egrep "INTERACTIVE Systems Corporation" >/dev/null 2>&1; then
1019  rm -rf conftest*
1020  if grep _POSIX_VERSION /usr/include/sys/unistd.h > /dev/null 2>&1; then
1021		  ksh_cv_os_type="$i-posix"
1022		else
1023		  ksh_cv_os_type=$i
1024		fi
1025fi
1026rm -f conftest*
1027	    CPPFLAGS="$saveCPPFLAGS"
1028	    ;;	#(
1029	  MINIX)
1030	    ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
1031echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
1032echo "configure:1033: checking for minix/config.h" >&5
1033if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1034  echo $ac_n "(cached) $ac_c" 1>&6
1035else
1036  cat > conftest.$ac_ext <<EOF
1037#line 1038 "configure"
1038#include "confdefs.h"
1039#include <minix/config.h>
1040EOF
1041ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1042{ (eval echo configure:1043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1043ac_err=`grep -v '^ *+' conftest.out`
1044if test -z "$ac_err"; then
1045  rm -rf conftest*
1046  eval "ac_cv_header_$ac_safe=yes"
1047else
1048  echo "$ac_err" >&5
1049  echo "configure: failed program was:" >&5
1050  cat conftest.$ac_ext >&5
1051  rm -rf conftest*
1052  eval "ac_cv_header_$ac_safe=no"
1053fi
1054rm -f conftest*
1055fi
1056if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1057  echo "$ac_t""yes" 1>&6
1058  ksh_cv_os_type=$i
1059else
1060  echo "$ac_t""no" 1>&6
1061fi
1062	    ;;	#(
1063	  SCO)
1064	    # Both native SCO cpp and gcc understand this (leave comments in)
1065	    CPPFLAGS="$CPPFLAGS -C"
1066	    cat > conftest.$ac_ext <<EOF
1067#line 1068 "configure"
1068#include "confdefs.h"
1069#include <unistd.h>
1070EOF
1071if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1072  egrep "The Santa Cruz Operation" >/dev/null 2>&1; then
1073  rm -rf conftest*
1074  ksh_cv_os_type=$i
1075fi
1076rm -f conftest*
1077	    CPPFLAGS="$saveCPPFLAGS"
1078	    ;;	#(
1079	  OS2_EMX)
1080	    cat > conftest.$ac_ext <<EOF
1081#line 1082 "configure"
1082#include "confdefs.h"
1083
1084#ifdef __EMX__
1085yes
1086#endif
1087	       
1088EOF
1089if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1090  egrep "yes" >/dev/null 2>&1; then
1091  rm -rf conftest*
1092  ksh_cv_os_type=$i
1093fi
1094rm -f conftest*
1095	    ;;	#(
1096	  TITANOS)
1097	    cat > conftest.$ac_ext <<EOF
1098#line 1099 "configure"
1099#include "confdefs.h"
1100
1101#if defined(titan) || defined(_titan) || defined(__titan)
1102YesTitan
1103#endif
1104	       
1105EOF
1106if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1107  egrep "YesTitan" >/dev/null 2>&1; then
1108  rm -rf conftest*
1109  ksh_cv_os_type=$i
1110fi
1111rm -f conftest*
1112	    ;;	#(
1113	  NEXT)
1114	    #
1115	    # NeXT 3.2 (other versions?) - cc -E doesn't work and /lib/cpp
1116	    # doesn't define things that need defining, so tests that rely
1117	    # on $CPP will break.
1118	    #
1119	    # Hmmm - can't safely use CPP to test for NeXT defines, so have
1120	    # to use a program that won't compile on a NeXT and one that will
1121	    # only compile on a NeXT...
1122	    cat > conftest.$ac_ext <<EOF
1123#line 1124 "configure"
1124#include "confdefs.h"
1125
1126int main() {
1127
1128	        #if defined(__NeXT) || defined(NeXT)
1129		  this is a NeXT box and the compile should fail
1130	        #endif
1131	      
1132; return 0; }
1133EOF
1134if { (eval echo configure:1135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1135  :
1136else
1137  echo "configure: failed program was:" >&5
1138  cat conftest.$ac_ext >&5
1139  rm -rf conftest*
1140  cat > conftest.$ac_ext <<EOF
1141#line 1142 "configure"
1142#include "confdefs.h"
1143
1144int main() {
1145
1146		  #if !defined(__NeXT) && !defined(NeXT)
1147		    this is NOT a NeXT box and the compile should fail
1148		  #endif
1149		
1150; return 0; }
1151EOF
1152if { (eval echo configure:1153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1153  rm -rf conftest*
1154  ksh_cv_os_type=$i
1155else
1156  echo "configure: failed program was:" >&5
1157  cat conftest.$ac_ext >&5
1158fi
1159rm -f conftest*
1160fi
1161rm -f conftest*	    ;;	#(
1162	  HPUX)
1163	    cat > conftest.$ac_ext <<EOF
1164#line 1165 "configure"
1165#include "confdefs.h"
1166
1167#ifdef __hpux
1168yes
1169#endif
1170	       
1171EOF
1172if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1173  egrep "yes" >/dev/null 2>&1; then
1174  rm -rf conftest*
1175  ksh_cv_os_type=$i
1176fi
1177rm -f conftest*
1178
1179	    ;;	#(
1180	esac		#))
1181	test $ksh_cv_os_type != no && break
1182      done
1183
1184fi
1185
1186echo "$ac_t""$ksh_cv_os_type" 1>&6
1187  case $ksh_cv_os_type in	#((
1188    AIX)
1189      cat >> confdefs.h <<\EOF
1190#define _ALL_SOURCE 1
1191EOF
1192      ;;			#(
1193    ISC)
1194      cat >> confdefs.h <<\EOF
1195#define OS_ISC 1
1196EOF
1197      ;;			#(
1198    ISC-posix)
1199      cat >> confdefs.h <<\EOF
1200#define OS_ISC 1
1201EOF
1202      cat >> confdefs.h <<\EOF
1203#define _POSIX_SOURCE 1
1204EOF
1205      if test "$GCC" = yes; then
1206	CC="$CC -posix"
1207      else
1208	CC="$CC -Xp"
1209      fi
1210      ;;			#(
1211    MINIX)
1212      cat >> confdefs.h <<\EOF
1213#define _POSIX_SOURCE 1
1214EOF
1215      cat >> confdefs.h <<\EOF
1216#define _POSIX_1_SOURCE 2
1217EOF
1218      cat >> confdefs.h <<\EOF
1219#define _MINIX 1
1220EOF
1221      ;;			#(
1222    SCO)
1223      cat >> confdefs.h <<\EOF
1224#define OS_SCO 1
1225EOF
1226      ;;			#(
1227    OS2_EMX)
1228      # XXX change this to OS_OS2 or OS_OS2_EMX?
1229      cat >> confdefs.h <<\EOF
1230#define OS2 1
1231EOF
1232      ac_exe_suffix=.exe
1233      ;;			#(
1234    TITANOS)
1235      # Need to use cc -43 to get a shell with job control
1236      case "$CC" in		#((
1237        *-43*)  			# Already have -43 option?
1238	  ;;			#(
1239	*/cc|*/cc' '|*/cc'	'|cc|cc' '|cc'	') # Using stock compiler?
1240	  CC="$CC -43"
1241	  ;;			#(
1242      esac			#))
1243      #
1244      # Force dirent check to find the right thing.  There is a dirent.h
1245      # (and a sys/dirent.h) file which compiles, but generates garbage...
1246      #
1247      ac_cv_header_dirent_dirent_h=no
1248      ac_cv_header_dirent_sys_ndir_h=no
1249      ac_cv_header_dirent_sys_dir_h=yes
1250      ;;			#(
1251    NEXT)
1252      #
1253      # NeXT 3.2 (other versions?) - cc -E doesn't work and /lib/cpp
1254      # doesn't define things that need defining, so tests that rely
1255      # on $CPP will break.
1256      #
1257      cat > conftest.$ac_ext <<EOF
1258#line 1259 "configure"
1259#include "confdefs.h"
1260#include <signal.h>
1261	#if !defined(SIGINT) || !defined(SIGQUIT)
1262	    Bad NeXT
1263	#endif
1264	
1265EOF
1266if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1267  egrep "Bad NeXT" >/dev/null 2>&1; then
1268  rm -rf conftest*
1269  { echo "configure: error:
1270There is a problem on NeXT boxes resulting in a bad siglist.out file being
1271generated (which breaks the trap and kill commands) and probably resulting
1272in many configuration tests not working correctly.
1273
1274You appear to have this problem - see the comments on NeXT in the pdksh
1275README file for work arounds." 1>&2; exit 1; }
1276fi
1277rm -f conftest*
1278      ;;			#(
1279    HPUX)
1280      #
1281      # In some versions of hpux (eg, 10.2), getwd & getcwd will dump core
1282      # if directory is not readble.
1283      #
1284      # name is used in test program
1285      echo $ac_n "checking for bug in getwd""... $ac_c" 1>&6
1286echo "configure:1287: checking for bug in getwd" >&5
1287if eval "test \"`echo '$''{'ksh_cv_hpux_getwd_bug'+set}'`\" = set"; then
1288  echo $ac_n "(cached) $ac_c" 1>&6
1289else
1290   tmpdir=conftest.dir
1291	  if mkdir $tmpdir ; then
1292	    if test "$cross_compiling" = yes; then
1293  echo "configure: warning: assuming getwd broken" 1>&2; ksh_cv_hpux_getwd_bug=yes
1294else
1295cat > conftest.$ac_ext <<EOF
1296#line 1297 "configure"
1297#include "confdefs.h"
1298
1299		int
1300		main()
1301		{
1302		  char buf[8 * 1024];
1303		  char *dirname = "conftest.dir";
1304		  int ok = 0;
1305		  if (chdir(dirname) < 0)
1306		    exit(2);
1307		  if (chmod(".", 0) < 0)
1308		    exit(3);
1309		  /* Test won't work if run as root - so don't be root */
1310		  if (getuid() == 0 || geteuid() == 0)
1311		    setresuid(1, 1, 1);	/* hpux has this */
1312#ifdef HAVE_GETWD /* silly since HAVE_* tests haven't been done yet */
1313		  {
1314		      extern char *getwd();
1315		      ok = getwd(buf) == 0;
1316		  }
1317#else
1318		  {
1319		      extern char *getcwd();
1320		      ok = getcwd(buf, sizeof(buf)) == 0;
1321		  }
1322#endif
1323		  exit(ok ? 0 : 10);
1324		  return ok ? 0 : 10;
1325		}
1326EOF
1327eval $ac_link
1328if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
1329  ksh_cv_hpux_getwd_bug=no
1330else
1331  ksh_cv_hpux_getwd_bug=yes
1332fi
1333fi
1334rm -fr conftest*
1335	       test -d $tmpdir && rmdir $tmpdir
1336	  else
1337	     { echo "configure: error: could not make temp directory for test" 1>&2; exit 1; }; ksh_cv_hpux_getwd_bug=yes
1338	  fi
1339fi
1340
1341echo "$ac_t""$ksh_cv_hpux_getwd_bug" 1>&6
1342      if test $ksh_cv_hpux_getwd_bug = yes; then
1343	cat >> confdefs.h <<\EOF
1344#define HPUX_GETWD_BUG 1
1345EOF
1346
1347      fi
1348      ;;			#(
1349  esac				#))
1350
1351if test "$program_transform_name" = s,x,x,; then
1352  program_transform_name=
1353else
1354  # Double any \ or $.  echo might interpret backslashes.
1355  cat <<\EOF_SED > conftestsed
1356s,\\,\\\\,g; s,\$,$$,g
1357EOF_SED
1358  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
1359  rm -f conftestsed
1360fi
1361test "$program_prefix" != NONE &&
1362  program_transform_name="s,^,${program_prefix},; $program_transform_name"
1363# Use a double $ so make ignores it.
1364test "$program_suffix" != NONE &&
1365  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
1366
1367# sed with no file args requires a program.
1368test "$program_transform_name" = "" && program_transform_name="s,x,x,"
1369
1370ac_header_dirent=no
1371for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
1372do
1373ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
1374echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
1375echo "configure:1376: checking for $ac_hdr that defines DIR" >&5
1376if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
1377  echo $ac_n "(cached) $ac_c" 1>&6
1378else
1379  cat > conftest.$ac_ext <<EOF
1380#line 1381 "configure"
1381#include "confdefs.h"
1382#include <sys/types.h>
1383#include <$ac_hdr>
1384int main() {
1385DIR *dirp = 0;
1386; return 0; }
1387EOF
1388if { (eval echo configure:1389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1389  rm -rf conftest*
1390  eval "ac_cv_header_dirent_$ac_safe=yes"
1391else
1392  echo "configure: failed program was:" >&5
1393  cat conftest.$ac_ext >&5
1394  rm -rf conftest*
1395  eval "ac_cv_header_dirent_$ac_safe=no"
1396fi
1397rm -f conftest*
1398fi
1399if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
1400  echo "$ac_t""yes" 1>&6
1401    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
1402  cat >> confdefs.h <<EOF
1403#define $ac_tr_hdr 1
1404EOF
1405 ac_header_dirent=$ac_hdr; break
1406else
1407  echo "$ac_t""no" 1>&6
1408fi
1409done
1410# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
1411if test $ac_header_dirent = dirent.h; then
1412echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
1413echo "configure:1414: checking for opendir in -ldir" >&5
1414ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
1415if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1416  echo $ac_n "(cached) $ac_c" 1>&6
1417else
1418  ac_save_LIBS="$LIBS"
1419LIBS="-ldir  $LIBS"
1420cat > conftest.$ac_ext <<EOF
1421#line 1422 "configure"
1422#include "confdefs.h"
1423/* Override any gcc2 internal prototype to avoid an error.  */
1424/* We use char because int might match the return type of a gcc2
1425    builtin and then its argument prototype would still apply.  */
1426char opendir();
1427
1428int main() {
1429opendir()
1430; return 0; }
1431EOF
1432if { (eval echo configure:1433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1433  rm -rf conftest*
1434  eval "ac_cv_lib_$ac_lib_var=yes"
1435else
1436  echo "configure: failed program was:" >&5
1437  cat conftest.$ac_ext >&5
1438  rm -rf conftest*
1439  eval "ac_cv_lib_$ac_lib_var=no"
1440fi
1441rm -f conftest*
1442LIBS="$ac_save_LIBS"
1443
1444fi
1445if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1446  echo "$ac_t""yes" 1>&6
1447  LIBS="$LIBS -ldir"
1448else
1449  echo "$ac_t""no" 1>&6
1450echo $ac_n "checking for opendir in -lndir""... $ac_c" 1>&6
1451echo "configure:1452: checking for opendir in -lndir" >&5
1452ac_lib_var=`echo ndir'_'opendir | sed 'y%./+-%__p_%'`
1453if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1454  echo $ac_n "(cached) $ac_c" 1>&6
1455else
1456  ac_save_LIBS="$LIBS"
1457LIBS="-lndir  $LIBS"
1458cat > conftest.$ac_ext <<EOF
1459#line 1460 "configure"
1460#include "confdefs.h"
1461/* Override any gcc2 internal prototype to avoid an error.  */
1462/* We use char because int might match the return type of a gcc2
1463    builtin and then its argument prototype would still apply.  */
1464char opendir();
1465
1466int main() {
1467opendir()
1468; return 0; }
1469EOF
1470if { (eval echo configure:1471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1471  rm -rf conftest*
1472  eval "ac_cv_lib_$ac_lib_var=yes"
1473else
1474  echo "configure: failed program was:" >&5
1475  cat conftest.$ac_ext >&5
1476  rm -rf conftest*
1477  eval "ac_cv_lib_$ac_lib_var=no"
1478fi
1479rm -f conftest*
1480LIBS="$ac_save_LIBS"
1481
1482fi
1483if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1484  echo "$ac_t""yes" 1>&6
1485  LIBS="$LIBS -lndir"
1486else
1487  echo "$ac_t""no" 1>&6
1488fi
1489
1490fi
1491
1492else
1493echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
1494echo "configure:1495: checking for opendir in -lx" >&5
1495ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
1496if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1497  echo $ac_n "(cached) $ac_c" 1>&6
1498else
1499  ac_save_LIBS="$LIBS"
1500LIBS="-lx  $LIBS"
1501cat > conftest.$ac_ext <<EOF
1502#line 1503 "configure"
1503#include "confdefs.h"
1504/* Override any gcc2 internal prototype to avoid an error.  */
1505/* We use char because int might match the return type of a gcc2
1506    builtin and then its argument prototype would still apply.  */
1507char opendir();
1508
1509int main() {
1510opendir()
1511; return 0; }
1512EOF
1513if { (eval echo configure:1514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1514  rm -rf conftest*
1515  eval "ac_cv_lib_$ac_lib_var=yes"
1516else
1517  echo "configure: failed program was:" >&5
1518  cat conftest.$ac_ext >&5
1519  rm -rf conftest*
1520  eval "ac_cv_lib_$ac_lib_var=no"
1521fi
1522rm -f conftest*
1523LIBS="$ac_save_LIBS"
1524
1525fi
1526if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1527  echo "$ac_t""yes" 1>&6
1528  LIBS="$LIBS -lx"
1529else
1530  echo "$ac_t""no" 1>&6
1531fi
1532
1533fi
1534
1535echo $ac_n "checking for sane unistd.h""... $ac_c" 1>&6
1536echo "configure:1537: checking for sane unistd.h" >&5
1537if eval "test \"`echo '$''{'ksh_cv_header_unistd'+set}'`\" = set"; then
1538  echo $ac_n "(cached) $ac_c" 1>&6
1539else
1540  cat > conftest.$ac_ext <<EOF
1541#line 1542 "configure"
1542#include "confdefs.h"
1543
1544#include <unistd.h>
1545#if defined(_POSIX_VERSION)
1546# include <sys/types.h>
1547# include <dirent.h> /* _POSIX_VERSION => HAVE_DIRENT_H test not needed */
1548#endif
1549      
1550int main() {
1551
1552; return 0; }
1553EOF
1554if { (eval echo configure:1555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1555  rm -rf conftest*
1556  ksh_cv_header_unistd=yes
1557else
1558  echo "configure: failed program was:" >&5
1559  cat conftest.$ac_ext >&5
1560  rm -rf conftest*
1561  ksh_cv_header_unistd=no
1562fi
1563rm -f conftest*
1564fi
1565
1566echo "$ac_t""$ksh_cv_header_unistd" 1>&6
1567  if test $ksh_cv_header_unistd = yes; then
1568    cat >> confdefs.h <<\EOF
1569#define HAVE_UNISTD_H 1
1570EOF
1571
1572  fi
1573
1574echo $ac_n "checking terminal interface""... $ac_c" 1>&6
1575echo "configure:1576: checking terminal interface" >&5
1576if eval "test \"`echo '$''{'ksh_cv_term_check'+set}'`\" = set"; then
1577  echo $ac_n "(cached) $ac_c" 1>&6
1578else
1579  cat > conftest.$ac_ext <<EOF
1580#line 1581 "configure"
1581#include "confdefs.h"
1582#include <termios.h>
1583int main() {
1584
1585        struct termios t;
1586#if defined(ultrix) || defined(__ultrix__)
1587         Termios in ultrix 4.2 botches type-ahead when going from cooked to
1588         cbreak mode.  The BSD tty interface works fine though, so use it
1589         (would be good to know if alter versions of ultrix work).
1590#endif /* ultrix */
1591         tcgetattr(0, &t); tcsetattr(0, TCSADRAIN, &t);
1592      
1593; return 0; }
1594EOF
1595if { (eval echo configure:1596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1596  rm -rf conftest*
1597  ksh_cv_term_check=termios
1598else
1599  echo "configure: failed program was:" >&5
1600  cat conftest.$ac_ext >&5
1601  rm -rf conftest*
1602  cat > conftest.$ac_ext <<EOF
1603#line 1604 "configure"
1604#include "confdefs.h"
1605#include <sys/ioctl.h>
1606int main() {
1607
1608	    struct sgttyb sb; ioctl(0, TIOCGETP, &sb);
1609#ifdef TIOCGATC
1610	    { struct ttychars lc; ioctl(0, TIOCGATC, &lc); }
1611#else /* TIOCGATC */
1612	    { struct tchars tc; ioctl(0, TIOCGETC, &tc); }
1613# ifdef TIOCGLTC
1614	    { struct ltchars ltc; ioctl(0, TIOCGLTC, &ltc); }
1615# endif /* TIOCGLTC */
1616#endif /* TIOCGATC */
1617	  
1618; return 0; }
1619EOF
1620if { (eval echo configure:1621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1621  rm -rf conftest*
1622  ksh_cv_term_check=bsd
1623else
1624  echo "configure: failed program was:" >&5
1625  cat conftest.$ac_ext >&5
1626  rm -rf conftest*
1627  ac_safe=`echo "termio.h" | sed 'y%./+-%__p_%'`
1628echo $ac_n "checking for termio.h""... $ac_c" 1>&6
1629echo "configure:1630: checking for termio.h" >&5
1630if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1631  echo $ac_n "(cached) $ac_c" 1>&6
1632else
1633  cat > conftest.$ac_ext <<EOF
1634#line 1635 "configure"
1635#include "confdefs.h"
1636#include <termio.h>
1637EOF
1638ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1639{ (eval echo configure:1640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1640ac_err=`grep -v '^ *+' conftest.out`
1641if test -z "$ac_err"; then
1642  rm -rf conftest*
1643  eval "ac_cv_header_$ac_safe=yes"
1644else
1645  echo "$ac_err" >&5
1646  echo "configure: failed program was:" >&5
1647  cat conftest.$ac_ext >&5
1648  rm -rf conftest*
1649  eval "ac_cv_header_$ac_safe=no"
1650fi
1651rm -f conftest*
1652fi
1653if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1654  echo "$ac_t""yes" 1>&6
1655  ksh_cv_term_check=termio
1656else
1657  echo "$ac_t""no" 1>&6
1658ksh_cv_term_check=sgtty
1659fi
1660
1661fi
1662rm -f conftest*
1663fi
1664rm -f conftest*
1665fi
1666
1667echo "$ac_t""$ksh_cv_term_check" 1>&6
1668  if test $ksh_cv_term_check = termios; then
1669    cat >> confdefs.h <<\EOF
1670#define HAVE_TERMIOS_H 1
1671EOF
1672
1673  elif test $ksh_cv_term_check = termio; then
1674    cat >> confdefs.h <<\EOF
1675#define HAVE_TERMIO_H 1
1676EOF
1677
1678  fi
1679
1680for ac_hdr in stddef.h stdlib.h string.h memory.h fcntl.h limits.h paths.h \
1681	sys/param.h sys/resource.h values.h ulimit.h sys/time.h
1682do
1683ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
1684echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
1685echo "configure:1686: checking for $ac_hdr" >&5
1686if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1687  echo $ac_n "(cached) $ac_c" 1>&6
1688else
1689  cat > conftest.$ac_ext <<EOF
1690#line 1691 "configure"
1691#include "confdefs.h"
1692#include <$ac_hdr>
1693EOF
1694ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1695{ (eval echo configure:1696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1696ac_err=`grep -v '^ *+' conftest.out`
1697if test -z "$ac_err"; then
1698  rm -rf conftest*
1699  eval "ac_cv_header_$ac_safe=yes"
1700else
1701  echo "$ac_err" >&5
1702  echo "configure: failed program was:" >&5
1703  cat conftest.$ac_ext >&5
1704  rm -rf conftest*
1705  eval "ac_cv_header_$ac_safe=no"
1706fi
1707rm -f conftest*
1708fi
1709if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1710  echo "$ac_t""yes" 1>&6
1711    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
1712  cat >> confdefs.h <<EOF
1713#define $ac_tr_hdr 1
1714EOF
1715
1716else
1717  echo "$ac_t""no" 1>&6
1718fi
1719done
1720
1721echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
1722echo "configure:1723: checking whether time.h and sys/time.h may both be included" >&5
1723if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
1724  echo $ac_n "(cached) $ac_c" 1>&6
1725else
1726  cat > conftest.$ac_ext <<EOF
1727#line 1728 "configure"
1728#include "confdefs.h"
1729#include <sys/types.h>
1730#include <sys/time.h>
1731#include <time.h>
1732int main() {
1733struct tm *tp;
1734; return 0; }
1735EOF
1736if { (eval echo configure:1737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1737  rm -rf conftest*
1738  ac_cv_header_time=yes
1739else
1740  echo "configure: failed program was:" >&5
1741  cat conftest.$ac_ext >&5
1742  rm -rf conftest*
1743  ac_cv_header_time=no
1744fi
1745rm -f conftest*
1746fi
1747
1748echo "$ac_t""$ac_cv_header_time" 1>&6
1749if test $ac_cv_header_time = yes; then
1750  cat >> confdefs.h <<\EOF
1751#define TIME_WITH_SYS_TIME 1
1752EOF
1753
1754fi
1755
1756echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
1757echo "configure:1758: checking for sys/wait.h that is POSIX.1 compatible" >&5
1758if eval "test \"`echo '$''{'ksh_cv_header_sys_wait_h'+set}'`\" = set"; then
1759  echo $ac_n "(cached) $ac_c" 1>&6
1760else
1761  cat > conftest.$ac_ext <<EOF
1762#line 1763 "configure"
1763#include "confdefs.h"
1764#include <sys/types.h>
1765#include <sys/wait.h>
1766#ifndef WEXITSTATUS
1767#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
1768#endif
1769#ifndef WIFEXITED
1770#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
1771#endif
1772int main() {
1773int s;
1774wait (&s);
1775s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
1776; return 0; }
1777EOF
1778if { (eval echo configure:1779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1779  rm -rf conftest*
1780  ksh_cv_header_sys_wait_h=yes
1781else
1782  echo "configure: failed program was:" >&5
1783  cat conftest.$ac_ext >&5
1784  rm -rf conftest*
1785  ksh_cv_header_sys_wait_h=no
1786fi
1787rm -f conftest*
1788fi
1789
1790echo "$ac_t""$ksh_cv_header_sys_wait_h" 1>&6
1791if test $ksh_cv_header_sys_wait_h = yes; then
1792  cat >> confdefs.h <<\EOF
1793#define POSIX_SYS_WAIT 1
1794EOF
1795  cat >> confdefs.h <<\EOF
1796#define HAVE_SYS_WAIT_H 1
1797EOF
1798else
1799  for ac_hdr in sys/wait.h
1800do
1801ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
1802echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
1803echo "configure:1804: checking for $ac_hdr" >&5
1804if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1805  echo $ac_n "(cached) $ac_c" 1>&6
1806else
1807  cat > conftest.$ac_ext <<EOF
1808#line 1809 "configure"
1809#include "confdefs.h"
1810#include <$ac_hdr>
1811EOF
1812ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1813{ (eval echo configure:1814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1814ac_err=`grep -v '^ *+' conftest.out`
1815if test -z "$ac_err"; then
1816  rm -rf conftest*
1817  eval "ac_cv_header_$ac_safe=yes"
1818else
1819  echo "$ac_err" >&5
1820  echo "configure: failed program was:" >&5
1821  cat conftest.$ac_ext >&5
1822  rm -rf conftest*
1823  eval "ac_cv_header_$ac_safe=no"
1824fi
1825rm -f conftest*
1826fi
1827if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1828  echo "$ac_t""yes" 1>&6
1829    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
1830  cat >> confdefs.h <<EOF
1831#define $ac_tr_hdr 1
1832EOF
1833
1834else
1835  echo "$ac_t""no" 1>&6
1836fi
1837done
1838fi
1839
1840echo $ac_n "checking for off_t in sys/types.h""... $ac_c" 1>&6
1841echo "configure:1842: checking for off_t in sys/types.h" >&5
1842if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
1843  echo $ac_n "(cached) $ac_c" 1>&6
1844else
1845  cat > conftest.$ac_ext <<EOF
1846#line 1847 "configure"
1847#include "confdefs.h"
1848#include <sys/types.h>
1849#if STDC_HEADERS
1850#include <stdlib.h>
1851#endif
1852
1853      
1854EOF
1855if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1856  egrep "(^|[^a-zA-Z0-9_])off_t([^a-zA-Z0-9_]|\$)" >/dev/null 2>&1; then
1857  rm -rf conftest*
1858  ac_cv_type_off_t=yes
1859else
1860  rm -rf conftest*
1861  ac_cv_type_off_t=no
1862fi
1863rm -f conftest*
1864
1865fi
1866
1867echo "$ac_t""$ac_cv_type_off_t" 1>&6
1868  if test $ac_cv_type_off_t = no; then
1869      cat >> confdefs.h <<\EOF
1870#define off_t long
1871EOF
1872
1873  fi
1874
1875echo $ac_n "checking for mode_t in sys/types.h""... $ac_c" 1>&6
1876echo "configure:1877: checking for mode_t in sys/types.h" >&5
1877if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
1878  echo $ac_n "(cached) $ac_c" 1>&6
1879else
1880  cat > conftest.$ac_ext <<EOF
1881#line 1882 "configure"
1882#include "confdefs.h"
1883#include <sys/types.h>
1884#if STDC_HEADERS
1885#include <stdlib.h>
1886#endif
1887
1888      
1889EOF
1890if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1891  egrep "(^|[^a-zA-Z0-9_])mode_t([^a-zA-Z0-9_]|\$)" >/dev/null 2>&1; then
1892  rm -rf conftest*
1893  ac_cv_type_mode_t=yes
1894else
1895  rm -rf conftest*
1896  ac_cv_type_mode_t=no
1897fi
1898rm -f conftest*
1899
1900fi
1901
1902echo "$ac_t""$ac_cv_type_mode_t" 1>&6
1903  if test $ac_cv_type_mode_t = no; then
1904      cat >> confdefs.h <<\EOF
1905#define mode_t short
1906EOF
1907
1908  fi
1909
1910echo $ac_n "checking for pid_t in sys/types.h""... $ac_c" 1>&6
1911echo "configure:1912: checking for pid_t in sys/types.h" >&5
1912if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
1913  echo $ac_n "(cached) $ac_c" 1>&6
1914else
1915  cat > conftest.$ac_ext <<EOF
1916#line 1917 "configure"
1917#include "confdefs.h"
1918#include <sys/types.h>
1919#if STDC_HEADERS
1920#include <stdlib.h>
1921#endif
1922
1923      
1924EOF
1925if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1926  egrep "(^|[^a-zA-Z0-9_])pid_t([^a-zA-Z0-9_]|\$)" >/dev/null 2>&1; then
1927  rm -rf conftest*
1928  ac_cv_type_pid_t=yes
1929else
1930  rm -rf conftest*
1931  ac_cv_type_pid_t=no
1932fi
1933rm -f conftest*
1934
1935fi
1936
1937echo "$ac_t""$ac_cv_type_pid_t" 1>&6
1938  if test $ac_cv_type_pid_t = no; then
1939      cat >> confdefs.h <<\EOF
1940#define pid_t int
1941EOF
1942
1943  fi
1944
1945echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
1946echo "configure:1947: checking for uid_t in sys/types.h" >&5
1947if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
1948  echo $ac_n "(cached) $ac_c" 1>&6
1949else
1950  cat > conftest.$ac_ext <<EOF
1951#line 1952 "configure"
1952#include "confdefs.h"
1953#include <sys/types.h>
1954#if STDC_HEADERS
1955#include <stdlib.h>
1956#endif
1957
1958      
1959EOF
1960if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
1961  egrep "(^|[^a-zA-Z0-9_])uid_t([^a-zA-Z0-9_]|\$)" >/dev/null 2>&1; then
1962  rm -rf conftest*
1963  ac_cv_type_uid_t=yes
1964else
1965  rm -rf conftest*
1966  ac_cv_type_uid_t=no
1967fi
1968rm -f conftest*
1969
1970fi
1971
1972echo "$ac_t""$ac_cv_type_uid_t" 1>&6
1973  if test $ac_cv_type_uid_t = no; then
1974      cat >> confdefs.h <<\EOF
1975#define uid_t int
1976EOF
1977
1978  fi
1979
1980if test $ac_cv_type_uid_t = no; then
1981  cat >> confdefs.h <<\EOF
1982#define gid_t int
1983EOF
1984
1985fi
1986
1987echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
1988echo "configure:2057: checking return type of signal handlers" >&5
1989if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
1990  echo $ac_n "(cached) $ac_c" 1>&6
1991else
1992  cat > conftest.$ac_ext <<EOF
1993#line 2062 "configure"
1994#include "confdefs.h"
1995#include <sys/types.h>
1996#include <signal.h>
1997#ifdef signal
1998#undef signal
1999#endif
2000#ifdef __cplusplus
2001extern "C" void (*signal (int, void (*)(int)))(int);
2002#else
2003void (*signal ()) ();
2004#endif
2005
2006int main() {
2007int i;
2008; return 0; }
2009EOF
2010if { (eval echo configure:2079: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2011  rm -rf conftest*
2012  ac_cv_type_signal=void
2013else
2014  echo "configure: failed program was:" >&5
2015  cat conftest.$ac_ext >&5
2016  rm -rf conftest*
2017  ac_cv_type_signal=int
2018fi
2019rm -f conftest*
2020fi
2021
2022echo "$ac_t""$ac_cv_type_signal" 1>&6
2023cat >> confdefs.h <<EOF
2024#define RETSIGTYPE $ac_cv_type_signal
2025EOF
2026
2027
2028case $ac_cv_type_signal in
2029int)  ksh_cv_signal_retval=0 ;;
2030void) ksh_cv_signal_retval=  ;;
2031*)
2032    { echo "configure: error: Internal erorr: unknown signal return type: $ac_cv_type_signal" 1>&2; exit 1; }
2033esac
2034cat >> confdefs.h <<EOF
2035#define RETSIGVAL $ksh_cv_signal_retval
2036EOF
2037
2038echo $ac_n "checking size of int""... $ac_c" 1>&6
2039echo "configure:2108: checking size of int" >&5
2040if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
2041  echo $ac_n "(cached) $ac_c" 1>&6
2042else
2043  if test "$cross_compiling" = yes; then
2044    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
2045else
2046cat > conftest.$ac_ext <<EOF
2047#line 2116 "configure"
2048#include "confdefs.h"
2049#include <stdio.h>
2050main()
2051{
2052  FILE *f=fopen("conftestval", "w");
2053  if (!f) exit(1);
2054  fprintf(f, "%d\n", sizeof(int));
2055  exit(0);
2056}
2057EOF
2058eval $ac_link
2059if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
2060  ac_cv_sizeof_int=`cat conftestval`
2061else
2062  ac_cv_sizeof_int=0
2063fi
2064fi
2065rm -fr conftest*
2066fi
2067echo "$ac_t""$ac_cv_sizeof_int" 1>&6
2068cat >> confdefs.h <<EOF
2069#define SIZEOF_INT $ac_cv_sizeof_int
2070EOF
2071
2072
2073echo $ac_n "checking size of long""... $ac_c" 1>&6
2074echo "configure:2143: checking size of long" >&5
2075if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
2076  echo $ac_n "(cached) $ac_c" 1>&6
2077else
2078  if test "$cross_compiling" = yes; then
2079    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
2080else
2081cat > conftest.$ac_ext <<EOF
2082#line 2151 "configure"
2083#include "confdefs.h"
2084#include <stdio.h>
2085main()
2086{
2087  FILE *f=fopen("conftestval", "w");
2088  if (!f) exit(1);
2089  fprintf(f, "%d\n", sizeof(long));
2090  exit(0);
2091}
2092EOF
2093eval $ac_link
2094if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
2095  ac_cv_sizeof_long=`cat conftestval`
2096else
2097  ac_cv_sizeof_long=0
2098fi
2099fi
2100rm -fr conftest*
2101fi
2102echo "$ac_t""$ac_cv_sizeof_long" 1>&6
2103cat >> confdefs.h <<EOF
2104#define SIZEOF_LONG $ac_cv_sizeof_long
2105EOF
2106
2107
2108echo $ac_n "checking for clock_t in any of <sys/types.h>, <sys/times.h> and <sys/time.h>""... $ac_c" 1>&6
2109echo "configure:2178: checking for clock_t in any of <sys/types.h>, <sys/times.h> and <sys/time.h>" >&5
2110if eval "test \"`echo '$''{'ac_cv_type_clock_t'+set}'`\" = set"; then
2111  echo $ac_n "(cached) $ac_c" 1>&6
2112else
2113  cat > conftest.$ac_ext <<EOF
2114#line 2183 "configure"
2115#include "confdefs.h"
2116#include <sys/types.h>
2117#if STDC_HEADERS
2118#include <stdlib.h>
2119#endif
2120
2121#ifdef HAVE_SYS_TIME_H
2122#include <sys/time.h>
2123#endif /* HAVE_SYS_TIME_H */
2124#include <sys/times.h>
2125	
2126      
2127EOF
2128if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
2129  egrep "(^|[^a-zA-Z0-9_])clock_t([^a-zA-Z0-9_]|\$)" >/dev/null 2>&1; then
2130  rm -rf conftest*
2131  ac_cv_type_clock_t=yes
2132else
2133  rm -rf conftest*
2134  ac_cv_type_clock_t=no
2135fi
2136rm -f conftest*
2137
2138fi
2139
2140echo "$ac_t""$ac_cv_type_clock_t" 1>&6
2141  if test $ac_cv_type_clock_t = no; then
2142      cat >> confdefs.h <<\EOF
2143#define clock_t INT32
2144EOF
2145
2146  fi
2147
2148echo $ac_n "checking for sigset_t in <sys/types.h> and <signal.h>""... $ac_c" 1>&6
2149echo "configure:2218: checking for sigset_t in <sys/types.h> and <signal.h>" >&5
2150if eval "test \"`echo '$''{'ac_cv_type_sigset_t'+set}'`\" = set"; then
2151  echo $ac_n "(cached) $ac_c" 1>&6
2152else
2153  cat > conftest.$ac_ext <<EOF
2154#line 2223 "configure"
2155#include "confdefs.h"
2156#include <sys/types.h>
2157#if STDC_HEADERS
2158#include <stdlib.h>
2159#endif
2160#include <signal.h>
2161      
2162EOF
2163if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
2164  egrep "(^|[^a-zA-Z0-9_])sigset_t([^a-zA-Z0-9_]|\$)" >/dev/null 2>&1; then
2165  rm -rf conftest*
2166  ac_cv_type_sigset_t=yes
2167else
2168  rm -rf conftest*
2169  ac_cv_type_sigset_t=no
2170fi
2171rm -f conftest*
2172
2173fi
2174
2175echo "$ac_t""$ac_cv_type_sigset_t" 1>&6
2176  if test $ac_cv_type_sigset_t = no; then
2177      cat >> confdefs.h <<\EOF
2178#define sigset_t unsigned
2179EOF
2180
2181  fi
2182
2183echo $ac_n "checking for rlim_t in <sys/types.h> and <sys/resource.h>""... $ac_c" 1>&6
2184echo "configure:2253: checking for rlim_t in <sys/types.h> and <sys/resource.h>" >&5
2185if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2186  echo $ac_n "(cached) $ac_c" 1>&6
2187else
2188  cat > conftest.$ac_ext <<EOF
2189#line 2258 "configure"
2190#include "confdefs.h"
2191#include <sys/types.h>
2192#if STDC_HEADERS
2193#include <stdlib.h>
2194#endif
2195#ifdef HAVE_SYS_RESOURCE_H
2196#include <sys/resource.h>
2197#endif
2198      
2199EOF
2200if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
2201  egrep "(^|[^a-zA-Z0-9_])rlim_t([^a-zA-Z0-9_]|\$)" >/dev/null 2>&1; then
2202  rm -rf conftest*
2203  ac_cv_type_rlim_t=yes
2204else
2205  rm -rf conftest*
2206  ac_cv_type_rlim_t=no
2207fi
2208rm -f conftest*
2209
2210fi
2211
2212echo "$ac_t""$ac_cv_type_rlim_t" 1>&6
2213     if test $ac_cv_type_rlim_t = no; then
2214    echo $ac_n "checking what to set rlim_t to""... $ac_c" 1>&6
2215echo "configure:2284: checking what to set rlim_t to" >&5
2216    if test $ac_cv_header_sys_resource_h = yes; then
2217      if eval "test \"`echo '$''{'ksh_cv_rlim_check'+set}'`\" = set"; then
2218  echo $ac_n "(cached) $ac_c" 1>&6
2219else
2220  if test "$cross_compiling" = yes; then
2221  { echo "configure: error: cannot determine type for rlimt_t when cross compiling" 1>&2; exit 1; }
2222
2223else
2224cat > conftest.$ac_ext <<EOF
2225#line 2294 "configure"
2226#include "confdefs.h"
2227
2228#include <sys/types.h>
2229#include <sys/time.h>
2230#include <sys/resource.h>
2231	    main()
2232	    {
2233	      struct rlimit rl;
2234	      if (sizeof(rl.rlim_cur) == sizeof(quad_t))
2235		exit(0);
2236	      exit(1);
2237	    }
2238	  
2239EOF
2240eval $ac_link
2241if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
2242  ksh_cv_rlim_check=quad_t
2243else
2244  ksh_cv_rlim_check=long
2245fi
2246fi
2247rm -fr conftest*
2248fi
2249    else
2250      ksh_cv_rlim_check=long
2251    fi
2252    echo "$ac_t""$ksh_cv_rlim_check" 1>&6
2253    cat >> confdefs.h <<EOF
2254#define rlim_t $ksh_cv_rlim_check
2255EOF
2256
2257  fi
2258
2259echo $ac_n "checking for working memmove""... $ac_c" 1>&6
2260echo "configure:2329: checking for working memmove" >&5
2261if eval "test \"`echo '$''{'ksh_cv_func_memmove'+set}'`\" = set"; then
2262  echo $ac_n "(cached) $ac_c" 1>&6
2263else
2264  if test "$cross_compiling" = yes; then
2265  echo "configure: warning: assuming memmove broken" 1>&2; ksh_cv_func_memmove=no
2266else
2267cat > conftest.$ac_ext <<EOF
2268#line 2337 "configure"
2269#include "confdefs.h"
2270
2271#ifdef HAVE_STRING_H
2272# include <string.h>
2273#else
2274# include <strings.h>
2275#endif
2276#ifdef HAVE_MEMORY_H
2277# include <memory.h>
2278#endif
2279        int
2280        main()
2281        {
2282	  char buf[16];
2283	  strcpy(buf, "abcdefABCDEF");
2284	  memmove(buf + 4, buf, 6);
2285	  if (strcmp(buf, "abcdabcdefEF"))
2286	    exit(1);
2287	  memmove(buf, buf + 4, 6);
2288	  if (strcmp(buf, "abcdefcdefEF"))
2289	    exit(2);
2290	  exit(0);
2291	  return 0;
2292	}
2293EOF
2294eval $ac_link
2295if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
2296  ksh_cv_func_memmove=yes
2297else
2298  ksh_cv_func_memmove=no
2299fi
2300fi
2301rm -fr conftest*
2302fi
2303
2304echo "$ac_t""$ksh_cv_func_memmove" 1>&6
2305  if test $ksh_cv_func_memmove = yes; then
2306    cat >> confdefs.h <<\EOF
2307#define HAVE_MEMMOVE 1
2308EOF
2309
2310  else
2311    echo $ac_n "checking for working bcopy""... $ac_c" 1>&6
2312echo "configure:2381: checking for working bcopy" >&5
2313if eval "test \"`echo '$''{'ksh_cv_func_bcopy'+set}'`\" = set"; then
2314  echo $ac_n "(cached) $ac_c" 1>&6
2315else
2316  if test "$cross_compiling" = yes; then
2317  echo "configure: warning: assuming bcopy broken" 1>&2; ksh_cv_func_bcopy=no
2318else
2319cat > conftest.$ac_ext <<EOF
2320#line 2389 "configure"
2321#include "confdefs.h"
2322
2323#ifdef HAVE_STRING_H
2324# include <string.h>
2325#else
2326# include <strings.h>
2327#endif
2328#ifdef HAVE_MEMORY_H
2329# include <memory.h>
2330#endif
2331	  int
2332	  main()
2333	  {
2334	    char buf[16];
2335	    strcpy(buf, "abcdefABCDEF");
2336	    bcopy(buf, buf + 4, 6);
2337	    if (strcmp(buf, "abcdabcdefEF"))
2338	      exit(1);
2339	    bcopy(buf + 4, buf, 6);
2340	    if (strcmp(buf, "abcdefcdefEF"))
2341	      exit(2);
2342	    exit(0);
2343	  }
2344EOF
2345eval $ac_link
2346if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
2347  ksh_cv_func_bcopy=yes
2348else
2349  ksh_cv_func_bcopy=no
2350fi
2351fi
2352rm -fr conftest*
2353fi
2354
2355echo "$ac_t""$ksh_cv_func_bcopy" 1>&6
2356    if test $ksh_cv_func_bcopy = yes; then
2357      cat >> confdefs.h <<\EOF
2358#define HAVE_BCOPY 1
2359EOF
2360
2361    fi
2362  fi
2363
2364echo $ac_n "checking for memset""... $ac_c" 1>&6
2365echo "configure:2434: checking for memset" >&5
2366if eval "test \"`echo '$''{'ksh_cv_func_memset'+set}'`\" = set"; then
2367  echo $ac_n "(cached) $ac_c" 1>&6
2368else
2369  cat > conftest.$ac_ext <<EOF
2370#line 2439 "configure"
2371#include "confdefs.h"
2372
2373#ifdef HAVE_STRING_H
2374# include <string.h>
2375#else
2376# include <strings.h>
2377#endif
2378#ifdef HAVE_MEMORY_H
2379# include <memory.h>
2380#endif
2381       
2382int main() {
2383
2384       char buf[16]; memset(buf, 'x', 7); printf("%7s", buf);
2385; return 0; }
2386EOF
2387if { (eval echo configure:2456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2388  rm -rf conftest*
2389  ksh_cv_func_memset=yes
2390else
2391  echo "configure: failed program was:" >&5
2392  cat conftest.$ac_ext >&5
2393  rm -rf conftest*
2394  ksh_cv_func_memset=no
2395fi
2396rm -f conftest*
2397fi
2398
2399echo "$ac_t""$ksh_cv_func_memset" 1>&6
2400  if test $ksh_cv_func_memset = yes; then
2401    cat >> confdefs.h <<\EOF
2402#define HAVE_MEMSET 1
2403EOF
2404
2405  fi
2406
2407for ac_func in confstr dup2 flock getcwd getwd killpg nice \
2408	setrlimit strerror strcasecmp strstr sysconf tcsetpgrp \
2409	ulimit waitpid wait3
2410do
2411echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
2412echo "configure:2481: checking for $ac_func" >&5
2413if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
2414  echo $ac_n "(cached) $ac_c" 1>&6
2415else
2416  cat > conftest.$ac_ext <<EOF
2417#line 2486 "configure"
2418#include "confdefs.h"
2419/* System header to define __stub macros and hopefully few prototypes,
2420    which can conflict with char $ac_func(); below.  */
2421#include <assert.h>
2422/* Override any gcc2 internal prototype to avoid an error.  */
2423/* We use char because int might match the return type of a gcc2
2424    builtin and then its argument prototype would still apply.  */
2425char $ac_func();
2426
2427int main() {
2428
2429/* The GNU C library defines this for functions which it implements
2430    to always fail with ENOSYS.  Some functions are actually named
2431    something starting with __ and the normal name is an alias.  */
2432#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
2433choke me
2434#else
2435$ac_func();
2436#endif
2437
2438; return 0; }
2439EOF
2440if { (eval echo configure:2509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2441  rm -rf conftest*
2442  eval "ac_cv_func_$ac_func=yes"
2443else
2444  echo "configure: failed program was:" >&5
2445  cat conftest.$ac_ext >&5
2446  rm -rf conftest*
2447  eval "ac_cv_func_$ac_func=no"
2448fi
2449rm -f conftest*
2450fi
2451
2452if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
2453  echo "$ac_t""yes" 1>&6
2454    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2455  cat >> confdefs.h <<EOF
2456#define $ac_tr_func 1
2457EOF
2458
2459else
2460  echo "$ac_t""no" 1>&6
2461fi
2462done
2463
2464for ac_func in sigsetjmp _setjmp
2465do
2466echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
2467echo "configure:2536: checking for $ac_func" >&5
2468if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
2469  echo $ac_n "(cached) $ac_c" 1>&6
2470else
2471  cat > conftest.$ac_ext <<EOF
2472#line 2541 "configure"
2473#include "confdefs.h"
2474/* System header to define __stub macros and hopefully few prototypes,
2475    which can conflict with char $ac_func(); below.  */
2476#include <assert.h>
2477/* Override any gcc2 internal prototype to avoid an error.  */
2478/* We use char because int might match the return type of a gcc2
2479    builtin and then its argument prototype would still apply.  */
2480char $ac_func();
2481
2482int main() {
2483
2484/* The GNU C library defines this for functions which it implements
2485    to always fail with ENOSYS.  Some functions are actually named
2486    something starting with __ and the normal name is an alias.  */
2487#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
2488choke me
2489#else
2490$ac_func();
2491#endif
2492
2493; return 0; }
2494EOF
2495if { (eval echo configure:2564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2496  rm -rf conftest*
2497  eval "ac_cv_func_$ac_func=yes"
2498else
2499  echo "configure: failed program was:" >&5
2500  cat conftest.$ac_ext >&5
2501  rm -rf conftest*
2502  eval "ac_cv_func_$ac_func=no"
2503fi
2504rm -f conftest*
2505fi
2506
2507if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
2508  echo "$ac_t""yes" 1>&6
2509    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2510  cat >> confdefs.h <<EOF
2511#define $ac_tr_func 1
2512EOF
2513 break
2514else
2515  echo "$ac_t""no" 1>&6
2516fi
2517done
2518
2519for ac_func in valloc getpagesize
2520do
2521echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
2522echo "configure:2591: checking for $ac_func" >&5
2523if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
2524  echo $ac_n "(cached) $ac_c" 1>&6
2525else
2526  cat > conftest.$ac_ext <<EOF
2527#line 2596 "configure"
2528#include "confdefs.h"
2529/* System header to define __stub macros and hopefully few prototypes,
2530    which can conflict with char $ac_func(); below.  */
2531#include <assert.h>
2532/* Override any gcc2 internal prototype to avoid an error.  */
2533/* We use char because int might match the return type of a gcc2
2534    builtin and then its argument prototype would still apply.  */
2535char $ac_func();
2536
2537int main() {
2538
2539/* The GNU C library defines this for functions which it implements
2540    to always fail with ENOSYS.  Some functions are actually named
2541    something starting with __ and the normal name is an alias.  */
2542#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
2543choke me
2544#else
2545$ac_func();
2546#endif
2547
2548; return 0; }
2549EOF
2550if { (eval echo configure:2619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2551  rm -rf conftest*
2552  eval "ac_cv_func_$ac_func=yes"
2553else
2554  echo "configure: failed program was:" >&5
2555  cat conftest.$ac_ext >&5
2556  rm -rf conftest*
2557  eval "ac_cv_func_$ac_func=no"
2558fi
2559rm -f conftest*
2560fi
2561
2562if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
2563  echo "$ac_t""yes" 1>&6
2564    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2565  cat >> confdefs.h <<EOF
2566#define $ac_tr_func 1
2567EOF
2568
2569else
2570  echo "$ac_t""no" 1>&6
2571fi
2572done
2573
2574echo $ac_n "checking for working mmap""... $ac_c" 1>&6
2575echo "configure:2644: checking for working mmap" >&5
2576if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then
2577  echo $ac_n "(cached) $ac_c" 1>&6
2578else
2579  if test "$cross_compiling" = yes; then
2580  ac_cv_func_mmap=no
2581else
2582cat > conftest.$ac_ext <<EOF
2583#line 2652 "configure"
2584#include "confdefs.h"
2585
2586/* Thanks to Mike Haertel and Jim Avera for this test. */
2587#include <sys/types.h>
2588#include <fcntl.h>
2589#include <sys/mman.h>
2590
2591#ifndef HAVE_GETPAGESIZE
2592# include <sys/param.h>
2593# ifdef EXEC_PAGESIZE
2594#  define getpagesize() EXEC_PAGESIZE
2595# else
2596#  ifdef NBPG
2597#   define getpagesize() NBPG * CLSIZE
2598#   ifndef CLSIZE
2599#    define CLSIZE 1
2600#   endif
2601#  else
2602#   ifdef NBPC
2603#    define getpagesize() NBPC
2604#   else
2605#    define getpagesize() PAGESIZE /* SVR4 */
2606#   endif
2607#  endif
2608# endif
2609#endif
2610
2611#ifndef HAVE_VALLOC
2612# define valloc malloc
2613#endif
2614
2615#ifdef __cplusplus
2616extern "C" { void *valloc(unsigned), *malloc(unsigned); }
2617#else
2618char *valloc(), *malloc();
2619#endif
2620
2621#ifndef MAP_FILE
2622# define MAP_FILE 0
2623#endif /* MAP_FILE */
2624
2625int
2626main()
2627{
2628  char *buf1, *buf2, *buf3;
2629  int i = getpagesize(), j;
2630  int i2 = i * 2;
2631  int fd;
2632
2633  buf1 = (char *)valloc(i2);
2634  buf2 = (char *)valloc(i);
2635  buf3 = (char *)malloc(i2);
2636  for (j = 0; j < i2; ++j)
2637    *(buf1 + j) = rand();
2638  fd = open("conftestmmap", O_CREAT | O_RDWR, 0666);
2639  write(fd, buf1, i2);
2640  mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FILE | MAP_FIXED | MAP_PRIVATE, fd, 0);
2641  for (j = 0; j < i; ++j)
2642    if (*(buf1 + j) != *(buf2 + j))
2643      exit(1);
2644  lseek(fd, (long)i, 0);
2645  read(fd, buf2, i); /* read into mapped memory -- file should not change */
2646  /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */
2647  lseek(fd, (long)0, 0);
2648  read(fd, buf3, i2);
2649  for (j = 0; j < i2; ++j)
2650    if (*(buf1 + j) != *(buf3 + j))
2651      exit(1);
2652  exit(0);
2653}
2654
2655EOF
2656eval $ac_link
2657if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
2658  ac_cv_func_mmap=yes
2659else
2660  ac_cv_func_mmap=no
2661fi
2662fi
2663rm -fr conftest*
2664fi
2665
2666echo "$ac_t""$ac_cv_func_mmap" 1>&6
2667if test $ac_cv_func_mmap = yes; then
2668  cat >> confdefs.h <<\EOF
2669#define HAVE_MMAP 1
2670EOF
2671
2672fi
2673
2674echo $ac_n "checking for lstat""... $ac_c" 1>&6
2675echo "configure:2744: checking for lstat" >&5
2676if eval "test \"`echo '$''{'ksh_cv_func_lstat'+set}'`\" = set"; then
2677  echo $ac_n "(cached) $ac_c" 1>&6
2678else
2679  cat > conftest.$ac_ext <<EOF
2680#line 2749 "configure"
2681#include "confdefs.h"
2682
2683#include <sys/types.h>
2684#include <sys/stat.h>
2685	
2686int main() {
2687
2688	  struct stat statb;
2689	  lstat("/", &statb);
2690	
2691; return 0; }
2692EOF
2693if { (eval echo configure:2762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2694  rm -rf conftest*
2695  ksh_cv_func_lstat=yes
2696else
2697  echo "configure: failed program was:" >&5
2698  cat conftest.$ac_ext >&5
2699  rm -rf conftest*
2700  ksh_cv_func_lstat=no
2701fi
2702rm -f conftest*
2703fi
2704
2705echo "$ac_t""$ksh_cv_func_lstat" 1>&6
2706if test $ksh_cv_func_lstat = yes; then
2707  cat >> confdefs.h <<\EOF
2708#define HAVE_LSTAT 1
2709EOF
2710
2711fi
2712
2713echo $ac_n "checking for sys_errlist declaration in errno.h""... $ac_c" 1>&6
2714echo "configure:2783: checking for sys_errlist declaration in errno.h" >&5
2715if eval "test \"`echo '$''{'ksh_cv_decl_sys_errlist'+set}'`\" = set"; then
2716  echo $ac_n "(cached) $ac_c" 1>&6
2717else
2718  cat > conftest.$ac_ext <<EOF
2719#line 2788 "configure"
2720#include "confdefs.h"
2721#include <errno.h>
2722int main() {
2723char *msg = *(sys_errlist + 1); if (msg && *msg) return 12; 
2724; return 0; }
2725EOF
2726if { (eval echo configure:2795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2727  rm -rf conftest*
2728  ksh_cv_decl_sys_errlist=yes
2729else
2730  echo "configure: failed program was:" >&5
2731  cat conftest.$ac_ext >&5
2732  rm -rf conftest*
2733  ksh_cv_decl_sys_errlist=no
2734fi
2735rm -f conftest*
2736fi
2737
2738echo "$ac_t""$ksh_cv_decl_sys_errlist" 1>&6
2739  if test $ksh_cv_decl_sys_errlist = yes; then
2740    cat >> confdefs.h <<\EOF
2741#define SYS_ERRLIST_DECLARED 1
2742EOF
2743
2744    cat >> confdefs.h <<\EOF
2745#define HAVE_SYS_ERRLIST 1
2746EOF
2747
2748  else
2749    echo $ac_n "checking for sys_errlist in library""... $ac_c" 1>&6
2750echo "configure:2819: checking for sys_errlist in library" >&5
2751if eval "test \"`echo '$''{'ksh_cv_var_sys_errlist'+set}'`\" = set"; then
2752  echo $ac_n "(cached) $ac_c" 1>&6
2753else
2754  cat > conftest.$ac_ext <<EOF
2755#line 2824 "configure"
2756#include "confdefs.h"
2757
2758int main() {
2759
2760	    extern char *sys_errlist[];
2761	    extern int sys_nerr;
2762	    char *p;
2763	    p = sys_errlist[sys_nerr - 1];
2764	    if (p) return 12;
2765	  
2766; return 0; }
2767EOF
2768if { (eval echo configure:2837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2769  rm -rf conftest*
2770  ksh_cv_var_sys_errlist=yes
2771else
2772  echo "configure: failed program was:" >&5
2773  cat conftest.$ac_ext >&5
2774  rm -rf conftest*
2775  ksh_cv_var_sys_errlist=no
2776fi
2777rm -f conftest*
2778fi
2779
2780echo "$ac_t""$ksh_cv_var_sys_errlist" 1>&6
2781    if test $ksh_cv_var_sys_errlist = yes; then
2782      cat >> confdefs.h <<\EOF
2783#define HAVE_SYS_ERRLIST 1
2784EOF
2785
2786    fi
2787  fi
2788
2789echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
2790echo "configure:2859: checking for sys_siglist declaration in signal.h or unistd.h" >&5
2791if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then
2792  echo $ac_n "(cached) $ac_c" 1>&6
2793else
2794  cat > conftest.$ac_ext <<EOF
2795#line 2864 "configure"
2796#include "confdefs.h"
2797#include <sys/types.h>
2798#include <signal.h>
2799/* NetBSD declares sys_siglist in unistd.h.  */
2800#ifdef HAVE_UNISTD_H
2801#include <unistd.h>
2802#endif
2803int main() {
2804char *msg = *(sys_siglist + 1);
2805; return 0; }
2806EOF
2807if { (eval echo configure:2876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2808  rm -rf conftest*
2809  ac_cv_decl_sys_siglist=yes
2810else
2811  echo "configure: failed program was:" >&5
2812  cat conftest.$ac_ext >&5
2813  rm -rf conftest*
2814  ac_cv_decl_sys_siglist=no
2815fi
2816rm -f conftest*
2817fi
2818
2819echo "$ac_t""$ac_cv_decl_sys_siglist" 1>&6
2820if test $ac_cv_decl_sys_siglist = yes; then
2821  cat >> confdefs.h <<\EOF
2822#define SYS_SIGLIST_DECLARED 1
2823EOF
2824
2825fi
2826
2827  if test ac_cv_decl_sys_siglist = yes; then
2828    cat >> confdefs.h <<\EOF
2829#define HAVE_SYS_SIGLIST 1
2830EOF
2831
2832  else
2833    echo $ac_n "checking for sys_siglist in library""... $ac_c" 1>&6
2834echo "configure:2903: checking for sys_siglist in library" >&5
2835if eval "test \"`echo '$''{'ksh_cv_var_sys_siglist'+set}'`\" = set"; then
2836  echo $ac_n "(cached) $ac_c" 1>&6
2837else
2838  cat > conftest.$ac_ext <<EOF
2839#line 2908 "configure"
2840#include "confdefs.h"
2841
2842int main() {
2843
2844	  extern char *sys_siglist[];
2845	  char *p = sys_siglist[2];
2846	  if (p)
2847		  return 12;
2848	  
2849; return 0; }
2850EOF
2851if { (eval echo configure:2920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2852  rm -rf conftest*
2853  ksh_cv_var_sys_siglist=yes
2854else
2855  echo "configure: failed program was:" >&5
2856  cat conftest.$ac_ext >&5
2857  rm -rf conftest*
2858  ksh_cv_var_sys_siglist=no
2859fi
2860rm -f conftest*
2861fi
2862
2863echo "$ac_t""$ksh_cv_var_sys_siglist" 1>&6
2864    if test $ksh_cv_var_sys_siglist = yes; then
2865      cat >> confdefs.h <<\EOF
2866#define HAVE_SYS_SIGLIST 1
2867EOF
2868
2869    fi
2870  fi
2871
2872echo $ac_n "checking time() declaration in time.h""... $ac_c" 1>&6
2873echo "configure:2942: checking time() declaration in time.h" >&5
2874if eval "test \"`echo '$''{'ksh_cv_time_delcared'+set}'`\" = set"; then
2875  echo $ac_n "(cached) $ac_c" 1>&6
2876else
2877  cat > conftest.$ac_ext <<EOF
2878#line 2947 "configure"
2879#include "confdefs.h"
2880#include <sys/types.h>
2881#include <time.h>
2882int main() {
2883time_t (*f)() = time; if (f) return 12;
2884; return 0; }
2885EOF
2886if { (eval echo configure:2955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2887  rm -rf conftest*
2888  ksh_cv_time_delcared=yes
2889else
2890  echo "configure: failed program was:" >&5
2891  cat conftest.$ac_ext >&5
2892  rm -rf conftest*
2893  ksh_cv_time_delcared=no
2894fi
2895rm -f conftest*
2896fi
2897
2898echo "$ac_t""$ksh_cv_time_delcared" 1>&6
2899  if test $ksh_cv_time_delcared = yes; then
2900    cat >> confdefs.h <<\EOF
2901#define TIME_DECLARED 1
2902EOF
2903
2904  fi
2905
2906echo $ac_n "checking if times() is present/working""... $ac_c" 1>&6
2907echo "configure:2976: checking if times() is present/working" >&5
2908if eval "test \"`echo '$''{'ksh_cv_func_times_ok'+set}'`\" = set"; then
2909  echo $ac_n "(cached) $ac_c" 1>&6
2910else
2911  if test "$cross_compiling" = yes; then
2912  { echo "configure: error: cannot determine if times works when cross compiling" 1>&2; exit 1; }
2913
2914else
2915cat > conftest.$ac_ext <<EOF
2916#line 2985 "configure"
2917#include "confdefs.h"
2918
2919#include <sys/types.h>
2920#include <sys/times.h>
2921/* if missing, clock_t is defined to be INT32 */
2922#if SIZEOF_INT == 4
2923# define INT32	int
2924#else /* SIZEOF_INT */
2925# if SIZEOF_LONG == 4
2926#  define INT32	long
2927# else /* SIZEOF_LONG */
2928   #error cannot find 32 bit type...
2929# endif /* SIZEOF_LONG */
2930#endif /* SIZEOF_INT */
2931	  main()
2932	  {
2933	    extern clock_t times();
2934	    struct tms tms;
2935	    times(&tms);
2936	    sleep(1);
2937	    if (times(&tms) == 0)
2938	      exit(1);
2939	    exit(0);
2940	  }
2941	
2942EOF
2943eval $ac_link
2944if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
2945  ksh_cv_func_times_ok=yes
2946else
2947  ksh_cv_func_times_ok=no
2948fi
2949fi
2950rm -fr conftest*
2951fi
2952
2953echo "$ac_t""$ksh_cv_func_times_ok" 1>&6
2954  if test $ksh_cv_func_times_ok = no; then
2955    cat >> confdefs.h <<\EOF
2956#define TIMES_BROKEN 1
2957EOF
2958
2959    for ac_func in getrusage
2960do
2961echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
2962echo "configure:3031: checking for $ac_func" >&5
2963if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
2964  echo $ac_n "(cached) $ac_c" 1>&6
2965else
2966  cat > conftest.$ac_ext <<EOF
2967#line 3036 "configure"
2968#include "confdefs.h"
2969/* System header to define __stub macros and hopefully few prototypes,
2970    which can conflict with char $ac_func(); below.  */
2971#include <assert.h>
2972/* Override any gcc2 internal prototype to avoid an error.  */
2973/* We use char because int might match the return type of a gcc2
2974    builtin and then its argument prototype would still apply.  */
2975char $ac_func();
2976
2977int main() {
2978
2979/* The GNU C library defines this for functions which it implements
2980    to always fail with ENOSYS.  Some functions are actually named
2981    something starting with __ and the normal name is an alias.  */
2982#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
2983choke me
2984#else
2985$ac_func();
2986#endif
2987
2988; return 0; }
2989EOF
2990if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2991  rm -rf conftest*
2992  eval "ac_cv_func_$ac_func=yes"
2993else
2994  echo "configure: failed program was:" >&5
2995  cat conftest.$ac_ext >&5
2996  rm -rf conftest*
2997  eval "ac_cv_func_$ac_func=no"
2998fi
2999rm -f conftest*
3000fi
3001
3002if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
3003  echo "$ac_t""yes" 1>&6
3004    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
3005  cat >> confdefs.h <<EOF
3006#define $ac_tr_func 1
3007EOF
3008
3009else
3010  echo "$ac_t""no" 1>&6
3011fi
3012done
3013
3014  fi
3015
3016echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
3017echo "configure:3086: checking whether stat file-mode macros are broken" >&5
3018if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
3019  echo $ac_n "(cached) $ac_c" 1>&6
3020else
3021  cat > conftest.$ac_ext <<EOF
3022#line 3091 "configure"
3023#include "confdefs.h"
3024#include <sys/types.h>
3025#include <sys/stat.h>
3026
3027#if defined(S_ISBLK) && defined(S_IFDIR)
3028# if S_ISBLK (S_IFDIR)
3029You lose.
3030# endif
3031#endif
3032
3033#if defined(S_ISBLK) && defined(S_IFCHR)
3034# if S_ISBLK (S_IFCHR)
3035You lose.
3036# endif
3037#endif
3038
3039#if defined(S_ISLNK) && defined(S_IFREG)
3040# if S_ISLNK (S_IFREG)
3041You lose.
3042# endif
3043#endif
3044
3045#if defined(S_ISSOCK) && defined(S_IFREG)
3046# if S_ISSOCK (S_IFREG)
3047You lose.
3048# endif
3049#endif
3050
3051#if defined(S_ISSOCK) && defined(S_IFIFO)
3052# if S_ISSOCK (S_IFIFO)
3053You lose.
3054# endif
3055#endif
3056
3057EOF
3058if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3059  egrep "You lose" >/dev/null 2>&1; then
3060  rm -rf conftest*
3061  ac_cv_header_stat_broken=yes
3062else
3063  rm -rf conftest*
3064  ac_cv_header_stat_broken=no
3065fi
3066rm -f conftest*
3067
3068fi
3069
3070echo "$ac_t""$ac_cv_header_stat_broken" 1>&6
3071if test $ac_cv_header_stat_broken = yes; then
3072  cat >> confdefs.h <<\EOF
3073#define STAT_MACROS_BROKEN 1
3074EOF
3075
3076fi
3077
3078echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
3079echo "configure:3148: checking for st_rdev in struct stat" >&5
3080if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
3081  echo $ac_n "(cached) $ac_c" 1>&6
3082else
3083  cat > conftest.$ac_ext <<EOF
3084#line 3153 "configure"
3085#include "confdefs.h"
3086#include <sys/types.h>
3087#include <sys/stat.h>
3088int main() {
3089struct stat s; s.st_rdev;
3090; return 0; }
3091EOF
3092if { (eval echo configure:3161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3093  rm -rf conftest*
3094  ac_cv_struct_st_rdev=yes
3095else
3096  echo "configure: failed program was:" >&5
3097  cat conftest.$ac_ext >&5
3098  rm -rf conftest*
3099  ac_cv_struct_st_rdev=no
3100fi
3101rm -f conftest*
3102fi
3103
3104echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6
3105if test $ac_cv_struct_st_rdev = yes; then
3106  cat >> confdefs.h <<\EOF
3107#define HAVE_ST_RDEV 1
3108EOF
3109
3110fi
3111
3112echo $ac_n "checking for working const""... $ac_c" 1>&6
3113echo "configure:3182: checking for working const" >&5
3114if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
3115  echo $ac_n "(cached) $ac_c" 1>&6
3116else
3117  cat > conftest.$ac_ext <<EOF
3118#line 3187 "configure"
3119#include "confdefs.h"
3120
3121int main() {
3122
3123/* Ultrix mips cc rejects this.  */
3124typedef int charset[2]; const charset x;
3125/* SunOS 4.1.1 cc rejects this.  */
3126char const *const *ccp;
3127char **p;
3128/* NEC SVR4.0.2 mips cc rejects this.  */
3129struct point {int x, y;};
3130static struct point const zero = {0,0};
3131/* AIX XL C 1.02.0.0 rejects this.
3132   It does not let you subtract one const X* pointer from another in an arm
3133   of an if-expression whose if-part is not a constant expression */
3134const char *g = "string";
3135ccp = &g + (g ? g-g : 0);
3136/* HPUX 7.0 cc rejects these. */
3137++ccp;
3138p = (char**) ccp;
3139ccp = (char const *const *) p;
3140{ /* SCO 3.2v4 cc rejects this.  */
3141  char *t;
3142  char const *s = 0 ? (char *) 0 : (char const *) 0;
3143
3144  *t++ = 0;
3145}
3146{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
3147  int x[] = {25, 17};
3148  const int *foo = &x[0];
3149  ++foo;
3150}
3151{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
3152  typedef const int *iptr;
3153  iptr p = 0;
3154  ++p;
3155}
3156{ /* AIX XL C 1.02.0.0 rejects this saying
3157     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
3158  struct s { int j; const int *ap[3]; };
3159  struct s *b; b->j = 5;
3160}
3161{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
3162  const int foo = 10;
3163}
3164
3165; return 0; }
3166EOF
3167if { (eval echo configure:3236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3168  rm -rf conftest*
3169  ac_cv_c_const=yes
3170else
3171  echo "configure: failed program was:" >&5
3172  cat conftest.$ac_ext >&5
3173  rm -rf conftest*
3174  ac_cv_c_const=no
3175fi
3176rm -f conftest*
3177fi
3178
3179echo "$ac_t""$ac_cv_c_const" 1>&6
3180if test $ac_cv_c_const = no; then
3181  cat >> confdefs.h <<\EOF
3182#define const
3183EOF
3184
3185fi
3186
3187echo $ac_n "checking if compiler understands void""... $ac_c" 1>&6
3188echo "configure:3257: checking if compiler understands void" >&5
3189if eval "test \"`echo '$''{'ksh_cv_c_void'+set}'`\" = set"; then
3190  echo $ac_n "(cached) $ac_c" 1>&6
3191else
3192  cat > conftest.$ac_ext <<EOF
3193#line 3262 "configure"
3194#include "confdefs.h"
3195
3196	void foo() { }
3197	/* Some compilers (old pcc ones) like "void *a;", but a can't be used */
3198	void *bar(a) void *a; { int *b = (int *) a; *b = 1; return a; }
3199      
3200int main() {
3201
3202; return 0; }
3203EOF
3204if { (eval echo configure:3273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3205  rm -rf conftest*
3206  ksh_cv_c_void=yes
3207else
3208  echo "configure: failed program was:" >&5
3209  cat conftest.$ac_ext >&5
3210  rm -rf conftest*
3211  ksh_cv_c_void=no
3212fi
3213rm -f conftest*
3214fi
3215
3216echo "$ac_t""$ksh_cv_c_void" 1>&6
3217  if test $ksh_cv_c_void = yes; then
3218    :
3219  else
3220    cat >> confdefs.h <<\EOF
3221#define void char
3222EOF
3223
3224  fi
3225
3226echo $ac_n "checking if compiler understands volatile""... $ac_c" 1>&6
3227echo "configure:3296: checking if compiler understands volatile" >&5
3228if eval "test \"`echo '$''{'ksh_cv_c_volatile'+set}'`\" = set"; then
3229  echo $ac_n "(cached) $ac_c" 1>&6
3230else
3231  cat > conftest.$ac_ext <<EOF
3232#line 3301 "configure"
3233#include "confdefs.h"
3234int x, y, z;
3235int main() {
3236volatile int a; int * volatile b = x ? &y : &z;
3237      /* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
3238      *b = 0;
3239; return 0; }
3240EOF
3241if { (eval echo configure:3310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3242  rm -rf conftest*
3243  ksh_cv_c_volatile=yes
3244else
3245  echo "configure: failed program was:" >&5
3246  cat conftest.$ac_ext >&5
3247  rm -rf conftest*
3248  ksh_cv_c_volatile=no
3249fi
3250rm -f conftest*
3251fi
3252
3253echo "$ac_t""$ksh_cv_c_volatile" 1>&6
3254  if test $ksh_cv_c_volatile = yes; then
3255    :
3256  else
3257    cat >> confdefs.h <<\EOF
3258#define volatile
3259EOF
3260
3261  fi
3262
3263echo $ac_n "checking if compiler understands prototypes""... $ac_c" 1>&6
3264echo "configure:3333: checking if compiler understands prototypes" >&5
3265if eval "test \"`echo '$''{'ksh_cv_c_prototypes'+set}'`\" = set"; then
3266  echo $ac_n "(cached) $ac_c" 1>&6
3267else
3268  cat > conftest.$ac_ext <<EOF
3269#line 3338 "configure"
3270#include "confdefs.h"
3271
3272#include <stdarg.h>
3273void foo(char *fmt, ...);
3274int bar(int a, char b, char *c);
3275int bar(a, b, c) int a; char b; char *c;
3276{ foo("%d%c%s\n", a, b, c); return a + b + *c; }
3277void foo(char *fmt, ...) { va_list a; va_start(a, fmt); va_end(a); }
3278      
3279int main() {
3280
3281; return 0; }
3282EOF
3283if { (eval echo configure:3352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3284  rm -rf conftest*
3285  ksh_cv_c_prototypes=yes
3286else
3287  echo "configure: failed program was:" >&5
3288  cat conftest.$ac_ext >&5
3289  rm -rf conftest*
3290  ksh_cv_c_prototypes=no
3291fi
3292rm -f conftest*
3293fi
3294
3295echo "$ac_t""$ksh_cv_c_prototypes" 1>&6
3296  if test $ksh_cv_c_prototypes = yes; then
3297    cat >> confdefs.h <<\EOF
3298#define HAVE_PROTOTYPES 1
3299EOF
3300
3301  fi
3302
3303echo $ac_n "checking if C compiler groks __attribute__(( .. ))""... $ac_c" 1>&6
3304echo "configure:3373: checking if C compiler groks __attribute__(( .. ))" >&5
3305if eval "test \"`echo '$''{'ksh_cv_c_func_attr'+set}'`\" = set"; then
3306  echo $ac_n "(cached) $ac_c" 1>&6
3307else
3308  cat > conftest.$ac_ext <<EOF
3309#line 3378 "configure"
3310#include "confdefs.h"
3311
3312#include <stdarg.h>
3313void test_fmt(char *fmt, ...) __attribute__((format(printf, 1, 2)));
3314void test_fmt(char *fmt, ...) { return; }
3315int test_cnst(int) __attribute__((const));
3316int test_cnst(int x) { return x + 1; }
3317void test_nr() __attribute__((noreturn));
3318void test_nr() { exit(1); }
3319void test_uk() __attribute__((blah));
3320void test_uk() { return; }
3321      
3322int main() {
3323test_nr("%d", 10); test_cnst(2); test_uk(); test_nr(); 
3324; return 0; }
3325EOF
3326if { (eval echo configure:3395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3327  rm -rf conftest*
3328  ksh_cv_c_func_attr=yes
3329else
3330  echo "configure: failed program was:" >&5
3331  cat conftest.$ac_ext >&5
3332  rm -rf conftest*
3333  ksh_cv_c_func_attr=no
3334fi
3335rm -f conftest*
3336fi
3337
3338echo "$ac_t""$ksh_cv_c_func_attr" 1>&6
3339  if test $ksh_cv_c_func_attr = yes; then
3340    cat >> confdefs.h <<\EOF
3341#define HAVE_GCC_FUNC_ATTR 1
3342EOF
3343
3344  fi
3345
3346# Pull the hash mark out of the macro call to avoid m4 problems.
3347ac_msg="whether #! works in shell scripts"
3348echo $ac_n "checking $ac_msg""... $ac_c" 1>&6
3349echo "configure:3418: checking $ac_msg" >&5
3350if eval "test \"`echo '$''{'ac_cv_sys_interpreter'+set}'`\" = set"; then
3351  echo $ac_n "(cached) $ac_c" 1>&6
3352else
3353  echo '#! /bin/cat
3354exit 69
3355' > conftest
3356chmod u+x conftest
3357(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)
3358if test $? -ne 69; then
3359   ac_cv_sys_interpreter=yes
3360else
3361   ac_cv_sys_interpreter=no
3362fi
3363rm -f conftest
3364fi
3365
3366echo "$ac_t""$ac_cv_sys_interpreter" 1>&6
3367
3368if test $ac_cv_sys_interpreter = no;
3369  then cat >> confdefs.h <<\EOF
3370#define SHARPBANG 1
3371EOF
3372
3373fi
3374ac_aux_dir=
3375for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
3376  if test -f $ac_dir/install-sh; then
3377    ac_aux_dir=$ac_dir
3378    ac_install_sh="$ac_aux_dir/install-sh -c"
3379    break
3380  elif test -f $ac_dir/install.sh; then
3381    ac_aux_dir=$ac_dir
3382    ac_install_sh="$ac_aux_dir/install.sh -c"
3383    break
3384  fi
3385done
3386if test -z "$ac_aux_dir"; then
3387  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
3388fi
3389ac_config_guess=$ac_aux_dir/config.guess
3390ac_config_sub=$ac_aux_dir/config.sub
3391ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
3392
3393# Find a good install program.  We prefer a C program (faster),
3394# so one script is as good as another.  But avoid the broken or
3395# incompatible versions:
3396# SysV /etc/install, /usr/sbin/install
3397# SunOS /usr/etc/install
3398# IRIX /sbin/install
3399# AIX /bin/install
3400# AFS /usr/afsws/bin/install, which mishandles nonexistent args
3401# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
3402# ./install, which can be erroneously created by make from ./install.sh.
3403echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
3404echo "configure:3473: checking for a BSD compatible install" >&5
3405if test -z "$INSTALL"; then
3406if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
3407  echo $ac_n "(cached) $ac_c" 1>&6
3408else
3409    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
3410  for ac_dir in $PATH; do
3411    # Account for people who put trailing slashes in PATH elements.
3412    case "$ac_dir/" in
3413    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
3414    *)
3415      # OSF1 and SCO ODT 3.0 have their own names for install.
3416      for ac_prog in ginstall installbsd scoinst install; do
3417        if test -f $ac_dir/$ac_prog; then
3418	  if test $ac_prog = install &&
3419            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
3420	    # AIX install.  It has an incompatible calling convention.
3421	    # OSF/1 installbsd also uses dspmsg, but is usable.
3422	    :
3423	  else
3424	    ac_cv_path_install="$ac_dir/$ac_prog -c"
3425	    break 2
3426	  fi
3427	fi
3428      done
3429      ;;
3430    esac
3431  done
3432  IFS="$ac_save_IFS"
3433
3434fi
3435  if test "${ac_cv_path_install+set}" = set; then
3436    INSTALL="$ac_cv_path_install"
3437  else
3438    # As a last resort, use the slow shell script.  We don't cache a
3439    # path for INSTALL within a source directory, because that will
3440    # break other packages using the cache if that directory is
3441    # removed, or if the path is relative.
3442    INSTALL="$ac_install_sh"
3443  fi
3444fi
3445echo "$ac_t""$INSTALL" 1>&6
3446
3447# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
3448# It thinks the first close brace ends the variable substitution.
3449test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
3450
3451test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
3452
3453echo $ac_n "checking if dup2() works (ie, resets the close-on-exec flag)""... $ac_c" 1>&6
3454echo "configure:3523: checking if dup2() works (ie, resets the close-on-exec flag)" >&5
3455if eval "test \"`echo '$''{'ksh_cv_dup2_clexec_ok'+set}'`\" = set"; then
3456  echo $ac_n "(cached) $ac_c" 1>&6
3457else
3458  if test "$cross_compiling" = yes; then
3459  echo "configure: warning: cannot test if dup2 is broken when cross compiling - assuming it is" 1>&2
3460     ksh_cv_dup2_clexec_ok=no
3461else
3462cat > conftest.$ac_ext <<EOF
3463#line 3532 "configure"
3464#include "confdefs.h"
3465
3466#include <sys/types.h>
3467#ifdef HAVE_FCNTL_H
3468# include <fcntl.h>
3469#endif /* HAVE_FCNTL_H */
3470#ifndef F_GETFD
3471# define F_GETFD 1
3472#endif
3473#ifndef F_SETFD
3474# define F_SETFD 2
3475#endif
3476#ifndef O_RDONLY
3477# define O_RDONLY 0
3478#endif
3479/* On some systems (Ultrix 2.1..4.2 (and more?)), dup2() does not clear
3480   the close on exec flag */
3481main()
3482{
3483  int fd1, fd2;
3484  fd1 = open("/dev/null", O_RDONLY);
3485  if (fcntl(fd1, F_SETFD, 1) < 0)
3486    exit(1);
3487  fd2 = dup2(fd1, fd1 + 1);
3488  if (fd2 < 0)
3489    exit(2);
3490  exit(fcntl(fd2, F_GETFD, 0) == 0 ? 0 : 3);
3491}
3492     
3493EOF
3494eval $ac_link
3495if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
3496  ksh_cv_dup2_clexec_ok=yes
3497else
3498  ksh_cv_dup2_clexec_ok=no
3499fi
3500fi
3501rm -fr conftest*
3502fi
3503
3504echo "$ac_t""$ksh_cv_dup2_clexec_ok" 1>&6
3505  if test $ksh_cv_dup2_clexec_ok = no; then
3506    cat >> confdefs.h <<\EOF
3507#define DUP2_BROKEN 1
3508EOF
3509
3510  fi
3511
3512echo $ac_n "checking flavour of signal routines""... $ac_c" 1>&6
3513echo "configure:3582: checking flavour of signal routines" >&5
3514if eval "test \"`echo '$''{'ksh_cv_signal_check'+set}'`\" = set"; then
3515  echo $ac_n "(cached) $ac_c" 1>&6
3516else
3517  cat > conftest.$ac_ext <<EOF
3518#line 3587 "configure"
3519#include "confdefs.h"
3520#include <signal.h>
3521int main() {
3522
3523	sigset_t ss;
3524	struct sigaction sa;
3525	sigemptyset(&ss); sigsuspend(&ss);
3526	sigaction(SIGINT, &sa, (struct sigaction *) 0);
3527	sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
3528      
3529; return 0; }
3530EOF
3531if { (eval echo configure:3600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
3532  rm -rf conftest*
3533  ksh_cv_signal_check=posix
3534else
3535  echo "configure: failed program was:" >&5
3536  cat conftest.$ac_ext >&5
3537  rm -rf conftest*
3538  cat > conftest.$ac_ext <<EOF
3539#line 3608 "configure"
3540#include "confdefs.h"
3541#include <signal.h>
3542int main() {
3543
3544	  int mask = sigmask(SIGINT);
3545	  sigsetmask(mask); sigblock(mask); sigpause(mask);
3546	
3547; return 0; }
3548EOF
3549if { (eval echo configure:3618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
3550  rm -rf conftest*
3551  ksh_cv_signal_check=bsd42
3552else
3553  echo "configure: failed program was:" >&5
3554  cat conftest.$ac_ext >&5
3555  rm -rf conftest*
3556  cat > conftest.$ac_ext <<EOF
3557#line 3626 "configure"
3558#include "confdefs.h"
3559#include <signal.h>
3560			RETSIGTYPE foo() { }
3561int main() {
3562
3563	    int mask = sigmask(SIGINT);
3564	    sigset(SIGINT, foo); sigrelse(SIGINT);
3565	    sighold(SIGINT); sigpause(SIGINT);
3566	  
3567; return 0; }
3568EOF
3569if { (eval echo configure:3638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
3570  rm -rf conftest*
3571  ksh_cv_signal_check=bsd41
3572else
3573  echo "configure: failed program was:" >&5
3574  cat conftest.$ac_ext >&5
3575  rm -rf conftest*
3576  ksh_cv_signal_check=v7
3577fi
3578rm -f conftest*
3579fi
3580rm -f conftest*
3581fi
3582rm -f conftest*
3583fi
3584
3585echo "$ac_t""$ksh_cv_signal_check" 1>&6
3586  if test $ksh_cv_signal_check = posix; then
3587    cat >> confdefs.h <<\EOF
3588#define POSIX_SIGNALS 1
3589EOF
3590
3591  else
3592    cat >> confdefs.h <<\EOF
3593#define USE_FAKE_SIGACT 1
3594EOF
3595
3596    if test $ksh_cv_signal_check = bsd42; then
3597      cat >> confdefs.h <<\EOF
3598#define BSD42_SIGNALS 1
3599EOF
3600
3601    elif test $ksh_cv_signal_check = bsd41; then
3602      cat >> confdefs.h <<\EOF
3603#define BSD41_SIGNALS 1
3604EOF
3605
3606      echo $ac_n "checking if signals interrupt read()""... $ac_c" 1>&6
3607echo "configure:3676: checking if signals interrupt read()" >&5
3608if eval "test \"`echo '$''{'ksh_cv_signals_interrupt'+set}'`\" = set"; then
3609  echo $ac_n "(cached) $ac_c" 1>&6
3610else
3611  if test "$cross_compiling" = yes; then
3612  { echo "configure: error: cannot determine if signals interrupt read() when cross compiling" 1>&2; exit 1; }
3613
3614else
3615cat > conftest.$ac_ext <<EOF
3616#line 3685 "configure"
3617#include "confdefs.h"
3618
3619#include <errno.h>
3620#include <signal.h>
3621
3622		extern int errno;
3623		int flag = 0;
3624
3625		RETSIGTYPE
3626		catcher(int sig)
3627		{
3628		    flag = 1;
3629		    return RETSIGVAL;
3630		}
3631
3632		int
3633		main()
3634		{
3635		    int pid;
3636		    int fdc[2];	/* child writes to parent */
3637		    int fdp[2];	/* parent writes to child */
3638		    char buf;
3639		    int nread;
3640
3641		    if (pipe(fdc) < 0)
3642			exit(1);
3643		    if (pipe(fdp) < 0)
3644			exit(2);
3645		    if ((pid = fork()) < 0)
3646			exit(3);
3647		    if (pid == 0) {
3648			close(fdc[0]);
3649			close(fdp[1]);
3650			if (read(fdp[0], &buf, 1) != 0)
3651			    exit(10);
3652			sleep(1); /* let parent into read */
3653			if (kill(getppid(), SIGALRM) < 0)
3654			    exit(11);
3655			sleep(1); /* ensure parent gets to run */
3656			write(fdc[1], "1", 1);
3657			close(fdc[1]);
3658			exit(0);
3659		    }
3660		    close(fdc[1]);
3661		    close(fdp[0]);
3662
3663		    /* Use native routines for test as this is what the shell
3664		     * will be using...
3665		     */
3666#ifdef POSIX_SIGNALS
3667		    {
3668			struct sigaction sa, osa;
3669			sa.sa_handler = catcher;
3670			sigemptyset(&sa.sa_mask);
3671			sa.sa_flags = 0;
3672			sigaction(SIGALRM, &sa, &osa);
3673		    }
3674#else /* POSIX_SIGNALS */
3675# ifdef BSD42_SIGNALS
3676		    {
3677			struct sigvec vec, ovec;
3678			vec.sv_handler = catcher;
3679			vec.sv_mask = 0;
3680			vec.sv_flags = 0;
3681#  ifdef SV_INTERRUPT
3682			vec.sv_flags |= SV_INTERRUPT;
3683#  endif /* SV_INTERRUPT */
3684			sigvec(SIGALRM, &vec, &ovec);
3685		    }
3686# else /* BSD42_SIGNALS */
3687#  ifdef BSD41_SIGNALS
3688		    sigset(SIGALRM, catcher);
3689#  else /* BSD41_SIGNALS */
3690#   ifdef V7_SIGNALS
3691		    signal(SIGALRM, catcher);
3692#   else /* V7_SIGNALS */
3693		    what kind of signals do you have?
3694#   endif /* V7_SIGNALS */
3695#  endif /* BSD41_SIGNALS */
3696# endif /* BSD42_SIGNALS */
3697#endif /* POSIX_SIGNALS */
3698		    close(fdp[1]); /* start child */
3699		    nread = read(fdc[0], &buf, 1);
3700		    if (nread == 0)
3701			exit(4);
3702		    if (nread > 0)
3703			exit(5);
3704		    if (errno != EINTR)
3705			exit(6);
3706		    if (!flag)
3707			exit(7);
3708		    exit(0);
3709		    return 0;
3710		}
3711	  
3712EOF
3713eval $ac_link
3714if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
3715  ksh_cv_signals_interrupt=yes
3716else
3717  ksh_cv_signals_interrupt=no
3718fi
3719fi
3720rm -fr conftest*
3721fi
3722
3723echo "$ac_t""$ksh_cv_signals_interrupt" 1>&6
3724      if test $ksh_cv_signals_interrupt = no ; then
3725	cat >> confdefs.h <<\EOF
3726#define SIGNALS_DONT_INTERRUPT 1
3727EOF
3728
3729      fi
3730    else
3731      cat >> confdefs.h <<\EOF
3732#define V7_SIGNALS 1
3733EOF
3734
3735    fi
3736  fi
3737
3738echo $ac_n "checking flavour of pgrp routines""... $ac_c" 1>&6
3739echo "configure:3808: checking flavour of pgrp routines" >&5
3740if eval "test \"`echo '$''{'ksh_cv_pgrp_check'+set}'`\" = set"; then
3741  echo $ac_n "(cached) $ac_c" 1>&6
3742else
3743  if test "$cross_compiling" = yes; then
3744  { echo "configure: error: cannot taste pgrp routines when cross compiling" 1>&2; exit 1; }
3745else
3746cat > conftest.$ac_ext <<EOF
3747#line 3816 "configure"
3748#include "confdefs.h"
3749
3750/* Check for BSD process groups */
3751#include <signal.h>
3752#ifdef HAVE_UNISTD_H
3753# include <unistd.h>
3754#endif /* HAVE_UNISTD_H */
3755	main()
3756	{
3757	  int ecode = 0, child = fork();
3758	  if (child < 0)
3759	    exit(1);
3760	  if (child == 0) {
3761	    signal(SIGTERM, SIG_DFL); /* just to make sure */
3762	    sleep(10);
3763	    exit(9);
3764	  }
3765	  if (setpgrp(child, child) < 0)
3766	    ecode = 2;
3767	  else if (getpgrp(child) != child)
3768	    ecode = 3;
3769	  kill(child, SIGTERM);
3770	  exit(ecode);
3771	}
3772       
3773EOF
3774eval $ac_link
3775if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
3776  ksh_cv_pgrp_check=bsd
3777else
3778  if test "$cross_compiling" = yes; then
3779  { echo "configure: error: cannot taste pgrp routines when cross compiling" 1>&2; exit 1; }
3780else
3781cat > conftest.$ac_ext <<EOF
3782#line 3851 "configure"
3783#include "confdefs.h"
3784
3785/* Check for POSIX process groups */
3786#ifdef HAVE_UNISTD_H
3787# include <unistd.h>
3788#endif /* HAVE_UNISTD_H */
3789	  main()
3790	  {
3791	    int child;
3792	    int n, p1[2], p2[2];
3793	    char buf[1];
3794	    if (pipe(p1) < 0 || pipe(p2) < 0)
3795	      exit(1);
3796	    if ((child = fork()) < 0)
3797	      exit(2);
3798	    if (child == 0) {
3799	      n = read(p1[0], buf, sizeof(buf)); /* wait for parent to setpgid */
3800	      buf[0] = (n != 1 ? 10 : (getpgrp() != getpid() ? 11 : 0));
3801	      if (write(p2[1], buf, sizeof(buf)) != 1)
3802		exit(12);
3803	      exit(0);
3804	    }
3805	    if (setpgid(child, child) < 0)
3806	      exit(3);
3807	    if (write(p1[1], buf, 1) != 1)
3808	      exit(4);
3809	    if (read(p2[0], buf, 1) != 1)
3810	      exit(5);
3811	    exit((int) buf[0]);
3812	  }
3813	 
3814EOF
3815eval $ac_link
3816if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
3817  ksh_cv_pgrp_check=posix
3818else
3819  if test "$cross_compiling" = yes; then
3820  { echo "configure: error: cannot taste pgrp routines when cross compiling" 1>&2; exit 1; }
3821else
3822cat > conftest.$ac_ext <<EOF
3823#line 3892 "configure"
3824#include "confdefs.h"
3825
3826/* Check for SYSV process groups */
3827#ifdef HAVE_UNISTD_H
3828# include <unistd.h>
3829#endif /* HAVE_UNISTD_H */
3830	    main()
3831	    {
3832	      int child;
3833	      int n, p[2];
3834	      char buf[1];
3835	      if (pipe(p) < 0)
3836		exit(1);
3837	      if ((child = fork()) < 0)
3838		exit(2);
3839	      if (child == 0) {
3840		buf[0] = (setpgrp() < 0 ? 10 : (getpgrp() != getpid() ? 11 : 0));
3841		if (write(p[1], buf, sizeof(buf)) != 1)
3842		  exit(11);
3843		exit(0);
3844	      }
3845	      if (read(p[0], buf, 1) != 1)
3846		exit(3);
3847	      exit((int) buf[0]);
3848	    }
3849	   
3850EOF
3851eval $ac_link
3852if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
3853  ksh_cv_pgrp_check=sysv
3854else
3855  ksh_cv_pgrp_check=none
3856fi
3857fi
3858rm -fr conftest*
3859fi
3860fi
3861rm -fr conftest*
3862fi
3863fi
3864rm -fr conftest*
3865fi
3866
3867echo "$ac_t""$ksh_cv_pgrp_check" 1>&6
3868  if test $ksh_cv_pgrp_check = bsd; then
3869    cat >> confdefs.h <<\EOF
3870#define BSD_PGRP 1
3871EOF
3872
3873  elif test $ksh_cv_pgrp_check = posix; then
3874    cat >> confdefs.h <<\EOF
3875#define POSIX_PGRP 1
3876EOF
3877
3878  elif test $ksh_cv_pgrp_check = sysv; then
3879    cat >> confdefs.h <<\EOF
3880#define SYSV_PGRP 1
3881EOF
3882
3883  else
3884    cat >> confdefs.h <<\EOF
3885#define NO_PGRP 1
3886EOF
3887
3888  fi
3889
3890  if test $ksh_cv_pgrp_check = bsd || test $ksh_cv_pgrp_check = posix ; then
3891   echo $ac_n "checking if process group synchronization is required""... $ac_c" 1>&6
3892echo "configure:3961: checking if process group synchronization is required" >&5
3893if eval "test \"`echo '$''{'ksh_cv_need_pgrp_sync'+set}'`\" = set"; then
3894  echo $ac_n "(cached) $ac_c" 1>&6
3895else
3896  if test "$cross_compiling" = yes; then
3897  echo "configure: warning: cannot test if pgrp synchronization needed when cross compiling - assuming it is" 1>&2
3898        ksh_cv_need_pgrp_sync=yes
3899else
3900cat > conftest.$ac_ext <<EOF
3901#line 3970 "configure"
3902#include "confdefs.h"
3903
3904	  main()
3905	  {
3906#ifdef POSIX_PGRP
3907#  define getpgID()	getpgrp()
3908#else
3909#  define getpgID()	getpgrp(0)
3910#  define setpgid(x,y)	setpgrp(x,y)
3911#endif
3912	    int pid1, pid2, fds[2];
3913	    int status;
3914	    char ok;
3915	    switch (pid1 = fork()) {
3916	      case -1:
3917		exit(1);
3918	      case 0:
3919		setpgid(0, getpid());
3920		exit(0);
3921	    }
3922	    setpgid(pid1, pid1);
3923	    sleep(2);	/* let first child die */
3924	    if (pipe(fds) < 0)
3925	      exit(2);
3926	    switch (pid2 = fork()) {
3927	      case -1:
3928		exit(3);
3929	      case 0:
3930		setpgid(0, pid1);
3931		ok = getpgID() == pid1;
3932		write(fds[1], &ok, 1);
3933		exit(0);
3934	    }
3935	    setpgid(pid2, pid1);
3936	    close(fds[1]);
3937	    if (read(fds[0], &ok, 1) != 1)
3938	      exit(4);
3939	    wait(&status);
3940	    wait(&status);
3941	    exit(ok ? 0 : 5);
3942	  }
3943        
3944EOF
3945eval $ac_link
3946if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
3947  ksh_cv_need_pgrp_sync=no
3948else
3949  ksh_cv_need_pgrp_sync=yes
3950fi
3951fi
3952rm -fr conftest*
3953fi
3954
3955echo "$ac_t""$ksh_cv_need_pgrp_sync" 1>&6
3956    if test $ksh_cv_need_pgrp_sync = yes; then
3957      cat >> confdefs.h <<\EOF
3958#define NEED_PGRP_SYNC 1
3959EOF
3960
3961    fi
3962  fi
3963
3964echo $ac_n "checking if opendir() fails to open non-directories""... $ac_c" 1>&6
3965echo "configure:4034: checking if opendir() fails to open non-directories" >&5
3966if eval "test \"`echo '$''{'ksh_cv_opendir_ok'+set}'`\" = set"; then
3967  echo $ac_n "(cached) $ac_c" 1>&6
3968else
3969  if test "$cross_compiling" = yes; then
3970  echo "configure: warning: cannot test if opendir opens non-directories when cross compiling - assuming it does" 1>&2
3971      ksh_cv_opendir_ok=no
3972else
3973cat > conftest.$ac_ext <<EOF
3974#line 4043 "configure"
3975#include "confdefs.h"
3976
3977#include <stdio.h>
3978#include <sys/types.h>
3979#ifdef HAVE_UNISTD_H
3980# include <unistd.h>
3981#endif /* HAVE_UNISTD_H */
3982#if defined(HAVE_DIRENT_H)
3983# include <dirent.h>
3984#else
3985# define dirent direct
3986# ifdef SYSNDIR
3987#  include <sys/ndir.h>
3988# endif /* SYSNDIR */
3989# ifdef SYSDIR
3990#  include <sys/dir.h>
3991# endif /* SYSDIR */
3992# ifdef NDIR
3993#  include <ndir.h>
3994# endif /* NDIR */
3995#endif /* DIRENT */
3996	main()
3997	{
3998	  int i, ret = 0;
3999	  FILE *fp;
4000	  char *fname = "conftestod", buf[256];
4001	  for (i = 0; i < sizeof(buf); i++) /* memset(buf, 0, sizeof(buf)) */
4002	    buf[i] = 0;
4003	  unlink(fname); /* paranoia */
4004	  i = ((fp = fopen(fname, "w")) == (FILE *) 0 && (ret = 1))
4005	       || (fwrite(buf, sizeof(buf), 1, fp) != 1 && (ret = 2))
4006	       || (fclose(fp) == EOF && (ret = 3))
4007	       || (opendir(fname) && (ret = 4))
4008	       || (opendir("/dev/null") && (ret = 5));
4009	  unlink(fname);
4010	  exit(ret);
4011	}
4012
4013EOF
4014eval $ac_link
4015if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
4016  ksh_cv_opendir_ok=yes
4017else
4018  ksh_cv_opendir_ok=no
4019fi
4020fi
4021rm -fr conftest*
4022fi
4023
4024echo "$ac_t""$ksh_cv_opendir_ok" 1>&6
4025  if test $ksh_cv_opendir_ok = no; then
4026    cat >> confdefs.h <<\EOF
4027#define OPENDIR_DOES_NONDIR 1
4028EOF
4029
4030  fi
4031
4032echo $ac_n "checking if you have /dev/fd/n""... $ac_c" 1>&6
4033echo "configure:4102: checking if you have /dev/fd/n" >&5
4034if eval "test \"`echo '$''{'ksh_cv_dev_fd'+set}'`\" = set"; then
4035  echo $ac_n "(cached) $ac_c" 1>&6
4036else
4037  if test "$cross_compiling" = yes; then
4038  echo "configure: warning: cannot determine if you have /dev/fd support" 1>&2
4039	ksh_cv_dev_fd=no
4040else
4041cat > conftest.$ac_ext <<EOF
4042#line 4111 "configure"
4043#include "confdefs.h"
4044
4045#include <stdio.h>
4046#include <sys/types.h>
4047#include <sys/stat.h>
4048	  main()
4049	  {
4050	    struct stat s1, s2;
4051	    FILE *fp1, *fp2;
4052	    char *file = "conftest.file";
4053	    char devfd[32];
4054
4055	    if (!(fp1 = fopen(file, "w")))
4056	      exit(1);
4057	    if (fstat(fileno(fp1), &s1) < 0)
4058	      exit(2);
4059	    sprintf(devfd, "/dev/fd/%d", fileno(fp1));
4060	    if (!(fp2 = fopen(devfd, "w")))
4061	      exit(3);
4062	    if (fstat(fileno(fp2), &s2) < 0)
4063	      exit(4);
4064	    if (s1.st_dev != s2.st_dev || s1.st_ino != s2.st_ino)
4065	      exit(5);
4066	    exit(0);
4067	  }
4068	
4069EOF
4070eval $ac_link
4071if test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then
4072  ksh_cv_dev_fd=yes
4073else
4074  ksh_cv_dev_fd=no
4075fi
4076fi
4077rm -fr conftest*
4078fi
4079
4080echo "$ac_t""$ksh_cv_dev_fd" 1>&6
4081  if test $ksh_cv_dev_fd = yes; then
4082    cat >> confdefs.h <<\EOF
4083#define HAVE_DEV_FD 1
4084EOF
4085
4086  fi
4087
4088if test X"$LDSTATIC" != X; then
4089  LDFLAGS=`echo -- "$LDFLAGS" | sed -e 's/^-- //' -e 's?$LDSTATIC?\$(LDSTATIC)?'`
4090fi
4091trap '' 1 2 15
4092cat > confcache <<\EOF
4093# This file is a shell script that caches the results of configure
4094# tests run on this system so they can be shared between configure
4095# scripts and configure runs.  It is not useful on other systems.
4096# If it contains results you don't want to keep, you may remove or edit it.
4097#
4098# By default, configure uses ./config.cache as the cache file,
4099# creating it if it does not exist already.  You can give configure
4100# the --cache-file=FILE option to use a different cache file; that is
4101# what configure does when it calls configure scripts in
4102# subdirectories, so they share the cache.
4103# Giving --cache-file=/dev/null disables caching, for debugging configure.
4104# config.status only pays attention to the cache file if you give it the
4105# --recheck option to rerun configure.
4106#
4107EOF
4108# The following way of writing the cache mishandles newlines in values,
4109# but we know of no workaround that is simple, portable, and efficient.
4110# So, don't put newlines in cache variables' values.
4111# Ultrix sh set writes to stderr and can't be redirected directly,
4112# and sets the high bit in the cache file unless we assign to the vars.
4113(set) 2>&1 |
4114  case `(ac_space=' '; set) 2>&1` in
4115  *ac_space=\ *)
4116    # `set' does not quote correctly, so add quotes (double-quote substitution
4117    # turns \\\\ into \\, and sed turns \\ into \).
4118    sed -n \
4119      -e "s/'/'\\\\''/g" \
4120      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
4121    ;;
4122  *)
4123    # `set' quotes correctly as required by POSIX, so do not add quotes.
4124    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
4125    ;;
4126  esac >> confcache
4127if cmp -s $cache_file confcache; then
4128  :
4129else
4130  if test -w $cache_file; then
4131    echo "updating cache $cache_file"
4132    cat confcache > $cache_file
4133  else
4134    echo "not updating unwritable cache $cache_file"
4135  fi
4136fi
4137rm -f confcache
4138
4139trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
4140
4141test "x$prefix" = xNONE && prefix=$ac_default_prefix
4142# Let make expand exec_prefix.
4143test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
4144
4145# Any assignment to VPATH causes Sun make to only execute
4146# the first set of double-colon rules, so remove it if not needed.
4147# If there is a colon in the path, we need to keep it.
4148if test "x$srcdir" = x.; then
4149  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
4150fi
4151
4152trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
4153
4154DEFS=-DHAVE_CONFIG_H
4155
4156# Without the "./", some shells look in PATH for config.status.
4157: ${CONFIG_STATUS=./config.status}
4158
4159echo creating $CONFIG_STATUS
4160rm -f $CONFIG_STATUS
4161cat > $CONFIG_STATUS <<EOF
4162#! /bin/sh
4163# Generated automatically by configure.
4164# Run this file to recreate the current configuration.
4165# This directory was configured as follows,
4166# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
4167#
4168# $0 $ac_configure_args
4169#
4170# Compiler output produced by configure, useful for debugging
4171# configure, is in ./config.log if it exists.
4172
4173ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
4174for ac_option
4175do
4176  case "\$ac_option" in
4177  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
4178    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
4179    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
4180  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
4181    echo "$CONFIG_STATUS generated by autoconf version 2.12"
4182    exit 0 ;;
4183  -help | --help | --hel | --he | --h)
4184    echo "\$ac_cs_usage"; exit 0 ;;
4185  *) echo "\$ac_cs_usage"; exit 1 ;;
4186  esac
4187done
4188
4189ac_given_srcdir=$srcdir
4190ac_given_INSTALL="$INSTALL"
4191
4192trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
4193EOF
4194cat >> $CONFIG_STATUS <<EOF
4195
4196# Protect against being on the right side of a sed subst in config.status.
4197sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
4198 s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
4199$ac_vpsub
4200$extrasub
4201s%@CFLAGS@%$CFLAGS%g
4202s%@CPPFLAGS@%$CPPFLAGS%g
4203s%@CXXFLAGS@%$CXXFLAGS%g
4204s%@DEFS@%$DEFS%g
4205s%@LDFLAGS@%$LDFLAGS%g
4206s%@LIBS@%$LIBS%g
4207s%@exec_prefix@%$exec_prefix%g
4208s%@prefix@%$prefix%g
4209s%@program_transform_name@%$program_transform_name%g
4210s%@bindir@%$bindir%g
4211s%@sbindir@%$sbindir%g
4212s%@libexecdir@%$libexecdir%g
4213s%@datadir@%$datadir%g
4214s%@sysconfdir@%$sysconfdir%g
4215s%@sharedstatedir@%$sharedstatedir%g
4216s%@localstatedir@%$localstatedir%g
4217s%@libdir@%$libdir%g
4218s%@includedir@%$includedir%g
4219s%@oldincludedir@%$oldincludedir%g
4220s%@infodir@%$infodir%g
4221s%@mandir@%$mandir%g
4222s%@SHELL_PROG@%$SHELL_PROG%g
4223s%@CC@%$CC%g
4224s%@CPP@%$CPP%g
4225s%@LDSTATIC@%$LDSTATIC%g
4226s%@ac_exe_suffix@%$ac_exe_suffix%g
4227s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
4228s%@INSTALL_DATA@%$INSTALL_DATA%g
4229
4230CEOF
4231EOF
4232
4233cat >> $CONFIG_STATUS <<\EOF
4234
4235# Split the substitutions into bite-sized pieces for seds with
4236# small command number limits, like on Digital OSF/1 and HP-UX.
4237ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
4238ac_file=1 # Number of current file.
4239ac_beg=1 # First line for current file.
4240ac_end=$ac_max_sed_cmds # Line after last line for current file.
4241ac_more_lines=:
4242ac_sed_cmds=""
4243while $ac_more_lines; do
4244  if test $ac_beg -gt 1; then
4245    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
4246  else
4247    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
4248  fi
4249  if test ! -s conftest.s$ac_file; then
4250    ac_more_lines=false
4251    rm -f conftest.s$ac_file
4252  else
4253    if test -z "$ac_sed_cmds"; then
4254      ac_sed_cmds="sed -f conftest.s$ac_file"
4255    else
4256      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
4257    fi
4258    ac_file=`expr $ac_file + 1`
4259    ac_beg=$ac_end
4260    ac_end=`expr $ac_end + $ac_max_sed_cmds`
4261  fi
4262done
4263if test -z "$ac_sed_cmds"; then
4264  ac_sed_cmds=cat
4265fi
4266EOF
4267
4268cat >> $CONFIG_STATUS <<EOF
4269
4270CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
4271EOF
4272cat >> $CONFIG_STATUS <<\EOF
4273for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
4274  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
4275  case "$ac_file" in
4276  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
4277       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
4278  *) ac_file_in="${ac_file}.in" ;;
4279  esac
4280
4281  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
4282
4283  # Remove last slash and all that follows it.  Not all systems have dirname.
4284  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
4285  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
4286    # The file is in a subdirectory.
4287    test ! -d "$ac_dir" && mkdir "$ac_dir"
4288    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
4289    # A "../" for each directory in $ac_dir_suffix.
4290    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
4291  else
4292    ac_dir_suffix= ac_dots=
4293  fi
4294
4295  case "$ac_given_srcdir" in
4296  .)  srcdir=.
4297      if test -z "$ac_dots"; then top_srcdir=.
4298      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
4299  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
4300  *) # Relative path.
4301    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
4302    top_srcdir="$ac_dots$ac_given_srcdir" ;;
4303  esac
4304
4305  case "$ac_given_INSTALL" in
4306  [/$]*) INSTALL="$ac_given_INSTALL" ;;
4307  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
4308  esac
4309
4310  echo creating "$ac_file"
4311  rm -f "$ac_file"
4312  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
4313  case "$ac_file" in
4314  *Makefile*) ac_comsub="1i\\
4315# $configure_input" ;;
4316  *) ac_comsub= ;;
4317  esac
4318
4319  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
4320  sed -e "$ac_comsub
4321s%@configure_input@%$configure_input%g
4322s%@srcdir@%$srcdir%g
4323s%@top_srcdir@%$top_srcdir%g
4324s%@INSTALL@%$INSTALL%g
4325" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
4326fi; done
4327rm -f conftest.s*
4328
4329# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
4330# NAME is the cpp macro being defined and VALUE is the value it is being given.
4331#
4332# ac_d sets the value in "#define NAME VALUE" lines.
4333ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
4334ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
4335ac_dC='\3'
4336ac_dD='%g'
4337# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
4338ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
4339ac_uB='\([ 	]\)%\1#\2define\3'
4340ac_uC=' '
4341ac_uD='\4%g'
4342# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
4343ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
4344ac_eB='$%\1#\2define\3'
4345ac_eC=' '
4346ac_eD='%g'
4347
4348if test "${CONFIG_HEADERS+set}" != set; then
4349EOF
4350cat >> $CONFIG_STATUS <<EOF
4351  CONFIG_HEADERS="config.h"
4352EOF
4353cat >> $CONFIG_STATUS <<\EOF
4354fi
4355for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
4356  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
4357  case "$ac_file" in
4358  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
4359       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
4360  *) ac_file_in="${ac_file}.in" ;;
4361  esac
4362
4363  echo creating $ac_file
4364
4365  rm -f conftest.frag conftest.in conftest.out
4366  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
4367  cat $ac_file_inputs > conftest.in
4368
4369EOF
4370
4371# Transform confdefs.h into a sed script conftest.vals that substitutes
4372# the proper values into config.h.in to produce config.h.  And first:
4373# Protect against being on the right side of a sed subst in config.status.
4374# Protect against being in an unquoted here document in config.status.
4375rm -f conftest.vals
4376cat > conftest.hdr <<\EOF
4377s/[\\&%]/\\&/g
4378s%[\\$`]%\\&%g
4379s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
4380s%ac_d%ac_u%gp
4381s%ac_u%ac_e%gp
4382EOF
4383sed -n -f conftest.hdr confdefs.h > conftest.vals
4384rm -f conftest.hdr
4385
4386# This sed command replaces #undef with comments.  This is necessary, for
4387# example, in the case of _POSIX_SOURCE, which is predefined and required
4388# on some systems where configure will not decide to define it.
4389cat >> conftest.vals <<\EOF
4390s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
4391EOF
4392
4393# Break up conftest.vals because some shells have a limit on
4394# the size of here documents, and old seds have small limits too.
4395
4396rm -f conftest.tail
4397while :
4398do
4399  ac_lines=`grep -c . conftest.vals`
4400  # grep -c gives empty output for an empty file on some AIX systems.
4401  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
4402  # Write a limited-size here document to conftest.frag.
4403  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
4404  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
4405  echo 'CEOF
4406  sed -f conftest.frag conftest.in > conftest.out
4407  rm -f conftest.in
4408  mv conftest.out conftest.in
4409' >> $CONFIG_STATUS
4410  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
4411  rm -f conftest.vals
4412  mv conftest.tail conftest.vals
4413done
4414rm -f conftest.vals
4415
4416cat >> $CONFIG_STATUS <<\EOF
4417  rm -f conftest.frag conftest.h
4418  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
4419  cat conftest.in >> conftest.h
4420  rm -f conftest.in
4421  if cmp -s $ac_file conftest.h 2>/dev/null; then
4422    echo "$ac_file is unchanged"
4423    rm -f conftest.h
4424  else
4425    # Remove last slash and all that follows it.  Not all systems have dirname.
4426      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
4427      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
4428      # The file is in a subdirectory.
4429      test ! -d "$ac_dir" && mkdir "$ac_dir"
4430    fi
4431    rm -f $ac_file
4432    mv conftest.h $ac_file
4433  fi
4434fi; done
4435
4436EOF
4437cat >> $CONFIG_STATUS <<EOF
4438
4439EOF
4440cat >> $CONFIG_STATUS <<\EOF
4441
4442exit 0
4443EOF
4444chmod +x $CONFIG_STATUS
4445rm -fr confdefs* $ac_clean_files
4446test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
4447
4448