home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / CLISP / CLISPSRC.TAR / clisp-1995-01-01 / src / readline / configure < prev    next >
Encoding:
Text File  |  1994-06-20  |  41.2 KB  |  1,460 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, and
  23. # --with-PACKAGE[=VALUE] unless this script has special code to handle it.
  24.  
  25. for arg
  26. do
  27.   # Handle --exec-prefix with a space before the argument.
  28.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  29.   # Handle --host with a space before the argument.
  30.   elif test x$next_host = xyes; then next_host=
  31.   # Handle --prefix with a space before the argument.
  32.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  33.   # Handle --srcdir with a space before the argument.
  34.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  35.   else
  36.     case $arg in
  37.      # For backward compatibility, recognize -exec-prefix and --exec_prefix.
  38.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  39.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  40.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  41.     next_exec_prefix=yes ;;
  42.  
  43.      -gas | --gas | --ga | --g) ;;
  44.  
  45.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  46.      -host | --host | --hos | --ho | --h)
  47.     next_host=yes ;;
  48.  
  49.      -nfp | --nfp | --nf) ;;
  50.  
  51.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  52.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  53.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  54.     next_prefix=yes ;;
  55.  
  56.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  57.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  58.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  59.     next_srcdir=yes ;;
  60.  
  61.      -with-* | --with-*)
  62.        package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'`
  63.        # Reject names that aren't valid shell variable names.
  64.        if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  65.          echo "configure: $package: invalid package name" >&2; exit 1
  66.        fi
  67.        package=`echo $package| sed 's/-/_/g'`
  68.        case "$arg" in
  69.          *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;;
  70.          *) val=1 ;;
  71.        esac
  72.        eval "with_$package='$val'" ;;
  73.  
  74.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  75.        verbose=yes ;;
  76.  
  77.      *) ;;
  78.     esac
  79.   fi
  80. done
  81.  
  82. trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15
  83. trap 'rm -f confdefs*' 0
  84.  
  85. # NLS nuisances.
  86. # These must not be set unconditionally because not all systems understand
  87. # e.g. LANG=C (notably SCO).
  88. if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
  89. if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
  90.  
  91. rm -fr conftest* confdefs.h
  92. # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  93. echo > confdefs.h
  94. compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  95.  
  96. # A filename unique to this package, relative to the directory that
  97. # configure is in, which we can look for to find out if srcdir is correct.
  98. unique_file=readline.c
  99.  
  100. # Find the source files, if location was not specified.
  101. if test -z "$srcdir"; then
  102.   srcdirdefaulted=yes
  103.   # Try the directory containing this script, then `..'.
  104.   prog=$0
  105.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  106.   test "X$confdir" = "X$prog" && confdir=.
  107.   srcdir=$confdir
  108.   if test ! -r $srcdir/$unique_file; then
  109.     srcdir=..
  110.   fi
  111. fi
  112. if test ! -r $srcdir/$unique_file; then
  113.   if test x$srcdirdefaulted = xyes; then
  114.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  115.   else
  116.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  117.   fi
  118.   exit 1
  119. fi
  120.  
  121. # Save the original args to write them into config.status later.
  122. configure_args="$*"
  123.  
  124.  
  125. if test -z "$CC"; then
  126.   # Extract the first word of `gcc', so it can be a program name with args.
  127.   set dummy gcc; word=$2
  128.   echo checking for $word
  129.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  130.   for dir in $PATH; do
  131.     test -z "$dir" && dir=.
  132.     if test -f $dir/$word; then
  133.       CC="gcc"
  134.       break
  135.     fi
  136.   done
  137.   IFS="$saveifs"
  138. fi
  139. test -z "$CC" && CC="cc"
  140.  
  141. # Find out if we are using GNU C, under whatever name.
  142. cat > conftest.c <<EOF
  143. #ifdef __GNUC__
  144.   yes
  145. #endif
  146. EOF
  147. ${CC-cc} -E conftest.c > conftest.out 2>&1
  148. if egrep yes conftest.out >/dev/null 2>&1; then
  149.   GCC=1 # For later tests.
  150.   CC="$CC -O"
  151. fi
  152. rm -f conftest*
  153.  
  154.                       echo checking how to run the C preprocessor
  155. if test -z "$CPP"; then
  156.   # This must be in double quotes, not single quotes, because CPP may get
  157.   # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  158.   # make.  It must be expanded now.
  159.   CPP="${CC-cc} -E"
  160.   if test -n "$GCC"; then
  161.     # Suppress warning messages.
  162.                     CPP="$CPP -w"
  163.   fi
  164.   if test -f /coherent; then
  165.             COHERENT=' || echo coherent'
  166.   fi
  167.   cat > conftest.c <<EOF
  168. #include "confdefs.h"
  169. #include <stdio.h>
  170. Syntax Error
  171. EOF
  172. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  173. if test -z "$err"; then
  174.   have_cpp=1
  175. fi
  176. rm -f conftest*
  177.   if test -z "$have_cpp"; then
  178.     CPP="${CC-cc} -E -traditional-cpp"
  179.     cat > conftest.c <<EOF
  180. #include "confdefs.h"
  181. #include <stdio.h>
  182. Syntax Error
  183. EOF
  184. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  185. if test -z "$err"; then
  186.   CC="${CC-cc} -traditional-cpp"
  187. else
  188.   CPP=/lib/cpp
  189. fi
  190. rm -f conftest*
  191.   fi
  192. fi
  193.  
  194.                       if test -n "$GCC"; then
  195.   echo checking whether -traditional is needed
  196.   pattern="Autoconf.*'x'"
  197.   prog='#include <sgtty.h>
  198. Autoconf TIOCGETP'
  199.   cat > conftest.c <<EOF
  200. #include "confdefs.h"
  201. $prog
  202. EOF
  203. eval "$CPP conftest.c > conftest.out 2>&1"
  204. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  205.   need_trad=1
  206. fi
  207. rm -f conftest*
  208.   if test -z "$need_trad"; then
  209.     prog='#include <termio.h>
  210. Autoconf TCGETA'
  211.     cat > conftest.c <<EOF
  212. #include "confdefs.h"
  213. $prog
  214. EOF
  215. eval "$CPP conftest.c > conftest.out 2>&1"
  216. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  217.   need_trad=1
  218. fi
  219. rm -f conftest*
  220.   fi
  221.   test -n "$need_trad" && CC="$CC -traditional"
  222. fi
  223.  
  224.                       if test -z "$RANLIB"; then
  225.   # Extract the first word of `ranlib', so it can be a program name with args.
  226.   set dummy ranlib; word=$2
  227.   echo checking for $word
  228.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  229.   for dir in $PATH; do
  230.     test -z "$dir" && dir=.
  231.     if test -f $dir/$word; then
  232.       RANLIB="ranlib"
  233.       break
  234.     fi
  235.   done
  236.   IFS="$saveifs"
  237. fi
  238. test -z "$RANLIB" && RANLIB=":"
  239.  
  240.                       # Make sure to not get the incompatible SysV /etc/install and
  241. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  242. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  243. # or the AFS install, which mishandles nonexistent args, or
  244. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  245. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  246. # anyway.  Sigh.
  247. if test "z${INSTALL}" = "z" ; then
  248.   echo checking for install
  249.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  250.   for dir in $PATH; do
  251.     test -z "$dir" && dir=.
  252.     case $dir in
  253.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  254.     *)
  255.       if test -f $dir/installbsd; then
  256.     INSTALL="$dir/installbsd -c" # OSF1
  257.     INSTALL_PROGRAM='$(INSTALL)'
  258.     INSTALL_DATA='$(INSTALL) -m 644'
  259.     break
  260.       fi
  261.       if test -f $dir/install; then
  262.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  263.       : # AIX
  264.     else
  265.       INSTALL="$dir/install -c"
  266.       INSTALL_PROGRAM='$(INSTALL)'
  267.       INSTALL_DATA='$(INSTALL) -m 644'
  268.       break
  269.     fi
  270.       fi
  271.       ;;
  272.     esac
  273.   done
  274.   IFS="$saveifs"
  275. fi
  276. INSTALL=${INSTALL-cp}
  277. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  278. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  279.  
  280.                       echo checking for AIX
  281. cat > conftest.c <<EOF
  282. #include "confdefs.h"
  283. #ifdef _AIX
  284.   yes
  285. #endif
  286.  
  287. EOF
  288. eval "$CPP conftest.c > conftest.out 2>&1"
  289. if egrep "yes" conftest.out >/dev/null 2>&1; then
  290.   echo "#define" _ALL_SOURCE "1" >> confdefs.h
  291. DEFS="$DEFS -D_ALL_SOURCE=1"
  292. SEDDEFS="${SEDDEFS}\${SEDdA}_ALL_SOURCE\${SEDdB}_ALL_SOURCE\${SEDdC}1\${SEDdD}
  293. \${SEDuA}_ALL_SOURCE\${SEDuB}_ALL_SOURCE\${SEDuC}1\${SEDuD}
  294. \${SEDeA}_ALL_SOURCE\${SEDeB}_ALL_SOURCE\${SEDeC}1\${SEDeD}
  295. \${SEDfA}_ALL_SOURCE\${SEDfB}_ALL_SOURCE\${SEDfC}1\${SEDfD}
  296. "
  297. fi
  298. rm -f conftest*
  299.  
  300.                       echo checking for POSIXized ISC
  301. if test -d /etc/conf/kconfig.d &&
  302.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  303. then
  304.   ISC=1 # If later tests want to check for ISC.
  305.   echo "#define" _POSIX_SOURCE "1" >> confdefs.h
  306. DEFS="$DEFS -D_POSIX_SOURCE=1"
  307. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  308. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  309. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  310. \${SEDfA}_POSIX_SOURCE\${SEDfB}_POSIX_SOURCE\${SEDfC}1\${SEDfD}
  311. "
  312.   if test -n "$GCC"; then
  313.     CC="$CC -posix"
  314.   else
  315.     CC="$CC -Xp"
  316.   fi
  317. fi
  318.  
  319.                       echo checking for minix/config.h
  320. cat > conftest.c <<EOF
  321. #include "confdefs.h"
  322. #include <minix/config.h>
  323. EOF
  324. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  325. if test -z "$err"; then
  326.   MINIX=1
  327. fi
  328. rm -f conftest*
  329. # The Minix shell can't assign to the same variable on the same line!
  330. if test -n "$MINIX"; then
  331.   echo "#define" _POSIX_SOURCE "1" >> confdefs.h
  332. DEFS="$DEFS -D_POSIX_SOURCE=1"
  333. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  334. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  335. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  336. \${SEDfA}_POSIX_SOURCE\${SEDfB}_POSIX_SOURCE\${SEDfC}1\${SEDfD}
  337. "
  338.   echo "#define" _POSIX_1_SOURCE "2" >> confdefs.h
  339. DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  340. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_1_SOURCE\${SEDdB}_POSIX_1_SOURCE\${SEDdC}2\${SEDdD}
  341. \${SEDuA}_POSIX_1_SOURCE\${SEDuB}_POSIX_1_SOURCE\${SEDuC}2\${SEDuD}
  342. \${SEDeA}_POSIX_1_SOURCE\${SEDeB}_POSIX_1_SOURCE\${SEDeC}2\${SEDeD}
  343. \${SEDfA}_POSIX_1_SOURCE\${SEDfB}_POSIX_1_SOURCE\${SEDfC}2\${SEDfD}
  344. "
  345.   echo "#define" _MINIX "1" >> confdefs.h
  346. DEFS="$DEFS -D_MINIX=1"
  347. SEDDEFS="${SEDDEFS}\${SEDdA}_MINIX\${SEDdB}_MINIX\${SEDdC}1\${SEDdD}
  348. \${SEDuA}_MINIX\${SEDuB}_MINIX\${SEDuC}1\${SEDuD}
  349. \${SEDeA}_MINIX\${SEDeB}_MINIX\${SEDeC}1\${SEDeD}
  350. \${SEDfA}_MINIX\${SEDfB}_MINIX\${SEDfC}1\${SEDfD}
  351. "
  352. fi
  353.  
  354.                       prog='/* Ultrix mips cc rejects this.  */
  355. typedef int charset[2]; const charset x;
  356. /* SunOS 4.1.1 cc rejects this.  */
  357. char const *const *ccp;
  358. char **p;
  359. /* AIX XL C 1.02.0.0 rejects this.
  360.    It does not let you subtract one const X* pointer from another in an arm
  361.    of an if-expression whose if-part is not a constant expression */
  362. const char *g = "string";
  363. ccp = &g + (g ? g-g : 0);
  364. /* HPUX 7.0 cc rejects these. */
  365. ++ccp;
  366. p = (char**) ccp;
  367. ccp = (char const *const *) p;
  368. { /* SCO 3.2v4 cc rejects this.  */
  369.   char *t;
  370.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  371.   *t++ = 0;
  372. }
  373. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  374.   int x[] = {25,17};
  375.   const int *foo = &x[0];
  376.   ++foo;
  377. }
  378. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  379.   typedef const int *iptr;
  380.   iptr p = 0;
  381.   ++p;
  382. }
  383. { /* AIX XL C 1.02.0.0 rejects this saying
  384.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  385.   struct s { int j; const int *ap[3]; };
  386.   struct s *b; b->j = 5;
  387. }
  388. { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  389.   const int foo = 10;
  390. }'
  391. echo checking for working const
  392. cat > conftest.c <<EOF
  393. #include "confdefs.h"
  394.  
  395. int main() { exit(0); }
  396. int t() { $prog }
  397. EOF
  398. if eval $compile; then
  399.   :
  400. else
  401.   echo "#define" const "" >> confdefs.h
  402. DEFS="$DEFS -Dconst="
  403. SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD}
  404. \${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD}
  405. \${SEDeA}const\${SEDeB}const\${SEDeC}\${SEDeD}
  406. \${SEDfA}const\${SEDfB}const\${SEDfC}\${SEDfD}
  407. "
  408. fi
  409. rm -f conftest*
  410.  
  411.                       if test -n "$GCC"; then
  412. echo checking for inline
  413. cat > conftest.c <<EOF
  414. #include "confdefs.h"
  415.  
  416. int main() { exit(0); }
  417. int t() { } inline foo() { }
  418. EOF
  419. if eval $compile; then
  420.   :
  421. else
  422.   echo "#define" inline "__inline" >> confdefs.h
  423. DEFS="$DEFS -Dinline=__inline"
  424. SEDDEFS="${SEDDEFS}\${SEDdA}inline\${SEDdB}inline\${SEDdC}__inline\${SEDdD}
  425. \${SEDuA}inline\${SEDuB}inline\${SEDuC}__inline\${SEDuD}
  426. \${SEDeA}inline\${SEDeB}inline\${SEDeC}__inline\${SEDeD}
  427. \${SEDfA}inline\${SEDfB}inline\${SEDfC}__inline\${SEDfD}
  428. "
  429. fi
  430. rm -f conftest*
  431. fi
  432.  
  433.                       echo checking for working void
  434. cat > conftest.c <<EOF
  435. #include "confdefs.h"
  436.  
  437. int main() { exit(0); }
  438. int t() { void f();
  439. typedef void x; x g();
  440. typedef void* y; y a;
  441.  }
  442. EOF
  443. if eval $compile; then
  444.   :
  445. else
  446.   echo "#define" void "char" >> confdefs.h
  447. DEFS="$DEFS -Dvoid=char"
  448. SEDDEFS="${SEDDEFS}\${SEDdA}void\${SEDdB}void\${SEDdC}char\${SEDdD}
  449. \${SEDuA}void\${SEDuB}void\${SEDuC}char\${SEDuD}
  450. \${SEDeA}void\${SEDeB}void\${SEDeC}char\${SEDeD}
  451. \${SEDfA}void\${SEDfB}void\${SEDfC}char\${SEDfD}
  452. "
  453. fi
  454. rm -f conftest*
  455.  
  456.                       echo checking for ANSI C header files
  457. cat > conftest.c <<EOF
  458. #include "confdefs.h"
  459. #include <stdlib.h>
  460. #include <stdarg.h>
  461. #include <string.h>
  462. #include <float.h>
  463. #include <limits.h>
  464. EOF
  465. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  466. if test -z "$err"; then
  467.   echo "#define" STDC_HEADERS "1" >> confdefs.h
  468. DEFS="$DEFS -DSTDC_HEADERS=1"
  469. SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD}
  470. \${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD}
  471. \${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD}
  472. \${SEDfA}STDC_HEADERS\${SEDfB}STDC_HEADERS\${SEDfC}1\${SEDfD}
  473. "
  474. fi
  475. rm -f conftest*
  476.  
  477.                       for hdr in unistd.h
  478. do
  479. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  480. echo checking for ${hdr}
  481. cat > conftest.c <<EOF
  482. #include "confdefs.h"
  483. #include <${hdr}>
  484. EOF
  485. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  486. if test -z "$err"; then
  487.   echo "#define" ${trhdr} "1" >> confdefs.h
  488. DEFS="$DEFS -D${trhdr}=1"
  489. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  490. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  491. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  492. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  493. "
  494. fi
  495. rm -f conftest*
  496. done
  497.  
  498.  
  499.                       echo checking for sys/file.h
  500. cat > conftest.c <<EOF
  501. #include "confdefs.h"
  502. #include <sys/file.h>
  503. EOF
  504. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  505. if test -z "$err"; then
  506.   have_sysfile=1
  507. fi
  508. rm -f conftest*
  509. if test -n "$have_sysfile"; then
  510. openflags_decl='#ifdef STDC_HEADERS
  511. #include <stdlib.h>
  512. #endif
  513. #ifdef HAVE_UNISTD_H
  514. #include <sys/types.h>
  515. #include <unistd.h>
  516. #endif
  517. #include <fcntl.h>
  518. '
  519. openflags_prog='int x = O_RDWR | O_RDONLY | O_WRONLY | O_CREAT | O_TRUNC;'
  520. echo checking for O_RDWR in fcntl.h
  521. cat > conftest.c <<EOF
  522. #include "confdefs.h"
  523. $openflags_decl
  524. int main() { exit(0); }
  525. int t() { $openflags_prog }
  526. EOF
  527. if eval $compile; then
  528.   openflags_ok=1
  529. fi
  530. rm -f conftest*
  531. if test -z "$openflags_ok"; then
  532. echo "#define" NEED_SYS_FILE_H "1" >> confdefs.h
  533. DEFS="$DEFS -DNEED_SYS_FILE_H=1"
  534. SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_FILE_H\${SEDdB}NEED_SYS_FILE_H\${SEDdC}1\${SEDdD}
  535. \${SEDuA}NEED_SYS_FILE_H\${SEDuB}NEED_SYS_FILE_H\${SEDuC}1\${SEDuD}
  536. \${SEDeA}NEED_SYS_FILE_H\${SEDeB}NEED_SYS_FILE_H\${SEDeC}1\${SEDeD}
  537. \${SEDfA}NEED_SYS_FILE_H\${SEDfB}NEED_SYS_FILE_H\${SEDfC}1\${SEDfD}
  538. "
  539. fi
  540. fi
  541.  
  542.                       echo checking for directory library header
  543. dirheader=
  544. if test -z "$dirheader"; then
  545.   echo checking for dirent.h
  546. cat > conftest.c <<EOF
  547. #include "confdefs.h"
  548. #include <sys/types.h>
  549. #include <dirent.h>
  550. int main() { exit(0); }
  551. int t() { DIR *dirp = 0; }
  552. EOF
  553. if eval $compile; then
  554.   echo "#define" DIRENT "1" >> confdefs.h
  555. DEFS="$DEFS -DDIRENT=1"
  556. SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
  557. \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
  558. \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
  559. \${SEDfA}DIRENT\${SEDfB}DIRENT\${SEDfC}1\${SEDfD}
  560. " dirheader=dirent.h
  561. fi
  562. rm -f conftest*
  563. fi
  564. if test -z "$dirheader"; then
  565.   echo checking for sys/ndir.h
  566. cat > conftest.c <<EOF
  567. #include "confdefs.h"
  568. #include <sys/types.h>
  569. #include <sys/ndir.h>
  570. int main() { exit(0); }
  571. int t() { DIR *dirp = 0; }
  572. EOF
  573. if eval $compile; then
  574.   echo "#define" SYSNDIR "1" >> confdefs.h
  575. DEFS="$DEFS -DSYSNDIR=1"
  576. SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
  577. \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
  578. \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
  579. \${SEDfA}SYSNDIR\${SEDfB}SYSNDIR\${SEDfC}1\${SEDfD}
  580. " dirheader=sys/ndir.h
  581. fi
  582. rm -f conftest*
  583. fi
  584. if test -z "$dirheader"; then
  585.   echo checking for sys/dir.h
  586. cat > conftest.c <<EOF
  587. #include "confdefs.h"
  588. #include <sys/types.h>
  589. #include <sys/dir.h>
  590. int main() { exit(0); }
  591. int t() { DIR *dirp = 0; }
  592. EOF
  593. if eval $compile; then
  594.   echo "#define" SYSDIR "1" >> confdefs.h
  595. DEFS="$DEFS -DSYSDIR=1"
  596. SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
  597. \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
  598. \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
  599. \${SEDfA}SYSDIR\${SEDfB}SYSDIR\${SEDfC}1\${SEDfD}
  600. " dirheader=sys/dir.h
  601. fi
  602. rm -f conftest*
  603. fi
  604. if test -z "$dirheader"; then
  605.   echo checking for ndir.h
  606. cat > conftest.c <<EOF
  607. #include "confdefs.h"
  608. #include <sys/types.h>
  609. #include <ndir.h>
  610. int main() { exit(0); }
  611. int t() { DIR *dirp = 0; }
  612. EOF
  613. if eval $compile; then
  614.   echo "#define" NDIR "1" >> confdefs.h
  615. DEFS="$DEFS -DNDIR=1"
  616. SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
  617. \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
  618. \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
  619. \${SEDfA}NDIR\${SEDfB}NDIR\${SEDfC}1\${SEDfD}
  620. " dirheader=ndir.h
  621. fi
  622. rm -f conftest*
  623. fi
  624.  
  625. echo checking for closedir return value
  626. cat > conftest.c <<EOF
  627. #include "confdefs.h"
  628. #include <sys/types.h>
  629. #include <$dirheader>
  630. extern
  631. #ifdef __cplusplus
  632. "C"
  633. #endif
  634. #ifdef __STDC__
  635. int closedir (DIR* dirp);
  636. #else
  637. int closedir();
  638. #endif
  639. main() { exit(closedir(opendir(".")) != 0); }
  640. EOF
  641. eval $compile
  642. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  643.   :
  644. else
  645.   echo "#define" VOID_CLOSEDIR "1" >> confdefs.h
  646. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  647. SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
  648. \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
  649. \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
  650. \${SEDfA}VOID_CLOSEDIR\${SEDfB}VOID_CLOSEDIR\${SEDfC}1\${SEDfD}
  651. "
  652. fi
  653. rm -f conftest*
  654.  
  655.                       echo checking for Xenix
  656. cat > conftest.c <<EOF
  657. #include "confdefs.h"
  658. #if defined(M_XENIX) && !defined(M_UNIX)
  659.   yes
  660. #endif
  661.  
  662. EOF
  663. eval "$CPP conftest.c > conftest.out 2>&1"
  664. if egrep "yes" conftest.out >/dev/null 2>&1; then
  665.   XENIX=1
  666. fi
  667. rm -f conftest*
  668. if test -n "$XENIX"; then
  669.   LIBS="$LIBS -lx"
  670.   case "$DEFS" in
  671.   *SYSNDIR*) ;;
  672.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  673.   esac
  674. fi
  675.  
  676.                       for hdr in termios.h termio.h sys/termio.h sgtty.h
  677. do
  678. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  679. echo checking for ${hdr}
  680. cat > conftest.c <<EOF
  681. #include "confdefs.h"
  682. #include <${hdr}>
  683. EOF
  684. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  685. if test -z "$err"; then
  686.   echo "#define" ${trhdr} "1" >> confdefs.h
  687. DEFS="$DEFS -D${trhdr}=1"
  688. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  689. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  690. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  691. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  692. "
  693. fi
  694. rm -f conftest*
  695. done
  696. case "$DEFS" in
  697.   *HAVE_TERMIOS_H*)
  698. for func in tcgetattr tcflow
  699. do
  700. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  701. echo checking for ${func}
  702. cat > conftest.c <<EOF
  703. #include "confdefs.h"
  704. #include <ctype.h>
  705. #ifdef __cplusplus
  706. extern "C" char ${func}();
  707. #endif
  708. int main() { exit(0); }
  709. int t() { 
  710. /* The GNU C library defines this for functions which it implements
  711.     to always fail with ENOSYS.  Some functions are actually named
  712.     something starting with __ and the normal name is an alias.  */
  713. #if defined (__stub_${func}) || defined (__stub___${func})
  714. choke me
  715. #else
  716. #ifndef __cplusplus
  717. /* Override any gcc2 internal prototype to avoid an error.  */
  718. extern char ${func}();
  719. #endif
  720. ${func}();
  721. #endif
  722.  }
  723. EOF
  724. if eval $compile; then
  725.   echo "#define" ${trfunc} "1" >> confdefs.h
  726. DEFS="$DEFS -D${trfunc}=1"
  727. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  728. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  729. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  730. \${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
  731. "
  732. fi
  733. rm -f conftest*
  734. done
  735.   ;;
  736.   *) ;;
  737. esac
  738. for hdr in sys/stream.h sys/ptem.h
  739. do
  740. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  741. echo checking for ${hdr}
  742. cat > conftest.c <<EOF
  743. #include "confdefs.h"
  744. #include <${hdr}>
  745. EOF
  746. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  747. if test -z "$err"; then
  748.   echo "#define" ${trhdr} "1" >> confdefs.h
  749. DEFS="$DEFS -D${trhdr}=1"
  750. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  751. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  752. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  753. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  754. "
  755. fi
  756. rm -f conftest*
  757. done
  758. ioctl_decl='#ifdef STDC_HEADERS
  759. #include <stdlib.h>
  760. #endif
  761. #ifdef HAVE_UNISTD_H
  762. #include <sys/types.h>
  763. #include <unistd.h>
  764. #endif
  765. #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) && defined(HAVE_TCFLOW)
  766. #include <termios.h>
  767. #else
  768. #if defined(HAVE_TERMIO_H) || defined(HAVE_SYS_TERMIO_H)
  769. #ifdef HAVE_SYS_TERMIO_H
  770. #include <sys/termio.h>
  771. #else
  772. #include <termio.h>
  773. #endif
  774. #else
  775. #include <sgtty.h>
  776. #include <sys/ioctl.h>
  777. #endif
  778. #endif
  779. #ifdef HAVE_SYS_STREAM_H
  780. #include <sys/stream.h>
  781. #endif
  782. #ifdef HAVE_SYS_PTEM_H
  783. #include <sys/ptem.h>
  784. #endif
  785. '
  786. ioctl_prog='int x = FIONREAD;'
  787. echo checking for FIONREAD
  788. cat > conftest.c <<EOF
  789. #include "confdefs.h"
  790. $ioctl_decl
  791. int main() { exit(0); }
  792. int t() { $ioctl_prog }
  793. EOF
  794. if eval $compile; then
  795.   ioctl_ok=1
  796. fi
  797. rm -f conftest*
  798. if test -z "$ioctl_ok"; then
  799. echo checking for FIONREAD in sys/filio.h
  800. cat > conftest.c <<EOF
  801. #include "confdefs.h"
  802. $ioctl_decl#include <sys/filio.h>
  803. int main() { exit(0); }
  804. int t() { $ioctl_prog }
  805. EOF
  806. if eval $compile; then
  807.   echo "#define" NEED_SYS_FILIO_H "1" >> confdefs.h
  808. DEFS="$DEFS -DNEED_SYS_FILIO_H=1"
  809. SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_FILIO_H\${SEDdB}NEED_SYS_FILIO_H\${SEDdC}1\${SEDdD}
  810. \${SEDuA}NEED_SYS_FILIO_H\${SEDuB}NEED_SYS_FILIO_H\${SEDuC}1\${SEDuD}
  811. \${SEDeA}NEED_SYS_FILIO_H\${SEDeB}NEED_SYS_FILIO_H\${SEDeC}1\${SEDeD}
  812. \${SEDfA}NEED_SYS_FILIO_H\${SEDfB}NEED_SYS_FILIO_H\${SEDfC}1\${SEDfD}
  813. "
  814. ioctl_ok=1
  815. fi
  816. rm -f conftest*
  817. fi
  818. if test -z "$ioctl_ok"; then
  819. echo checking for FIONREAD in sys/ioctl.h
  820. cat > conftest.c <<EOF
  821. #include "confdefs.h"
  822. $ioctl_decl#include <sys/ioctl.h>
  823. int main() { exit(0); }
  824. int t() { $ioctl_prog }
  825. EOF
  826. if eval $compile; then
  827.   echo "#define" NEED_SYS_IOCTL_H "1" >> confdefs.h
  828. DEFS="$DEFS -DNEED_SYS_IOCTL_H=1"
  829. SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_IOCTL_H\${SEDdB}NEED_SYS_IOCTL_H\${SEDdC}1\${SEDdD}
  830. \${SEDuA}NEED_SYS_IOCTL_H\${SEDuB}NEED_SYS_IOCTL_H\${SEDuC}1\${SEDuD}
  831. \${SEDeA}NEED_SYS_IOCTL_H\${SEDeB}NEED_SYS_IOCTL_H\${SEDeC}1\${SEDeD}
  832. \${SEDfA}NEED_SYS_IOCTL_H\${SEDfB}NEED_SYS_IOCTL_H\${SEDfC}1\${SEDfD}
  833. "
  834. ioctl_ok=1
  835. fi
  836. rm -f conftest*
  837. fi
  838.  
  839.                                                                                         # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  840. # for constant arguments.  Useless!
  841. echo checking for working alloca.h
  842. cat > conftest.c <<EOF
  843. #include "confdefs.h"
  844. #include <alloca.h>
  845. int main() { exit(0); }
  846. int t() { char *p = alloca(2 * sizeof(int)); }
  847. EOF
  848. if eval $compile; then
  849.   echo "#define" HAVE_ALLOCA_H "1" >> confdefs.h
  850. DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  851. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD}
  852. \${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD}
  853. \${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD}
  854. \${SEDfA}HAVE_ALLOCA_H\${SEDfB}HAVE_ALLOCA_H\${SEDfC}1\${SEDfD}
  855. "
  856. fi
  857. rm -f conftest*
  858.  
  859. decl="#ifdef __GNUC__
  860. #define alloca __builtin_alloca
  861. #else
  862. #if HAVE_ALLOCA_H
  863. #include <alloca.h>
  864. #else
  865. #ifdef _AIX
  866.  #pragma alloca
  867. #else
  868. char *alloca ();
  869. #endif
  870. #endif
  871. #endif
  872. "
  873. echo checking for alloca
  874. cat > conftest.c <<EOF
  875. #include "confdefs.h"
  876. $decl
  877. int main() { exit(0); }
  878. int t() { char *p = (char *) alloca(1); }
  879. EOF
  880. if eval $compile; then
  881.   :
  882. else
  883.   alloca_missing=1
  884. cat > conftest.c <<EOF
  885. #include "confdefs.h"
  886.  
  887. #if defined(CRAY) && ! defined(CRAY2)
  888. winnitude
  889. #else
  890. lossage
  891. #endif
  892.  
  893. EOF
  894. eval "$CPP conftest.c > conftest.out 2>&1"
  895. if egrep "winnitude" conftest.out >/dev/null 2>&1; then
  896.   echo checking for _getb67
  897. cat > conftest.c <<EOF
  898. #include "confdefs.h"
  899. #include <ctype.h>
  900. #ifdef __cplusplus
  901. extern "C" char _getb67();
  902. #endif
  903. int main() { exit(0); }
  904. int t() { 
  905. /* The GNU C library defines this for functions which it implements
  906.     to always fail with ENOSYS.  Some functions are actually named
  907.     something starting with __ and the normal name is an alias.  */
  908. #if defined (__stub__getb67) || defined (__stub____getb67)
  909. choke me
  910. #else
  911. #ifndef __cplusplus
  912. /* Override any gcc2 internal prototype to avoid an error.  */
  913. extern char _getb67();
  914. #endif
  915. _getb67();
  916. #endif
  917.  }
  918. EOF
  919. if eval $compile; then
  920.   echo "#define" CRAY_STACKSEG_END "_getb67" >> confdefs.h
  921. DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67"
  922. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}_getb67\${SEDdD}
  923. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}_getb67\${SEDuD}
  924. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}_getb67\${SEDeD}
  925. \${SEDfA}CRAY_STACKSEG_END\${SEDfB}CRAY_STACKSEG_END\${SEDfC}_getb67\${SEDfD}
  926. "
  927. else
  928.   echo checking for GETB67
  929. cat > conftest.c <<EOF
  930. #include "confdefs.h"
  931. #include <ctype.h>
  932. #ifdef __cplusplus
  933. extern "C" char GETB67();
  934. #endif
  935. int main() { exit(0); }
  936. int t() { 
  937. /* The GNU C library defines this for functions which it implements
  938.     to always fail with ENOSYS.  Some functions are actually named
  939.     something starting with __ and the normal name is an alias.  */
  940. #if defined (__stub_GETB67) || defined (__stub___GETB67)
  941. choke me
  942. #else
  943. #ifndef __cplusplus
  944. /* Override any gcc2 internal prototype to avoid an error.  */
  945. extern char GETB67();
  946. #endif
  947. GETB67();
  948. #endif
  949.  }
  950. EOF
  951. if eval $compile; then
  952.   echo "#define" CRAY_STACKSEG_END "GETB67" >> confdefs.h
  953. DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67"
  954. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}GETB67\${SEDdD}
  955. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}GETB67\${SEDuD}
  956. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}GETB67\${SEDeD}
  957. \${SEDfA}CRAY_STACKSEG_END\${SEDfB}CRAY_STACKSEG_END\${SEDfC}GETB67\${SEDfD}
  958. "
  959. else
  960.   echo checking for getb67
  961. cat > conftest.c <<EOF
  962. #include "confdefs.h"
  963. #include <ctype.h>
  964. #ifdef __cplusplus
  965. extern "C" char getb67();
  966. #endif
  967. int main() { exit(0); }
  968. int t() { 
  969. /* The GNU C library defines this for functions which it implements
  970.     to always fail with ENOSYS.  Some functions are actually named
  971.     something starting with __ and the normal name is an alias.  */
  972. #if defined (__stub_getb67) || defined (__stub___getb67)
  973. choke me
  974. #else
  975. #ifndef __cplusplus
  976. /* Override any gcc2 internal prototype to avoid an error.  */
  977. extern char getb67();
  978. #endif
  979. getb67();
  980. #endif
  981.  }
  982. EOF
  983. if eval $compile; then
  984.   echo "#define" CRAY_STACKSEG_END "getb67" >> confdefs.h
  985. DEFS="$DEFS -DCRAY_STACKSEG_END=getb67"
  986. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}getb67\${SEDdD}
  987. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}getb67\${SEDuD}
  988. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}getb67\${SEDeD}
  989. \${SEDfA}CRAY_STACKSEG_END\${SEDfB}CRAY_STACKSEG_END\${SEDfC}getb67\${SEDfD}
  990. "
  991. fi
  992. rm -f conftest*
  993.  
  994. fi
  995. rm -f conftest*
  996.  
  997. fi
  998. rm -f conftest*
  999.  
  1000. fi
  1001. rm -f conftest*
  1002.  
  1003.  
  1004. fi
  1005. rm -f conftest*
  1006.  
  1007. if test -n "$alloca_missing"; then
  1008.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  1009.   # that cause trouble.  Some versions do not even contain alloca or
  1010.   # contain a buggy version.  If you still want to use their alloca,
  1011.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  1012.   ALLOCA=alloca.o
  1013.   echo "#define" C_ALLOCA "1" >> confdefs.h
  1014. DEFS="$DEFS -DC_ALLOCA=1"
  1015. SEDDEFS="${SEDDEFS}\${SEDdA}C_ALLOCA\${SEDdB}C_ALLOCA\${SEDdC}1\${SEDdD}
  1016. \${SEDuA}C_ALLOCA\${SEDuB}C_ALLOCA\${SEDuC}1\${SEDuD}
  1017. \${SEDeA}C_ALLOCA\${SEDeB}C_ALLOCA\${SEDeC}1\${SEDeD}
  1018. \${SEDfA}C_ALLOCA\${SEDfB}C_ALLOCA\${SEDfC}1\${SEDfD}
  1019. "
  1020.  
  1021.   echo 'checking stack direction for C alloca'
  1022.   echo checking whether cross-compiling
  1023. # If we cannot run a trivial program, we must be cross compiling.
  1024. cat > conftest.c <<EOF
  1025. #include "confdefs.h"
  1026. main(){exit(0);}
  1027. EOF
  1028. eval $compile
  1029. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1030.   :
  1031. else
  1032.   cross_compiling=1
  1033. fi
  1034. rm -f conftest*
  1035.  
  1036. if test -n "$cross_compiling"
  1037. then
  1038.   echo "#define" STACK_DIRECTION "0" >> confdefs.h
  1039. DEFS="$DEFS -DSTACK_DIRECTION=0"
  1040. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}0\${SEDdD}
  1041. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}0\${SEDuD}
  1042. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}0\${SEDeD}
  1043. \${SEDfA}STACK_DIRECTION\${SEDfB}STACK_DIRECTION\${SEDfC}0\${SEDfD}
  1044. "
  1045. else
  1046. cat > conftest.c <<EOF
  1047. #include "confdefs.h"
  1048. find_stack_direction ()
  1049. {
  1050.   static char *addr = 0;
  1051.   auto char dummy;
  1052.   if (addr == 0)
  1053.     {
  1054.       addr = &dummy;
  1055.       return find_stack_direction ();
  1056.     }
  1057.   else
  1058.     return (&dummy > addr) ? 1 : -1;
  1059. }
  1060. main ()
  1061. {
  1062.   exit (find_stack_direction() < 0);
  1063. }
  1064. EOF
  1065. eval $compile
  1066. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1067.   echo "#define" STACK_DIRECTION "1" >> confdefs.h
  1068. DEFS="$DEFS -DSTACK_DIRECTION=1"
  1069. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}1\${SEDdD}
  1070. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}1\${SEDuD}
  1071. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}1\${SEDeD}
  1072. \${SEDfA}STACK_DIRECTION\${SEDfB}STACK_DIRECTION\${SEDfC}1\${SEDfD}
  1073. "
  1074. else
  1075.   echo "#define" STACK_DIRECTION "-1" >> confdefs.h
  1076. DEFS="$DEFS -DSTACK_DIRECTION=-1"
  1077. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}-1\${SEDdD}
  1078. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}-1\${SEDuD}
  1079. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}-1\${SEDeD}
  1080. \${SEDfA}STACK_DIRECTION\${SEDfB}STACK_DIRECTION\${SEDfC}-1\${SEDfD}
  1081. "
  1082. fi
  1083. fi
  1084. rm -f conftest*
  1085. fi
  1086.  
  1087.                       for func in strchr strrchr strpbrk
  1088. do
  1089. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  1090. echo checking for ${func}
  1091. cat > conftest.c <<EOF
  1092. #include "confdefs.h"
  1093. #include <ctype.h>
  1094. #ifdef __cplusplus
  1095. extern "C" char ${func}();
  1096. #endif
  1097. int main() { exit(0); }
  1098. int t() { 
  1099. /* The GNU C library defines this for functions which it implements
  1100.     to always fail with ENOSYS.  Some functions are actually named
  1101.     something starting with __ and the normal name is an alias.  */
  1102. #if defined (__stub_${func}) || defined (__stub___${func})
  1103. choke me
  1104. #else
  1105. #ifndef __cplusplus
  1106. /* Override any gcc2 internal prototype to avoid an error.  */
  1107. extern char ${func}();
  1108. #endif
  1109. ${func}();
  1110. #endif
  1111.  }
  1112. EOF
  1113. if eval $compile; then
  1114.   echo "#define" ${trfunc} "1" >> confdefs.h
  1115. DEFS="$DEFS -D${trfunc}=1"
  1116. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  1117. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  1118. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  1119. \${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
  1120. "
  1121. fi
  1122. rm -f conftest*
  1123. done
  1124.  
  1125.                       echo checking for return type of signal handlers
  1126. cat > conftest.c <<EOF
  1127. #include "confdefs.h"
  1128. #include <sys/types.h>
  1129. #include <signal.h>
  1130. #ifdef signal
  1131. #undef signal
  1132. #endif
  1133. extern
  1134. #ifdef __cplusplus
  1135. "C"
  1136. #endif
  1137. int (*signal ()) ();
  1138. int main() { exit(0); }
  1139. int t() { int i; }
  1140. EOF
  1141. if eval $compile; then
  1142.   :
  1143. else
  1144.   echo "#define" RETSIGTYPE_VOID "1" >> confdefs.h
  1145. DEFS="$DEFS -DRETSIGTYPE_VOID=1"
  1146. SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE_VOID\${SEDdB}RETSIGTYPE_VOID\${SEDdC}1\${SEDdD}
  1147. \${SEDuA}RETSIGTYPE_VOID\${SEDuB}RETSIGTYPE_VOID\${SEDuC}1\${SEDuD}
  1148. \${SEDeA}RETSIGTYPE_VOID\${SEDeB}RETSIGTYPE_VOID\${SEDeC}1\${SEDeD}
  1149. \${SEDfA}RETSIGTYPE_VOID\${SEDfB}RETSIGTYPE_VOID\${SEDfC}1\${SEDfD}
  1150. "
  1151. fi
  1152. rm -f conftest*
  1153.  
  1154.  
  1155.                       echo checking for sighold
  1156. cat > conftest.c <<EOF
  1157. #include "confdefs.h"
  1158. #include <ctype.h>
  1159. #ifdef __cplusplus
  1160. extern "C" char sighold();
  1161. #endif
  1162. int main() { exit(0); }
  1163. int t() { 
  1164. /* The GNU C library defines this for functions which it implements
  1165.     to always fail with ENOSYS.  Some functions are actually named
  1166.     something starting with __ and the normal name is an alias.  */
  1167. #if defined (__stub_sighold) || defined (__stub___sighold)
  1168. choke me
  1169. #else
  1170. #ifndef __cplusplus
  1171. /* Override any gcc2 internal prototype to avoid an error.  */
  1172. extern char sighold();
  1173. #endif
  1174. sighold();
  1175. #endif
  1176.  }
  1177. EOF
  1178. if eval $compile; then
  1179.   echo "#define" SIGNALBLOCK_SYSV "1" >> confdefs.h
  1180. DEFS="$DEFS -DSIGNALBLOCK_SYSV=1"
  1181. SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_SYSV\${SEDdB}SIGNALBLOCK_SYSV\${SEDdC}1\${SEDdD}
  1182. \${SEDuA}SIGNALBLOCK_SYSV\${SEDuB}SIGNALBLOCK_SYSV\${SEDuC}1\${SEDuD}
  1183. \${SEDeA}SIGNALBLOCK_SYSV\${SEDeB}SIGNALBLOCK_SYSV\${SEDeC}1\${SEDeD}
  1184. \${SEDfA}SIGNALBLOCK_SYSV\${SEDfB}SIGNALBLOCK_SYSV\${SEDfC}1\${SEDfD}
  1185. "
  1186. fi
  1187. rm -f conftest*
  1188. echo '#include "confdefs.h"
  1189. #include <signal.h>' > conftest.c
  1190. eval "$CPP conftest.c > conftest.out 2>&1"
  1191. if egrep "sigset_t" conftest.out >/dev/null 2>&1; then
  1192.   :
  1193. else
  1194.   signals_not_posix=1
  1195. fi
  1196. rm -f conftest*
  1197. if test -z "$signals_not_posix"; then
  1198. echo checking for sigprocmask
  1199. cat > conftest.c <<EOF
  1200. #include "confdefs.h"
  1201. #include <ctype.h>
  1202. #ifdef __cplusplus
  1203. extern "C" char sigprocmask();
  1204. #endif
  1205. int main() { exit(0); }
  1206. int t() { 
  1207. /* The GNU C library defines this for functions which it implements
  1208.     to always fail with ENOSYS.  Some functions are actually named
  1209.     something starting with __ and the normal name is an alias.  */
  1210. #if defined (__stub_sigprocmask) || defined (__stub___sigprocmask)
  1211. choke me
  1212. #else
  1213. #ifndef __cplusplus
  1214. /* Override any gcc2 internal prototype to avoid an error.  */
  1215. extern char sigprocmask();
  1216. #endif
  1217. sigprocmask();
  1218. #endif
  1219.  }
  1220. EOF
  1221. if eval $compile; then
  1222.   echo "#define" SIGNALBLOCK_POSIX "1" >> confdefs.h
  1223. DEFS="$DEFS -DSIGNALBLOCK_POSIX=1"
  1224. SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_POSIX\${SEDdB}SIGNALBLOCK_POSIX\${SEDdC}1\${SEDdD}
  1225. \${SEDuA}SIGNALBLOCK_POSIX\${SEDuB}SIGNALBLOCK_POSIX\${SEDuC}1\${SEDuD}
  1226. \${SEDeA}SIGNALBLOCK_POSIX\${SEDeB}SIGNALBLOCK_POSIX\${SEDeC}1\${SEDeD}
  1227. \${SEDfA}SIGNALBLOCK_POSIX\${SEDfB}SIGNALBLOCK_POSIX\${SEDfC}1\${SEDfD}
  1228. "
  1229. fi
  1230. rm -f conftest*
  1231. fi
  1232. echo checking for sigblock
  1233. cat > conftest.c <<EOF
  1234. #include "confdefs.h"
  1235. #include <ctype.h>
  1236. #ifdef __cplusplus
  1237. extern "C" char sigblock();
  1238. #endif
  1239. int main() { exit(0); }
  1240. int t() { 
  1241. /* The GNU C library defines this for functions which it implements
  1242.     to always fail with ENOSYS.  Some functions are actually named
  1243.     something starting with __ and the normal name is an alias.  */
  1244. #if defined (__stub_sigblock) || defined (__stub___sigblock)
  1245. choke me
  1246. #else
  1247. #ifndef __cplusplus
  1248. /* Override any gcc2 internal prototype to avoid an error.  */
  1249. extern char sigblock();
  1250. #endif
  1251. sigblock();
  1252. #endif
  1253.  }
  1254. EOF
  1255. if eval $compile; then
  1256.   echo "#define" SIGNALBLOCK_BSD "1" >> confdefs.h
  1257. DEFS="$DEFS -DSIGNALBLOCK_BSD=1"
  1258. SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_BSD\${SEDdB}SIGNALBLOCK_BSD\${SEDdC}1\${SEDdD}
  1259. \${SEDuA}SIGNALBLOCK_BSD\${SEDuB}SIGNALBLOCK_BSD\${SEDuC}1\${SEDuD}
  1260. \${SEDeA}SIGNALBLOCK_BSD\${SEDeB}SIGNALBLOCK_BSD\${SEDeC}1\${SEDeD}
  1261. \${SEDfA}SIGNALBLOCK_BSD\${SEDfB}SIGNALBLOCK_BSD\${SEDfC}1\${SEDfD}
  1262. "
  1263. fi
  1264. rm -f conftest*
  1265.  
  1266.                       # Set default prefixes.
  1267. if test -n "$prefix"; then
  1268.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  1269.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  1270. fi
  1271. if test -n "$exec_prefix"; then
  1272.   prsub="$prsub
  1273. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  1274. fi
  1275. # Quote sed substitution magic chars in DEFS.
  1276. cat >conftest.def <<EOF
  1277. $DEFS
  1278. EOF
  1279. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  1280. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  1281. rm -f conftest.def
  1282. # Substitute for predefined variables.
  1283.  
  1284. trap 'rm -f config.status; exit 1' 1 3 15
  1285. echo creating config.status
  1286. rm -f config.status
  1287. cat > config.status <<EOF
  1288. #!/bin/sh
  1289. # Generated automatically by configure.
  1290. # Run this file to recreate the current configuration.
  1291. # This directory was configured as follows,
  1292. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  1293. #
  1294. # $0 $configure_args
  1295.  
  1296. for arg
  1297. do
  1298.   case "\$arg" in
  1299.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  1300.     echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args
  1301.     exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;;
  1302.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  1303.   esac
  1304. done
  1305.  
  1306. trap 'rm -fr Makefile config.h conftest*; exit 1' 1 3 15
  1307. CC='$CC'
  1308. CPP='$CPP'
  1309. RANLIB='$RANLIB'
  1310. INSTALL='$INSTALL'
  1311. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  1312. INSTALL_DATA='$INSTALL_DATA'
  1313. ALLOCA='$ALLOCA'
  1314. LIBS='$LIBS'
  1315. srcdir='$srcdir'
  1316. prefix='$prefix'
  1317. exec_prefix='$exec_prefix'
  1318. prsub='$prsub'
  1319. extrasub='$extrasub'
  1320. EOF
  1321. cat >> config.status <<\EOF
  1322.  
  1323. top_srcdir=$srcdir
  1324.  
  1325. CONFIG_FILES=${CONFIG_FILES-"Makefile"}
  1326. for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
  1327.   srcdir=$top_srcdir
  1328.   # Remove last slash and all that follows it.  Not all systems have dirname.
  1329.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  1330.   if test "$dir" != "$file"; then
  1331.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  1332.     test ! -d $dir && mkdir $dir
  1333.   fi
  1334.   echo creating $file
  1335.   rm -f $file
  1336.   touch $file
  1337.   if test `echo $file|sed 's|.*/||'` = makemake; then
  1338.     echo "#! /bin/sh" >> $file
  1339.   fi
  1340.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." >> $file
  1341.   sed -e "
  1342. $prsub
  1343. $extrasub
  1344. s%@CC@%$CC%g
  1345. s%@CPP@%$CPP%g
  1346. s%@RANLIB@%$RANLIB%g
  1347. s%@INSTALL@%$INSTALL%g
  1348. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  1349. s%@INSTALL_DATA@%$INSTALL_DATA%g
  1350. s%@ALLOCA@%$ALLOCA%g
  1351. s%@LIBS@%$LIBS%g
  1352. s%@srcdir@%$srcdir%g
  1353. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  1354.   if test `echo $file|sed 's|.*/||'` = makemake; then
  1355.     chmod a+x $file
  1356.   fi
  1357. fi; done
  1358.  
  1359. CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"}
  1360. for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then
  1361. echo creating $file
  1362.  
  1363. # These sed commands are put into SEDDEFS when defining a macro.
  1364. # They are broken into pieces to make the sed script easier to manage.
  1365. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  1366. # is the cpp macro being defined and VALUE is the value it is being given.
  1367. # Each defining turns into a single global substitution command.
  1368. #
  1369. # SEDd sets the value in "#define NAME VALUE" lines.
  1370. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  1371. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  1372. SEDdC='\3'
  1373. SEDdD='@g'
  1374. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  1375. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  1376. SEDuB='\([     ]\)@\1#\2define\3'
  1377. SEDuC=' '
  1378. SEDuD='\4@g'
  1379. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  1380. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  1381. SEDeB='$@\1#\2define\3'
  1382. SEDeC=' '
  1383. SEDeD='@g'
  1384. # SEDf turns "#define NAME" without trailing blanks into "#define NAME VALUE".
  1385. SEDfA='s@^\([     ]*\)#\([     ]*\)define\([     ][     ]*\)'
  1386. SEDfB='$@\1#\2define\3'
  1387. SEDfC=' '
  1388. SEDfD='@g'
  1389. rm -f conftest.sed
  1390. EOF
  1391. # Turn off quoting long enough to insert the sed commands.
  1392. rm -f conftest.sh
  1393. cat > conftest.sh <<EOF
  1394. $SEDDEFS
  1395. EOF
  1396.  
  1397. # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
  1398. # on the size of here documents.
  1399.  
  1400. # Maximum number of lines to put in a single here document.
  1401. maxshlines=9
  1402.  
  1403. while :
  1404. do
  1405.   # wc gives bogus results for an empty file on some systems.
  1406.   lines=`grep -c . conftest.sh`
  1407.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  1408.   rm -f conftest.s1 conftest.s2
  1409.   sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  1410.   sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  1411.   # Write a limited-size here document to append to conftest.sed.
  1412.   echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  1413.   cat conftest.s1 >> config.status
  1414.   echo 'CONFEOF' >> config.status
  1415.   rm -f conftest.s1 conftest.sh
  1416.   mv conftest.s2 conftest.sh
  1417. done
  1418. rm -f conftest.sh
  1419.  
  1420. # Now back to your regularly scheduled config.status.
  1421. cat >> config.status <<\EOF
  1422. rm -f conftest.h
  1423. # Break up the sed commands because old seds have small limits.
  1424. maxsedlines=20
  1425. cp $top_srcdir/$file.in conftest.h1
  1426. while :
  1427. do
  1428.   lines=`grep -c . conftest.sed`
  1429.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  1430.   rm -f conftest.s1 conftest.s2 conftest.h2
  1431.   sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  1432.   sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  1433.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  1434.   rm -f conftest.s1 conftest.h1 conftest.sed
  1435.   mv conftest.h2 conftest.h1
  1436.   mv conftest.s2 conftest.sed
  1437. done
  1438. rm -f conftest.sed conftest.h
  1439. echo "/* $file.  Generated automatically by configure.  */" > conftest.h
  1440. cat conftest.h1 >> conftest.h
  1441. rm -f conftest.h1
  1442. if cmp -s $file conftest.h 2>/dev/null; then
  1443.   # The file exists and we would not be changing it.
  1444.   echo "$file is unchanged"
  1445.   rm -f conftest.h
  1446. else
  1447.   rm -f $file
  1448.   mv conftest.h $file
  1449. fi
  1450. fi; done
  1451.  
  1452.  
  1453.  
  1454. exit 0
  1455. EOF
  1456. chmod +x config.status
  1457. ${CONFIG_SHELL-/bin/sh} config.status
  1458.  
  1459.  
  1460.