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