home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / CLISP / CLISPSRC.TAR / clisp-1995-01-01 / src / configure.old < prev    next >
Encoding:
Text File  |  1994-12-30  |  196.2 KB  |  7,294 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. if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  92.   if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then
  93.     ac_n= ac_c='
  94. ' ac_t='    ' ac_tt=
  95.   else
  96.     ac_n=-n ac_c= ac_t= ac_tt='
  97.      '
  98.   fi
  99. else
  100.   ac_n= ac_c='\c' ac_t= ac_tt='
  101.      '
  102. fi
  103.  
  104. rm -fr conftest* confdefs.h core
  105. # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  106. echo > confdefs.h
  107. compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  108.  
  109. # A filename unique to this package, relative to the directory that
  110. # configure is in, which we can look for to find out if srcdir is correct.
  111. unique_file=lispbibl.d
  112.  
  113. # Find the source files, if location was not specified.
  114. if test -z "$srcdir"; then
  115.   srcdirdefaulted=yes
  116.   # Try the directory containing this script, then `..'.
  117.   prog=$0
  118.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  119.   test "X$confdir" = "X$prog" && confdir=.
  120.   srcdir=$confdir
  121.   if test ! -r $srcdir/$unique_file; then
  122.     srcdir=..
  123.   fi
  124. fi
  125. if test ! -r $srcdir/$unique_file; then
  126.   if test x$srcdirdefaulted = xyes; then
  127.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  128.   else
  129.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  130.   fi
  131.   exit 1
  132. fi
  133.  
  134. # Save the original args to write them into config.status later.
  135. configure_args="$*"
  136.  
  137.  
  138. if test -z "$CC"; then
  139.   # Extract the first word of `gcc', so it can be a program name with args.
  140.   set dummy gcc; word=$2
  141.   echo $ac_n "checking for $word""... $ac_c"
  142.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  143.   for dir in $PATH; do
  144.     test -z "$dir" && dir=.
  145.     if test -f $dir/$word; then
  146.       CC="gcc"
  147.       break
  148.     fi
  149.   done
  150.   IFS="$saveifs"
  151.   test -z "$CC" && CC="cc"
  152.   echo "${ac_t}using $CC"
  153. fi
  154.  
  155. # Find out if we are using GNU C, under whatever name.
  156. cat > conftest.c <<EOF
  157. #ifdef __GNUC__
  158.   yes
  159. #endif
  160. EOF
  161. ${CC-cc} -E conftest.c > conftest.out 2>&1
  162. if egrep yes conftest.out >/dev/null 2>&1; then
  163.   GCC=1 # For later tests.
  164.   CC="$CC -O"
  165. fi
  166. rm -f conftest*
  167.  
  168.                       echo $ac_n "checking how to run the C preprocessor""... $ac_c"
  169. if test -z "$CPP"; then
  170.   # This must be in double quotes, not single quotes, because CPP may get
  171.   # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  172.   # make.  It must be expanded now.
  173.   CPP="${CC-cc} -E"
  174.   if test -n "$GCC"; then
  175.     # Suppress warning messages.
  176.                     CPP="$CPP -w"
  177.   fi
  178.   if test -f /coherent; then
  179.             COHERENT=' || echo coherent'
  180.   fi
  181.   cat > conftest.c <<EOF
  182. #include "confdefs.h"
  183. #include <stdio.h>
  184. Syntax Error
  185. EOF
  186. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  187. if test -z "$err"; then
  188.   have_cpp=1
  189. fi
  190. rm -f conftest*
  191.   if test -z "$have_cpp"; then
  192.     CPP="${CC-cc} -E -traditional-cpp"
  193.     cat > conftest.c <<EOF
  194. #include "confdefs.h"
  195. #include <stdio.h>
  196. Syntax Error
  197. EOF
  198. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  199. if test -z "$err"; then
  200.   CC="${CC-cc} -traditional-cpp"
  201. else
  202.   CPP=/lib/cpp
  203. fi
  204. rm -f conftest*
  205.   fi
  206. fi
  207. echo "${ac_t}$CPP"
  208.  
  209.                       if test -n "$GCC"; then
  210.   echo $ac_n "checking whether -traditional is needed""... $ac_c"
  211.   pattern="Autoconf.*'x'"
  212.   prog='#include <sgtty.h>
  213. Autoconf TIOCGETP'
  214.   cat > conftest.c <<EOF
  215. #include "confdefs.h"
  216. $prog
  217. EOF
  218. eval "$CPP conftest.c > conftest.out 2>&1"
  219. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  220.   need_trad=1
  221. fi
  222. rm -f conftest*
  223.   if test -z "$need_trad"; then
  224.     prog='#include <termio.h>
  225. Autoconf TCGETA'
  226.     cat > conftest.c <<EOF
  227. #include "confdefs.h"
  228. $prog
  229. EOF
  230. eval "$CPP conftest.c > conftest.out 2>&1"
  231. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  232.   need_trad=1
  233. fi
  234. rm -f conftest*
  235.   fi
  236.   if test -z "$need_trad"; then
  237.     # On some USL SVR4 systems, gcc's fixinc.svr4 modifies <signal.h> and
  238.     # <sys/signal.h> in such a way that "#include <signal.h>" results in a
  239.     # syntax error because of `sigset_t' if gcc is called with __STDC__=1
  240.     # but __STRICT_ANSI__ undefined. Remedy: use -traditional.
  241.     prog='
  242. #include <sys/types.h>
  243. #include <signal.h>
  244. int main() { exit(0); }'
  245.     echo "$prog" > conftest.c
  246.     if eval $compile; then
  247.       :
  248.     else
  249.       prog='
  250. #undef __STDC__
  251. #include <sys/types.h>
  252. #include <signal.h>
  253. int main() { exit(0); }'
  254.       echo "$prog" > conftest.c
  255.       if eval $compile; then
  256.         need_trad=1
  257.       fi
  258.     fi
  259.     rm -f conftest*
  260.   fi
  261.   if test -n "$need_trad"; then
  262.     echo "${ac_t}yes"
  263.     CC="$CC -traditional"
  264.   else
  265.     echo "${ac_t}no"
  266.   fi
  267. fi
  268.  
  269.                       echo $ac_n "checking whether using GNU C""... $ac_c"
  270. cat > conftest.c <<EOF
  271. #include "confdefs.h"
  272. #ifdef __GNUC__
  273.   yes
  274. #endif
  275.  
  276. EOF
  277. eval "$CPP conftest.c > conftest.out 2>&1"
  278. if egrep "yes" conftest.out >/dev/null 2>&1; then
  279.   echo "${ac_t}yes"
  280. CC_GCC=true
  281. else
  282.   echo "${ac_t}no"
  283. CC_GCC=false
  284. fi
  285. rm -f conftest*
  286.  
  287.                       echo $ac_n "checking whether using ANSI C""... $ac_c"
  288. cat > conftest.c <<EOF
  289. #include "confdefs.h"
  290. #ifdef __STDC__
  291.   yes
  292. #endif
  293.  
  294. EOF
  295. eval "$CPP conftest.c > conftest.out 2>&1"
  296. if egrep "yes" conftest.out >/dev/null 2>&1; then
  297.   echo "${ac_t}yes"
  298. CC_ANSI=true
  299. else
  300.   echo "${ac_t}no"
  301. CC_ANSI=false
  302. fi
  303. rm -f conftest*
  304.  
  305.                       echo $ac_n "checking whether CPP likes indented directives""... $ac_c"
  306. cat > conftest.c <<EOF
  307. #include "confdefs.h"
  308.  #define foo
  309. EOF
  310. eval "$CPP conftest.c > conftest.out 2>&1"
  311. if egrep "#.*foo" conftest.out >/dev/null 2>&1; then
  312.   echo "${ac_t}no"
  313. CC_NEED_CCPAUX=true
  314. else
  315.   echo "${ac_t}yes"
  316. CC_NEED_CCPAUX=false
  317. fi
  318. rm -f conftest*
  319.  
  320.                       echo $ac_n "checking whether CPP understands #elif""... $ac_c"
  321. cat > conftest.c <<EOF
  322. #include "confdefs.h"
  323. #if 0
  324. #elif 1
  325. #else
  326. #endif
  327. EOF
  328. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  329. if test -z "$err"; then
  330.   echo "${ac_t}yes"
  331. CC_NEED_DEELIF=false
  332. else
  333.   echo "${ac_t}no"
  334. CC_NEED_DEELIF=true
  335. fi
  336. rm -f conftest*
  337.                       echo $ac_n "checking whether CPP understands #error""... $ac_c"
  338. cat > conftest.c <<EOF
  339. #include "confdefs.h"
  340. #if 0
  341. #error "bla"
  342. #endif
  343. EOF
  344. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  345. if test -z "$err"; then
  346.   echo "${ac_t}yes"
  347. CC_NEED_DEERROR=false
  348. else
  349.   echo "${ac_t}no"
  350. CC_NEED_DEERROR=true
  351. fi
  352. rm -f conftest*
  353.                       echo $ac_n "checking whether CPP likes empty macro arguments""... $ac_c"
  354. cat > conftest.c <<EOF
  355. #include "confdefs.h"
  356. #define divide(x,y,q_zuw,r_zuw) (r_zuw(x)-(q_zuw(x)/(y))*(y))
  357. foo(x,y) int x,y; { int q; divide(x,y,q=,); return q; }
  358. EOF
  359. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  360. if test -z "$err"; then
  361.   echo "${ac_t}yes"
  362. CC_NEED_DEEMA=false
  363. else
  364.   echo "${ac_t}no"
  365. CC_NEED_DEEMA=true
  366. fi
  367. rm -f conftest*
  368.                       echo $ac_n "checking whether CC merges adjacent strings""... $ac_c"
  369. echo "char foo [] = \"abc\" \"def\"; main() { exit(0); }" > conftest.c
  370. if eval $compile; then
  371.   echo "${ac_t}yes"
  372.   CC_NEED_MERGESTRINGS=false
  373. else
  374.   echo "${ac_t}no"
  375.   CC_NEED_MERGESTRINGS=true
  376. fi
  377. rm -f conftest*
  378.  
  379.                       echo $ac_n "checking for underscore in external names""... $ac_c"
  380. cat > conftest.c <<EOF
  381. int foo() { return 0; }
  382. EOF
  383. ${CC-cc} -c conftest.c >/dev/null 2>&1
  384. # check whether nm exists
  385. if (nm conftest.o) >/dev/null 2>&1 ; then
  386.   # use nm to see the assembly language name
  387.   if nm conftest.o | grep _foo >/dev/null 2>&1 ; then
  388.     AS_UNDERSCORE=true
  389.   else
  390.     AS_UNDERSCORE=false
  391.   fi
  392. else
  393.   # look for the assembly language name in the .s file
  394.   ${CC-cc} -S conftest.c >/dev/null 2>&1
  395.   if grep _foo conftest.s >/dev/null ; then
  396.     AS_UNDERSCORE=true
  397.   else
  398.     AS_UNDERSCORE=false
  399.   fi
  400. fi
  401. if test $AS_UNDERSCORE = true; then
  402.   echo "${ac_t}yes"
  403. else
  404.   echo "${ac_t}no"
  405. fi
  406. rm -f conftest*
  407.  
  408.                       if test -z "$RANLIB"; then
  409.   # Extract the first word of `ranlib', so it can be a program name with args.
  410.   set dummy ranlib; word=$2
  411.   echo $ac_n "checking for $word""... $ac_c"
  412.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  413.   for dir in $PATH; do
  414.     test -z "$dir" && dir=.
  415.     if test -f $dir/$word; then
  416.       RANLIB="ranlib"
  417.       break
  418.     fi
  419.   done
  420.   IFS="$saveifs"
  421.   test -z "$RANLIB" && RANLIB="echo not executing ranlib"
  422.   echo "${ac_t}using $RANLIB"
  423. fi
  424.  
  425.                       # Make sure to not get the incompatible SysV /etc/install and
  426. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  427. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  428. # or the AFS install, which mishandles nonexistent args, or
  429. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  430. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  431. # anyway.  Sigh.
  432. if test "z${INSTALL}" = "z" ; then
  433.   echo $ac_n "checking for install""... $ac_c"
  434.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  435.   for dir in $PATH; do
  436.     test -z "$dir" && dir=.
  437.     case $dir in
  438.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  439.     *)
  440.       if test -f $dir/installbsd; then
  441.     INSTALL="$dir/installbsd -c" # OSF1
  442.     INSTALL_PROGRAM='$(INSTALL)'
  443.     INSTALL_DATA='$(INSTALL) -m 644'
  444.     break
  445.       fi
  446.       if test -f $dir/install; then
  447.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  448.       : # AIX
  449.     else
  450.       INSTALL="$dir/install -c"
  451.       INSTALL_PROGRAM='$(INSTALL)'
  452.       INSTALL_DATA='$(INSTALL) -m 644'
  453.       break
  454.     fi
  455.       fi
  456.       ;;
  457.     esac
  458.   done
  459.   IFS="$saveifs"
  460.   echo "${ac_t}${INSTALL-cp}"
  461. fi
  462. INSTALL=${INSTALL-cp}
  463. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  464. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  465.  
  466.                       echo $ac_n "checking how to copy files""... $ac_c"
  467. echo "blabla" > conftest.x
  468. err=`/bin/sh -c "cp -p conftest.x conftest.y 2>&1"`
  469. if test -z "$err"; then
  470.   CP='cp -p'
  471. else
  472.   CP='cp'
  473. fi
  474. rm -f conftest*
  475. echo "${ac_t}$CP"
  476.  
  477.                       echo $ac_n "checking for ln -s""... $ac_c"
  478. rm -f conftestdata
  479. if ln -s X conftestdata 2>/dev/null
  480. then
  481.   rm -f conftestdata
  482.   echo "${ac_t}yes"
  483.   LN_S="ln -s"
  484. else
  485.   echo "${ac_t}no"
  486.   LN_S=ln
  487. fi
  488.  
  489.  
  490.                       echo $ac_n "checking for AIX""... $ac_c"
  491. cat > conftest.c <<EOF
  492. #include "confdefs.h"
  493. #ifdef _AIX
  494.   yes
  495. #endif
  496.  
  497. EOF
  498. eval "$CPP conftest.c > conftest.out 2>&1"
  499. if egrep "yes" conftest.out >/dev/null 2>&1; then
  500.   echo "${ac_t}yes"
  501. echo "#define" _ALL_SOURCE "1" >> confdefs.h
  502. DEFS="$DEFS -D_ALL_SOURCE=1"
  503. SEDDEFS="${SEDDEFS}\${SEDdA}_ALL_SOURCE\${SEDdB}_ALL_SOURCE\${SEDdC}1\${SEDdD}
  504. \${SEDuA}_ALL_SOURCE\${SEDuB}_ALL_SOURCE\${SEDuC}1\${SEDuD}
  505. \${SEDeA}_ALL_SOURCE\${SEDeB}_ALL_SOURCE\${SEDeC}1\${SEDeD}
  506. \${SEDfA}_ALL_SOURCE\${SEDfB}_ALL_SOURCE\${SEDfC}1\${SEDfD}
  507. "
  508. else
  509.   echo "${ac_t}no"
  510. fi
  511. rm -f conftest*
  512.  
  513.                       echo $ac_n "checking for POSIXized ISC""... $ac_c"
  514. if test -d /etc/conf/kconfig.d &&
  515.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  516. then
  517.   echo "${ac_t}yes"
  518.   ISC=1 # If later tests want to check for ISC.
  519.   echo "#define" _POSIX_SOURCE "1" >> confdefs.h
  520. DEFS="$DEFS -D_POSIX_SOURCE=1"
  521. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  522. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  523. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  524. \${SEDfA}_POSIX_SOURCE\${SEDfB}_POSIX_SOURCE\${SEDfC}1\${SEDfD}
  525. "
  526.   if test -n "$GCC"; then
  527.     CC="$CC -posix"
  528.   else
  529.     CC="$CC -Xp"
  530.   fi
  531. else
  532.   echo "${ac_t}no"
  533. fi
  534.  
  535.                       echo $ac_n "checking for minix/config.h""... $ac_c"
  536. cat > conftest.c <<EOF
  537. #include "confdefs.h"
  538. #include <minix/config.h>
  539. EOF
  540. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  541. if test -z "$err"; then
  542.   echo "${ac_t}yes"
  543. MINIX=1
  544. else
  545.   echo "${ac_t}no"
  546.  
  547. fi
  548. rm -f conftest*
  549. # The Minix shell can't assign to the same variable on the same line!
  550. if test -n "$MINIX"; then
  551.   echo "#define" _POSIX_SOURCE "1" >> confdefs.h
  552. DEFS="$DEFS -D_POSIX_SOURCE=1"
  553. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  554. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  555. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  556. \${SEDfA}_POSIX_SOURCE\${SEDfB}_POSIX_SOURCE\${SEDfC}1\${SEDfD}
  557. "
  558.   echo "#define" _POSIX_1_SOURCE "2" >> confdefs.h
  559. DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  560. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_1_SOURCE\${SEDdB}_POSIX_1_SOURCE\${SEDdC}2\${SEDdD}
  561. \${SEDuA}_POSIX_1_SOURCE\${SEDuB}_POSIX_1_SOURCE\${SEDuC}2\${SEDuD}
  562. \${SEDeA}_POSIX_1_SOURCE\${SEDeB}_POSIX_1_SOURCE\${SEDeC}2\${SEDeD}
  563. \${SEDfA}_POSIX_1_SOURCE\${SEDfB}_POSIX_1_SOURCE\${SEDfC}2\${SEDfD}
  564. "
  565.   echo "#define" _MINIX "1" >> confdefs.h
  566. DEFS="$DEFS -D_MINIX=1"
  567. SEDDEFS="${SEDDEFS}\${SEDdA}_MINIX\${SEDdB}_MINIX\${SEDdC}1\${SEDdD}
  568. \${SEDuA}_MINIX\${SEDuB}_MINIX\${SEDuC}1\${SEDuD}
  569. \${SEDeA}_MINIX\${SEDeB}_MINIX\${SEDeC}1\${SEDeD}
  570. \${SEDfA}_MINIX\${SEDfB}_MINIX\${SEDfC}1\${SEDfD}
  571. "
  572. fi
  573.  
  574.                       echo $ac_n "checking for IRIX libsun""... $ac_c"
  575. if test -f /usr/lib/libsun.a; then
  576.   echo "${ac_t}yes"
  577.   LIBS="$LIBS -lsun"
  578. else
  579.   echo "${ac_t}no"
  580. fi
  581.  
  582.                       echo $ac_n "checking for SCO UNIX libintl""... $ac_c"
  583. cat > conftest.c <<EOF
  584. #include "confdefs.h"
  585. #if defined(M_UNIX)
  586.   yes
  587. #endif
  588.  
  589. EOF
  590. eval "$CPP conftest.c > conftest.out 2>&1"
  591. if egrep "yes" conftest.out >/dev/null 2>&1; then
  592.   SCO_UNIX=1
  593. fi
  594. rm -f conftest*
  595. if test -n "$SCO_UNIX" && test -f /lib/libintl.a; then
  596.   echo "${ac_t}yes"
  597.   LIBS="$LIBS -lintl" # For strftime.
  598. else
  599.   echo "${ac_t}no"
  600. fi
  601.  
  602.                       echo $ac_n "checking for DYNIX/ptx libseq or libsocket""... $ac_c"
  603. cat > conftest.c <<EOF
  604. #include "confdefs.h"
  605. #if defined(_SEQUENT_)
  606.   yes
  607. #endif
  608.  
  609. EOF
  610. eval "$CPP conftest.c > conftest.out 2>&1"
  611. if egrep "yes" conftest.out >/dev/null 2>&1; then
  612.   SEQUENT=1
  613. fi
  614. rm -f conftest*
  615. if test -n "$SEQUENT"; then
  616. test -f /usr/lib/libseq.a &&
  617.   LIBS="$LIBS -lseq"
  618. test -f /usr/lib/libsocket.a &&
  619.   LIBS="$LIBS -lsocket"
  620. echo "${ac_t}yes"
  621. else
  622. echo "${ac_t}no"
  623. fi
  624.  
  625.                       echo $ac_n "checking whether gethostbyname requires -lsocket""... $ac_c"
  626. cat > conftest.c <<EOF
  627. #include "confdefs.h"
  628. extern char gethostbyname();
  629. int main() { exit(0); }
  630. int t() { gethostbyname(); }
  631. EOF
  632. if eval $compile; then
  633.   have_gethostbyname=1
  634. else
  635.   :
  636. fi
  637. rm -f conftest*
  638. if test -z "$have_gethostbyname"; then
  639. LIBS_old="$LIBS"
  640. LIBS="$LIBS -lsocket"
  641. cat > conftest.c <<EOF
  642. #include "confdefs.h"
  643. extern char gethostbyname();
  644. int main() { exit(0); }
  645. int t() { gethostbyname(); }
  646. EOF
  647. if eval $compile; then
  648.   echo "${ac_t}yes"
  649. else
  650.   echo "${ac_t}no"
  651. LIBS="$LIBS_old"
  652. fi
  653. rm -f conftest*
  654. else
  655. echo "${ac_t}no"
  656. fi
  657.  
  658.                       echo $ac_n "checking whether CC works at all""... $ac_c"
  659. cat > conftest.c <<EOF
  660. #include "confdefs.h"
  661. main() { exit(0); }
  662. EOF
  663. eval $compile
  664. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  665.   echo "${ac_t}yes"
  666.  
  667. else
  668.   echo "${ac_t}no"
  669. echo "Installation or configuration problem: C compiler cannot create executables."; exit 1
  670. fi
  671. if test -f core; then
  672.   coredir=core`/bin/sh -c 'echo $$'`
  673.   mkdir $coredir
  674.   cp confdefs.h $coredir/confdefs.h
  675.   mv conftest.c $coredir/conftest.c
  676.   mv conftest $coredir/conftest
  677.   mv core $coredir/core
  678.   echo "warning: test program dumped core -- see subdirectory $coredir"
  679. fi
  680. rm -f conftest*
  681.  
  682.                       echo $ac_n "checking for broken HP/UX, A/UX and OSF/1 shell""... $ac_c"
  683. # A program that outputs its argument count:
  684. cat > conftest.c <<EOF
  685. #include "confdefs.h"
  686. #include <stdio.h>
  687. #ifdef __STDC__
  688. main (int argc, char** argv)
  689. #else
  690. main (argc,argv) int argc; char** argv;
  691. #endif
  692. { printf("%d\n",argc); exit(0); }
  693. EOF
  694. eval $compile
  695. # How can a shell script forward its arguments to another program?
  696. #                                    $ * "$ *" "$ @"
  697. # conftest.sh                         1    2     1 (*)
  698. # conftest.sh foo                     2    2     2
  699. # conftest.sh foo bar                 3    2     3
  700. # conftest.sh "foo bar"               3    2     2
  701. # (*): 2 with HP-UX /bin/sh. We must use /bin/ksh instead.
  702. #      2 as well with NeXTstep /bin/sh. No /bin/ksh. Examine 0 first.
  703. psubs='"$''@"'
  704. cat > conftest.sh <<EOF
  705. #!/bin/sh
  706. exec ./conftest $psubs
  707. EOF
  708. chmod a+x conftest.sh
  709. if test `./conftest.sh` = "1"; then
  710.   echo "${ac_t}no"
  711.   GOOD_SH='/bin/sh'
  712. else
  713.   echo "${ac_t}yes"
  714.   if test -x /bin/ksh; then
  715.     GOOD_SH='/bin/ksh'
  716.     echo "#define" UNIX_USE_KSH "1" >> confdefs.h
  717. DEFS="$DEFS -DUNIX_USE_KSH=1"
  718. SEDDEFS="${SEDDEFS}\${SEDdA}UNIX_USE_KSH\${SEDdB}UNIX_USE_KSH\${SEDdC}1\${SEDdD}
  719. \${SEDuA}UNIX_USE_KSH\${SEDuB}UNIX_USE_KSH\${SEDuC}1\${SEDuD}
  720. \${SEDeA}UNIX_USE_KSH\${SEDeB}UNIX_USE_KSH\${SEDeC}1\${SEDeD}
  721. \${SEDfA}UNIX_USE_KSH\${SEDfB}UNIX_USE_KSH\${SEDfC}1\${SEDfD}
  722. "
  723.   else
  724.     GOOD_SH=''
  725.     echo "#define" UNIX_BROKEN_SH "1" >> confdefs.h
  726. DEFS="$DEFS -DUNIX_BROKEN_SH=1"
  727. SEDDEFS="${SEDDEFS}\${SEDdA}UNIX_BROKEN_SH\${SEDdB}UNIX_BROKEN_SH\${SEDdC}1\${SEDdD}
  728. \${SEDuA}UNIX_BROKEN_SH\${SEDuB}UNIX_BROKEN_SH\${SEDuC}1\${SEDuD}
  729. \${SEDeA}UNIX_BROKEN_SH\${SEDeB}UNIX_BROKEN_SH\${SEDeC}1\${SEDeD}
  730. \${SEDfA}UNIX_BROKEN_SH\${SEDfB}UNIX_BROKEN_SH\${SEDfC}1\${SEDfD}
  731. "
  732.   fi
  733. fi
  734. rm -f conftest*
  735.  
  736.                       prog='/* Ultrix mips cc rejects this.  */
  737. typedef int charset[2]; const charset x;
  738. /* SunOS 4.1.1 cc rejects this.  */
  739. char const *const *ccp;
  740. char **p;
  741. /* AIX XL C 1.02.0.0 rejects this.
  742.    It does not let you subtract one const X* pointer from another in an arm
  743.    of an if-expression whose if-part is not a constant expression */
  744. const char *g = "string";
  745. ccp = &g + (g ? g-g : 0);
  746. /* HPUX 7.0 cc rejects these. */
  747. ++ccp;
  748. p = (char**) ccp;
  749. ccp = (char const *const *) p;
  750. { /* SCO 3.2v4 cc rejects this.  */
  751.   char *t;
  752.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  753.   *t++ = 0;
  754. }
  755. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  756.   int x[] = {25,17};
  757.   const int *foo = &x[0];
  758.   ++foo;
  759. }
  760. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  761.   typedef const int *iptr;
  762.   iptr p = 0;
  763.   ++p;
  764. }
  765. { /* AIX XL C 1.02.0.0 rejects this saying
  766.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  767.   struct s { int j; const int *ap[3]; };
  768.   struct s *b; b->j = 5;
  769. }
  770. { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  771.   const int foo = 10;
  772. }'
  773. echo $ac_n "checking for working const""... $ac_c"
  774. cat > conftest.c <<EOF
  775. #include "confdefs.h"
  776.  
  777. int main() { exit(0); }
  778. int t() { $prog }
  779. EOF
  780. if eval $compile; then
  781.   echo "${ac_t}yes"
  782.   :
  783. else
  784.   echo "${ac_t}no"
  785.   echo "#define" const "" >> confdefs.h
  786. DEFS="$DEFS -Dconst="
  787. SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD}
  788. \${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD}
  789. \${SEDeA}const\${SEDeB}const\${SEDeC}\${SEDeD}
  790. \${SEDfA}const\${SEDfB}const\${SEDfC}\${SEDfD}
  791. "
  792. fi
  793. rm -f conftest*
  794.  
  795.                       if test -n "$GCC"; then
  796. echo $ac_n "checking for inline""... $ac_c"
  797. cat > conftest.c <<EOF
  798. #include "confdefs.h"
  799.  
  800. int main() { exit(0); }
  801. int t() { } inline foo() { }
  802. EOF
  803. if eval $compile; then
  804.   echo "${ac_t}yes"
  805.   :
  806. else
  807.   echo "${ac_t}no"
  808.   echo "#define" inline "__inline" >> confdefs.h
  809. DEFS="$DEFS -Dinline=__inline"
  810. SEDDEFS="${SEDDEFS}\${SEDdA}inline\${SEDdB}inline\${SEDdC}__inline\${SEDdD}
  811. \${SEDuA}inline\${SEDuB}inline\${SEDuC}__inline\${SEDuD}
  812. \${SEDeA}inline\${SEDeB}inline\${SEDeC}__inline\${SEDeD}
  813. \${SEDfA}inline\${SEDfB}inline\${SEDfC}__inline\${SEDfD}
  814. "
  815. fi
  816. rm -f conftest*
  817. fi
  818.  
  819.                       if test -n "$GCC"; then
  820. echo $ac_n "checking for __nowarn__""... $ac_c"
  821. cat > conftest.c <<EOF
  822. #include "confdefs.h"
  823. int x;
  824. int main() { exit(0); }
  825. int t() { __nowarn__ x; }
  826. EOF
  827. if eval $compile; then
  828.   echo "${ac_t}yes"
  829.   have_nowarn=1
  830. else
  831.   echo "${ac_t}no"
  832.   :
  833. fi
  834. rm -f conftest*
  835. fi
  836. if test -z "$have_nowarn"; then
  837. echo "#define" __nowarn__ "" >> confdefs.h
  838. DEFS="$DEFS -D__nowarn__="
  839. SEDDEFS="${SEDDEFS}\${SEDdA}__nowarn__\${SEDdB}__nowarn__\${SEDdC}\${SEDdD}
  840. \${SEDuA}__nowarn__\${SEDuB}__nowarn__\${SEDuC}\${SEDuD}
  841. \${SEDeA}__nowarn__\${SEDeB}__nowarn__\${SEDeC}\${SEDeD}
  842. \${SEDfA}__nowarn__\${SEDfB}__nowarn__\${SEDfC}\${SEDfD}
  843. "
  844. fi
  845.  
  846.                       echo $ac_n "checking for working void""... $ac_c"
  847. cat > conftest.c <<EOF
  848. #include "confdefs.h"
  849.  
  850. int main() { exit(0); }
  851. int t() { void f();
  852. typedef void x; x g();
  853. typedef void* y; y a;
  854.  }
  855. EOF
  856. if eval $compile; then
  857.   echo "${ac_t}yes"
  858.   have_void=1
  859. else
  860.   echo "${ac_t}no"
  861.   echo "#define" void "char" >> confdefs.h
  862. DEFS="$DEFS -Dvoid=char"
  863. SEDDEFS="${SEDDEFS}\${SEDdA}void\${SEDdB}void\${SEDdC}char\${SEDdD}
  864. \${SEDuA}void\${SEDuB}void\${SEDuC}char\${SEDuD}
  865. \${SEDeA}void\${SEDeB}void\${SEDeC}char\${SEDeD}
  866. \${SEDfA}void\${SEDfB}void\${SEDfC}char\${SEDfD}
  867. "
  868. fi
  869. rm -f conftest*
  870. if test -n "$have_void"; then
  871. echo $ac_n "checking for working \"return void\"""... $ac_c"
  872. cat > conftest.c <<EOF
  873. #include "confdefs.h"
  874. void f() {} typedef void x; x g() { return f(); }
  875. int main() { exit(0); }
  876. int t() { ; }
  877. EOF
  878. if eval $compile; then
  879.   echo "${ac_t}yes"
  880.   echo "#define" return_void "return" >> confdefs.h
  881. DEFS="$DEFS -Dreturn_void=return"
  882. SEDDEFS="${SEDDEFS}\${SEDdA}return_void\${SEDdB}return_void\${SEDdC}return\${SEDdD}
  883. \${SEDuA}return_void\${SEDuB}return_void\${SEDuC}return\${SEDuD}
  884. \${SEDeA}return_void\${SEDeB}return_void\${SEDeC}return\${SEDeD}
  885. \${SEDfA}return_void\${SEDfB}return_void\${SEDfC}return\${SEDfD}
  886. "
  887. else
  888.   echo "${ac_t}no"
  889.   :
  890. fi
  891. rm -f conftest*
  892. fi
  893.  
  894.                       echo $ac_n "checking for long long type""... $ac_c"
  895. cat > conftest.c <<EOF
  896. #include "confdefs.h"
  897. main()
  898. { long x = 944938507; long y = 737962842; long z = 162359677;
  899.   exit(!(((long long) x)*((long long) y)>>32 == z)); }
  900. EOF
  901. eval $compile
  902. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  903.   echo "${ac_t}yes"
  904. echo "#define" HAVE_LONGLONG "1" >> confdefs.h
  905. DEFS="$DEFS -DHAVE_LONGLONG=1"
  906. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONGLONG\${SEDdB}HAVE_LONGLONG\${SEDdC}1\${SEDdD}
  907. \${SEDuA}HAVE_LONGLONG\${SEDuB}HAVE_LONGLONG\${SEDuC}1\${SEDuD}
  908. \${SEDeA}HAVE_LONGLONG\${SEDeB}HAVE_LONGLONG\${SEDeC}1\${SEDeD}
  909. \${SEDfA}HAVE_LONGLONG\${SEDfB}HAVE_LONGLONG\${SEDfC}1\${SEDfD}
  910. "
  911. else
  912.   echo "${ac_t}no"
  913. fi
  914. if test -f core; then
  915.   coredir=core`/bin/sh -c 'echo $$'`
  916.   mkdir $coredir
  917.   cp confdefs.h $coredir/confdefs.h
  918.   mv conftest.c $coredir/conftest.c
  919.   mv conftest $coredir/conftest
  920.   mv core $coredir/core
  921.   echo "warning: test program dumped core -- see subdirectory $coredir"
  922. fi
  923. rm -f conftest*
  924.  
  925.                       echo $ac_n "checking for ANSI C header files""... $ac_c"
  926. cat > conftest.c <<EOF
  927. #include "confdefs.h"
  928. #include <stdlib.h>
  929. #include <stdarg.h>
  930. #include <string.h>
  931. #include <float.h>
  932. #include <limits.h>
  933. EOF
  934. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  935. if test -z "$err"; then
  936.   echo "${ac_t}yes"
  937. echo "#define" STDC_HEADERS "1" >> confdefs.h
  938. DEFS="$DEFS -DSTDC_HEADERS=1"
  939. SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD}
  940. \${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD}
  941. \${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD}
  942. \${SEDfA}STDC_HEADERS\${SEDfB}STDC_HEADERS\${SEDfC}1\${SEDfD}
  943. "
  944. else
  945.   echo "${ac_t}no"
  946. fi
  947. rm -f conftest*
  948.  
  949.                       for hdr in stdlib.h
  950. do
  951. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  952. echo $ac_n "checking for ${hdr}""... $ac_c"
  953. cat > conftest.c <<EOF
  954. #include "confdefs.h"
  955. #include <${hdr}>
  956. EOF
  957. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  958. if test -z "$err"; then
  959.   echo "${ac_t}yes"
  960. echo "#define" ${trhdr} "1" >> confdefs.h
  961. DEFS="$DEFS -D${trhdr}=1"
  962. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  963. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  964. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  965. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  966. "
  967. else
  968.   echo "${ac_t}no"
  969.  
  970. fi
  971. rm -f conftest*
  972. done
  973.  
  974.  
  975.                       for hdr in unistd.h
  976. do
  977. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  978. echo $ac_n "checking for ${hdr}""... $ac_c"
  979. cat > conftest.c <<EOF
  980. #include "confdefs.h"
  981. #include <${hdr}>
  982. EOF
  983. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  984. if test -z "$err"; then
  985.   echo "${ac_t}yes"
  986. echo "#define" ${trhdr} "1" >> confdefs.h
  987. DEFS="$DEFS -D${trhdr}=1"
  988. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  989. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  990. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  991. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  992. "
  993. else
  994.   echo "${ac_t}no"
  995.  
  996. fi
  997. rm -f conftest*
  998. done
  999.  
  1000.  
  1001.                       echo $ac_n "checking for sys/file.h""... $ac_c"
  1002. cat > conftest.c <<EOF
  1003. #include "confdefs.h"
  1004. #include <sys/file.h>
  1005. EOF
  1006. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  1007. if test -z "$err"; then
  1008.   echo "${ac_t}yes"
  1009. have_sysfile=1
  1010. else
  1011.   echo "${ac_t}no"
  1012.  
  1013. fi
  1014. rm -f conftest*
  1015. if test -n "$have_sysfile"; then
  1016. openflags_decl='#ifdef STDC_HEADERS
  1017. #include <stdlib.h>
  1018. #endif
  1019. #ifdef HAVE_UNISTD_H
  1020. #include <sys/types.h>
  1021. #include <unistd.h>
  1022. #endif
  1023. #include <fcntl.h>
  1024. '
  1025. openflags_prog='int x = O_RDWR | O_RDONLY | O_WRONLY | O_CREAT | O_TRUNC;'
  1026. echo $ac_n "checking for O_RDWR in fcntl.h""... $ac_c"
  1027. cat > conftest.c <<EOF
  1028. #include "confdefs.h"
  1029. $openflags_decl
  1030. int main() { exit(0); }
  1031. int t() { $openflags_prog }
  1032. EOF
  1033. if eval $compile; then
  1034.   echo "${ac_t}yes"
  1035.   openflags_ok=1
  1036. else
  1037.   echo "${ac_t}no"
  1038.   :
  1039. fi
  1040. rm -f conftest*
  1041. if test -z "$openflags_ok"; then
  1042. echo "#define" NEED_SYS_FILE_H "1" >> confdefs.h
  1043. DEFS="$DEFS -DNEED_SYS_FILE_H=1"
  1044. SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_FILE_H\${SEDdB}NEED_SYS_FILE_H\${SEDdC}1\${SEDdD}
  1045. \${SEDuA}NEED_SYS_FILE_H\${SEDuB}NEED_SYS_FILE_H\${SEDuC}1\${SEDuD}
  1046. \${SEDeA}NEED_SYS_FILE_H\${SEDeB}NEED_SYS_FILE_H\${SEDeC}1\${SEDeD}
  1047. \${SEDfA}NEED_SYS_FILE_H\${SEDfB}NEED_SYS_FILE_H\${SEDfC}1\${SEDfD}
  1048. "
  1049. fi
  1050. fi
  1051.  
  1052.                       echo checking for directory library header
  1053. dirheader=
  1054. if test -z "$dirheader"; then
  1055.   echo $ac_n "checking for dirent.h""... $ac_c"
  1056. cat > conftest.c <<EOF
  1057. #include "confdefs.h"
  1058. #include <sys/types.h>
  1059. #include <dirent.h>
  1060. int main() { exit(0); }
  1061. int t() { DIR *dirp = 0; }
  1062. EOF
  1063. if eval $compile; then
  1064.   echo "${ac_t}yes"
  1065.   echo "#define" DIRENT "1" >> confdefs.h
  1066. DEFS="$DEFS -DDIRENT=1"
  1067. SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
  1068. \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
  1069. \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
  1070. \${SEDfA}DIRENT\${SEDfB}DIRENT\${SEDfC}1\${SEDfD}
  1071. "
  1072. dirheader=dirent.h
  1073. else
  1074.   echo "${ac_t}no"
  1075.   :
  1076. fi
  1077. rm -f conftest*
  1078. fi
  1079. if test -z "$dirheader"; then
  1080.   echo $ac_n "checking for sys/ndir.h""... $ac_c"
  1081. cat > conftest.c <<EOF
  1082. #include "confdefs.h"
  1083. #include <sys/types.h>
  1084. #include <sys/ndir.h>
  1085. int main() { exit(0); }
  1086. int t() { DIR *dirp = 0; }
  1087. EOF
  1088. if eval $compile; then
  1089.   echo "${ac_t}yes"
  1090.   echo "#define" SYSNDIR "1" >> confdefs.h
  1091. DEFS="$DEFS -DSYSNDIR=1"
  1092. SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
  1093. \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
  1094. \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
  1095. \${SEDfA}SYSNDIR\${SEDfB}SYSNDIR\${SEDfC}1\${SEDfD}
  1096. "
  1097. dirheader=sys/ndir.h
  1098. else
  1099.   echo "${ac_t}no"
  1100.   :
  1101. fi
  1102. rm -f conftest*
  1103. fi
  1104. if test -z "$dirheader"; then
  1105.   echo $ac_n "checking for sys/dir.h""... $ac_c"
  1106. cat > conftest.c <<EOF
  1107. #include "confdefs.h"
  1108. #include <sys/types.h>
  1109. #include <sys/dir.h>
  1110. int main() { exit(0); }
  1111. int t() { DIR *dirp = 0; }
  1112. EOF
  1113. if eval $compile; then
  1114.   echo "${ac_t}yes"
  1115.   echo "#define" SYSDIR "1" >> confdefs.h
  1116. DEFS="$DEFS -DSYSDIR=1"
  1117. SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
  1118. \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
  1119. \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
  1120. \${SEDfA}SYSDIR\${SEDfB}SYSDIR\${SEDfC}1\${SEDfD}
  1121. "
  1122. dirheader=sys/dir.h
  1123. else
  1124.   echo "${ac_t}no"
  1125.   :
  1126. fi
  1127. rm -f conftest*
  1128. fi
  1129. if test -z "$dirheader"; then
  1130.   echo $ac_n "checking for ndir.h""... $ac_c"
  1131. cat > conftest.c <<EOF
  1132. #include "confdefs.h"
  1133. #include <sys/types.h>
  1134. #include <ndir.h>
  1135. int main() { exit(0); }
  1136. int t() { DIR *dirp = 0; }
  1137. EOF
  1138. if eval $compile; then
  1139.   echo "${ac_t}yes"
  1140.   echo "#define" NDIR "1" >> confdefs.h
  1141. DEFS="$DEFS -DNDIR=1"
  1142. SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
  1143. \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
  1144. \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
  1145. \${SEDfA}NDIR\${SEDfB}NDIR\${SEDfC}1\${SEDfD}
  1146. "
  1147. dirheader=ndir.h
  1148. else
  1149.   echo "${ac_t}no"
  1150.   :
  1151. fi
  1152. rm -f conftest*
  1153. fi
  1154.  
  1155. echo $ac_n "checking for closedir return value""... $ac_c"
  1156. cat > conftest.c <<EOF
  1157. #include "confdefs.h"
  1158. #include <sys/types.h>
  1159. #include <$dirheader>
  1160. extern
  1161. #ifdef __cplusplus
  1162. "C"
  1163. #endif
  1164. #ifdef __STDC__
  1165. int closedir (DIR* dirp);
  1166. #else
  1167. int closedir();
  1168. #endif
  1169. main() { exit(closedir(opendir(".")) != 0); }
  1170. EOF
  1171. eval $compile
  1172. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1173.   echo "${ac_t}int"
  1174. else
  1175.   echo "${ac_t}void"
  1176. echo "#define" VOID_CLOSEDIR "1" >> confdefs.h
  1177. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  1178. SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
  1179. \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
  1180. \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
  1181. \${SEDfA}VOID_CLOSEDIR\${SEDfB}VOID_CLOSEDIR\${SEDfC}1\${SEDfD}
  1182. "
  1183. fi
  1184. if test -f core; then
  1185.   coredir=core`/bin/sh -c 'echo $$'`
  1186.   mkdir $coredir
  1187.   cp confdefs.h $coredir/confdefs.h
  1188.   mv conftest.c $coredir/conftest.c
  1189.   mv conftest $coredir/conftest
  1190.   mv core $coredir/core
  1191.   echo "warning: test program dumped core -- see subdirectory $coredir"
  1192. fi
  1193. rm -f conftest*
  1194. echo $ac_n "checking for Xenix""... $ac_c"
  1195. cat > conftest.c <<EOF
  1196. #include "confdefs.h"
  1197. #if defined(M_XENIX) && !defined(M_UNIX)
  1198.   yes
  1199. #endif
  1200.  
  1201. EOF
  1202. eval "$CPP conftest.c > conftest.out 2>&1"
  1203. if egrep "yes" conftest.out >/dev/null 2>&1; then
  1204.   XENIX=1
  1205. fi
  1206. rm -f conftest*
  1207. if test -n "$XENIX"; then
  1208.   echo "${ac_t}yes"
  1209.   LIBS="$LIBS -lx"
  1210.   case "$DEFS" in
  1211.   *SYSNDIR*) ;;
  1212.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  1213.   esac
  1214. else
  1215.   echo "${ac_t}no"
  1216. fi
  1217.  
  1218.                       echo $ac_n "checking for sys/utsname.h and struct utsname""... $ac_c"
  1219. cat > conftest.c <<EOF
  1220. #include "confdefs.h"
  1221. #include <sys/utsname.h>
  1222. int main() { exit(0); }
  1223. int t() { struct utsname u; }
  1224. EOF
  1225. if eval $compile; then
  1226.   echo "${ac_t}yes"
  1227.   echo "#define" HAVE_SYS_UTSNAME_H "1" >> confdefs.h
  1228. DEFS="$DEFS -DHAVE_SYS_UTSNAME_H=1"
  1229. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYS_UTSNAME_H\${SEDdB}HAVE_SYS_UTSNAME_H\${SEDdC}1\${SEDdD}
  1230. \${SEDuA}HAVE_SYS_UTSNAME_H\${SEDuB}HAVE_SYS_UTSNAME_H\${SEDuC}1\${SEDuD}
  1231. \${SEDeA}HAVE_SYS_UTSNAME_H\${SEDeB}HAVE_SYS_UTSNAME_H\${SEDeC}1\${SEDeD}
  1232. \${SEDfA}HAVE_SYS_UTSNAME_H\${SEDfB}HAVE_SYS_UTSNAME_H\${SEDfC}1\${SEDfD}
  1233. "
  1234. else
  1235.   echo "${ac_t}no"
  1236.   :
  1237. fi
  1238. rm -f conftest*
  1239.  
  1240.                       for hdr in netdb.h
  1241. do
  1242. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  1243. echo $ac_n "checking for ${hdr}""... $ac_c"
  1244. cat > conftest.c <<EOF
  1245. #include "confdefs.h"
  1246. #include <${hdr}>
  1247. EOF
  1248. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  1249. if test -z "$err"; then
  1250.   echo "${ac_t}yes"
  1251. echo "#define" ${trhdr} "1" >> confdefs.h
  1252. DEFS="$DEFS -D${trhdr}=1"
  1253. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  1254. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  1255. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  1256. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  1257. "
  1258. else
  1259.   echo "${ac_t}no"
  1260.  
  1261. fi
  1262. rm -f conftest*
  1263. done
  1264.  
  1265.  
  1266.                       echo $ac_n "checking for sys/shm.h""... $ac_c"
  1267. cat > conftest.c <<EOF
  1268. #include "confdefs.h"
  1269. #include <sys/shm.h>
  1270. EOF
  1271. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  1272. if test -z "$err"; then
  1273.   echo "${ac_t}yes"
  1274.  
  1275. else
  1276.   echo "${ac_t}no"
  1277. no_shm=1
  1278. fi
  1279. rm -f conftest*
  1280. if test -z "$no_shm"; then
  1281. echo $ac_n "checking for sys/ipc.h""... $ac_c"
  1282. cat > conftest.c <<EOF
  1283. #include "confdefs.h"
  1284. #include <sys/ipc.h>
  1285. EOF
  1286. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  1287. if test -z "$err"; then
  1288.   echo "${ac_t}yes"
  1289.  
  1290. else
  1291.   echo "${ac_t}no"
  1292. no_shm=1
  1293. fi
  1294. rm -f conftest*
  1295. fi
  1296. if test -z "$no_shm"; then
  1297. echo $ac_n "checking for working shared memory""... $ac_c"
  1298. cat > conftest.c <<EOF
  1299. #include "confdefs.h"
  1300. #include <sys/types.h>
  1301. #include <sys/ipc.h>
  1302. #include <sys/shm.h>
  1303. /* try attaching a single segment to multiple addresses */
  1304. #define segsize 0x10000
  1305. #define attaches 128
  1306. #define base_addr 0x01000000
  1307. main ()
  1308. { int shmid, i; char* addr; char* result;
  1309.   if ((shmid = shmget(IPC_PRIVATE,segsize,0400)) < 0) exit(1);
  1310.   for (i=0, addr = (char*)0x01000000; i<attaches; i++, addr += segsize)
  1311.     { if ((result = shmat(shmid,addr,SHM_RDONLY)) == (char*)(-1)) break; }
  1312.   for (i=0, addr = (char*)0x01000000; i<attaches; i++, addr += segsize)
  1313.     shmdt(addr);
  1314.   shmctl(shmid,IPC_RMID,0);
  1315.   exit(result == (char*)(-1));
  1316. }
  1317. EOF
  1318. eval $compile
  1319. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1320.   :
  1321. else
  1322.   no_shm=1
  1323. fi
  1324. if test -f core; then
  1325.   coredir=core`/bin/sh -c 'echo $$'`
  1326.   mkdir $coredir
  1327.   cp confdefs.h $coredir/confdefs.h
  1328.   mv conftest.c $coredir/conftest.c
  1329.   mv conftest $coredir/conftest
  1330.   mv core $coredir/core
  1331.   echo "warning: test program dumped core -- see subdirectory $coredir"
  1332. fi
  1333. rm -f conftest*
  1334. fi
  1335. if test -z "$no_shm"; then
  1336. echo "${ac_t}yes"
  1337. echo "#define" HAVE_SHM "1" >> confdefs.h
  1338. DEFS="$DEFS -DHAVE_SHM=1"
  1339. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SHM\${SEDdB}HAVE_SHM\${SEDdC}1\${SEDdD}
  1340. \${SEDuA}HAVE_SHM\${SEDuB}HAVE_SHM\${SEDuC}1\${SEDuD}
  1341. \${SEDeA}HAVE_SHM\${SEDeB}HAVE_SHM\${SEDeC}1\${SEDeD}
  1342. \${SEDfA}HAVE_SHM\${SEDfB}HAVE_SHM\${SEDfC}1\${SEDfD}
  1343. "
  1344. for hdr in sys/sysmacros.h
  1345. do
  1346. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  1347. echo $ac_n "checking for ${hdr}""... $ac_c"
  1348. cat > conftest.c <<EOF
  1349. #include "confdefs.h"
  1350. #include <${hdr}>
  1351. EOF
  1352. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  1353. if test -z "$err"; then
  1354.   echo "${ac_t}yes"
  1355. echo "#define" ${trhdr} "1" >> confdefs.h
  1356. DEFS="$DEFS -D${trhdr}=1"
  1357. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  1358. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  1359. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  1360. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  1361. "
  1362. else
  1363.   echo "${ac_t}no"
  1364.  
  1365. fi
  1366. rm -f conftest*
  1367. done
  1368. else
  1369. echo "${ac_t}no"
  1370. fi
  1371.  
  1372.                       for hdr in termios.h termio.h sys/termio.h sgtty.h
  1373. do
  1374. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  1375. echo $ac_n "checking for ${hdr}""... $ac_c"
  1376. cat > conftest.c <<EOF
  1377. #include "confdefs.h"
  1378. #include <${hdr}>
  1379. EOF
  1380. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  1381. if test -z "$err"; then
  1382.   echo "${ac_t}yes"
  1383. echo "#define" ${trhdr} "1" >> confdefs.h
  1384. DEFS="$DEFS -D${trhdr}=1"
  1385. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  1386. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  1387. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  1388. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  1389. "
  1390. else
  1391.   echo "${ac_t}no"
  1392.  
  1393. fi
  1394. rm -f conftest*
  1395. done
  1396. case "$DEFS" in
  1397.   *HAVE_TERMIOS_H*)
  1398. echo $ac_n "checking for tcgetattr""... $ac_c"
  1399. cat > conftest.c <<EOF
  1400. #include "confdefs.h"
  1401. #include <termios.h>
  1402. int main() { exit(0); }
  1403. int t() { struct termios t; tcgetattr(0,&t); }
  1404. EOF
  1405. if eval $compile; then
  1406.   echo "${ac_t}yes"
  1407.   echo "#define" HAVE_TCGETATTR "1" >> confdefs.h
  1408. DEFS="$DEFS -DHAVE_TCGETATTR=1"
  1409. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TCGETATTR\${SEDdB}HAVE_TCGETATTR\${SEDdC}1\${SEDdD}
  1410. \${SEDuA}HAVE_TCGETATTR\${SEDuB}HAVE_TCGETATTR\${SEDuC}1\${SEDuD}
  1411. \${SEDeA}HAVE_TCGETATTR\${SEDeB}HAVE_TCGETATTR\${SEDeC}1\${SEDeD}
  1412. \${SEDfA}HAVE_TCGETATTR\${SEDfB}HAVE_TCGETATTR\${SEDfC}1\${SEDfD}
  1413. "
  1414. else
  1415.   echo "${ac_t}no"
  1416.   :
  1417. fi
  1418. rm -f conftest*
  1419. echo $ac_n "checking for TCSAFLUSH in termios.h""... $ac_c"
  1420. cat > conftest.c <<EOF
  1421. #include "confdefs.h"
  1422. #include <termios.h>
  1423. int main() { exit(0); }
  1424. int t() { int x = TCSAFLUSH; }
  1425. EOF
  1426. if eval $compile; then
  1427.   echo "${ac_t}yes"
  1428.   echo "#define" HAVE_TCSAFLUSH "1" >> confdefs.h
  1429. DEFS="$DEFS -DHAVE_TCSAFLUSH=1"
  1430. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TCSAFLUSH\${SEDdB}HAVE_TCSAFLUSH\${SEDdC}1\${SEDdD}
  1431. \${SEDuA}HAVE_TCSAFLUSH\${SEDuB}HAVE_TCSAFLUSH\${SEDuC}1\${SEDuD}
  1432. \${SEDeA}HAVE_TCSAFLUSH\${SEDeB}HAVE_TCSAFLUSH\${SEDeC}1\${SEDeD}
  1433. \${SEDfA}HAVE_TCSAFLUSH\${SEDfB}HAVE_TCSAFLUSH\${SEDfC}1\${SEDfD}
  1434. "
  1435. else
  1436.   echo "${ac_t}no"
  1437.   :
  1438. fi
  1439. rm -f conftest*
  1440.   ;;
  1441.   *) ;;
  1442. esac
  1443.  
  1444.                       echo checking for X11
  1445. X_INCLUDES=''
  1446. X_LIBS=''
  1447. if test -z "$HAVE_XMKMF"; then
  1448.   # Extract the first word of `xmkmf', so it can be a program name with args.
  1449.   set dummy xmkmf; word=$2
  1450.   echo $ac_n "checking for $word""... $ac_c"
  1451.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  1452.   for dir in $PATH; do
  1453.     test -z "$dir" && dir=.
  1454.     if test -f $dir/$word; then
  1455.       HAVE_XMKMF="yes"
  1456.       break
  1457.     fi
  1458.   done
  1459.   IFS="$saveifs"
  1460.   echo "${ac_t}using $HAVE_XMKMF"
  1461. fi
  1462. if test "$HAVE_XMKMF" = yes; then
  1463.   echo "#define" HAVE_X11 "1" >> confdefs.h
  1464. DEFS="$DEFS -DHAVE_X11=1"
  1465. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_X11\${SEDdB}HAVE_X11\${SEDdC}1\${SEDdD}
  1466. \${SEDuA}HAVE_X11\${SEDuB}HAVE_X11\${SEDuC}1\${SEDuD}
  1467. \${SEDeA}HAVE_X11\${SEDeB}HAVE_X11\${SEDeC}1\${SEDeD}
  1468. \${SEDfA}HAVE_X11\${SEDfB}HAVE_X11\${SEDfC}1\${SEDfD}
  1469. "
  1470.   X_LIBS='-lX11'
  1471.   # If we find X, set shell vars x_includes and x_libraries to the paths.
  1472. echo $ac_n "checking for X include and library files with xmkmf""... $ac_c"
  1473. rm -fr conftestdir
  1474. if mkdir conftestdir; then
  1475.   cd conftestdir
  1476.   cat > Imakefile <<EOF
  1477. acfindx:
  1478.     @echo "x_includes=\$(INCROOT); x_libraries=\$(USRLIBDIR)"
  1479. EOF
  1480.   if xmkmf >/dev/null 2>/dev/null && test -f Makefile; then
  1481.     eval `make acfindx`
  1482.   fi
  1483.   cd ..
  1484.   rm -fr conftestdir
  1485. fi
  1486. if test -n "$x_includes" && test -n "$x_libraries"; then
  1487.   echo "${ac_t}yes"
  1488. else
  1489.   echo "${ac_t}no"
  1490. fi
  1491.   if test -n "$x_includes"; then
  1492.     # Adding -I/usr/include may override gcc's private include hierarchy.
  1493.     if test "$x_includes" != "/usr/include"; then
  1494.       X_INCLUDES="-I$x_includes"
  1495.     fi
  1496.   fi
  1497.   if test -n "$x_libraries"; then
  1498.     X_LIBS="-L$x_libraries "$X_LIBS
  1499.   fi
  1500. else
  1501.       echo $ac_n "checking for X11 header files""... $ac_c"
  1502.   cat > conftest.c <<EOF
  1503. #include "confdefs.h"
  1504. #include <X11/Intrinsic.h>
  1505. EOF
  1506. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  1507. if test -z "$err"; then
  1508.   have_x_includes=1
  1509. fi
  1510. rm -f conftest*
  1511.   if test -z "$have_x_includes"; then
  1512.     for dir in /usr/X11/include /usr/openwin/include /usr/include/X11R5 /usr/X11R5/include /usr/include/X11R4 /usr/X386/include /usr/x386/include /usr/local/include /usr/unsupported/include; do
  1513.       if test -z "$have_x_includes"; then
  1514.         if test -r $dir/X11/Intrinsic.h; then
  1515.           x_includes="$dir"
  1516.           have_x_includes=1
  1517.         fi
  1518.       fi
  1519.     done
  1520.   fi
  1521.   if test -n "$x_includes"; then
  1522.     X_INCLUDES="-I$x_includes"
  1523.   fi
  1524.   echo "${ac_t}$X_INCLUDES"
  1525.   echo $ac_n "checking for X11 library""... $ac_c"
  1526.   LIBS_save="${LIBS}"
  1527. LIBS="${LIBS} -lX11"
  1528. have_lib=""
  1529. echo $ac_n "checking for -lX11""... $ac_c"
  1530. cat > conftest.c <<EOF
  1531. #include "confdefs.h"
  1532.  
  1533. int main() { exit(0); }
  1534. int t() { main(); }
  1535. EOF
  1536. if eval $compile; then
  1537.   echo "${ac_t}yes"
  1538.   have_lib="1"
  1539. else
  1540.   echo "${ac_t}no"
  1541.   :
  1542. fi
  1543. rm -f conftest*
  1544. LIBS="${LIBS_save}"
  1545. if test -n "${have_lib}"; then
  1546.    :; have_x_libraries=1
  1547. else
  1548.    :; 
  1549. fi
  1550.   if test -z "$have_x_libraries"; then
  1551.     for dir in /usr/X11/lib /usr/openwin/lib /usr/lib/X11R5 /usr/X11R5/lib /usr/lib/X11R4 /usr/X386/lib /usr/x386/lib /usr/local/lib /usr/unsupported/lib; do
  1552.       if test -z "$have_x_libraries"; then
  1553.         if test -r $dir/libX11.a; then
  1554.           x_libraries="$dir"
  1555.           have_x_libraries=1
  1556.         fi
  1557.       fi
  1558.     done
  1559.   fi
  1560.   if test -n "$have_x_libraries"; then
  1561.     X_LIBS='-lX11'
  1562.     if test -n "$x_libraries"; then
  1563.       X_LIBS="-L$x_libraries "$X_LIBS
  1564.     fi
  1565.   else
  1566.     LIBS_save="${LIBS}"
  1567. LIBS="${LIBS} -lXwindow"
  1568. have_lib=""
  1569. echo $ac_n "checking for -lXwindow""... $ac_c"
  1570. cat > conftest.c <<EOF
  1571. #include "confdefs.h"
  1572.  
  1573. int main() { exit(0); }
  1574. int t() { main(); }
  1575. EOF
  1576. if eval $compile; then
  1577.   echo "${ac_t}yes"
  1578.   have_lib="1"
  1579. else
  1580.   echo "${ac_t}no"
  1581.   :
  1582. fi
  1583. rm -f conftest*
  1584. LIBS="${LIBS_save}"
  1585. if test -n "${have_lib}"; then
  1586.    :; X_LIBS='-lXwindow' have_x_libraries=1
  1587. else
  1588.    :; 
  1589. fi
  1590.   fi
  1591.   echo "${ac_t}$X_LIBS"
  1592.     if test -n "$have_x_includes" -a -n "$have_x_libraries"; then
  1593.     echo "#define" HAVE_X11 "1" >> confdefs.h
  1594. DEFS="$DEFS -DHAVE_X11=1"
  1595. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_X11\${SEDdB}HAVE_X11\${SEDdC}1\${SEDdD}
  1596. \${SEDuA}HAVE_X11\${SEDuB}HAVE_X11\${SEDuC}1\${SEDuD}
  1597. \${SEDeA}HAVE_X11\${SEDeB}HAVE_X11\${SEDeC}1\${SEDeD}
  1598. \${SEDfA}HAVE_X11\${SEDfB}HAVE_X11\${SEDfC}1\${SEDfD}
  1599. "
  1600.   else
  1601.     X_INCLUDES=''
  1602.     X_LIBS=''
  1603.   fi
  1604. fi
  1605.  
  1606.                       echo $ac_n "checking for size_t in sys/types.h""... $ac_c"
  1607. echo '#include "confdefs.h"
  1608. #include <sys/types.h>' > conftest.c
  1609. eval "$CPP conftest.c > conftest.out 2>&1"
  1610. if egrep "size_t" conftest.out >/dev/null 2>&1; then
  1611.   echo "${ac_t}yes"
  1612. else
  1613.   echo "${ac_t}no"
  1614. echo "#define" size_t "unsigned" >> confdefs.h
  1615. DEFS="$DEFS -Dsize_t=unsigned"
  1616. SEDDEFS="${SEDDEFS}\${SEDdA}size_t\${SEDdB}size_t\${SEDdC}unsigned\${SEDdD}
  1617. \${SEDuA}size_t\${SEDuB}size_t\${SEDuC}unsigned\${SEDuD}
  1618. \${SEDeA}size_t\${SEDeB}size_t\${SEDeC}unsigned\${SEDeD}
  1619. \${SEDfA}size_t\${SEDfB}size_t\${SEDfC}unsigned\${SEDfD}
  1620. "
  1621. fi
  1622. rm -f conftest*
  1623.  
  1624.                       echo $ac_n "checking for pid_t in sys/types.h""... $ac_c"
  1625. echo '#include "confdefs.h"
  1626. #include <sys/types.h>' > conftest.c
  1627. eval "$CPP conftest.c > conftest.out 2>&1"
  1628. if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  1629.   echo "${ac_t}yes"
  1630. else
  1631.   echo "${ac_t}no"
  1632. echo "#define" pid_t "int" >> confdefs.h
  1633. DEFS="$DEFS -Dpid_t=int"
  1634. SEDDEFS="${SEDDEFS}\${SEDdA}pid_t\${SEDdB}pid_t\${SEDdC}int\${SEDdD}
  1635. \${SEDuA}pid_t\${SEDuB}pid_t\${SEDuC}int\${SEDuD}
  1636. \${SEDeA}pid_t\${SEDeB}pid_t\${SEDeC}int\${SEDeD}
  1637. \${SEDfA}pid_t\${SEDfB}pid_t\${SEDfC}int\${SEDfD}
  1638. "
  1639. fi
  1640. rm -f conftest*
  1641.  
  1642.                       echo $ac_n "checking for uid_t in sys/types.h""... $ac_c"
  1643. echo '#include "confdefs.h"
  1644. #include <sys/types.h>' > conftest.c
  1645. eval "$CPP conftest.c > conftest.out 2>&1"
  1646. if egrep "uid_t" conftest.out >/dev/null 2>&1; then
  1647.   echo "${ac_t}yes"
  1648. else
  1649.   echo "${ac_t}no"
  1650. echo "#define" uid_t "int" >> confdefs.h
  1651. DEFS="$DEFS -Duid_t=int"
  1652. SEDDEFS="${SEDDEFS}\${SEDdA}uid_t\${SEDdB}uid_t\${SEDdC}int\${SEDdD}
  1653. \${SEDuA}uid_t\${SEDuB}uid_t\${SEDuC}int\${SEDuD}
  1654. \${SEDeA}uid_t\${SEDeB}uid_t\${SEDeC}int\${SEDeD}
  1655. \${SEDfA}uid_t\${SEDfB}uid_t\${SEDfC}int\${SEDfD}
  1656. "
  1657. echo "#define" gid_t "int" >> confdefs.h
  1658. DEFS="$DEFS -Dgid_t=int"
  1659. SEDDEFS="${SEDDEFS}\${SEDdA}gid_t\${SEDdB}gid_t\${SEDdC}int\${SEDdD}
  1660. \${SEDuA}gid_t\${SEDuB}gid_t\${SEDuC}int\${SEDuD}
  1661. \${SEDeA}gid_t\${SEDeB}gid_t\${SEDeC}int\${SEDeD}
  1662. \${SEDfA}gid_t\${SEDfB}gid_t\${SEDfC}int\${SEDfD}
  1663. "
  1664. fi
  1665. rm -f conftest*
  1666.  
  1667.                       echo $ac_n "checking for off_t in sys/types.h""... $ac_c"
  1668. echo '#include "confdefs.h"
  1669. #include <sys/types.h>' > conftest.c
  1670. eval "$CPP conftest.c > conftest.out 2>&1"
  1671. if egrep "off_t" conftest.out >/dev/null 2>&1; then
  1672.   echo "${ac_t}yes"
  1673. else
  1674.   echo "${ac_t}no"
  1675. echo "#define" off_t "long" >> confdefs.h
  1676. DEFS="$DEFS -Doff_t=long"
  1677. SEDDEFS="${SEDDEFS}\${SEDdA}off_t\${SEDdB}off_t\${SEDdC}long\${SEDdD}
  1678. \${SEDuA}off_t\${SEDuB}off_t\${SEDuC}long\${SEDuD}
  1679. \${SEDeA}off_t\${SEDeB}off_t\${SEDeC}long\${SEDeD}
  1680. \${SEDfA}off_t\${SEDfB}off_t\${SEDfC}long\${SEDfD}
  1681. "
  1682. fi
  1683. rm -f conftest*
  1684.  
  1685.                       echo $ac_n "checking for caddr_t in sys/types.h""... $ac_c"
  1686. echo '#include "confdefs.h"
  1687. #include <sys/types.h>' > conftest.c
  1688. eval "$CPP conftest.c > conftest.out 2>&1"
  1689. if egrep "caddr_t" conftest.out >/dev/null 2>&1; then
  1690.   echo "${ac_t}yes"
  1691. echo "#define" CADDR_T "caddr_t" >> confdefs.h
  1692. DEFS="$DEFS -DCADDR_T=caddr_t"
  1693. SEDDEFS="${SEDDEFS}\${SEDdA}CADDR_T\${SEDdB}CADDR_T\${SEDdC}caddr_t\${SEDdD}
  1694. \${SEDuA}CADDR_T\${SEDuB}CADDR_T\${SEDuC}caddr_t\${SEDuD}
  1695. \${SEDeA}CADDR_T\${SEDeB}CADDR_T\${SEDeC}caddr_t\${SEDeD}
  1696. \${SEDfA}CADDR_T\${SEDfB}CADDR_T\${SEDfC}caddr_t\${SEDfD}
  1697. "
  1698. else
  1699.   echo "${ac_t}no"
  1700. echo "#define" CADDR_T "void*" >> confdefs.h
  1701. DEFS="$DEFS -DCADDR_T=void*"
  1702. SEDDEFS="${SEDDEFS}\${SEDdA}CADDR_T\${SEDdB}CADDR_T\${SEDdC}void*\${SEDdD}
  1703. \${SEDuA}CADDR_T\${SEDuB}CADDR_T\${SEDuC}void*\${SEDuD}
  1704. \${SEDeA}CADDR_T\${SEDeB}CADDR_T\${SEDeC}void*\${SEDeD}
  1705. \${SEDfA}CADDR_T\${SEDfB}CADDR_T\${SEDfC}void*\${SEDfD}
  1706. "
  1707. fi
  1708. rm -f conftest*
  1709.  
  1710.  
  1711.                       echo $ac_n "checking for clock_t in sys/types.h etc.""... $ac_c"
  1712. echo '#include "confdefs.h"
  1713. #include <sys/types.h>' > conftest.c
  1714. eval "$CPP conftest.c > conftest.out 2>&1"
  1715. if egrep "clock_t" conftest.out >/dev/null 2>&1; then
  1716.   have_clock=1
  1717. fi
  1718. rm -f conftest*
  1719. if test -z "$have_clock"; then
  1720. echo '#include "confdefs.h"
  1721. #include <sys/times.h>' > conftest.c
  1722. eval "$CPP conftest.c > conftest.out 2>&1"
  1723. if egrep "clock_t" conftest.out >/dev/null 2>&1; then
  1724.   have_clock=1
  1725. fi
  1726. rm -f conftest*
  1727. fi
  1728. if test -z "$have_clock"; then
  1729. echo '#include "confdefs.h"
  1730. #include <time.h>' > conftest.c
  1731. eval "$CPP conftest.c > conftest.out 2>&1"
  1732. if egrep "clock_t" conftest.out >/dev/null 2>&1; then
  1733.   have_clock=1
  1734. fi
  1735. rm -f conftest*
  1736. fi
  1737. if test -z "$have_clock"; then
  1738. echo "${ac_t}no"
  1739. echo "#define" CLOCK_T "int" >> confdefs.h
  1740. DEFS="$DEFS -DCLOCK_T=int"
  1741. SEDDEFS="${SEDDEFS}\${SEDdA}CLOCK_T\${SEDdB}CLOCK_T\${SEDdC}int\${SEDdD}
  1742. \${SEDuA}CLOCK_T\${SEDuB}CLOCK_T\${SEDuC}int\${SEDuD}
  1743. \${SEDeA}CLOCK_T\${SEDeB}CLOCK_T\${SEDeC}int\${SEDeD}
  1744. \${SEDfA}CLOCK_T\${SEDfB}CLOCK_T\${SEDfC}int\${SEDfD}
  1745. "
  1746. else
  1747. echo "${ac_t}yes"
  1748. echo "#define" CLOCK_T "clock_t" >> confdefs.h
  1749. DEFS="$DEFS -DCLOCK_T=clock_t"
  1750. SEDDEFS="${SEDDEFS}\${SEDdA}CLOCK_T\${SEDdB}CLOCK_T\${SEDdC}clock_t\${SEDdD}
  1751. \${SEDuA}CLOCK_T\${SEDuB}CLOCK_T\${SEDuC}clock_t\${SEDuD}
  1752. \${SEDeA}CLOCK_T\${SEDeB}CLOCK_T\${SEDeC}clock_t\${SEDeD}
  1753. \${SEDfA}CLOCK_T\${SEDfB}CLOCK_T\${SEDfC}clock_t\${SEDfD}
  1754. "
  1755. fi
  1756.  
  1757.                       echo $ac_n "checking for d_namlen in struct dirent""... $ac_c"
  1758. cat > conftest.c <<EOF
  1759. #include "confdefs.h"
  1760. #include <dirent.h>
  1761. int main() { exit(0); }
  1762. int t() { struct dirent d; d.d_namlen; }
  1763. EOF
  1764. if eval $compile; then
  1765.   echo "${ac_t}yes"
  1766.   :
  1767. else
  1768.   echo "${ac_t}no"
  1769.   echo "#define" DIRENT_WITHOUT_NAMLEN "1" >> confdefs.h
  1770. DEFS="$DEFS -DDIRENT_WITHOUT_NAMLEN=1"
  1771. SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT_WITHOUT_NAMLEN\${SEDdB}DIRENT_WITHOUT_NAMLEN\${SEDdC}1\${SEDdD}
  1772. \${SEDuA}DIRENT_WITHOUT_NAMLEN\${SEDuB}DIRENT_WITHOUT_NAMLEN\${SEDuC}1\${SEDuD}
  1773. \${SEDeA}DIRENT_WITHOUT_NAMLEN\${SEDeB}DIRENT_WITHOUT_NAMLEN\${SEDeC}1\${SEDeD}
  1774. \${SEDfA}DIRENT_WITHOUT_NAMLEN\${SEDfB}DIRENT_WITHOUT_NAMLEN\${SEDfC}1\${SEDfD}
  1775. "
  1776. fi
  1777. rm -f conftest*
  1778.  
  1779.  
  1780.                       echo $ac_n "checking for struct tm in sys/time.h""... $ac_c"
  1781. cat > conftest.c <<EOF
  1782. #include "confdefs.h"
  1783. #include <sys/types.h>
  1784. #include <sys/time.h>
  1785. int main() { exit(0); }
  1786. int t() { struct tm *tp; tp->tm_sec; }
  1787. EOF
  1788. if eval $compile; then
  1789.   echo "${ac_t}yes"
  1790.   echo "#define" TM_IN_SYS_TIME "1" >> confdefs.h
  1791. DEFS="$DEFS -DTM_IN_SYS_TIME=1"
  1792. SEDDEFS="${SEDDEFS}\${SEDdA}TM_IN_SYS_TIME\${SEDdB}TM_IN_SYS_TIME\${SEDdC}1\${SEDdD}
  1793. \${SEDuA}TM_IN_SYS_TIME\${SEDuB}TM_IN_SYS_TIME\${SEDuC}1\${SEDuD}
  1794. \${SEDeA}TM_IN_SYS_TIME\${SEDeB}TM_IN_SYS_TIME\${SEDeC}1\${SEDeD}
  1795. \${SEDfA}TM_IN_SYS_TIME\${SEDfB}TM_IN_SYS_TIME\${SEDfC}1\${SEDfD}
  1796. "
  1797. else
  1798.   echo "${ac_t}no"
  1799.   :
  1800. fi
  1801. rm -f conftest*
  1802.  
  1803.                       echo $ac_n "checking for strlen declaration""... $ac_c"
  1804. cat > conftest.c <<EOF
  1805. #include "confdefs.h"
  1806. #include <string.h>
  1807. #ifdef strlen
  1808. is a macro
  1809. #endif
  1810.  
  1811. EOF
  1812. eval "$CPP conftest.c > conftest.out 2>&1"
  1813. if egrep "is a macro" conftest.out >/dev/null 2>&1; then
  1814.   strlen_macro=1
  1815. fi
  1816. rm -f conftest*
  1817. if test -n "$strlen_macro"; then
  1818. echo "${ac_t}macro"
  1819. else
  1820. cat > conftest.c <<EOF
  1821. #include "confdefs.h"
  1822. #define strlen foo
  1823. #include <string.h>
  1824. extern
  1825. #ifdef __cplusplus
  1826. "C"
  1827. #endif
  1828. int strlen();
  1829. main() { exit(0); }
  1830. EOF
  1831. eval $compile
  1832. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1833.   x="int"
  1834. else
  1835.   x="size_t"
  1836. fi
  1837. if test -f core; then
  1838.   coredir=core`/bin/sh -c 'echo $$'`
  1839.   mkdir $coredir
  1840.   cp confdefs.h $coredir/confdefs.h
  1841.   mv conftest.c $coredir/conftest.c
  1842.   mv conftest $coredir/conftest
  1843.   mv core $coredir/core
  1844.   echo "warning: test program dumped core -- see subdirectory $coredir"
  1845. fi
  1846. rm -f conftest*
  1847. echo "#define" RETSTRLENTYPE "$x" >> confdefs.h
  1848. DEFS="$DEFS -DRETSTRLENTYPE=$x"
  1849. SEDDEFS="${SEDDEFS}\${SEDdA}RETSTRLENTYPE\${SEDdB}RETSTRLENTYPE\${SEDdC}$x\${SEDdD}
  1850. \${SEDuA}RETSTRLENTYPE\${SEDuB}RETSTRLENTYPE\${SEDuC}$x\${SEDuD}
  1851. \${SEDeA}RETSTRLENTYPE\${SEDeB}RETSTRLENTYPE\${SEDeC}$x\${SEDeD}
  1852. \${SEDfA}RETSTRLENTYPE\${SEDfB}RETSTRLENTYPE\${SEDfC}$x\${SEDfD}
  1853. "
  1854. cat > conftest.c <<EOF
  1855. #include "confdefs.h"
  1856. #define strlen foo
  1857. #include <string.h>
  1858. extern
  1859. #ifdef __cplusplus
  1860. "C"
  1861. #endif
  1862. #ifdef __STDC__
  1863. RETSTRLENTYPE strlen (char* s);
  1864. #else
  1865. RETSTRLENTYPE strlen();
  1866. #endif
  1867. main() { exit(0); }
  1868. EOF
  1869. eval $compile
  1870. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1871.   y=""
  1872. else
  1873.   y="const"
  1874. fi
  1875. if test -f core; then
  1876.   coredir=core`/bin/sh -c 'echo $$'`
  1877.   mkdir $coredir
  1878.   cp confdefs.h $coredir/confdefs.h
  1879.   mv conftest.c $coredir/conftest.c
  1880.   mv conftest $coredir/conftest
  1881.   mv core $coredir/core
  1882.   echo "warning: test program dumped core -- see subdirectory $coredir"
  1883. fi
  1884. rm -f conftest*
  1885. echo "#define" STRLEN_CONST "$y" >> confdefs.h
  1886. DEFS="$DEFS -DSTRLEN_CONST=$y"
  1887. SEDDEFS="${SEDDEFS}\${SEDdA}STRLEN_CONST\${SEDdB}STRLEN_CONST\${SEDdC}$y\${SEDdD}
  1888. \${SEDuA}STRLEN_CONST\${SEDuB}STRLEN_CONST\${SEDuC}$y\${SEDuD}
  1889. \${SEDeA}STRLEN_CONST\${SEDeB}STRLEN_CONST\${SEDeC}$y\${SEDeD}
  1890. \${SEDfA}STRLEN_CONST\${SEDfB}STRLEN_CONST\${SEDfC}$y\${SEDfD}
  1891. "
  1892. ac_proto=`echo "extern $x strlen ($y char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  1893. echo "${ac_t}${ac_tt}${ac_proto}"
  1894. fi
  1895.  
  1896.                       for func in memset
  1897. do
  1898. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  1899. echo $ac_n "checking for ${func}""... $ac_c"
  1900. cat > conftest.c <<EOF
  1901. #include "confdefs.h"
  1902. #include <ctype.h>
  1903. #ifdef __cplusplus
  1904. extern "C" char ${func}();
  1905. #endif
  1906. int main() { exit(0); }
  1907. int t() { 
  1908. /* The GNU C library defines this for functions which it implements
  1909.     to always fail with ENOSYS.  Some functions are actually named
  1910.     something starting with __ and the normal name is an alias.  */
  1911. #if defined (__stub_${func}) || defined (__stub___${func})
  1912. choke me
  1913. #else
  1914. #ifndef __cplusplus
  1915. /* Override any gcc2 internal prototype to avoid an error.  */
  1916. extern char ${func}();
  1917. #endif
  1918. ${func}();
  1919. #endif
  1920.  }
  1921. EOF
  1922. if eval $compile; then
  1923.   echo "${ac_t}yes"
  1924.   echo "#define" ${trfunc} "1" >> confdefs.h
  1925. DEFS="$DEFS -D${trfunc}=1"
  1926. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  1927. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  1928. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  1929. \${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
  1930. "
  1931. else
  1932.   echo "${ac_t}no"
  1933.   :
  1934. fi
  1935. rm -f conftest*
  1936. done
  1937.  
  1938.                       echo $ac_n "checking for broken HP/UX and SunOS malloc""... $ac_c"
  1939. # Note that HP-UX has two different malloc() implementations.
  1940. # Both are broken. When used with CLISP, the one in the default libc.a
  1941. # leads to a SIGSEGV, the one in libmalloc.a leads to a SIGBUS.
  1942. # The SunOS 4.1.1 malloc() breaks when used by CLISP's generational GC.
  1943. os_name=`(uname -s) 2> /dev/null`
  1944. if test "$os_name" = HP-UX -o "$os_name" = SunOS ; then
  1945. echo "${ac_t}yes"
  1946. # Remedy: Use GNU malloc.
  1947. GMALLOC=gmalloc
  1948. else
  1949. echo "${ac_t}no"
  1950. GMALLOC=''
  1951. fi
  1952.  
  1953.  
  1954.                       echo $ac_n "checking for malloc declaration""... $ac_c"
  1955. echo '#include "confdefs.h"
  1956. #include <stdlib.h>' > conftest.c
  1957. eval "$CPP conftest.c > conftest.out 2>&1"
  1958. if egrep "void.*\*.*malloc" conftest.out >/dev/null 2>&1; then
  1959.   malloc_void=1
  1960. fi
  1961. rm -f conftest*
  1962. if test -z "$malloc_void"; then
  1963. cat > conftest.c <<EOF
  1964. #include "confdefs.h"
  1965.  
  1966. #ifdef HAVE_STDLIB_H
  1967. #include <stdlib.h>
  1968. #endif
  1969. #ifdef HAVE_UNISTD_H
  1970. #include <unistd.h>
  1971. #endif
  1972. extern
  1973. #ifdef __cplusplus
  1974. "C"
  1975. #endif
  1976. void* malloc();
  1977. main() { exit(0); }
  1978. EOF
  1979. eval $compile
  1980. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1981.   malloc_void=1
  1982. fi
  1983. if test -f core; then
  1984.   coredir=core`/bin/sh -c 'echo $$'`
  1985.   mkdir $coredir
  1986.   cp confdefs.h $coredir/confdefs.h
  1987.   mv conftest.c $coredir/conftest.c
  1988.   mv conftest $coredir/conftest
  1989.   mv core $coredir/core
  1990.   echo "warning: test program dumped core -- see subdirectory $coredir"
  1991. fi
  1992. rm -f conftest*
  1993. fi
  1994. if test -n "$malloc_void"; then
  1995. retmalloctype="void*"
  1996. else
  1997. retmalloctype="char*"
  1998. fi
  1999. echo "#define" RETMALLOCTYPE "$retmalloctype" >> confdefs.h
  2000. DEFS="$DEFS -DRETMALLOCTYPE=$retmalloctype"
  2001. SEDDEFS="${SEDDEFS}\${SEDdA}RETMALLOCTYPE\${SEDdB}RETMALLOCTYPE\${SEDdC}$retmalloctype\${SEDdD}
  2002. \${SEDuA}RETMALLOCTYPE\${SEDuB}RETMALLOCTYPE\${SEDuC}$retmalloctype\${SEDuD}
  2003. \${SEDeA}RETMALLOCTYPE\${SEDeB}RETMALLOCTYPE\${SEDeC}$retmalloctype\${SEDeD}
  2004. \${SEDfA}RETMALLOCTYPE\${SEDfB}RETMALLOCTYPE\${SEDfC}$retmalloctype\${SEDfD}
  2005. "
  2006. cat > conftest.c <<EOF
  2007. #include "confdefs.h"
  2008.  
  2009. #ifdef HAVE_STDLIB_H
  2010. #include <stdlib.h>
  2011. #endif
  2012. #ifdef HAVE_UNISTD_H
  2013. #include <unistd.h>
  2014. #endif
  2015. extern
  2016. #ifdef __cplusplus
  2017. "C"
  2018. #endif
  2019. #ifdef __STDC__
  2020. RETMALLOCTYPE malloc (unsigned int size);
  2021. #else
  2022. RETMALLOCTYPE malloc();
  2023. #endif
  2024. main() { exit(0); }
  2025. EOF
  2026. eval $compile
  2027. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2028.   y="unsigned int"
  2029. else
  2030.   y="size_t"
  2031. fi
  2032. if test -f core; then
  2033.   coredir=core`/bin/sh -c 'echo $$'`
  2034.   mkdir $coredir
  2035.   cp confdefs.h $coredir/confdefs.h
  2036.   mv conftest.c $coredir/conftest.c
  2037.   mv conftest $coredir/conftest
  2038.   mv core $coredir/core
  2039.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2040. fi
  2041. rm -f conftest*
  2042. echo "#define" MALLOC_SIZE_T "$y" >> confdefs.h
  2043. DEFS="$DEFS -DMALLOC_SIZE_T=$y"
  2044. SEDDEFS="${SEDDEFS}\${SEDdA}MALLOC_SIZE_T\${SEDdB}MALLOC_SIZE_T\${SEDdC}$y\${SEDdD}
  2045. \${SEDuA}MALLOC_SIZE_T\${SEDuB}MALLOC_SIZE_T\${SEDuC}$y\${SEDuD}
  2046. \${SEDeA}MALLOC_SIZE_T\${SEDeB}MALLOC_SIZE_T\${SEDeC}$y\${SEDeD}
  2047. \${SEDfA}MALLOC_SIZE_T\${SEDfB}MALLOC_SIZE_T\${SEDfC}$y\${SEDfD}
  2048. "
  2049. ac_proto=`echo "extern $retmalloctype malloc ($y);" | tr -s ' ' | sed -e 's/( /(/g'`
  2050. echo "${ac_t}${ac_tt}${ac_proto}"
  2051.  
  2052.                       echo $ac_n "checking for free declaration""... $ac_c"
  2053. cat > conftest.c <<EOF
  2054. #include "confdefs.h"
  2055.  
  2056. #ifdef HAVE_STDLIB_H
  2057. #include <stdlib.h>
  2058. #endif
  2059. #ifdef HAVE_UNISTD_H
  2060. #include <unistd.h>
  2061. #endif
  2062. extern
  2063. #ifdef __cplusplus
  2064. "C"
  2065. #endif
  2066. int free();
  2067. main() { exit(0); }
  2068. EOF
  2069. eval $compile
  2070. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2071.   x="int"
  2072. else
  2073.   x="void"
  2074. fi
  2075. if test -f core; then
  2076.   coredir=core`/bin/sh -c 'echo $$'`
  2077.   mkdir $coredir
  2078.   cp confdefs.h $coredir/confdefs.h
  2079.   mv conftest.c $coredir/conftest.c
  2080.   mv conftest $coredir/conftest
  2081.   mv core $coredir/core
  2082.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2083. fi
  2084. rm -f conftest*
  2085. echo "#define" RETFREETYPE "$x" >> confdefs.h
  2086. DEFS="$DEFS -DRETFREETYPE=$x"
  2087. SEDDEFS="${SEDDEFS}\${SEDdA}RETFREETYPE\${SEDdB}RETFREETYPE\${SEDdC}$x\${SEDdD}
  2088. \${SEDuA}RETFREETYPE\${SEDuB}RETFREETYPE\${SEDuC}$x\${SEDuD}
  2089. \${SEDeA}RETFREETYPE\${SEDeB}RETFREETYPE\${SEDeC}$x\${SEDeD}
  2090. \${SEDfA}RETFREETYPE\${SEDfB}RETFREETYPE\${SEDfC}$x\${SEDfD}
  2091. "
  2092. ac_proto=`echo "extern $x free ($retmalloctype);" | tr -s ' ' | sed -e 's/( /(/g'`
  2093. echo "${ac_t}${ac_tt}${ac_proto}"
  2094.  
  2095.                       # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  2096. # for constant arguments.  Useless!
  2097. echo $ac_n "checking for working alloca.h""... $ac_c"
  2098. cat > conftest.c <<EOF
  2099. #include "confdefs.h"
  2100. #include <alloca.h>
  2101. int main() { exit(0); }
  2102. int t() { char *p = alloca(2 * sizeof(int)); }
  2103. EOF
  2104. if eval $compile; then
  2105.   echo "${ac_t}yes"
  2106.   echo "#define" HAVE_ALLOCA_H "1" >> confdefs.h
  2107. DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  2108. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD}
  2109. \${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD}
  2110. \${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD}
  2111. \${SEDfA}HAVE_ALLOCA_H\${SEDfB}HAVE_ALLOCA_H\${SEDfC}1\${SEDfD}
  2112. "
  2113. else
  2114.   echo "${ac_t}no"
  2115.   :
  2116. fi
  2117. rm -f conftest*
  2118. decl="#ifdef __GNUC__
  2119. #define alloca __builtin_alloca
  2120. #else
  2121. #ifdef HAVE_ALLOCA_H
  2122. #include <alloca.h>
  2123. #else
  2124. #ifdef _AIX
  2125.  #pragma alloca
  2126. #else
  2127. char *alloca ();
  2128. #endif
  2129. #endif
  2130. #endif
  2131. "
  2132. echo $ac_n "checking for alloca""... $ac_c"
  2133. cat > conftest.c <<EOF
  2134. #include "confdefs.h"
  2135. $decl
  2136. int main() { exit(0); }
  2137. int t() { char *p = (char *) alloca(1); }
  2138. EOF
  2139. if eval $compile; then
  2140.   echo "${ac_t}yes"
  2141.   :
  2142. else
  2143.   echo "${ac_t}no"
  2144.   alloca_missing=1
  2145. fi
  2146. rm -f conftest*
  2147. if test -n "$alloca_missing"; then
  2148.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  2149.   # that cause trouble.  Some versions do not even contain alloca or
  2150.   # contain a buggy version.  If you still want to use their alloca,
  2151.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  2152.   ALLOCA=alloca.o
  2153.   echo "#define" NO_ALLOCA "1" >> confdefs.h
  2154. DEFS="$DEFS -DNO_ALLOCA=1"
  2155. SEDDEFS="${SEDDEFS}\${SEDdA}NO_ALLOCA\${SEDdB}NO_ALLOCA\${SEDdC}1\${SEDdD}
  2156. \${SEDuA}NO_ALLOCA\${SEDuB}NO_ALLOCA\${SEDuC}1\${SEDuD}
  2157. \${SEDeA}NO_ALLOCA\${SEDeB}NO_ALLOCA\${SEDeC}1\${SEDeD}
  2158. \${SEDfA}NO_ALLOCA\${SEDfB}NO_ALLOCA\${SEDfC}1\${SEDfD}
  2159. "
  2160. fi
  2161.  
  2162.                       echo $ac_n "checking for _setjmp""... $ac_c"
  2163. cat > conftest.c <<EOF
  2164. #include "confdefs.h"
  2165. #include <ctype.h>
  2166. #ifdef __cplusplus
  2167. extern "C" char _setjmp();
  2168. #endif
  2169. int main() { exit(0); }
  2170. int t() { 
  2171. /* The GNU C library defines this for functions which it implements
  2172.     to always fail with ENOSYS.  Some functions are actually named
  2173.     something starting with __ and the normal name is an alias.  */
  2174. #if defined (__stub__setjmp) || defined (__stub____setjmp)
  2175. choke me
  2176. #else
  2177. #ifndef __cplusplus
  2178. /* Override any gcc2 internal prototype to avoid an error.  */
  2179. extern char _setjmp();
  2180. #endif
  2181. _setjmp();
  2182. #endif
  2183.  }
  2184. EOF
  2185. if eval $compile; then
  2186.   echo "${ac_t}yes"
  2187.   :
  2188. else
  2189.   echo "${ac_t}no"
  2190.   no__jmp=1
  2191. fi
  2192. rm -f conftest*
  2193. if test -z "$no__jmp"; then
  2194. echo $ac_n "checking for _longjmp""... $ac_c"
  2195. cat > conftest.c <<EOF
  2196. #include "confdefs.h"
  2197. #include <ctype.h>
  2198. #ifdef __cplusplus
  2199. extern "C" char _longjmp();
  2200. #endif
  2201. int main() { exit(0); }
  2202. int t() { 
  2203. /* The GNU C library defines this for functions which it implements
  2204.     to always fail with ENOSYS.  Some functions are actually named
  2205.     something starting with __ and the normal name is an alias.  */
  2206. #if defined (__stub__longjmp) || defined (__stub____longjmp)
  2207. choke me
  2208. #else
  2209. #ifndef __cplusplus
  2210. /* Override any gcc2 internal prototype to avoid an error.  */
  2211. extern char _longjmp();
  2212. #endif
  2213. _longjmp();
  2214. #endif
  2215.  }
  2216. EOF
  2217. if eval $compile; then
  2218.   echo "${ac_t}yes"
  2219.   :
  2220. else
  2221.   echo "${ac_t}no"
  2222.   no__jmp=1
  2223. fi
  2224. rm -f conftest*
  2225. fi
  2226. if test -z "$no__jmp"; then
  2227. echo "#define" HAVE__JMP "1" >> confdefs.h
  2228. DEFS="$DEFS -DHAVE__JMP=1"
  2229. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE__JMP\${SEDdB}HAVE__JMP\${SEDdC}1\${SEDdD}
  2230. \${SEDuA}HAVE__JMP\${SEDuB}HAVE__JMP\${SEDuC}1\${SEDuD}
  2231. \${SEDeA}HAVE__JMP\${SEDeB}HAVE__JMP\${SEDeC}1\${SEDeD}
  2232. \${SEDfA}HAVE__JMP\${SEDfB}HAVE__JMP\${SEDfC}1\${SEDfD}
  2233. "
  2234. fi
  2235. echo '#include "confdefs.h"
  2236. #include <setjmp.h>' > conftest.c
  2237. eval "$CPP conftest.c > conftest.out 2>&1"
  2238. if egrep "void.* longjmp" conftest.out >/dev/null 2>&1; then
  2239.   :
  2240. else
  2241.   echo "#define" LONGJMP_RETURNS "1" >> confdefs.h
  2242. DEFS="$DEFS -DLONGJMP_RETURNS=1"
  2243. SEDDEFS="${SEDDEFS}\${SEDdA}LONGJMP_RETURNS\${SEDdB}LONGJMP_RETURNS\${SEDdC}1\${SEDdD}
  2244. \${SEDuA}LONGJMP_RETURNS\${SEDuB}LONGJMP_RETURNS\${SEDuC}1\${SEDuD}
  2245. \${SEDeA}LONGJMP_RETURNS\${SEDeB}LONGJMP_RETURNS\${SEDeC}1\${SEDeD}
  2246. \${SEDfA}LONGJMP_RETURNS\${SEDfB}LONGJMP_RETURNS\${SEDfC}1\${SEDfD}
  2247. "
  2248. fi
  2249. rm -f conftest*
  2250.  
  2251.  
  2252.                       echo $ac_n "checking return type of signal handlers""... $ac_c"
  2253. cat > conftest.c <<EOF
  2254. #include "confdefs.h"
  2255. #include <sys/types.h>
  2256. #include <signal.h>
  2257. #ifdef signal
  2258. #undef signal
  2259. #endif
  2260. extern
  2261. #ifdef __cplusplus
  2262. "C"
  2263. #endif
  2264. void (*signal ()) ();
  2265. int main() { exit(0); }
  2266. int t() { int i; }
  2267. EOF
  2268. if eval $compile; then
  2269.   retsigtype=void
  2270. else
  2271.   retsigtype=int
  2272. fi
  2273. rm -f conftest*
  2274.  
  2275. echo "${ac_t}$retsigtype"
  2276. echo "#define" RETSIGTYPE "$retsigtype" >> confdefs.h
  2277. DEFS="$DEFS -DRETSIGTYPE=$retsigtype"
  2278. SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}$retsigtype\${SEDdD}
  2279. \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}$retsigtype\${SEDuD}
  2280. \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}$retsigtype\${SEDeD}
  2281. \${SEDfA}RETSIGTYPE\${SEDfB}RETSIGTYPE\${SEDfC}$retsigtype\${SEDfD}
  2282. "
  2283.  
  2284.                       echo $ac_n "checking whether signal handlers need to be reinstalled""... $ac_c"
  2285. cat > conftest.c <<EOF
  2286. #include "confdefs.h"
  2287.  
  2288. #ifdef STDC_HEADERS
  2289. #include <stdlib.h>
  2290. #endif
  2291. #ifdef HAVE_UNISTD_H
  2292. #include <unistd.h>
  2293. #endif
  2294. #include <signal.h>
  2295. /* volatile */ int gotsig=0;
  2296. RETSIGTYPE sigalrm_handler() { gotsig=1; }
  2297. int got_sig () { return gotsig; }
  2298. typedef RETSIGTYPE (*signal_handler) ();
  2299. main() { /* returns 0 if they need not to be reinstalled */
  2300.   signal(SIGALRM,(signal_handler)sigalrm_handler); alarm(1); while (!got_sig());
  2301.   exit(!( (signal_handler)signal(SIGALRM,(signal_handler)sigalrm_handler)
  2302.           == (signal_handler)sigalrm_handler
  2303.       ) );
  2304. }
  2305. EOF
  2306. eval $compile
  2307. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2308.   echo "${ac_t}no"
  2309. else
  2310.   echo "${ac_t}yes"
  2311. echo "#define" SIGNAL_NEED_REINSTALL "1" >> confdefs.h
  2312. DEFS="$DEFS -DSIGNAL_NEED_REINSTALL=1"
  2313. SEDDEFS="${SEDDEFS}\${SEDdA}SIGNAL_NEED_REINSTALL\${SEDdB}SIGNAL_NEED_REINSTALL\${SEDdC}1\${SEDdD}
  2314. \${SEDuA}SIGNAL_NEED_REINSTALL\${SEDuB}SIGNAL_NEED_REINSTALL\${SEDuC}1\${SEDuD}
  2315. \${SEDeA}SIGNAL_NEED_REINSTALL\${SEDeB}SIGNAL_NEED_REINSTALL\${SEDeC}1\${SEDeD}
  2316. \${SEDfA}SIGNAL_NEED_REINSTALL\${SEDfB}SIGNAL_NEED_REINSTALL\${SEDfC}1\${SEDfD}
  2317. "
  2318. fi
  2319. if test -f core; then
  2320.   coredir=core`/bin/sh -c 'echo $$'`
  2321.   mkdir $coredir
  2322.   cp confdefs.h $coredir/confdefs.h
  2323.   mv conftest.c $coredir/conftest.c
  2324.   mv conftest $coredir/conftest
  2325.   mv core $coredir/core
  2326.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2327. fi
  2328. rm -f conftest*
  2329.  
  2330.                       echo $ac_n "checking for sighold""... $ac_c"
  2331. cat > conftest.c <<EOF
  2332. #include "confdefs.h"
  2333. #include <ctype.h>
  2334. #ifdef __cplusplus
  2335. extern "C" char sighold();
  2336. #endif
  2337. int main() { exit(0); }
  2338. int t() { 
  2339. /* The GNU C library defines this for functions which it implements
  2340.     to always fail with ENOSYS.  Some functions are actually named
  2341.     something starting with __ and the normal name is an alias.  */
  2342. #if defined (__stub_sighold) || defined (__stub___sighold)
  2343. choke me
  2344. #else
  2345. #ifndef __cplusplus
  2346. /* Override any gcc2 internal prototype to avoid an error.  */
  2347. extern char sighold();
  2348. #endif
  2349. sighold();
  2350. #endif
  2351.  }
  2352. EOF
  2353. if eval $compile; then
  2354.   echo "${ac_t}yes"
  2355.   echo "#define" SIGNALBLOCK_SYSV "1" >> confdefs.h
  2356. DEFS="$DEFS -DSIGNALBLOCK_SYSV=1"
  2357. SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_SYSV\${SEDdB}SIGNALBLOCK_SYSV\${SEDdC}1\${SEDdD}
  2358. \${SEDuA}SIGNALBLOCK_SYSV\${SEDuB}SIGNALBLOCK_SYSV\${SEDuC}1\${SEDuD}
  2359. \${SEDeA}SIGNALBLOCK_SYSV\${SEDeB}SIGNALBLOCK_SYSV\${SEDeC}1\${SEDeD}
  2360. \${SEDfA}SIGNALBLOCK_SYSV\${SEDfB}SIGNALBLOCK_SYSV\${SEDfC}1\${SEDfD}
  2361. "
  2362. else
  2363.   echo "${ac_t}no"
  2364.   :
  2365. fi
  2366. rm -f conftest*
  2367. echo '#include "confdefs.h"
  2368. #include <signal.h>' > conftest.c
  2369. eval "$CPP conftest.c > conftest.out 2>&1"
  2370. if egrep "sigset_t" conftest.out >/dev/null 2>&1; then
  2371.   :
  2372. else
  2373.   signals_not_posix=1
  2374. fi
  2375. rm -f conftest*
  2376. if test -z "$signals_not_posix"; then
  2377. echo $ac_n "checking for sigprocmask""... $ac_c"
  2378. cat > conftest.c <<EOF
  2379. #include "confdefs.h"
  2380. #include <ctype.h>
  2381. #ifdef __cplusplus
  2382. extern "C" char sigprocmask();
  2383. #endif
  2384. int main() { exit(0); }
  2385. int t() { 
  2386. /* The GNU C library defines this for functions which it implements
  2387.     to always fail with ENOSYS.  Some functions are actually named
  2388.     something starting with __ and the normal name is an alias.  */
  2389. #if defined (__stub_sigprocmask) || defined (__stub___sigprocmask)
  2390. choke me
  2391. #else
  2392. #ifndef __cplusplus
  2393. /* Override any gcc2 internal prototype to avoid an error.  */
  2394. extern char sigprocmask();
  2395. #endif
  2396. sigprocmask();
  2397. #endif
  2398.  }
  2399. EOF
  2400. if eval $compile; then
  2401.   echo "${ac_t}yes"
  2402.   echo "#define" SIGNALBLOCK_POSIX "1" >> confdefs.h
  2403. DEFS="$DEFS -DSIGNALBLOCK_POSIX=1"
  2404. SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_POSIX\${SEDdB}SIGNALBLOCK_POSIX\${SEDdC}1\${SEDdD}
  2405. \${SEDuA}SIGNALBLOCK_POSIX\${SEDuB}SIGNALBLOCK_POSIX\${SEDuC}1\${SEDuD}
  2406. \${SEDeA}SIGNALBLOCK_POSIX\${SEDeB}SIGNALBLOCK_POSIX\${SEDeC}1\${SEDeD}
  2407. \${SEDfA}SIGNALBLOCK_POSIX\${SEDfB}SIGNALBLOCK_POSIX\${SEDfC}1\${SEDfD}
  2408. "
  2409. else
  2410.   echo "${ac_t}no"
  2411.   :
  2412. fi
  2413. rm -f conftest*
  2414. fi
  2415. echo $ac_n "checking for sigblock""... $ac_c"
  2416. cat > conftest.c <<EOF
  2417. #include "confdefs.h"
  2418. #include <ctype.h>
  2419. #ifdef __cplusplus
  2420. extern "C" char sigblock();
  2421. #endif
  2422. int main() { exit(0); }
  2423. int t() { 
  2424. /* The GNU C library defines this for functions which it implements
  2425.     to always fail with ENOSYS.  Some functions are actually named
  2426.     something starting with __ and the normal name is an alias.  */
  2427. #if defined (__stub_sigblock) || defined (__stub___sigblock)
  2428. choke me
  2429. #else
  2430. #ifndef __cplusplus
  2431. /* Override any gcc2 internal prototype to avoid an error.  */
  2432. extern char sigblock();
  2433. #endif
  2434. sigblock();
  2435. #endif
  2436.  }
  2437. EOF
  2438. if eval $compile; then
  2439.   echo "${ac_t}yes"
  2440.   echo "#define" SIGNALBLOCK_BSD "1" >> confdefs.h
  2441. DEFS="$DEFS -DSIGNALBLOCK_BSD=1"
  2442. SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_BSD\${SEDdB}SIGNALBLOCK_BSD\${SEDdC}1\${SEDdD}
  2443. \${SEDuA}SIGNALBLOCK_BSD\${SEDuB}SIGNALBLOCK_BSD\${SEDuC}1\${SEDuD}
  2444. \${SEDeA}SIGNALBLOCK_BSD\${SEDeB}SIGNALBLOCK_BSD\${SEDeC}1\${SEDeD}
  2445. \${SEDfA}SIGNALBLOCK_BSD\${SEDfB}SIGNALBLOCK_BSD\${SEDfC}1\${SEDfD}
  2446. "
  2447. else
  2448.   echo "${ac_t}no"
  2449.   :
  2450. fi
  2451. rm -f conftest*
  2452.  
  2453.                       case "$DEFS" in
  2454.   *SIGNALBLOCK_BSD*)
  2455. echo $ac_n "checking whether signals are blocked when signal handlers are entered""... $ac_c"
  2456. cat > conftest.c <<EOF
  2457. #include "confdefs.h"
  2458.  
  2459. #ifdef STDC_HEADERS
  2460. #include <stdlib.h>
  2461. #endif
  2462. #ifdef HAVE_UNISTD_H
  2463. #include <unistd.h>
  2464. #endif
  2465. #include <signal.h>
  2466. int gotsig=0;
  2467. int wasblocked=0;
  2468. typedef RETSIGTYPE (*signal_handler) ();
  2469. RETSIGTYPE sigalrm_handler()
  2470. { gotsig=1;
  2471. #ifdef SIGNAL_NEED_REINSTALL
  2472.   signal(SIGALRM,(signal_handler)sigalrm_handler);
  2473. #endif
  2474. #ifdef SIGNALBLOCK_POSIX
  2475.   { sigset_t blocked;
  2476.     sigprocmask(SIG_BLOCK, (sigset_t *) 0, &blocked);
  2477.     wasblocked = sigismember(&blocked,SIGALRM) ? 1 : 0;
  2478.   }
  2479. #else
  2480.   wasblocked = ((sigblock(0) & sigmask(SIGALRM)) != 0);
  2481. #endif
  2482. }
  2483. int got_sig () { return gotsig; }
  2484. main() { /* returns 0 if they need not to be unblocked */
  2485.   signal(SIGALRM,(signal_handler)sigalrm_handler); alarm(1); while (!got_sig());
  2486.   exit(wasblocked);
  2487. }
  2488. EOF
  2489. eval $compile
  2490. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2491.   echo "${ac_t}no"
  2492. else
  2493.   echo "${ac_t}yes"
  2494. echo "#define" SIGNAL_NEED_UNBLOCK "1" >> confdefs.h
  2495. DEFS="$DEFS -DSIGNAL_NEED_UNBLOCK=1"
  2496. SEDDEFS="${SEDDEFS}\${SEDdA}SIGNAL_NEED_UNBLOCK\${SEDdB}SIGNAL_NEED_UNBLOCK\${SEDdC}1\${SEDdD}
  2497. \${SEDuA}SIGNAL_NEED_UNBLOCK\${SEDuB}SIGNAL_NEED_UNBLOCK\${SEDuC}1\${SEDuD}
  2498. \${SEDeA}SIGNAL_NEED_UNBLOCK\${SEDeB}SIGNAL_NEED_UNBLOCK\${SEDeC}1\${SEDeD}
  2499. \${SEDfA}SIGNAL_NEED_UNBLOCK\${SEDfB}SIGNAL_NEED_UNBLOCK\${SEDfC}1\${SEDfD}
  2500. "
  2501. fi
  2502. if test -f core; then
  2503.   coredir=core`/bin/sh -c 'echo $$'`
  2504.   mkdir $coredir
  2505.   cp confdefs.h $coredir/confdefs.h
  2506.   mv conftest.c $coredir/conftest.c
  2507.   mv conftest $coredir/conftest
  2508.   mv core $coredir/core
  2509.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2510. fi
  2511. rm -f conftest*
  2512.   ;;
  2513.   *) ;;
  2514. esac
  2515.  
  2516.                       case "$DEFS" in
  2517.   *SIGNALBLOCK_POSIX*)
  2518. echo $ac_n "checking for sigprocmask declaration""... $ac_c"
  2519. cat > conftest.c <<EOF
  2520. #include "confdefs.h"
  2521.  
  2522. #ifdef STDC_HEADERS
  2523. #include <stdlib.h>
  2524. #endif
  2525. #ifdef HAVE_UNISTD_H
  2526. #include <unistd.h>
  2527. #endif
  2528. #include <signal.h>
  2529. extern
  2530. #ifdef __cplusplus
  2531. "C"
  2532. #endif
  2533. #ifdef __STDC__
  2534. int sigprocmask (int how, sigset_t* set, sigset_t* oset);
  2535. #else
  2536. int sigprocmask();
  2537. #endif
  2538. main() { exit(0); }
  2539. EOF
  2540. eval $compile
  2541. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2542.   x=""
  2543. else
  2544.   x="const"
  2545. fi
  2546. if test -f core; then
  2547.   coredir=core`/bin/sh -c 'echo $$'`
  2548.   mkdir $coredir
  2549.   cp confdefs.h $coredir/confdefs.h
  2550.   mv conftest.c $coredir/conftest.c
  2551.   mv conftest $coredir/conftest
  2552.   mv core $coredir/core
  2553.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2554. fi
  2555. rm -f conftest*
  2556. echo "#define" SIGPROCMASK_CONST "$x" >> confdefs.h
  2557. DEFS="$DEFS -DSIGPROCMASK_CONST=$x"
  2558. SEDDEFS="${SEDDEFS}\${SEDdA}SIGPROCMASK_CONST\${SEDdB}SIGPROCMASK_CONST\${SEDdC}$x\${SEDdD}
  2559. \${SEDuA}SIGPROCMASK_CONST\${SEDuB}SIGPROCMASK_CONST\${SEDuC}$x\${SEDuD}
  2560. \${SEDeA}SIGPROCMASK_CONST\${SEDeB}SIGPROCMASK_CONST\${SEDeC}$x\${SEDeD}
  2561. \${SEDfA}SIGPROCMASK_CONST\${SEDfB}SIGPROCMASK_CONST\${SEDfC}$x\${SEDfD}
  2562. "
  2563. ac_proto=`echo "extern int sigprocmask (int, $x sigset_t*, sigset_t*);" | tr -s ' ' | sed -e 's/( /(/g'`
  2564. echo "${ac_t}${ac_tt}${ac_proto}"
  2565.   ;;
  2566.   *) ;;
  2567. esac
  2568.  
  2569.                       echo $ac_n "checking for sigaction""... $ac_c"
  2570. cat > conftest.c <<EOF
  2571. #include "confdefs.h"
  2572. #include <ctype.h>
  2573. #ifdef __cplusplus
  2574. extern "C" char sigaction();
  2575. #endif
  2576. int main() { exit(0); }
  2577. int t() { 
  2578. /* The GNU C library defines this for functions which it implements
  2579.     to always fail with ENOSYS.  Some functions are actually named
  2580.     something starting with __ and the normal name is an alias.  */
  2581. #if defined (__stub_sigaction) || defined (__stub___sigaction)
  2582. choke me
  2583. #else
  2584. #ifndef __cplusplus
  2585. /* Override any gcc2 internal prototype to avoid an error.  */
  2586. extern char sigaction();
  2587. #endif
  2588. sigaction();
  2589. #endif
  2590.  }
  2591. EOF
  2592. if eval $compile; then
  2593.   echo "${ac_t}yes"
  2594.   echo "#define" HAVE_SIGACTION "1" >> confdefs.h
  2595. DEFS="$DEFS -DHAVE_SIGACTION=1"
  2596. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIGACTION\${SEDdB}HAVE_SIGACTION\${SEDdC}1\${SEDdD}
  2597. \${SEDuA}HAVE_SIGACTION\${SEDuB}HAVE_SIGACTION\${SEDuC}1\${SEDuD}
  2598. \${SEDeA}HAVE_SIGACTION\${SEDeB}HAVE_SIGACTION\${SEDeC}1\${SEDeD}
  2599. \${SEDfA}HAVE_SIGACTION\${SEDfB}HAVE_SIGACTION\${SEDfC}1\${SEDfD}
  2600. "
  2601. have_sigaction=1
  2602. else
  2603.   echo "${ac_t}no"
  2604.   :
  2605. fi
  2606. rm -f conftest*
  2607.  
  2608.                       echo $ac_n "checking for siginterrupt""... $ac_c"
  2609. cat > conftest.c <<EOF
  2610. #include "confdefs.h"
  2611. #include <ctype.h>
  2612. #ifdef __cplusplus
  2613. extern "C" char siginterrupt();
  2614. #endif
  2615. int main() { exit(0); }
  2616. int t() { 
  2617. /* The GNU C library defines this for functions which it implements
  2618.     to always fail with ENOSYS.  Some functions are actually named
  2619.     something starting with __ and the normal name is an alias.  */
  2620. #if defined (__stub_siginterrupt) || defined (__stub___siginterrupt)
  2621. choke me
  2622. #else
  2623. #ifndef __cplusplus
  2624. /* Override any gcc2 internal prototype to avoid an error.  */
  2625. extern char siginterrupt();
  2626. #endif
  2627. siginterrupt();
  2628. #endif
  2629.  }
  2630. EOF
  2631. if eval $compile; then
  2632.   echo "${ac_t}yes"
  2633.   echo "#define" HAVE_SIGINTERRUPT "1" >> confdefs.h
  2634. DEFS="$DEFS -DHAVE_SIGINTERRUPT=1"
  2635. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIGINTERRUPT\${SEDdB}HAVE_SIGINTERRUPT\${SEDdC}1\${SEDdD}
  2636. \${SEDuA}HAVE_SIGINTERRUPT\${SEDuB}HAVE_SIGINTERRUPT\${SEDuC}1\${SEDuD}
  2637. \${SEDeA}HAVE_SIGINTERRUPT\${SEDeB}HAVE_SIGINTERRUPT\${SEDeC}1\${SEDeD}
  2638. \${SEDfA}HAVE_SIGINTERRUPT\${SEDfB}HAVE_SIGINTERRUPT\${SEDfC}1\${SEDfD}
  2639. "
  2640. have_siginterrupt=1
  2641. else
  2642.   echo "${ac_t}no"
  2643.   :
  2644. fi
  2645. rm -f conftest*
  2646. if test -z "$have_siginterrupt" -a -z "$have_sigaction"; then
  2647. for func in sigvec
  2648. do
  2649. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  2650. echo $ac_n "checking for ${func}""... $ac_c"
  2651. cat > conftest.c <<EOF
  2652. #include "confdefs.h"
  2653. #include <ctype.h>
  2654. #ifdef __cplusplus
  2655. extern "C" char ${func}();
  2656. #endif
  2657. int main() { exit(0); }
  2658. int t() { 
  2659. /* The GNU C library defines this for functions which it implements
  2660.     to always fail with ENOSYS.  Some functions are actually named
  2661.     something starting with __ and the normal name is an alias.  */
  2662. #if defined (__stub_${func}) || defined (__stub___${func})
  2663. choke me
  2664. #else
  2665. #ifndef __cplusplus
  2666. /* Override any gcc2 internal prototype to avoid an error.  */
  2667. extern char ${func}();
  2668. #endif
  2669. ${func}();
  2670. #endif
  2671.  }
  2672. EOF
  2673. if eval $compile; then
  2674.   echo "${ac_t}yes"
  2675.   echo "#define" ${trfunc} "1" >> confdefs.h
  2676. DEFS="$DEFS -D${trfunc}=1"
  2677. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  2678. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  2679. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  2680. \${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
  2681. "
  2682. else
  2683.   echo "${ac_t}no"
  2684.   :
  2685. fi
  2686. rm -f conftest*
  2687. done
  2688. fi
  2689.  
  2690.                       echo $ac_n "checking for abort declaration""... $ac_c"
  2691. cat > conftest.c <<EOF
  2692. #include "confdefs.h"
  2693.  
  2694. #ifdef STDC_HEADERS
  2695. #include <stdlib.h>
  2696. #endif
  2697. #ifdef HAVE_UNISTD_H
  2698. #include <unistd.h>
  2699. #endif
  2700. extern
  2701. #ifdef __cplusplus
  2702. "C"
  2703. #endif
  2704. int abort();
  2705. main() { exit(0); }
  2706. EOF
  2707. eval $compile
  2708. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2709.   x="int"
  2710. else
  2711.   x="void"
  2712. fi
  2713. if test -f core; then
  2714.   coredir=core`/bin/sh -c 'echo $$'`
  2715.   mkdir $coredir
  2716.   cp confdefs.h $coredir/confdefs.h
  2717.   mv conftest.c $coredir/conftest.c
  2718.   mv conftest $coredir/conftest
  2719.   mv core $coredir/core
  2720.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2721. fi
  2722. rm -f conftest*
  2723. echo "#define" RETABORTTYPE "$x" >> confdefs.h
  2724. DEFS="$DEFS -DRETABORTTYPE=$x"
  2725. SEDDEFS="${SEDDEFS}\${SEDdA}RETABORTTYPE\${SEDdB}RETABORTTYPE\${SEDdC}$x\${SEDdD}
  2726. \${SEDuA}RETABORTTYPE\${SEDuB}RETABORTTYPE\${SEDuC}$x\${SEDuD}
  2727. \${SEDeA}RETABORTTYPE\${SEDeB}RETABORTTYPE\${SEDeC}$x\${SEDeD}
  2728. \${SEDfA}RETABORTTYPE\${SEDfB}RETABORTTYPE\${SEDfC}$x\${SEDfD}
  2729. "
  2730. cat > conftest.c <<EOF
  2731. #include "confdefs.h"
  2732.  
  2733. #ifdef STDC_HEADERS
  2734. #include <stdlib.h>
  2735. #endif
  2736. #ifdef HAVE_UNISTD_H
  2737. #include <unistd.h>
  2738. #endif
  2739. extern
  2740. #ifdef __cplusplus
  2741. "C"
  2742. #endif
  2743. RETABORTTYPE abort();
  2744. main() { exit(0); }
  2745. EOF
  2746. eval $compile
  2747. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2748.   y=""
  2749. else
  2750.   y="__volatile__"
  2751. fi
  2752. if test -f core; then
  2753.   coredir=core`/bin/sh -c 'echo $$'`
  2754.   mkdir $coredir
  2755.   cp confdefs.h $coredir/confdefs.h
  2756.   mv conftest.c $coredir/conftest.c
  2757.   mv conftest $coredir/conftest
  2758.   mv core $coredir/core
  2759.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2760. fi
  2761. rm -f conftest*
  2762. echo "#define" ABORT_VOLATILE "$y" >> confdefs.h
  2763. DEFS="$DEFS -DABORT_VOLATILE=$y"
  2764. SEDDEFS="${SEDDEFS}\${SEDdA}ABORT_VOLATILE\${SEDdB}ABORT_VOLATILE\${SEDdC}$y\${SEDdD}
  2765. \${SEDuA}ABORT_VOLATILE\${SEDuB}ABORT_VOLATILE\${SEDuC}$y\${SEDuD}
  2766. \${SEDeA}ABORT_VOLATILE\${SEDeB}ABORT_VOLATILE\${SEDeC}$y\${SEDeD}
  2767. \${SEDfA}ABORT_VOLATILE\${SEDfB}ABORT_VOLATILE\${SEDfC}$y\${SEDfD}
  2768. "
  2769. ac_proto=`echo "extern $y $x abort (void);" | tr -s ' ' | sed -e 's/( /(/g'`
  2770. echo "${ac_t}${ac_tt}${ac_proto}"
  2771.  
  2772.                       echo $ac_n "checking for sys_errlist declaration""... $ac_c"
  2773. brackets='[]'
  2774. cat > conftest.c <<EOF
  2775. #include "confdefs.h"
  2776.  
  2777. /* Most systems declare sys_errlist in <errno.h>, NetBSD 1.0 in <stdio.h>. */
  2778. #include <stdio.h>
  2779. #include <errno.h>
  2780. extern char* sys_errlist $brackets ;
  2781. main() { exit(0); }
  2782. EOF
  2783. eval $compile
  2784. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2785.   x=""
  2786. else
  2787.   x="const"
  2788. fi
  2789. if test -f core; then
  2790.   coredir=core`/bin/sh -c 'echo $$'`
  2791.   mkdir $coredir
  2792.   cp confdefs.h $coredir/confdefs.h
  2793.   mv conftest.c $coredir/conftest.c
  2794.   mv conftest $coredir/conftest
  2795.   mv core $coredir/core
  2796.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2797. fi
  2798. rm -f conftest*
  2799. echo "#define" SYS_ERRLIST_CONST "$x" >> confdefs.h
  2800. DEFS="$DEFS -DSYS_ERRLIST_CONST=$x"
  2801. SEDDEFS="${SEDDEFS}\${SEDdA}SYS_ERRLIST_CONST\${SEDdB}SYS_ERRLIST_CONST\${SEDdC}$x\${SEDdD}
  2802. \${SEDuA}SYS_ERRLIST_CONST\${SEDuB}SYS_ERRLIST_CONST\${SEDuC}$x\${SEDuD}
  2803. \${SEDeA}SYS_ERRLIST_CONST\${SEDeB}SYS_ERRLIST_CONST\${SEDeC}$x\${SEDeD}
  2804. \${SEDfA}SYS_ERRLIST_CONST\${SEDfB}SYS_ERRLIST_CONST\${SEDfC}$x\${SEDfD}
  2805. "
  2806. ac_proto=`echo "extern $x char* $x sys_errlist$brackets;" | tr -s ' ' | sed -e 's/( /(/g'`
  2807. echo "${ac_t}${ac_tt}${ac_proto}"
  2808.  
  2809.                       echo $ac_n "checking for getenv declaration""... $ac_c"
  2810. cat > conftest.c <<EOF
  2811. #include "confdefs.h"
  2812.  
  2813. #ifdef STDC_HEADERS
  2814. #include <stdlib.h>
  2815. #endif
  2816. #ifdef HAVE_UNISTD_H
  2817. #include <unistd.h>
  2818. #endif
  2819. extern
  2820. #ifdef __cplusplus
  2821. "C"
  2822. #endif
  2823. #ifdef __STDC__
  2824. char* getenv (char* name);
  2825. #else
  2826. char* getenv();
  2827. #endif
  2828. main() { exit(0); }
  2829. EOF
  2830. eval $compile
  2831. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2832.   x=""
  2833. else
  2834.   x="const"
  2835. fi
  2836. if test -f core; then
  2837.   coredir=core`/bin/sh -c 'echo $$'`
  2838.   mkdir $coredir
  2839.   cp confdefs.h $coredir/confdefs.h
  2840.   mv conftest.c $coredir/conftest.c
  2841.   mv conftest $coredir/conftest
  2842.   mv core $coredir/core
  2843.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2844. fi
  2845. rm -f conftest*
  2846. echo "#define" GETENV_CONST "$x" >> confdefs.h
  2847. DEFS="$DEFS -DGETENV_CONST=$x"
  2848. SEDDEFS="${SEDDEFS}\${SEDdA}GETENV_CONST\${SEDdB}GETENV_CONST\${SEDdC}$x\${SEDdD}
  2849. \${SEDuA}GETENV_CONST\${SEDuB}GETENV_CONST\${SEDuC}$x\${SEDuD}
  2850. \${SEDeA}GETENV_CONST\${SEDeB}GETENV_CONST\${SEDeC}$x\${SEDeD}
  2851. \${SEDfA}GETENV_CONST\${SEDfB}GETENV_CONST\${SEDfC}$x\${SEDfD}
  2852. "
  2853. ac_proto=`echo "extern char* getenv ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  2854. echo "${ac_t}${ac_tt}${ac_proto}"
  2855.  
  2856.                       echo $ac_n "checking for vfork.h""... $ac_c"
  2857. cat > conftest.c <<EOF
  2858. #include "confdefs.h"
  2859. #include <vfork.h>
  2860. EOF
  2861. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  2862. if test -z "$err"; then
  2863.   echo "${ac_t}yes"
  2864. echo "#define" HAVE_VFORK_H "1" >> confdefs.h
  2865. DEFS="$DEFS -DHAVE_VFORK_H=1"
  2866. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_VFORK_H\${SEDdB}HAVE_VFORK_H\${SEDdC}1\${SEDdD}
  2867. \${SEDuA}HAVE_VFORK_H\${SEDuB}HAVE_VFORK_H\${SEDuC}1\${SEDuD}
  2868. \${SEDeA}HAVE_VFORK_H\${SEDeB}HAVE_VFORK_H\${SEDeC}1\${SEDeD}
  2869. \${SEDfA}HAVE_VFORK_H\${SEDfB}HAVE_VFORK_H\${SEDfC}1\${SEDfD}
  2870. "
  2871. else
  2872.   echo "${ac_t}no"
  2873.  
  2874. fi
  2875. rm -f conftest*
  2876. echo $ac_n "checking for working vfork""... $ac_c"
  2877. cat > conftest.c <<EOF
  2878. #include "confdefs.h"
  2879. /* Thanks to Paul Eggert for this test.  */
  2880. #include <stdio.h>
  2881. #include <sys/types.h>
  2882. #include <sys/stat.h>
  2883. #include <signal.h>
  2884. #ifdef HAVE_UNISTD_H
  2885. #include <unistd.h>
  2886. #endif
  2887. #ifdef HAVE_VFORK_H
  2888. #include <vfork.h>
  2889. #endif
  2890. static int signalled;
  2891. static RETSIGTYPE
  2892. #ifdef __STDC__
  2893. catch (int s)
  2894. #else
  2895. catch (s) int s;
  2896. #endif
  2897. { signalled = 1; }
  2898. main() {
  2899.   pid_t parent = getpid();
  2900.   pid_t child;
  2901.   signal (SIGINT, catch);
  2902.   child = vfork ();
  2903.   if (child == 0) {
  2904.     /* On sparc systems, changes by the child to local and incoming
  2905.        argument registers are propagated back to the parent.
  2906.        The compiler is told about this with #include <vfork.h>,
  2907.        but some compilers (e.g. gcc -O) don't grok <vfork.h>.
  2908.        Test for this by using lots of local variables, at least
  2909.        as many local variables as main has allocated so far
  2910.        including compiler temporaries.  4 locals are enough for
  2911.        gcc 1.40.3 on a sparc, but we use 8 to be safe.
  2912.        A buggy compiler should reuse the register of parent
  2913.        for one of the local variables, since it will think that
  2914.        parent can't possibly be used any more in this routine.
  2915.        Assigning to the local variable will thus munge parent
  2916.        in the parent process.  */
  2917.     pid_t
  2918.       p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
  2919.       p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
  2920.     /* Convince the compiler that p..p7 are live; otherwise, it might
  2921.        use the same hardware register for all 8 local variables.  */
  2922.     if (p != p1 || p != p2 || p != p3 || p != p4
  2923.     || p != p5 || p != p6 || p != p7)
  2924.       _exit(1);
  2925.     /* On some systems (e.g. SunOS 5.2), if the parent is catching
  2926.        a signal, the child ignores the signal before execing,
  2927.        and the parent later receives that signal, the parent dumps core.
  2928.        Test for this by ignoring SIGINT in the child.  */
  2929.     signal (SIGINT, SIG_IGN);
  2930.     /* On some systems (e.g. IRIX 3.3),
  2931.        vfork doesn't separate parent from child file descriptors.
  2932.        If the child closes a descriptor before it execs or exits,
  2933.        this munges the parent's descriptor as well.
  2934.        Test for this by closing stdout in the child.  */
  2935.     _exit(close(fileno(stdout)) != 0);
  2936.   } else {
  2937.     int status;
  2938.     struct stat st;
  2939.     while (wait(&status) != child) ;
  2940.     exit(
  2941.      /* Was there some problem with vforking?  */
  2942.      child < 0
  2943.      /* Did the child fail?  (This shouldn't happen.)  */
  2944.      || status
  2945.      /* Did the vfork/compiler bug occur?  */
  2946.      || parent != getpid()
  2947.      /* Did the signal handling bug occur?  */
  2948.      || kill(parent, SIGINT) != 0
  2949.      || signalled != 1
  2950.      /* Did the file descriptor bug occur?  */
  2951.      || fstat(fileno(stdout), &st) != 0
  2952.      );
  2953.   }
  2954. }
  2955. EOF
  2956. eval $compile
  2957. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2958.   echo "${ac_t}yes"
  2959. else
  2960.   rm -f core
  2961. echo "${ac_t}no"
  2962. echo "#define" vfork "fork" >> confdefs.h
  2963. DEFS="$DEFS -Dvfork=fork"
  2964. SEDDEFS="${SEDDEFS}\${SEDdA}vfork\${SEDdB}vfork\${SEDdC}fork\${SEDdD}
  2965. \${SEDuA}vfork\${SEDuB}vfork\${SEDuC}fork\${SEDuD}
  2966. \${SEDeA}vfork\${SEDeB}vfork\${SEDeC}fork\${SEDeD}
  2967. \${SEDfA}vfork\${SEDfB}vfork\${SEDfC}fork\${SEDfD}
  2968. "
  2969. fi
  2970. if test -f core; then
  2971.   coredir=core`/bin/sh -c 'echo $$'`
  2972.   mkdir $coredir
  2973.   cp confdefs.h $coredir/confdefs.h
  2974.   mv conftest.c $coredir/conftest.c
  2975.   mv conftest $coredir/conftest
  2976.   mv core $coredir/core
  2977.   echo "warning: test program dumped core -- see subdirectory $coredir"
  2978. fi
  2979. rm -f conftest*
  2980.  
  2981.                       echo $ac_n "checking for vfork declaration""... $ac_c"
  2982. cat > conftest.c <<EOF
  2983. #include "confdefs.h"
  2984.  
  2985. #ifdef STDC_HEADERS
  2986. #include <stdlib.h>
  2987. #endif
  2988. #ifdef HAVE_UNISTD_H
  2989. #include <unistd.h>
  2990. #endif
  2991. #ifdef HAVE_VFORK_H
  2992. #include <vfork.h>
  2993. #endif
  2994. extern
  2995. #ifdef __cplusplus
  2996. "C"
  2997. #endif
  2998. #ifdef __STDC__
  2999. pid_t vfork (void);
  3000. #else
  3001. pid_t vfork();
  3002. #endif
  3003. main() { exit(0); }
  3004. EOF
  3005. eval $compile
  3006. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3007.   x="pid_t"
  3008. else
  3009.   x="int"
  3010. fi
  3011. if test -f core; then
  3012.   coredir=core`/bin/sh -c 'echo $$'`
  3013.   mkdir $coredir
  3014.   cp confdefs.h $coredir/confdefs.h
  3015.   mv conftest.c $coredir/conftest.c
  3016.   mv conftest $coredir/conftest
  3017.   mv core $coredir/core
  3018.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3019. fi
  3020. rm -f conftest*
  3021. echo "#define" RETVFORKTYPE "$x" >> confdefs.h
  3022. DEFS="$DEFS -DRETVFORKTYPE=$x"
  3023. SEDDEFS="${SEDDEFS}\${SEDdA}RETVFORKTYPE\${SEDdB}RETVFORKTYPE\${SEDdC}$x\${SEDdD}
  3024. \${SEDuA}RETVFORKTYPE\${SEDuB}RETVFORKTYPE\${SEDuC}$x\${SEDuD}
  3025. \${SEDeA}RETVFORKTYPE\${SEDeB}RETVFORKTYPE\${SEDeC}$x\${SEDeD}
  3026. \${SEDfA}RETVFORKTYPE\${SEDfB}RETVFORKTYPE\${SEDfC}$x\${SEDfD}
  3027. "
  3028. ac_proto=`echo "extern $x vfork (void);" | tr -s ' ' | sed -e 's/( /(/g'`
  3029. echo "${ac_t}${ac_tt}${ac_proto}"
  3030.  
  3031.                       for func in setsid setpgid
  3032. do
  3033. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  3034. echo $ac_n "checking for ${func}""... $ac_c"
  3035. cat > conftest.c <<EOF
  3036. #include "confdefs.h"
  3037. #include <ctype.h>
  3038. #ifdef __cplusplus
  3039. extern "C" char ${func}();
  3040. #endif
  3041. int main() { exit(0); }
  3042. int t() { 
  3043. /* The GNU C library defines this for functions which it implements
  3044.     to always fail with ENOSYS.  Some functions are actually named
  3045.     something starting with __ and the normal name is an alias.  */
  3046. #if defined (__stub_${func}) || defined (__stub___${func})
  3047. choke me
  3048. #else
  3049. #ifndef __cplusplus
  3050. /* Override any gcc2 internal prototype to avoid an error.  */
  3051. extern char ${func}();
  3052. #endif
  3053. ${func}();
  3054. #endif
  3055.  }
  3056. EOF
  3057. if eval $compile; then
  3058.   echo "${ac_t}yes"
  3059.   echo "#define" ${trfunc} "1" >> confdefs.h
  3060. DEFS="$DEFS -D${trfunc}=1"
  3061. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  3062. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  3063. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  3064. \${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
  3065. "
  3066. else
  3067.   echo "${ac_t}no"
  3068.   :
  3069. fi
  3070. rm -f conftest*
  3071. done
  3072.  
  3073.                       echo $ac_n "checking for execv declaration""... $ac_c"
  3074. brackets='[]'
  3075. for z in '' 'const'; do
  3076. for y in '' 'const'; do
  3077. for x in '' 'const'; do
  3078. if test -z "$have_execv"; then
  3079. cat > conftest.c <<EOF
  3080. #include "confdefs.h"
  3081.  
  3082. #ifdef STDC_HEADERS
  3083. #include <stdlib.h>
  3084. #endif
  3085. #ifdef HAVE_UNISTD_H
  3086. #include <unistd.h>
  3087. #endif
  3088. extern
  3089. #ifdef __cplusplus
  3090. "C"
  3091. #endif
  3092. #ifdef __STDC__
  3093. int execv ($x char* path, $y char* $z argv[]);
  3094. #else
  3095. int execv();
  3096. #endif
  3097. main() { exit(0); }
  3098. EOF
  3099. eval $compile
  3100. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3101.   echo "#define" EXECV_CONST "$x" >> confdefs.h
  3102. DEFS="$DEFS -DEXECV_CONST=$x"
  3103. SEDDEFS="${SEDDEFS}\${SEDdA}EXECV_CONST\${SEDdB}EXECV_CONST\${SEDdC}$x\${SEDdD}
  3104. \${SEDuA}EXECV_CONST\${SEDuB}EXECV_CONST\${SEDuC}$x\${SEDuD}
  3105. \${SEDeA}EXECV_CONST\${SEDeB}EXECV_CONST\${SEDeC}$x\${SEDeD}
  3106. \${SEDfA}EXECV_CONST\${SEDfB}EXECV_CONST\${SEDfC}$x\${SEDfD}
  3107. "
  3108. echo "#define" EXECV1_CONST "$y" >> confdefs.h
  3109. DEFS="$DEFS -DEXECV1_CONST=$y"
  3110. SEDDEFS="${SEDDEFS}\${SEDdA}EXECV1_CONST\${SEDdB}EXECV1_CONST\${SEDdC}$y\${SEDdD}
  3111. \${SEDuA}EXECV1_CONST\${SEDuB}EXECV1_CONST\${SEDuC}$y\${SEDuD}
  3112. \${SEDeA}EXECV1_CONST\${SEDeB}EXECV1_CONST\${SEDeC}$y\${SEDeD}
  3113. \${SEDfA}EXECV1_CONST\${SEDfB}EXECV1_CONST\${SEDfC}$y\${SEDfD}
  3114. "
  3115. echo "#define" EXECV2_CONST "$z" >> confdefs.h
  3116. DEFS="$DEFS -DEXECV2_CONST=$z"
  3117. SEDDEFS="${SEDDEFS}\${SEDdA}EXECV2_CONST\${SEDdB}EXECV2_CONST\${SEDdC}$z\${SEDdD}
  3118. \${SEDuA}EXECV2_CONST\${SEDuB}EXECV2_CONST\${SEDuC}$z\${SEDuD}
  3119. \${SEDeA}EXECV2_CONST\${SEDeB}EXECV2_CONST\${SEDeC}$z\${SEDeD}
  3120. \${SEDfA}EXECV2_CONST\${SEDfB}EXECV2_CONST\${SEDfC}$z\${SEDfD}
  3121. "
  3122. ac_proto=`echo "extern int execv ($x char*, $y char* $z$brackets);" | tr -s ' ' | sed -e 's/( /(/g'`
  3123. echo "${ac_t}${ac_tt}${ac_proto}"
  3124. execv_const="$x"
  3125. have_execv=1
  3126. fi
  3127. if test -f core; then
  3128.   coredir=core`/bin/sh -c 'echo $$'`
  3129.   mkdir $coredir
  3130.   cp confdefs.h $coredir/confdefs.h
  3131.   mv conftest.c $coredir/conftest.c
  3132.   mv conftest $coredir/conftest
  3133.   mv core $coredir/core
  3134.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3135. fi
  3136. rm -f conftest*
  3137. fi
  3138. done
  3139. done
  3140. done
  3141.  
  3142.                       echo $ac_n "checking for execl declaration""... $ac_c"
  3143. for x in '' 'const'; do
  3144. if test -z "$have_execl"; then
  3145. cat > conftest.c <<EOF
  3146. #include "confdefs.h"
  3147.  
  3148. #ifdef STDC_HEADERS
  3149. #include <stdlib.h>
  3150. #endif
  3151. #ifdef HAVE_UNISTD_H
  3152. #include <unistd.h>
  3153. #endif
  3154. extern
  3155. #ifdef __cplusplus
  3156. "C"
  3157. #endif
  3158. #ifdef __STDC__
  3159. int execl (EXECV_CONST char* path, $x char* arg, ...);
  3160. #else
  3161. int execl();
  3162. #endif
  3163. main() { exit(0); }
  3164. EOF
  3165. eval $compile
  3166. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3167.   echo "#define" EXECL_CONST "$x" >> confdefs.h
  3168. DEFS="$DEFS -DEXECL_CONST=$x"
  3169. SEDDEFS="${SEDDEFS}\${SEDdA}EXECL_CONST\${SEDdB}EXECL_CONST\${SEDdC}$x\${SEDdD}
  3170. \${SEDuA}EXECL_CONST\${SEDuB}EXECL_CONST\${SEDuC}$x\${SEDuD}
  3171. \${SEDeA}EXECL_CONST\${SEDeB}EXECL_CONST\${SEDeC}$x\${SEDeD}
  3172. \${SEDfA}EXECL_CONST\${SEDfB}EXECL_CONST\${SEDfC}$x\${SEDfD}
  3173. "
  3174. echo "#define" EXECL_DOTS "1" >> confdefs.h
  3175. DEFS="$DEFS -DEXECL_DOTS=1"
  3176. SEDDEFS="${SEDDEFS}\${SEDdA}EXECL_DOTS\${SEDdB}EXECL_DOTS\${SEDdC}1\${SEDdD}
  3177. \${SEDuA}EXECL_DOTS\${SEDuB}EXECL_DOTS\${SEDuC}1\${SEDuD}
  3178. \${SEDeA}EXECL_DOTS\${SEDeB}EXECL_DOTS\${SEDeC}1\${SEDeD}
  3179. \${SEDfA}EXECL_DOTS\${SEDfB}EXECL_DOTS\${SEDfC}1\${SEDfD}
  3180. "
  3181. ac_proto=`echo "extern int execl ($execv_const char*, $x char*, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
  3182. echo "${ac_t}${ac_tt}${ac_proto}"
  3183. have_execl=1
  3184. fi
  3185. if test -f core; then
  3186.   coredir=core`/bin/sh -c 'echo $$'`
  3187.   mkdir $coredir
  3188.   cp confdefs.h $coredir/confdefs.h
  3189.   mv conftest.c $coredir/conftest.c
  3190.   mv conftest $coredir/conftest
  3191.   mv core $coredir/core
  3192.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3193. fi
  3194. rm -f conftest*
  3195. fi
  3196. done
  3197. for x in '' 'const'; do
  3198. if test -z "$have_execl"; then
  3199. cat > conftest.c <<EOF
  3200. #include "confdefs.h"
  3201.  
  3202. #ifdef STDC_HEADERS
  3203. #include <stdlib.h>
  3204. #endif
  3205. #ifdef HAVE_UNISTD_H
  3206. #include <unistd.h>
  3207. #endif
  3208. extern
  3209. #ifdef __cplusplus
  3210. "C"
  3211. #endif
  3212. #ifdef __STDC__
  3213. int execl (EXECV_CONST char* path, $x char* arg0, $x char* arg1, $x char* arg2, $x char* arg3);
  3214. #else
  3215. int execl();
  3216. #endif
  3217. main() { exit(0); }
  3218. EOF
  3219. eval $compile
  3220. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3221.   echo "#define" EXECL_CONST "$x" >> confdefs.h
  3222. DEFS="$DEFS -DEXECL_CONST=$x"
  3223. SEDDEFS="${SEDDEFS}\${SEDdA}EXECL_CONST\${SEDdB}EXECL_CONST\${SEDdC}$x\${SEDdD}
  3224. \${SEDuA}EXECL_CONST\${SEDuB}EXECL_CONST\${SEDuC}$x\${SEDuD}
  3225. \${SEDeA}EXECL_CONST\${SEDeB}EXECL_CONST\${SEDeC}$x\${SEDeD}
  3226. \${SEDfA}EXECL_CONST\${SEDfB}EXECL_CONST\${SEDfC}$x\${SEDfD}
  3227. "
  3228. ac_proto=`echo "extern int execl ($execv_const char*, $x char*, $x char*, $x char*, $x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  3229. echo "${ac_t}${ac_tt}${ac_proto}"
  3230. have_execl=1
  3231. fi
  3232. if test -f core; then
  3233.   coredir=core`/bin/sh -c 'echo $$'`
  3234.   mkdir $coredir
  3235.   cp confdefs.h $coredir/confdefs.h
  3236.   mv conftest.c $coredir/conftest.c
  3237.   mv conftest $coredir/conftest
  3238.   mv core $coredir/core
  3239.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3240. fi
  3241. rm -f conftest*
  3242. fi
  3243. done
  3244.  
  3245.                       echo $ac_n "checking for waitpid""... $ac_c"
  3246. cat > conftest.c <<EOF
  3247. #include "confdefs.h"
  3248. #include <ctype.h>
  3249. #ifdef __cplusplus
  3250. extern "C" char waitpid();
  3251. #endif
  3252. int main() { exit(0); }
  3253. int t() { 
  3254. /* The GNU C library defines this for functions which it implements
  3255.     to always fail with ENOSYS.  Some functions are actually named
  3256.     something starting with __ and the normal name is an alias.  */
  3257. #if defined (__stub_waitpid) || defined (__stub___waitpid)
  3258. choke me
  3259. #else
  3260. #ifndef __cplusplus
  3261. /* Override any gcc2 internal prototype to avoid an error.  */
  3262. extern char waitpid();
  3263. #endif
  3264. waitpid();
  3265. #endif
  3266.  }
  3267. EOF
  3268. if eval $compile; then
  3269.   echo "${ac_t}yes"
  3270.   echo "#define" HAVE_WAITPID "1" >> confdefs.h
  3271. DEFS="$DEFS -DHAVE_WAITPID=1"
  3272. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WAITPID\${SEDdB}HAVE_WAITPID\${SEDdC}1\${SEDdD}
  3273. \${SEDuA}HAVE_WAITPID\${SEDuB}HAVE_WAITPID\${SEDuC}1\${SEDuD}
  3274. \${SEDeA}HAVE_WAITPID\${SEDeB}HAVE_WAITPID\${SEDeC}1\${SEDeD}
  3275. \${SEDfA}HAVE_WAITPID\${SEDfB}HAVE_WAITPID\${SEDfC}1\${SEDfD}
  3276. "
  3277. have_waitpid=1
  3278. else
  3279.   echo "${ac_t}no"
  3280.   :
  3281. fi
  3282. rm -f conftest*
  3283. if test -n "$have_waitpid"; then
  3284. echo $ac_n "checking for waitpid declaration""... $ac_c"
  3285. cat > conftest.c <<EOF
  3286. #include "confdefs.h"
  3287.  
  3288. #ifdef STDC_HEADERS
  3289. #include <stdlib.h>
  3290. #endif
  3291. #ifdef HAVE_UNISTD_H
  3292. #include <unistd.h>
  3293. #endif
  3294. extern
  3295. #ifdef __cplusplus
  3296. "C"
  3297. #endif
  3298. #ifdef __STDC__
  3299. pid_t waitpid (pid_t pid, int* statusp, int options);
  3300. #else
  3301. pid_t waitpid();
  3302. #endif
  3303. main() { exit(0); }
  3304. EOF
  3305. eval $compile
  3306. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3307.   x="pid_t"
  3308. else
  3309.   x="int"
  3310. fi
  3311. if test -f core; then
  3312.   coredir=core`/bin/sh -c 'echo $$'`
  3313.   mkdir $coredir
  3314.   cp confdefs.h $coredir/confdefs.h
  3315.   mv conftest.c $coredir/conftest.c
  3316.   mv conftest $coredir/conftest
  3317.   mv core $coredir/core
  3318.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3319. fi
  3320. rm -f conftest*
  3321. echo "#define" PID_T "$x" >> confdefs.h
  3322. DEFS="$DEFS -DPID_T=$x"
  3323. SEDDEFS="${SEDDEFS}\${SEDdA}PID_T\${SEDdB}PID_T\${SEDdC}$x\${SEDdD}
  3324. \${SEDuA}PID_T\${SEDuB}PID_T\${SEDuC}$x\${SEDuD}
  3325. \${SEDeA}PID_T\${SEDeB}PID_T\${SEDeC}$x\${SEDeD}
  3326. \${SEDfA}PID_T\${SEDfB}PID_T\${SEDfC}$x\${SEDfD}
  3327. "
  3328. ac_proto=`echo "extern pid_t waitpid ($x, int*, int);" | tr -s ' ' | sed -e 's/( /(/g'`
  3329. echo "${ac_t}${ac_tt}${ac_proto}"
  3330. else
  3331. for hdr in sys/wait.h
  3332. do
  3333. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  3334. echo $ac_n "checking for ${hdr}""... $ac_c"
  3335. cat > conftest.c <<EOF
  3336. #include "confdefs.h"
  3337. #include <${hdr}>
  3338. EOF
  3339. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  3340. if test -z "$err"; then
  3341.   echo "${ac_t}yes"
  3342. echo "#define" ${trhdr} "1" >> confdefs.h
  3343. DEFS="$DEFS -D${trhdr}=1"
  3344. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  3345. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  3346. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  3347. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  3348. "
  3349. else
  3350.   echo "${ac_t}no"
  3351.  
  3352. fi
  3353. rm -f conftest*
  3354. done
  3355. fi
  3356.  
  3357.                       for hdr in sys/resource.h sys/times.h
  3358. do
  3359. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  3360. echo $ac_n "checking for ${hdr}""... $ac_c"
  3361. cat > conftest.c <<EOF
  3362. #include "confdefs.h"
  3363. #include <${hdr}>
  3364. EOF
  3365. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  3366. if test -z "$err"; then
  3367.   echo "${ac_t}yes"
  3368. echo "#define" ${trhdr} "1" >> confdefs.h
  3369. DEFS="$DEFS -D${trhdr}=1"
  3370. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  3371. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  3372. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  3373. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  3374. "
  3375. else
  3376.   echo "${ac_t}no"
  3377.  
  3378. fi
  3379. rm -f conftest*
  3380. done
  3381. case "$DEFS" in
  3382.   *HAVE_SYS_RESOURCE_H*)
  3383.     echo $ac_n "checking for getrusage""... $ac_c"
  3384. cat > conftest.c <<EOF
  3385. #include "confdefs.h"
  3386. #include <sys/types.h> /* NetBSD 1.0 needs this */
  3387. #include <sys/time.h>
  3388. #include <sys/resource.h>
  3389. int main() { exit(0); }
  3390. int t() { struct rusage x; int y = RUSAGE_SELF; getrusage(y,&x); x.ru_utime.tv_sec; }
  3391. EOF
  3392. if eval $compile; then
  3393.   echo "${ac_t}yes"
  3394.   echo "#define" HAVE_GETRUSAGE "1" >> confdefs.h
  3395. DEFS="$DEFS -DHAVE_GETRUSAGE=1"
  3396. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETRUSAGE\${SEDdB}HAVE_GETRUSAGE\${SEDdC}1\${SEDdD}
  3397. \${SEDuA}HAVE_GETRUSAGE\${SEDuB}HAVE_GETRUSAGE\${SEDuC}1\${SEDuD}
  3398. \${SEDeA}HAVE_GETRUSAGE\${SEDeB}HAVE_GETRUSAGE\${SEDeC}1\${SEDeD}
  3399. \${SEDfA}HAVE_GETRUSAGE\${SEDfB}HAVE_GETRUSAGE\${SEDfC}1\${SEDfD}
  3400. "
  3401. else
  3402.   echo "${ac_t}no"
  3403.   :
  3404. fi
  3405. rm -f conftest*
  3406.     ;;
  3407.   *) ;;
  3408. esac
  3409.  
  3410.                       echo $ac_n "checking for getwd""... $ac_c"
  3411. cat > conftest.c <<EOF
  3412. #include "confdefs.h"
  3413.  
  3414. int main() { exit(0); }
  3415. int t() { getwd(); }
  3416. EOF
  3417. if eval $compile; then
  3418.   echo "${ac_t}yes"
  3419.   echo "#define" HAVE_GETWD "1" >> confdefs.h
  3420. DEFS="$DEFS -DHAVE_GETWD=1"
  3421. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETWD\${SEDdB}HAVE_GETWD\${SEDdC}1\${SEDdD}
  3422. \${SEDuA}HAVE_GETWD\${SEDuB}HAVE_GETWD\${SEDuC}1\${SEDuD}
  3423. \${SEDeA}HAVE_GETWD\${SEDeB}HAVE_GETWD\${SEDeC}1\${SEDeD}
  3424. \${SEDfA}HAVE_GETWD\${SEDfB}HAVE_GETWD\${SEDfC}1\${SEDfD}
  3425. "
  3426. else
  3427.   echo "${ac_t}no"
  3428.   :
  3429. fi
  3430. rm -f conftest*
  3431.  
  3432.  
  3433.                       case "$DEFS" in
  3434.   *HAVE_GETWD*) ;;
  3435.   *)
  3436. echo $ac_n "checking for getcwd declaration""... $ac_c"
  3437. cat > conftest.c <<EOF
  3438. #include "confdefs.h"
  3439.  
  3440. #ifdef STDC_HEADERS
  3441. #include <stdlib.h>
  3442. #endif
  3443. #ifdef HAVE_UNISTD_H
  3444. #include <unistd.h>
  3445. #endif
  3446. extern
  3447. #ifdef __cplusplus
  3448. "C"
  3449. #endif
  3450. #ifdef __STDC__
  3451. char* getcwd (char* buf, int bufsize);
  3452. #else
  3453. char* getcwd();
  3454. #endif
  3455. main() { exit(0); }
  3456. EOF
  3457. eval $compile
  3458. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3459.   x="int"
  3460. else
  3461.   x="size_t"
  3462. fi
  3463. if test -f core; then
  3464.   coredir=core`/bin/sh -c 'echo $$'`
  3465.   mkdir $coredir
  3466.   cp confdefs.h $coredir/confdefs.h
  3467.   mv conftest.c $coredir/conftest.c
  3468.   mv conftest $coredir/conftest
  3469.   mv core $coredir/core
  3470.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3471. fi
  3472. rm -f conftest*
  3473. echo "#define" GETCWD_SIZE_T "$x" >> confdefs.h
  3474. DEFS="$DEFS -DGETCWD_SIZE_T=$x"
  3475. SEDDEFS="${SEDDEFS}\${SEDdA}GETCWD_SIZE_T\${SEDdB}GETCWD_SIZE_T\${SEDdC}$x\${SEDdD}
  3476. \${SEDuA}GETCWD_SIZE_T\${SEDuB}GETCWD_SIZE_T\${SEDuC}$x\${SEDuD}
  3477. \${SEDeA}GETCWD_SIZE_T\${SEDeB}GETCWD_SIZE_T\${SEDeC}$x\${SEDeD}
  3478. \${SEDfA}GETCWD_SIZE_T\${SEDfB}GETCWD_SIZE_T\${SEDfC}$x\${SEDfD}
  3479. "
  3480. ac_proto=`echo "extern char* getcwd (char*, $x);" | tr -s ' ' | sed -e 's/( /(/g'`
  3481. echo "${ac_t}${ac_tt}${ac_proto}"
  3482.   ;;
  3483. esac
  3484.  
  3485.                       echo $ac_n "checking for chdir declaration""... $ac_c"
  3486. cat > conftest.c <<EOF
  3487. #include "confdefs.h"
  3488.  
  3489. #ifdef STDC_HEADERS
  3490. #include <stdlib.h>
  3491. #endif
  3492. #ifdef HAVE_UNISTD_H
  3493. #include <unistd.h>
  3494. #endif
  3495. extern
  3496. #ifdef __cplusplus
  3497. "C"
  3498. #endif
  3499. #ifdef __STDC__
  3500. int chdir (char* path);
  3501. #else
  3502. int chdir();
  3503. #endif
  3504. main() { exit(0); }
  3505. EOF
  3506. eval $compile
  3507. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3508.   x=""
  3509. else
  3510.   x="const"
  3511. fi
  3512. if test -f core; then
  3513.   coredir=core`/bin/sh -c 'echo $$'`
  3514.   mkdir $coredir
  3515.   cp confdefs.h $coredir/confdefs.h
  3516.   mv conftest.c $coredir/conftest.c
  3517.   mv conftest $coredir/conftest
  3518.   mv core $coredir/core
  3519.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3520. fi
  3521. rm -f conftest*
  3522. echo "#define" CHDIR_CONST "$x" >> confdefs.h
  3523. DEFS="$DEFS -DCHDIR_CONST=$x"
  3524. SEDDEFS="${SEDDEFS}\${SEDdA}CHDIR_CONST\${SEDdB}CHDIR_CONST\${SEDdC}$x\${SEDdD}
  3525. \${SEDuA}CHDIR_CONST\${SEDuB}CHDIR_CONST\${SEDuC}$x\${SEDuD}
  3526. \${SEDeA}CHDIR_CONST\${SEDeB}CHDIR_CONST\${SEDeC}$x\${SEDeD}
  3527. \${SEDfA}CHDIR_CONST\${SEDfB}CHDIR_CONST\${SEDfC}$x\${SEDfD}
  3528. "
  3529. ac_proto=`echo "extern int chdir ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  3530. echo "${ac_t}${ac_tt}${ac_proto}"
  3531.  
  3532.                       echo $ac_n "checking for mkdir declaration""... $ac_c"
  3533. echo '#include "confdefs.h"
  3534. #include <sys/types.h>' > conftest.c
  3535. eval "$CPP conftest.c > conftest.out 2>&1"
  3536. if egrep "mode_t" conftest.out >/dev/null 2>&1; then
  3537.   cat > conftest.c <<EOF
  3538. #include "confdefs.h"
  3539.  
  3540. #ifdef STDC_HEADERS
  3541. #include <stdlib.h>
  3542. #endif
  3543. #ifdef HAVE_UNISTD_H
  3544. #include <unistd.h>
  3545. #endif
  3546. #include <sys/types.h>
  3547. #include <sys/stat.h>
  3548. extern
  3549. #ifdef __cplusplus
  3550. "C"
  3551. #endif
  3552. #ifdef __STDC__
  3553. int mkdir (char* path, mode_t mode);
  3554. #else
  3555. int mkdir();
  3556. #endif
  3557. main() { exit(0); }
  3558. EOF
  3559. eval $compile
  3560. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3561.   mode_t_unneeded=1
  3562. fi
  3563. if test -f core; then
  3564.   coredir=core`/bin/sh -c 'echo $$'`
  3565.   mkdir $coredir
  3566.   cp confdefs.h $coredir/confdefs.h
  3567.   mv conftest.c $coredir/conftest.c
  3568.   mv conftest $coredir/conftest
  3569.   mv core $coredir/core
  3570.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3571. fi
  3572. rm -f conftest*
  3573. if test -z "$mode_t_unneeded"; then
  3574. cat > conftest.c <<EOF
  3575. #include "confdefs.h"
  3576.  
  3577. #ifdef STDC_HEADERS
  3578. #include <stdlib.h>
  3579. #endif
  3580. #ifdef HAVE_UNISTD_H
  3581. #include <unistd.h>
  3582. #endif
  3583. #include <sys/types.h>
  3584. #include <sys/stat.h>
  3585. extern
  3586. #ifdef __cplusplus
  3587. "C"
  3588. #endif
  3589. #ifdef __STDC__
  3590. int mkdir (const char* path, mode_t mode);
  3591. #else
  3592. int mkdir();
  3593. #endif
  3594. main() { exit(0); }
  3595. EOF
  3596. eval $compile
  3597. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3598.   mode_t_unneeded=1
  3599. fi
  3600. if test -f core; then
  3601.   coredir=core`/bin/sh -c 'echo $$'`
  3602.   mkdir $coredir
  3603.   cp confdefs.h $coredir/confdefs.h
  3604.   mv conftest.c $coredir/conftest.c
  3605.   mv conftest $coredir/conftest
  3606.   mv core $coredir/core
  3607.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3608. fi
  3609. rm -f conftest*
  3610. fi
  3611. fi
  3612. rm -f conftest*
  3613. if test -n "$mode_t_unneeded"; then
  3614. mode_t="mode_t"
  3615. else
  3616. mode_t="int"
  3617. fi
  3618. echo "#define" MODE_T "$mode_t" >> confdefs.h
  3619. DEFS="$DEFS -DMODE_T=$mode_t"
  3620. SEDDEFS="${SEDDEFS}\${SEDdA}MODE_T\${SEDdB}MODE_T\${SEDdC}$mode_t\${SEDdD}
  3621. \${SEDuA}MODE_T\${SEDuB}MODE_T\${SEDuC}$mode_t\${SEDuD}
  3622. \${SEDeA}MODE_T\${SEDeB}MODE_T\${SEDeC}$mode_t\${SEDeD}
  3623. \${SEDfA}MODE_T\${SEDfB}MODE_T\${SEDfC}$mode_t\${SEDfD}
  3624. "
  3625. cat > conftest.c <<EOF
  3626. #include "confdefs.h"
  3627.  
  3628. #ifdef STDC_HEADERS
  3629. #include <stdlib.h>
  3630. #endif
  3631. #ifdef HAVE_UNISTD_H
  3632. #include <unistd.h>
  3633. #endif
  3634. #include <sys/types.h>
  3635. #include <sys/stat.h>
  3636. extern
  3637. #ifdef __cplusplus
  3638. "C"
  3639. #endif
  3640. #ifdef __STDC__
  3641. int mkdir (char* path, MODE_T mode);
  3642. #else
  3643. int mkdir();
  3644. #endif
  3645. main() { exit(0); }
  3646. EOF
  3647. eval $compile
  3648. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3649.   x=""
  3650. else
  3651.   x="const"
  3652. fi
  3653. if test -f core; then
  3654.   coredir=core`/bin/sh -c 'echo $$'`
  3655.   mkdir $coredir
  3656.   cp confdefs.h $coredir/confdefs.h
  3657.   mv conftest.c $coredir/conftest.c
  3658.   mv conftest $coredir/conftest
  3659.   mv core $coredir/core
  3660.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3661. fi
  3662. rm -f conftest*
  3663. echo "#define" MKDIR_CONST "$x" >> confdefs.h
  3664. DEFS="$DEFS -DMKDIR_CONST=$x"
  3665. SEDDEFS="${SEDDEFS}\${SEDdA}MKDIR_CONST\${SEDdB}MKDIR_CONST\${SEDdC}$x\${SEDdD}
  3666. \${SEDuA}MKDIR_CONST\${SEDuB}MKDIR_CONST\${SEDuC}$x\${SEDuD}
  3667. \${SEDeA}MKDIR_CONST\${SEDeB}MKDIR_CONST\${SEDeC}$x\${SEDeD}
  3668. \${SEDfA}MKDIR_CONST\${SEDfB}MKDIR_CONST\${SEDfC}$x\${SEDfD}
  3669. "
  3670. ac_proto=`echo "extern int mkdir ($x char*, $mode_t);" | tr -s ' ' | sed -e 's/( /(/g'`
  3671. echo "${ac_t}${ac_tt}${ac_proto}"
  3672.  
  3673.                       echo $ac_n "checking for rmdir declaration""... $ac_c"
  3674. cat > conftest.c <<EOF
  3675. #include "confdefs.h"
  3676.  
  3677. #ifdef STDC_HEADERS
  3678. #include <stdlib.h>
  3679. #endif
  3680. #ifdef HAVE_UNISTD_H
  3681. #include <unistd.h>
  3682. #endif
  3683. extern
  3684. #ifdef __cplusplus
  3685. "C"
  3686. #endif
  3687. #ifdef __STDC__
  3688. int rmdir (char* path);
  3689. #else
  3690. int rmdir();
  3691. #endif
  3692. main() { exit(0); }
  3693. EOF
  3694. eval $compile
  3695. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3696.   x=""
  3697. else
  3698.   x="const"
  3699. fi
  3700. if test -f core; then
  3701.   coredir=core`/bin/sh -c 'echo $$'`
  3702.   mkdir $coredir
  3703.   cp confdefs.h $coredir/confdefs.h
  3704.   mv conftest.c $coredir/conftest.c
  3705.   mv conftest $coredir/conftest
  3706.   mv core $coredir/core
  3707.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3708. fi
  3709. rm -f conftest*
  3710. echo "#define" RMDIR_CONST "$x" >> confdefs.h
  3711. DEFS="$DEFS -DRMDIR_CONST=$x"
  3712. SEDDEFS="${SEDDEFS}\${SEDdA}RMDIR_CONST\${SEDdB}RMDIR_CONST\${SEDdC}$x\${SEDdD}
  3713. \${SEDuA}RMDIR_CONST\${SEDuB}RMDIR_CONST\${SEDuC}$x\${SEDuD}
  3714. \${SEDeA}RMDIR_CONST\${SEDeB}RMDIR_CONST\${SEDeC}$x\${SEDeD}
  3715. \${SEDfA}RMDIR_CONST\${SEDfB}RMDIR_CONST\${SEDfC}$x\${SEDfD}
  3716. "
  3717. ac_proto=`echo "extern int rmdir ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  3718. echo "${ac_t}${ac_tt}${ac_proto}"
  3719.  
  3720.                       echo $ac_n "checking for working stat file mode macros""... $ac_c"
  3721. cat > conftest.c <<EOF
  3722. #include "confdefs.h"
  3723. #include <sys/types.h>
  3724. #include <sys/stat.h>
  3725. #ifdef S_ISBLK
  3726. #if S_ISBLK (S_IFDIR)
  3727. You lose.
  3728. #endif
  3729. #ifdef S_IFCHR
  3730. #if S_ISBLK (S_IFCHR)
  3731. You lose.
  3732. #endif
  3733. #endif /* S_IFCHR */
  3734. #endif /* S_ISBLK */
  3735. #ifdef S_ISLNK
  3736. #if S_ISLNK (S_IFREG)
  3737. You lose.
  3738. #endif
  3739. #endif /* S_ISLNK */
  3740. #ifdef S_ISSOCK
  3741. #if S_ISSOCK (S_IFREG)
  3742. You lose.
  3743. #endif
  3744. #endif /* S_ISSOCK */
  3745.  
  3746. EOF
  3747. eval "$CPP conftest.c > conftest.out 2>&1"
  3748. if egrep "You lose" conftest.out >/dev/null 2>&1; then
  3749.   echo "${ac_t}no"
  3750. echo "#define" STAT_MACROS_BROKEN "1" >> confdefs.h
  3751. DEFS="$DEFS -DSTAT_MACROS_BROKEN=1"
  3752. SEDDEFS="${SEDDEFS}\${SEDdA}STAT_MACROS_BROKEN\${SEDdB}STAT_MACROS_BROKEN\${SEDdC}1\${SEDdD}
  3753. \${SEDuA}STAT_MACROS_BROKEN\${SEDuB}STAT_MACROS_BROKEN\${SEDuC}1\${SEDuD}
  3754. \${SEDeA}STAT_MACROS_BROKEN\${SEDeB}STAT_MACROS_BROKEN\${SEDeC}1\${SEDeD}
  3755. \${SEDfA}STAT_MACROS_BROKEN\${SEDfB}STAT_MACROS_BROKEN\${SEDfC}1\${SEDfD}
  3756. "
  3757. else
  3758.   echo "${ac_t}yes"
  3759. fi
  3760. rm -f conftest*
  3761.  
  3762.                       echo $ac_n "checking for stat declaration""... $ac_c"
  3763. cat > conftest.c <<EOF
  3764. #include "confdefs.h"
  3765.  
  3766. #ifdef STDC_HEADERS
  3767. #include <stdlib.h>
  3768. #endif
  3769. #ifdef HAVE_UNISTD_H
  3770. #include <unistd.h>
  3771. #endif
  3772. #include <sys/types.h>
  3773. #include <sys/stat.h>
  3774. extern
  3775. #ifdef __cplusplus
  3776. "C"
  3777. #endif
  3778. #ifdef __STDC__
  3779. int stat (char* path, struct stat * buf);
  3780. #else
  3781. int stat();
  3782. #endif
  3783. main() { exit(0); }
  3784. EOF
  3785. eval $compile
  3786. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3787.   x=""
  3788. else
  3789.   x="const"
  3790. fi
  3791. if test -f core; then
  3792.   coredir=core`/bin/sh -c 'echo $$'`
  3793.   mkdir $coredir
  3794.   cp confdefs.h $coredir/confdefs.h
  3795.   mv conftest.c $coredir/conftest.c
  3796.   mv conftest $coredir/conftest
  3797.   mv core $coredir/core
  3798.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3799. fi
  3800. rm -f conftest*
  3801. echo "#define" STAT_CONST "$x" >> confdefs.h
  3802. DEFS="$DEFS -DSTAT_CONST=$x"
  3803. SEDDEFS="${SEDDEFS}\${SEDdA}STAT_CONST\${SEDdB}STAT_CONST\${SEDdC}$x\${SEDdD}
  3804. \${SEDuA}STAT_CONST\${SEDuB}STAT_CONST\${SEDuC}$x\${SEDuD}
  3805. \${SEDeA}STAT_CONST\${SEDeB}STAT_CONST\${SEDeC}$x\${SEDeD}
  3806. \${SEDfA}STAT_CONST\${SEDfB}STAT_CONST\${SEDfC}$x\${SEDfD}
  3807. "
  3808. ac_proto=`echo "extern int stat ($x char*, struct stat *);" | tr -s ' ' | sed -e 's/( /(/g'`
  3809. echo "${ac_t}${ac_tt}${ac_proto}"
  3810.  
  3811.                       echo $ac_n "checking for lstat""... $ac_c"
  3812. cat > conftest.c <<EOF
  3813. #include "confdefs.h"
  3814. #include <ctype.h>
  3815. #ifdef __cplusplus
  3816. extern "C" char lstat();
  3817. #endif
  3818. int main() { exit(0); }
  3819. int t() { 
  3820. /* The GNU C library defines this for functions which it implements
  3821.     to always fail with ENOSYS.  Some functions are actually named
  3822.     something starting with __ and the normal name is an alias.  */
  3823. #if defined (__stub_lstat) || defined (__stub___lstat)
  3824. choke me
  3825. #else
  3826. #ifndef __cplusplus
  3827. /* Override any gcc2 internal prototype to avoid an error.  */
  3828. extern char lstat();
  3829. #endif
  3830. lstat();
  3831. #endif
  3832.  }
  3833. EOF
  3834. if eval $compile; then
  3835.   echo "${ac_t}yes"
  3836.   echo "#define" HAVE_LSTAT "1" >> confdefs.h
  3837. DEFS="$DEFS -DHAVE_LSTAT=1"
  3838. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LSTAT\${SEDdB}HAVE_LSTAT\${SEDdC}1\${SEDdD}
  3839. \${SEDuA}HAVE_LSTAT\${SEDuB}HAVE_LSTAT\${SEDuC}1\${SEDuD}
  3840. \${SEDeA}HAVE_LSTAT\${SEDeB}HAVE_LSTAT\${SEDeC}1\${SEDeD}
  3841. \${SEDfA}HAVE_LSTAT\${SEDfB}HAVE_LSTAT\${SEDfC}1\${SEDfD}
  3842. "
  3843. have_lstat=1
  3844. else
  3845.   echo "${ac_t}no"
  3846.   :
  3847. fi
  3848. rm -f conftest*
  3849. if test -n "$have_lstat"; then
  3850. echo $ac_n "checking for lstat declaration""... $ac_c"
  3851. cat > conftest.c <<EOF
  3852. #include "confdefs.h"
  3853.  
  3854. #ifdef STDC_HEADERS
  3855. #include <stdlib.h>
  3856. #endif
  3857. #ifdef HAVE_UNISTD_H
  3858. #include <unistd.h>
  3859. #endif
  3860. #include <sys/types.h>
  3861. #include <sys/stat.h>
  3862. extern
  3863. #ifdef __cplusplus
  3864. "C"
  3865. #endif
  3866. #ifdef __STDC__
  3867. int lstat (char* path, struct stat * buf);
  3868. #else
  3869. int lstat();
  3870. #endif
  3871. main() { exit(0); }
  3872. EOF
  3873. eval $compile
  3874. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3875.   x=""
  3876. else
  3877.   x="const"
  3878. fi
  3879. if test -f core; then
  3880.   coredir=core`/bin/sh -c 'echo $$'`
  3881.   mkdir $coredir
  3882.   cp confdefs.h $coredir/confdefs.h
  3883.   mv conftest.c $coredir/conftest.c
  3884.   mv conftest $coredir/conftest
  3885.   mv core $coredir/core
  3886.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3887. fi
  3888. rm -f conftest*
  3889. echo "#define" LSTAT_CONST "$x" >> confdefs.h
  3890. DEFS="$DEFS -DLSTAT_CONST=$x"
  3891. SEDDEFS="${SEDDEFS}\${SEDdA}LSTAT_CONST\${SEDdB}LSTAT_CONST\${SEDdC}$x\${SEDdD}
  3892. \${SEDuA}LSTAT_CONST\${SEDuB}LSTAT_CONST\${SEDuC}$x\${SEDuD}
  3893. \${SEDeA}LSTAT_CONST\${SEDeB}LSTAT_CONST\${SEDeC}$x\${SEDeD}
  3894. \${SEDfA}LSTAT_CONST\${SEDfB}LSTAT_CONST\${SEDfC}$x\${SEDfD}
  3895. "
  3896. ac_proto=`echo "extern int lstat ($x char*, struct stat *);" | tr -s ' ' | sed -e 's/( /(/g'`
  3897. echo "${ac_t}${ac_tt}${ac_proto}"
  3898. fi
  3899.  
  3900.                       echo $ac_n "checking for readlink""... $ac_c"
  3901. cat > conftest.c <<EOF
  3902. #include "confdefs.h"
  3903. #include <ctype.h>
  3904. #ifdef __cplusplus
  3905. extern "C" char readlink();
  3906. #endif
  3907. int main() { exit(0); }
  3908. int t() { 
  3909. /* The GNU C library defines this for functions which it implements
  3910.     to always fail with ENOSYS.  Some functions are actually named
  3911.     something starting with __ and the normal name is an alias.  */
  3912. #if defined (__stub_readlink) || defined (__stub___readlink)
  3913. choke me
  3914. #else
  3915. #ifndef __cplusplus
  3916. /* Override any gcc2 internal prototype to avoid an error.  */
  3917. extern char readlink();
  3918. #endif
  3919. readlink();
  3920. #endif
  3921.  }
  3922. EOF
  3923. if eval $compile; then
  3924.   echo "${ac_t}yes"
  3925.   echo "#define" HAVE_READLINK "1" >> confdefs.h
  3926. DEFS="$DEFS -DHAVE_READLINK=1"
  3927. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_READLINK\${SEDdB}HAVE_READLINK\${SEDdC}1\${SEDdD}
  3928. \${SEDuA}HAVE_READLINK\${SEDuB}HAVE_READLINK\${SEDuC}1\${SEDuD}
  3929. \${SEDeA}HAVE_READLINK\${SEDeB}HAVE_READLINK\${SEDeC}1\${SEDeD}
  3930. \${SEDfA}HAVE_READLINK\${SEDfB}HAVE_READLINK\${SEDfC}1\${SEDfD}
  3931. "
  3932. have_readlink=1
  3933. else
  3934.   echo "${ac_t}no"
  3935.   :
  3936. fi
  3937. rm -f conftest*
  3938. if test -n "$have_readlink"; then
  3939. echo $ac_n "checking for readlink declaration""... $ac_c"
  3940. for z in 'int' 'size_t'; do
  3941. for y in 'char*' 'void*'; do
  3942. for x in '' 'const'; do
  3943. if test -z "$have_rl"; then
  3944. cat > conftest.c <<EOF
  3945. #include "confdefs.h"
  3946.  
  3947. #ifdef STDC_HEADERS
  3948. #include <stdlib.h>
  3949. #endif
  3950. #ifdef HAVE_UNISTD_H
  3951. #include <unistd.h>
  3952. #endif
  3953. extern
  3954. #ifdef __cplusplus
  3955. "C"
  3956. #endif
  3957. #ifdef __STDC__
  3958. int readlink ($x char* path, $y buf, $z bufsiz);
  3959. #else
  3960. int readlink();
  3961. #endif
  3962. main() { exit(0); }
  3963. EOF
  3964. eval $compile
  3965. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  3966.   echo "#define" READLINK_CONST "$x" >> confdefs.h
  3967. DEFS="$DEFS -DREADLINK_CONST=$x"
  3968. SEDDEFS="${SEDDEFS}\${SEDdA}READLINK_CONST\${SEDdB}READLINK_CONST\${SEDdC}$x\${SEDdD}
  3969. \${SEDuA}READLINK_CONST\${SEDuB}READLINK_CONST\${SEDuC}$x\${SEDuD}
  3970. \${SEDeA}READLINK_CONST\${SEDeB}READLINK_CONST\${SEDeC}$x\${SEDeD}
  3971. \${SEDfA}READLINK_CONST\${SEDfB}READLINK_CONST\${SEDfC}$x\${SEDfD}
  3972. "
  3973. echo "#define" READLINK_BUF_T "$y" >> confdefs.h
  3974. DEFS="$DEFS -DREADLINK_BUF_T=$y"
  3975. SEDDEFS="${SEDDEFS}\${SEDdA}READLINK_BUF_T\${SEDdB}READLINK_BUF_T\${SEDdC}$y\${SEDdD}
  3976. \${SEDuA}READLINK_BUF_T\${SEDuB}READLINK_BUF_T\${SEDuC}$y\${SEDuD}
  3977. \${SEDeA}READLINK_BUF_T\${SEDeB}READLINK_BUF_T\${SEDeC}$y\${SEDeD}
  3978. \${SEDfA}READLINK_BUF_T\${SEDfB}READLINK_BUF_T\${SEDfC}$y\${SEDfD}
  3979. "
  3980. echo "#define" READLINK_SIZE_T "$z" >> confdefs.h
  3981. DEFS="$DEFS -DREADLINK_SIZE_T=$z"
  3982. SEDDEFS="${SEDDEFS}\${SEDdA}READLINK_SIZE_T\${SEDdB}READLINK_SIZE_T\${SEDdC}$z\${SEDdD}
  3983. \${SEDuA}READLINK_SIZE_T\${SEDuB}READLINK_SIZE_T\${SEDuC}$z\${SEDuD}
  3984. \${SEDeA}READLINK_SIZE_T\${SEDeB}READLINK_SIZE_T\${SEDeC}$z\${SEDeD}
  3985. \${SEDfA}READLINK_SIZE_T\${SEDfB}READLINK_SIZE_T\${SEDfC}$z\${SEDfD}
  3986. "
  3987. ac_proto=`echo "extern int readlink ($x char*, $y, $z);" | tr -s ' ' | sed -e 's/( /(/g'`
  3988. echo "${ac_t}${ac_tt}${ac_proto}"
  3989. have_rl=1
  3990. fi
  3991. if test -f core; then
  3992.   coredir=core`/bin/sh -c 'echo $$'`
  3993.   mkdir $coredir
  3994.   cp confdefs.h $coredir/confdefs.h
  3995.   mv conftest.c $coredir/conftest.c
  3996.   mv conftest $coredir/conftest
  3997.   mv core $coredir/core
  3998.   echo "warning: test program dumped core -- see subdirectory $coredir"
  3999. fi
  4000. rm -f conftest*
  4001. fi
  4002. done
  4003. done
  4004. done
  4005. fi
  4006.  
  4007.                       echo $ac_n "checking for ELOOP""... $ac_c"
  4008. cat > conftest.c <<EOF
  4009. #include "confdefs.h"
  4010. #ifdef STDC_HEADERS
  4011. #include <stdlib.h>
  4012. #endif
  4013. #ifdef HAVE_UNISTD_H
  4014. #include <unistd.h>
  4015. #endif
  4016. #include <errno.h>
  4017. #include <stdio.h>
  4018. #ifdef ELOOP
  4019. main () { printf("ELOOP\n"); exit(0); }
  4020. #else
  4021. extern int errno;
  4022. #define foo "conflink"
  4023. #define foobar "conflink/somefile"
  4024. main()
  4025. { /* If a system goes into an endless loop on this, it must be really broken. */
  4026.   if (symlink(foo,foo)<0) exit(1);
  4027.   if (unlink(foobar)>=0) { unlink(foo); exit(1); }
  4028.   printf("%d\n",errno); unlink(foo); exit(0);
  4029. }
  4030. #endif
  4031. EOF
  4032. eval $compile
  4033. eloop=`./conftest`
  4034. echo "#define" ELOOP_VALUE "$eloop" >> confdefs.h
  4035. DEFS="$DEFS -DELOOP_VALUE=$eloop"
  4036. SEDDEFS="${SEDDEFS}\${SEDdA}ELOOP_VALUE\${SEDdB}ELOOP_VALUE\${SEDdC}$eloop\${SEDdD}
  4037. \${SEDuA}ELOOP_VALUE\${SEDuB}ELOOP_VALUE\${SEDuC}$eloop\${SEDuD}
  4038. \${SEDeA}ELOOP_VALUE\${SEDeB}ELOOP_VALUE\${SEDeC}$eloop\${SEDeD}
  4039. \${SEDfA}ELOOP_VALUE\${SEDfB}ELOOP_VALUE\${SEDfC}$eloop\${SEDfD}
  4040. "
  4041. if test "$eloop" = "ELOOP"; then
  4042.   echo "${ac_t}yes"
  4043. else
  4044.   echo "${ac_t}$eloop"
  4045. fi
  4046. rm -f conftest*
  4047.  
  4048.                       case "$DEFS" in
  4049.   *DIRENT*)
  4050. echo $ac_n "checking for opendir declaration""... $ac_c"
  4051. cat > conftest.c <<EOF
  4052. #include "confdefs.h"
  4053.  
  4054. #ifdef STDC_HEADERS
  4055. #include <stdlib.h>
  4056. #endif
  4057. #ifdef HAVE_UNISTD_H
  4058. #include <unistd.h>
  4059. #endif
  4060. #include <dirent.h>
  4061. extern
  4062. #ifdef __cplusplus
  4063. "C"
  4064. #endif
  4065. #ifdef __STDC__
  4066. DIR* opendir (char* dirname);
  4067. #else
  4068. DIR* opendir();
  4069. #endif
  4070. main() { exit(0); }
  4071. EOF
  4072. eval $compile
  4073. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4074.   x=""
  4075. else
  4076.   x="const"
  4077. fi
  4078. if test -f core; then
  4079.   coredir=core`/bin/sh -c 'echo $$'`
  4080.   mkdir $coredir
  4081.   cp confdefs.h $coredir/confdefs.h
  4082.   mv conftest.c $coredir/conftest.c
  4083.   mv conftest $coredir/conftest
  4084.   mv core $coredir/core
  4085.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4086. fi
  4087. rm -f conftest*
  4088. echo "#define" OPENDIR_CONST "$x" >> confdefs.h
  4089. DEFS="$DEFS -DOPENDIR_CONST=$x"
  4090. SEDDEFS="${SEDDEFS}\${SEDdA}OPENDIR_CONST\${SEDdB}OPENDIR_CONST\${SEDdC}$x\${SEDdD}
  4091. \${SEDuA}OPENDIR_CONST\${SEDuB}OPENDIR_CONST\${SEDuC}$x\${SEDuD}
  4092. \${SEDeA}OPENDIR_CONST\${SEDeB}OPENDIR_CONST\${SEDeC}$x\${SEDeD}
  4093. \${SEDfA}OPENDIR_CONST\${SEDfB}OPENDIR_CONST\${SEDfC}$x\${SEDfD}
  4094. "
  4095. ac_proto=`echo "extern DIR* opendir ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  4096. echo "${ac_t}${ac_tt}${ac_proto}"
  4097.   ;;
  4098.   *) ;;
  4099. esac
  4100.  
  4101.                       echo $ac_n "checking for open declaration""... $ac_c"
  4102. for y in 'MODE_T mode' '...'; do
  4103. for x in '' 'const'; do
  4104. if test -z "$have_open"; then
  4105. cat > conftest.c <<EOF
  4106. #include "confdefs.h"
  4107.  
  4108. #ifdef STDC_HEADERS
  4109. #include <stdlib.h>
  4110. #endif
  4111. #ifdef HAVE_UNISTD_H
  4112. #include <unistd.h>
  4113. #endif
  4114. #include <fcntl.h>
  4115. extern
  4116. #ifdef __cplusplus
  4117. "C"
  4118. #endif
  4119. #ifdef __STDC__
  4120. int open ($x char* path, int flags, $y);
  4121. #else
  4122. int open();
  4123. #endif
  4124. main() { exit(0); }
  4125. EOF
  4126. eval $compile
  4127. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4128.   echo "#define" OPEN_CONST "$x" >> confdefs.h
  4129. DEFS="$DEFS -DOPEN_CONST=$x"
  4130. SEDDEFS="${SEDDEFS}\${SEDdA}OPEN_CONST\${SEDdB}OPEN_CONST\${SEDdC}$x\${SEDdD}
  4131. \${SEDuA}OPEN_CONST\${SEDuB}OPEN_CONST\${SEDuC}$x\${SEDuD}
  4132. \${SEDeA}OPEN_CONST\${SEDeB}OPEN_CONST\${SEDeC}$x\${SEDeD}
  4133. \${SEDfA}OPEN_CONST\${SEDfB}OPEN_CONST\${SEDfC}$x\${SEDfD}
  4134. "
  4135. if test "$y" = "..."; then
  4136. echo "#define" OPEN_DOTS "1" >> confdefs.h
  4137. DEFS="$DEFS -DOPEN_DOTS=1"
  4138. SEDDEFS="${SEDDEFS}\${SEDdA}OPEN_DOTS\${SEDdB}OPEN_DOTS\${SEDdC}1\${SEDdD}
  4139. \${SEDuA}OPEN_DOTS\${SEDuB}OPEN_DOTS\${SEDuC}1\${SEDuD}
  4140. \${SEDeA}OPEN_DOTS\${SEDeB}OPEN_DOTS\${SEDeC}1\${SEDeD}
  4141. \${SEDfA}OPEN_DOTS\${SEDfB}OPEN_DOTS\${SEDfC}1\${SEDfD}
  4142. "
  4143. ac_proto=`echo "extern int open ($x char*, int, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
  4144. echo "${ac_t}${ac_tt}${ac_proto}"
  4145. else
  4146. ac_proto=`echo "extern int open ($x char*, int, $mode_t);" | tr -s ' ' | sed -e 's/( /(/g'`
  4147. echo "${ac_t}${ac_tt}${ac_proto}"
  4148. fi
  4149. have_open=1
  4150. fi
  4151. if test -f core; then
  4152.   coredir=core`/bin/sh -c 'echo $$'`
  4153.   mkdir $coredir
  4154.   cp confdefs.h $coredir/confdefs.h
  4155.   mv conftest.c $coredir/conftest.c
  4156.   mv conftest $coredir/conftest
  4157.   mv core $coredir/core
  4158.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4159. fi
  4160. rm -f conftest*
  4161. fi
  4162. done
  4163. done
  4164.  
  4165.                       echo $ac_n "checking for read declaration""... $ac_c"
  4166. cat > conftest.c <<EOF
  4167. #include "confdefs.h"
  4168.  
  4169. #ifdef STDC_HEADERS
  4170. #include <stdlib.h>
  4171. #endif
  4172. #ifdef HAVE_UNISTD_H
  4173. #include <unistd.h>
  4174. #endif
  4175. extern
  4176. #ifdef __cplusplus
  4177. "C"
  4178. #endif
  4179. int read();
  4180. main() { exit(0); }
  4181. EOF
  4182. eval $compile
  4183. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4184.   retrwtype="int"
  4185. else
  4186.   retrwtype="long"
  4187. fi
  4188. if test -f core; then
  4189.   coredir=core`/bin/sh -c 'echo $$'`
  4190.   mkdir $coredir
  4191.   cp confdefs.h $coredir/confdefs.h
  4192.   mv conftest.c $coredir/conftest.c
  4193.   mv conftest $coredir/conftest
  4194.   mv core $coredir/core
  4195.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4196. fi
  4197. rm -f conftest*
  4198. echo "#define" RETRWTYPE "$retrwtype" >> confdefs.h
  4199. DEFS="$DEFS -DRETRWTYPE=$retrwtype"
  4200. SEDDEFS="${SEDDEFS}\${SEDdA}RETRWTYPE\${SEDdB}RETRWTYPE\${SEDdC}$retrwtype\${SEDdD}
  4201. \${SEDuA}RETRWTYPE\${SEDuB}RETRWTYPE\${SEDuC}$retrwtype\${SEDuD}
  4202. \${SEDeA}RETRWTYPE\${SEDeB}RETRWTYPE\${SEDeC}$retrwtype\${SEDeD}
  4203. \${SEDfA}RETRWTYPE\${SEDfB}RETRWTYPE\${SEDfC}$retrwtype\${SEDfD}
  4204. "
  4205. for y in 'int' 'size_t' 'unsigned RETRWTYPE' 'off_t'; do
  4206. for x in 'char*' 'void*'; do
  4207. if test -z "$have_rw"; then
  4208. cat > conftest.c <<EOF
  4209. #include "confdefs.h"
  4210.  
  4211. #ifdef STDC_HEADERS
  4212. #include <stdlib.h>
  4213. #endif
  4214. #ifdef HAVE_UNISTD_H
  4215. #include <unistd.h>
  4216. #endif
  4217. extern
  4218. #ifdef __cplusplus
  4219. "C"
  4220. #endif
  4221. #ifdef __STDC__
  4222. RETRWTYPE read (int fd, $x buf, $y count);
  4223. #else
  4224. RETRWTYPE read();
  4225. #endif
  4226. main() { exit(0); }
  4227. EOF
  4228. eval $compile
  4229. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4230.   echo "#define" RW_BUF_T "$x" >> confdefs.h
  4231. DEFS="$DEFS -DRW_BUF_T=$x"
  4232. SEDDEFS="${SEDDEFS}\${SEDdA}RW_BUF_T\${SEDdB}RW_BUF_T\${SEDdC}$x\${SEDdD}
  4233. \${SEDuA}RW_BUF_T\${SEDuB}RW_BUF_T\${SEDuC}$x\${SEDuD}
  4234. \${SEDeA}RW_BUF_T\${SEDeB}RW_BUF_T\${SEDeC}$x\${SEDeD}
  4235. \${SEDfA}RW_BUF_T\${SEDfB}RW_BUF_T\${SEDfC}$x\${SEDfD}
  4236. "
  4237. echo "#define" RW_SIZE_T "$y" >> confdefs.h
  4238. DEFS="$DEFS -DRW_SIZE_T=$y"
  4239. SEDDEFS="${SEDDEFS}\${SEDdA}RW_SIZE_T\${SEDdB}RW_SIZE_T\${SEDdC}$y\${SEDdD}
  4240. \${SEDuA}RW_SIZE_T\${SEDuB}RW_SIZE_T\${SEDuC}$y\${SEDuD}
  4241. \${SEDeA}RW_SIZE_T\${SEDeB}RW_SIZE_T\${SEDeC}$y\${SEDeD}
  4242. \${SEDfA}RW_SIZE_T\${SEDfB}RW_SIZE_T\${SEDfC}$y\${SEDfD}
  4243. "
  4244. rw_buf_t="$x"
  4245. rw_size_t="$y"
  4246. ac_proto=`echo "extern $retrwtype read (int, $rw_buf_t, $rw_size_t);" | tr -s ' ' | sed -e 's/( /(/g'`
  4247. echo "${ac_t}${ac_tt}${ac_proto}"
  4248. have_rw=1
  4249. fi
  4250. if test -f core; then
  4251.   coredir=core`/bin/sh -c 'echo $$'`
  4252.   mkdir $coredir
  4253.   cp confdefs.h $coredir/confdefs.h
  4254.   mv conftest.c $coredir/conftest.c
  4255.   mv conftest $coredir/conftest
  4256.   mv core $coredir/core
  4257.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4258. fi
  4259. rm -f conftest*
  4260. fi
  4261. done
  4262. done
  4263.  
  4264.                       echo $ac_n "checking for write declaration""... $ac_c"
  4265. cat > conftest.c <<EOF
  4266. #include "confdefs.h"
  4267.  
  4268. #ifdef STDC_HEADERS
  4269. #include <stdlib.h>
  4270. #endif
  4271. #ifdef HAVE_UNISTD_H
  4272. #include <unistd.h>
  4273. #endif
  4274. extern
  4275. #ifdef __cplusplus
  4276. "C"
  4277. #endif
  4278. #ifdef __STDC__
  4279. RETRWTYPE write (int fd, RW_BUF_T buf, RW_SIZE_T count);
  4280. #else
  4281. RETRWTYPE write();
  4282. #endif
  4283. main() { exit(0); }
  4284. EOF
  4285. eval $compile
  4286. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4287.   x=""
  4288. else
  4289.   x="const"
  4290. fi
  4291. if test -f core; then
  4292.   coredir=core`/bin/sh -c 'echo $$'`
  4293.   mkdir $coredir
  4294.   cp confdefs.h $coredir/confdefs.h
  4295.   mv conftest.c $coredir/conftest.c
  4296.   mv conftest $coredir/conftest
  4297.   mv core $coredir/core
  4298.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4299. fi
  4300. rm -f conftest*
  4301. echo "#define" WRITE_CONST "$x" >> confdefs.h
  4302. DEFS="$DEFS -DWRITE_CONST=$x"
  4303. SEDDEFS="${SEDDEFS}\${SEDdA}WRITE_CONST\${SEDdB}WRITE_CONST\${SEDdC}$x\${SEDdD}
  4304. \${SEDuA}WRITE_CONST\${SEDuB}WRITE_CONST\${SEDuC}$x\${SEDuD}
  4305. \${SEDeA}WRITE_CONST\${SEDeB}WRITE_CONST\${SEDeC}$x\${SEDeD}
  4306. \${SEDfA}WRITE_CONST\${SEDfB}WRITE_CONST\${SEDfC}$x\${SEDfD}
  4307. "
  4308. ac_proto=`echo "extern $retrwtype write (int, $x $rw_buf_t, $rw_size_t);" | tr -s ' ' | sed -e 's/( /(/g'`
  4309. echo "${ac_t}${ac_tt}${ac_proto}"
  4310.  
  4311.                       echo $ac_n "checking for rename""... $ac_c"
  4312. cat > conftest.c <<EOF
  4313. #include "confdefs.h"
  4314. #include <ctype.h>
  4315. #ifdef __cplusplus
  4316. extern "C" char rename();
  4317. #endif
  4318. int main() { exit(0); }
  4319. int t() { 
  4320. /* The GNU C library defines this for functions which it implements
  4321.     to always fail with ENOSYS.  Some functions are actually named
  4322.     something starting with __ and the normal name is an alias.  */
  4323. #if defined (__stub_rename) || defined (__stub___rename)
  4324. choke me
  4325. #else
  4326. #ifndef __cplusplus
  4327. /* Override any gcc2 internal prototype to avoid an error.  */
  4328. extern char rename();
  4329. #endif
  4330. rename();
  4331. #endif
  4332.  }
  4333. EOF
  4334. if eval $compile; then
  4335.   echo "${ac_t}yes"
  4336.   echo "#define" HAVE_RENAME "1" >> confdefs.h
  4337. DEFS="$DEFS -DHAVE_RENAME=1"
  4338. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_RENAME\${SEDdB}HAVE_RENAME\${SEDdC}1\${SEDdD}
  4339. \${SEDuA}HAVE_RENAME\${SEDuB}HAVE_RENAME\${SEDuC}1\${SEDuD}
  4340. \${SEDeA}HAVE_RENAME\${SEDeB}HAVE_RENAME\${SEDeC}1\${SEDeD}
  4341. \${SEDfA}HAVE_RENAME\${SEDfB}HAVE_RENAME\${SEDfC}1\${SEDfD}
  4342. "
  4343. have_rename=1
  4344. else
  4345.   echo "${ac_t}no"
  4346.   :
  4347. fi
  4348. rm -f conftest*
  4349. if test -n "$have_rename"; then
  4350. echo $ac_n "checking for rename declaration""... $ac_c"
  4351. cat > conftest.c <<EOF
  4352. #include "confdefs.h"
  4353.  
  4354. #ifdef STDC_HEADERS
  4355. #include <stdlib.h>
  4356. #endif
  4357. #ifdef HAVE_UNISTD_H
  4358. #include <unistd.h>
  4359. #endif
  4360. #include <stdio.h>
  4361. extern
  4362. #ifdef __cplusplus
  4363. "C"
  4364. #endif
  4365. #ifdef __STDC__
  4366. int rename (char* oldpath, char* newpath);
  4367. #else
  4368. int rename();
  4369. #endif
  4370. main() { exit(0); }
  4371. EOF
  4372. eval $compile
  4373. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4374.   x=""
  4375. else
  4376.   x="const"
  4377. fi
  4378. if test -f core; then
  4379.   coredir=core`/bin/sh -c 'echo $$'`
  4380.   mkdir $coredir
  4381.   cp confdefs.h $coredir/confdefs.h
  4382.   mv conftest.c $coredir/conftest.c
  4383.   mv conftest $coredir/conftest
  4384.   mv core $coredir/core
  4385.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4386. fi
  4387. rm -f conftest*
  4388. echo "#define" RENAME_CONST "$x" >> confdefs.h
  4389. DEFS="$DEFS -DRENAME_CONST=$x"
  4390. SEDDEFS="${SEDDEFS}\${SEDdA}RENAME_CONST\${SEDdB}RENAME_CONST\${SEDdC}$x\${SEDdD}
  4391. \${SEDuA}RENAME_CONST\${SEDuB}RENAME_CONST\${SEDuC}$x\${SEDuD}
  4392. \${SEDeA}RENAME_CONST\${SEDeB}RENAME_CONST\${SEDeC}$x\${SEDeD}
  4393. \${SEDfA}RENAME_CONST\${SEDfB}RENAME_CONST\${SEDfC}$x\${SEDfD}
  4394. "
  4395. ac_proto=`echo "extern int rename ($x char*, $x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  4396. echo "${ac_t}${ac_tt}${ac_proto}"
  4397. fi
  4398.  
  4399.                       echo $ac_n "checking for unlink declaration""... $ac_c"
  4400. cat > conftest.c <<EOF
  4401. #include "confdefs.h"
  4402.  
  4403. #ifdef STDC_HEADERS
  4404. #include <stdlib.h>
  4405. #endif
  4406. #ifdef HAVE_UNISTD_H
  4407. #include <unistd.h>
  4408. #endif
  4409. extern
  4410. #ifdef __cplusplus
  4411. "C"
  4412. #endif
  4413. #ifdef __STDC__
  4414. int unlink (char* path);
  4415. #else
  4416. int unlink();
  4417. #endif
  4418. main() { exit(0); }
  4419. EOF
  4420. eval $compile
  4421. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4422.   x=""
  4423. else
  4424.   x="const"
  4425. fi
  4426. if test -f core; then
  4427.   coredir=core`/bin/sh -c 'echo $$'`
  4428.   mkdir $coredir
  4429.   cp confdefs.h $coredir/confdefs.h
  4430.   mv conftest.c $coredir/conftest.c
  4431.   mv conftest $coredir/conftest
  4432.   mv core $coredir/core
  4433.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4434. fi
  4435. rm -f conftest*
  4436. echo "#define" UNLINK_CONST "$x" >> confdefs.h
  4437. DEFS="$DEFS -DUNLINK_CONST=$x"
  4438. SEDDEFS="${SEDDEFS}\${SEDdA}UNLINK_CONST\${SEDdB}UNLINK_CONST\${SEDdC}$x\${SEDdD}
  4439. \${SEDuA}UNLINK_CONST\${SEDuB}UNLINK_CONST\${SEDuC}$x\${SEDuD}
  4440. \${SEDeA}UNLINK_CONST\${SEDeB}UNLINK_CONST\${SEDeC}$x\${SEDeD}
  4441. \${SEDfA}UNLINK_CONST\${SEDfB}UNLINK_CONST\${SEDfC}$x\${SEDfD}
  4442. "
  4443. ac_proto=`echo "extern int unlink ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  4444. echo "${ac_t}${ac_tt}${ac_proto}"
  4445.  
  4446.                       echo $ac_n "checking for fsync""... $ac_c"
  4447. cat > conftest.c <<EOF
  4448. #include "confdefs.h"
  4449. #include <ctype.h>
  4450. #ifdef __cplusplus
  4451. extern "C" char fsync();
  4452. #endif
  4453. int main() { exit(0); }
  4454. int t() { 
  4455. /* The GNU C library defines this for functions which it implements
  4456.     to always fail with ENOSYS.  Some functions are actually named
  4457.     something starting with __ and the normal name is an alias.  */
  4458. #if defined (__stub_fsync) || defined (__stub___fsync)
  4459. choke me
  4460. #else
  4461. #ifndef __cplusplus
  4462. /* Override any gcc2 internal prototype to avoid an error.  */
  4463. extern char fsync();
  4464. #endif
  4465. fsync();
  4466. #endif
  4467.  }
  4468. EOF
  4469. if eval $compile; then
  4470.   echo "${ac_t}yes"
  4471.   echo "#define" HAVE_FSYNC "1" >> confdefs.h
  4472. DEFS="$DEFS -DHAVE_FSYNC=1"
  4473. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_FSYNC\${SEDdB}HAVE_FSYNC\${SEDdC}1\${SEDdD}
  4474. \${SEDuA}HAVE_FSYNC\${SEDuB}HAVE_FSYNC\${SEDuC}1\${SEDuD}
  4475. \${SEDeA}HAVE_FSYNC\${SEDeB}HAVE_FSYNC\${SEDeC}1\${SEDeD}
  4476. \${SEDfA}HAVE_FSYNC\${SEDfB}HAVE_FSYNC\${SEDfC}1\${SEDfD}
  4477. "
  4478. else
  4479.   echo "${ac_t}no"
  4480.   :
  4481. fi
  4482. rm -f conftest*
  4483.  
  4484.  
  4485.                       echo $ac_n "checking for ioctl declaration""... $ac_c"
  4486. ioctl_decl1='#ifdef STDC_HEADERS
  4487. #include <stdlib.h>
  4488. #endif
  4489. #ifdef HAVE_UNISTD_H
  4490. #include <sys/types.h>
  4491. #include <unistd.h>
  4492. #endif
  4493. #ifndef HAVE_TCSAFLUSH
  4494. #undef HAVE_TERMIOS_H
  4495. #endif
  4496. #ifdef HAVE_TERMIOS_H
  4497. #include <termios.h>
  4498. #else
  4499. #ifdef HAVE_SYS_TERMIO_H
  4500. #include <sys/termio.h>
  4501. #else
  4502. #ifdef HAVE_TERMIO_H
  4503. #include <termio.h>
  4504. #else
  4505. #ifdef HAVE_SGTTY_H
  4506. #include <sgtty.h>
  4507. #include <sys/ioctl.h>
  4508. #endif
  4509. #endif
  4510. #endif
  4511. #endif
  4512. '
  4513. cat > conftest.c <<EOF
  4514. #include "confdefs.h"
  4515. $ioctl_decl1
  4516. extern
  4517. #ifdef __cplusplus
  4518. "C"
  4519. #endif
  4520. char* ioctl();
  4521. main() { exit(0); }
  4522. EOF
  4523. eval $compile
  4524. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4525.   try_sys_ioctl=1
  4526. else
  4527.   ioctl_decl="$ioctl_decl1"
  4528. fi
  4529. if test -f core; then
  4530.   coredir=core`/bin/sh -c 'echo $$'`
  4531.   mkdir $coredir
  4532.   cp confdefs.h $coredir/confdefs.h
  4533.   mv conftest.c $coredir/conftest.c
  4534.   mv conftest $coredir/conftest
  4535.   mv core $coredir/core
  4536.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4537. fi
  4538. rm -f conftest*
  4539. if test -n "try_sys_ioctl"; then
  4540. ioctl_decl2='#ifdef STDC_HEADERS
  4541. #include <stdlib.h>
  4542. #endif
  4543. #ifdef HAVE_UNISTD_H
  4544. #include <sys/types.h>
  4545. #include <unistd.h>
  4546. #endif
  4547. #include <sys/ioctl.h>
  4548. '
  4549. cat > conftest.c <<EOF
  4550. #include "confdefs.h"
  4551. $ioctl_decl2
  4552. extern
  4553. #ifdef __cplusplus
  4554. "C"
  4555. #endif
  4556. char* ioctl();
  4557. main() { exit(0); }
  4558. EOF
  4559. eval $compile
  4560. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4561.   ioctl_decl="$ioctl_decl1"
  4562. else
  4563.   ioctl_decl="$ioctl_decl2"
  4564. fi
  4565. if test -f core; then
  4566.   coredir=core`/bin/sh -c 'echo $$'`
  4567.   mkdir $coredir
  4568.   cp confdefs.h $coredir/confdefs.h
  4569.   mv conftest.c $coredir/conftest.c
  4570.   mv conftest $coredir/conftest
  4571.   mv core $coredir/core
  4572.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4573. fi
  4574. rm -f conftest*
  4575. fi
  4576. for y in 'caddr_t arg' '...'; do
  4577. for x in 'int' 'unsigned long' 'long'; do
  4578. if test -z "$have_ioctl"; then
  4579. cat > conftest.c <<EOF
  4580. #include "confdefs.h"
  4581. $ioctl_decl
  4582. #ifdef INCLUDE_SYS_IOCTL_H
  4583. #include <sys/ioctl.h>
  4584. #endif
  4585. extern
  4586. #ifdef __cplusplus
  4587. "C"
  4588. #endif
  4589. #ifdef __STDC__
  4590. int ioctl (int fd, $x request, $y);
  4591. #else
  4592. int ioctl();
  4593. #endif
  4594. main() { exit(0); }
  4595. EOF
  4596. eval $compile
  4597. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4598.   echo "#define" IOCTL_REQUEST_T "$x" >> confdefs.h
  4599. DEFS="$DEFS -DIOCTL_REQUEST_T=$x"
  4600. SEDDEFS="${SEDDEFS}\${SEDdA}IOCTL_REQUEST_T\${SEDdB}IOCTL_REQUEST_T\${SEDdC}$x\${SEDdD}
  4601. \${SEDuA}IOCTL_REQUEST_T\${SEDuB}IOCTL_REQUEST_T\${SEDuC}$x\${SEDuD}
  4602. \${SEDeA}IOCTL_REQUEST_T\${SEDeB}IOCTL_REQUEST_T\${SEDeC}$x\${SEDeD}
  4603. \${SEDfA}IOCTL_REQUEST_T\${SEDfB}IOCTL_REQUEST_T\${SEDfC}$x\${SEDfD}
  4604. "
  4605. if test "$y" = "..."; then
  4606. echo "#define" IOCTL_DOTS "1" >> confdefs.h
  4607. DEFS="$DEFS -DIOCTL_DOTS=1"
  4608. SEDDEFS="${SEDDEFS}\${SEDdA}IOCTL_DOTS\${SEDdB}IOCTL_DOTS\${SEDdC}1\${SEDdD}
  4609. \${SEDuA}IOCTL_DOTS\${SEDuB}IOCTL_DOTS\${SEDuC}1\${SEDuD}
  4610. \${SEDeA}IOCTL_DOTS\${SEDeB}IOCTL_DOTS\${SEDeC}1\${SEDeD}
  4611. \${SEDfA}IOCTL_DOTS\${SEDfB}IOCTL_DOTS\${SEDfC}1\${SEDfD}
  4612. "
  4613. ac_proto=`echo "extern int ioctl (int, $x, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
  4614. echo "${ac_t}${ac_tt}${ac_proto}"
  4615. else
  4616. ac_proto=`echo "extern int ioctl (int, $x, caddr_t);" | tr -s ' ' | sed -e 's/( /(/g'`
  4617. echo "${ac_t}${ac_tt}${ac_proto}"
  4618. fi
  4619. have_ioctl=1
  4620. fi
  4621. if test -f core; then
  4622.   coredir=core`/bin/sh -c 'echo $$'`
  4623.   mkdir $coredir
  4624.   cp confdefs.h $coredir/confdefs.h
  4625.   mv conftest.c $coredir/conftest.c
  4626.   mv conftest $coredir/conftest
  4627.   mv core $coredir/core
  4628.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4629. fi
  4630. rm -f conftest*
  4631. fi
  4632. done
  4633. done
  4634. ioctl_decl="$ioctl_decl1"
  4635. ioctl_prog='int x = FIONREAD;'
  4636. echo $ac_n "checking for FIONREAD""... $ac_c"
  4637. cat > conftest.c <<EOF
  4638. #include "confdefs.h"
  4639. $ioctl_decl
  4640. int main() { exit(0); }
  4641. int t() { $ioctl_prog }
  4642. EOF
  4643. if eval $compile; then
  4644.   echo "${ac_t}yes"
  4645.   ioctl_ok=1
  4646. else
  4647.   echo "${ac_t}no"
  4648.   :
  4649. fi
  4650. rm -f conftest*
  4651. if test -z "$ioctl_ok"; then
  4652. echo $ac_n "checking for FIONREAD in sys/filio.h""... $ac_c"
  4653. cat > conftest.c <<EOF
  4654. #include "confdefs.h"
  4655. $ioctl_decl#include <sys/filio.h>
  4656. int main() { exit(0); }
  4657. int t() { $ioctl_prog }
  4658. EOF
  4659. if eval $compile; then
  4660.   echo "${ac_t}yes"
  4661.   echo "#define" NEED_SYS_FILIO_H "1" >> confdefs.h
  4662. DEFS="$DEFS -DNEED_SYS_FILIO_H=1"
  4663. SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_FILIO_H\${SEDdB}NEED_SYS_FILIO_H\${SEDdC}1\${SEDdD}
  4664. \${SEDuA}NEED_SYS_FILIO_H\${SEDuB}NEED_SYS_FILIO_H\${SEDuC}1\${SEDuD}
  4665. \${SEDeA}NEED_SYS_FILIO_H\${SEDeB}NEED_SYS_FILIO_H\${SEDeC}1\${SEDeD}
  4666. \${SEDfA}NEED_SYS_FILIO_H\${SEDfB}NEED_SYS_FILIO_H\${SEDfC}1\${SEDfD}
  4667. "
  4668. ioctl_ok=1
  4669. else
  4670.   echo "${ac_t}no"
  4671.   :
  4672. fi
  4673. rm -f conftest*
  4674. fi
  4675. if test -z "$ioctl_ok"; then
  4676. echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c"
  4677. cat > conftest.c <<EOF
  4678. #include "confdefs.h"
  4679. $ioctl_decl#include <sys/ioctl.h>
  4680. int main() { exit(0); }
  4681. int t() { $ioctl_prog }
  4682. EOF
  4683. if eval $compile; then
  4684.   echo "${ac_t}yes"
  4685.   echo "#define" NEED_SYS_IOCTL_H "1" >> confdefs.h
  4686. DEFS="$DEFS -DNEED_SYS_IOCTL_H=1"
  4687. SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_IOCTL_H\${SEDdB}NEED_SYS_IOCTL_H\${SEDdC}1\${SEDdD}
  4688. \${SEDuA}NEED_SYS_IOCTL_H\${SEDuB}NEED_SYS_IOCTL_H\${SEDuC}1\${SEDuD}
  4689. \${SEDeA}NEED_SYS_IOCTL_H\${SEDeB}NEED_SYS_IOCTL_H\${SEDeC}1\${SEDeD}
  4690. \${SEDfA}NEED_SYS_IOCTL_H\${SEDfB}NEED_SYS_IOCTL_H\${SEDfC}1\${SEDfD}
  4691. "
  4692. ioctl_ok=1
  4693. else
  4694.   echo "${ac_t}no"
  4695.   :
  4696. fi
  4697. rm -f conftest*
  4698. fi
  4699. if test -n "$ioctl_ok"; then
  4700. echo "#define" HAVE_FIONREAD "1" >> confdefs.h
  4701. DEFS="$DEFS -DHAVE_FIONREAD=1"
  4702. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_FIONREAD\${SEDdB}HAVE_FIONREAD\${SEDdC}1\${SEDdD}
  4703. \${SEDuA}HAVE_FIONREAD\${SEDuB}HAVE_FIONREAD\${SEDuC}1\${SEDuD}
  4704. \${SEDeA}HAVE_FIONREAD\${SEDeB}HAVE_FIONREAD\${SEDeC}1\${SEDeD}
  4705. \${SEDfA}HAVE_FIONREAD\${SEDfB}HAVE_FIONREAD\${SEDfC}1\${SEDfD}
  4706. "
  4707. fi
  4708.  
  4709.                       echo $ac_n "checking for fcntl declaration""... $ac_c"
  4710. for x in 'int arg' '...'; do
  4711. if test -z "$have_fcntl"; then
  4712. cat > conftest.c <<EOF
  4713. #include "confdefs.h"
  4714.  
  4715. #ifdef HAVE_UNISTD_H
  4716. #include <unistd.h>
  4717. #endif
  4718. #include <fcntl.h>
  4719. extern
  4720. #ifdef __cplusplus
  4721. "C"
  4722. #endif
  4723. #ifdef __STDC__
  4724. int fcntl (int fd, int cmd, $x);
  4725. #else
  4726. int fcntl();
  4727. #endif
  4728. main() { exit(0); }
  4729. EOF
  4730. eval $compile
  4731. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4732.   if test "$x" = "..."; then
  4733. echo "#define" FCNTL_DOTS "1" >> confdefs.h
  4734. DEFS="$DEFS -DFCNTL_DOTS=1"
  4735. SEDDEFS="${SEDDEFS}\${SEDdA}FCNTL_DOTS\${SEDdB}FCNTL_DOTS\${SEDdC}1\${SEDdD}
  4736. \${SEDuA}FCNTL_DOTS\${SEDuB}FCNTL_DOTS\${SEDuC}1\${SEDuD}
  4737. \${SEDeA}FCNTL_DOTS\${SEDeB}FCNTL_DOTS\${SEDeC}1\${SEDeD}
  4738. \${SEDfA}FCNTL_DOTS\${SEDfB}FCNTL_DOTS\${SEDfC}1\${SEDfD}
  4739. "
  4740. ac_proto=`echo "extern int fcntl (int, int, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
  4741. echo "${ac_t}${ac_tt}${ac_proto}"
  4742. else
  4743. ac_proto=`echo "extern int fcntl (int, int, int);" | tr -s ' ' | sed -e 's/( /(/g'`
  4744. echo "${ac_t}${ac_tt}${ac_proto}"
  4745. fi
  4746. have_fcntl=1
  4747. fi
  4748. if test -f core; then
  4749.   coredir=core`/bin/sh -c 'echo $$'`
  4750.   mkdir $coredir
  4751.   cp confdefs.h $coredir/confdefs.h
  4752.   mv conftest.c $coredir/conftest.c
  4753.   mv conftest $coredir/conftest
  4754.   mv core $coredir/core
  4755.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4756. fi
  4757. rm -f conftest*
  4758. fi
  4759. done
  4760.  
  4761.                       echo $ac_n "checking for select""... $ac_c"
  4762. cat > conftest.c <<EOF
  4763. #include "confdefs.h"
  4764. #include <ctype.h>
  4765. #ifdef __cplusplus
  4766. extern "C" char select();
  4767. #endif
  4768. int main() { exit(0); }
  4769. int t() { 
  4770. /* The GNU C library defines this for functions which it implements
  4771.     to always fail with ENOSYS.  Some functions are actually named
  4772.     something starting with __ and the normal name is an alias.  */
  4773. #if defined (__stub_select) || defined (__stub___select)
  4774. choke me
  4775. #else
  4776. #ifndef __cplusplus
  4777. /* Override any gcc2 internal prototype to avoid an error.  */
  4778. extern char select();
  4779. #endif
  4780. select();
  4781. #endif
  4782.  }
  4783. EOF
  4784. if eval $compile; then
  4785.   echo "${ac_t}yes"
  4786.   echo "#define" HAVE_SELECT "1" >> confdefs.h
  4787. DEFS="$DEFS -DHAVE_SELECT=1"
  4788. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SELECT\${SEDdB}HAVE_SELECT\${SEDdC}1\${SEDdD}
  4789. \${SEDuA}HAVE_SELECT\${SEDuB}HAVE_SELECT\${SEDuC}1\${SEDuD}
  4790. \${SEDeA}HAVE_SELECT\${SEDeB}HAVE_SELECT\${SEDeC}1\${SEDeD}
  4791. \${SEDfA}HAVE_SELECT\${SEDfB}HAVE_SELECT\${SEDfC}1\${SEDfD}
  4792. "
  4793. else
  4794.   echo "${ac_t}no"
  4795.   have_select=1
  4796. fi
  4797. rm -f conftest*
  4798. if test -z "$have_select"; then
  4799. for hdr in sys/select.h
  4800. do
  4801. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  4802. echo $ac_n "checking for ${hdr}""... $ac_c"
  4803. cat > conftest.c <<EOF
  4804. #include "confdefs.h"
  4805. #include <${hdr}>
  4806. EOF
  4807. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  4808. if test -z "$err"; then
  4809.   echo "${ac_t}yes"
  4810. echo "#define" ${trhdr} "1" >> confdefs.h
  4811. DEFS="$DEFS -D${trhdr}=1"
  4812. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  4813. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  4814. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  4815. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  4816. "
  4817. else
  4818.   echo "${ac_t}no"
  4819.  
  4820. fi
  4821. rm -f conftest*
  4822. done
  4823. echo $ac_n "checking for select declaration""... $ac_c"
  4824. for z in '' 'const'; do
  4825. for y in 'fd_set' 'int' 'void'; do
  4826. for x in 'int' 'size_t'; do
  4827. if test -z "$have_select"; then
  4828. cat > conftest.c <<EOF
  4829. #include "confdefs.h"
  4830.  
  4831. #ifdef STDC_HEADERS
  4832. #include <stdlib.h>
  4833. #endif
  4834. #ifdef HAVE_UNISTD_H
  4835. #include <unistd.h>
  4836. #endif
  4837. #include <sys/time.h>
  4838. #ifdef HAVE_SYS_SELECT_H
  4839. #include <sys/select.h>
  4840. #endif
  4841. extern
  4842. #ifdef __cplusplus
  4843. "C"
  4844. #endif
  4845. #ifdef __STDC__
  4846. int select ($x width, $y * readfds, $y * writefds, $y * exceptfds, $z struct timeval * timeout);
  4847. #else
  4848. int select();
  4849. #endif
  4850. main() { exit(0); }
  4851. EOF
  4852. eval $compile
  4853. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  4854.   echo "#define" SELECT_WIDTH_T "$x" >> confdefs.h
  4855. DEFS="$DEFS -DSELECT_WIDTH_T=$x"
  4856. SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_WIDTH_T\${SEDdB}SELECT_WIDTH_T\${SEDdC}$x\${SEDdD}
  4857. \${SEDuA}SELECT_WIDTH_T\${SEDuB}SELECT_WIDTH_T\${SEDuC}$x\${SEDuD}
  4858. \${SEDeA}SELECT_WIDTH_T\${SEDeB}SELECT_WIDTH_T\${SEDeC}$x\${SEDeD}
  4859. \${SEDfA}SELECT_WIDTH_T\${SEDfB}SELECT_WIDTH_T\${SEDfC}$x\${SEDfD}
  4860. "
  4861. echo "#define" SELECT_SET_T "$y" >> confdefs.h
  4862. DEFS="$DEFS -DSELECT_SET_T=$y"
  4863. SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_SET_T\${SEDdB}SELECT_SET_T\${SEDdC}$y\${SEDdD}
  4864. \${SEDuA}SELECT_SET_T\${SEDuB}SELECT_SET_T\${SEDuC}$y\${SEDuD}
  4865. \${SEDeA}SELECT_SET_T\${SEDeB}SELECT_SET_T\${SEDeC}$y\${SEDeD}
  4866. \${SEDfA}SELECT_SET_T\${SEDfB}SELECT_SET_T\${SEDfC}$y\${SEDfD}
  4867. "
  4868. echo "#define" SELECT_CONST "$z" >> confdefs.h
  4869. DEFS="$DEFS -DSELECT_CONST=$z"
  4870. SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_CONST\${SEDdB}SELECT_CONST\${SEDdC}$z\${SEDdD}
  4871. \${SEDuA}SELECT_CONST\${SEDuB}SELECT_CONST\${SEDuC}$z\${SEDuD}
  4872. \${SEDeA}SELECT_CONST\${SEDeB}SELECT_CONST\${SEDeC}$z\${SEDeD}
  4873. \${SEDfA}SELECT_CONST\${SEDfB}SELECT_CONST\${SEDfC}$z\${SEDfD}
  4874. "
  4875. ac_proto=`echo "extern int select ($x, $y *, $y *, $y *, $z struct timeval *);" | tr -s ' ' | sed -e 's/( /(/g'`
  4876. echo "${ac_t}${ac_tt}${ac_proto}"
  4877. have_select=1
  4878. fi
  4879. if test -f core; then
  4880.   coredir=core`/bin/sh -c 'echo $$'`
  4881.   mkdir $coredir
  4882.   cp confdefs.h $coredir/confdefs.h
  4883.   mv conftest.c $coredir/conftest.c
  4884.   mv conftest $coredir/conftest
  4885.   mv core $coredir/core
  4886.   echo "warning: test program dumped core -- see subdirectory $coredir"
  4887. fi
  4888. rm -f conftest*
  4889. fi
  4890. done
  4891. done
  4892. done
  4893. else
  4894. for func in poll
  4895. do
  4896. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  4897. echo $ac_n "checking for ${func}""... $ac_c"
  4898. cat > conftest.c <<EOF
  4899. #include "confdefs.h"
  4900. #include <ctype.h>
  4901. #ifdef __cplusplus
  4902. extern "C" char ${func}();
  4903. #endif
  4904. int main() { exit(0); }
  4905. int t() { 
  4906. /* The GNU C library defines this for functions which it implements
  4907.     to always fail with ENOSYS.  Some functions are actually named
  4908.     something starting with __ and the normal name is an alias.  */
  4909. #if defined (__stub_${func}) || defined (__stub___${func})
  4910. choke me
  4911. #else
  4912. #ifndef __cplusplus
  4913. /* Override any gcc2 internal prototype to avoid an error.  */
  4914. extern char ${func}();
  4915. #endif
  4916. ${func}();
  4917. #endif
  4918.  }
  4919. EOF
  4920. if eval $compile; then
  4921.   echo "${ac_t}yes"
  4922.   echo "#define" ${trfunc} "1" >> confdefs.h
  4923. DEFS="$DEFS -D${trfunc}=1"
  4924. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  4925. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  4926. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  4927. \${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
  4928. "
  4929. else
  4930.   echo "${ac_t}no"
  4931.   :
  4932. fi
  4933. rm -f conftest*
  4934. done
  4935. fi
  4936.  
  4937.                       echo $ac_n "checking for ualarm""... $ac_c"
  4938. cat > conftest.c <<EOF
  4939. #include "confdefs.h"
  4940. #include <ctype.h>
  4941. #ifdef __cplusplus
  4942. extern "C" char ualarm();
  4943. #endif
  4944. int main() { exit(0); }
  4945. int t() { 
  4946. /* The GNU C library defines this for functions which it implements
  4947.     to always fail with ENOSYS.  Some functions are actually named
  4948.     something starting with __ and the normal name is an alias.  */
  4949. #if defined (__stub_ualarm) || defined (__stub___ualarm)
  4950. choke me
  4951. #else
  4952. #ifndef __cplusplus
  4953. /* Override any gcc2 internal prototype to avoid an error.  */
  4954. extern char ualarm();
  4955. #endif
  4956. ualarm();
  4957. #endif
  4958.  }
  4959. EOF
  4960. if eval $compile; then
  4961.   echo "${ac_t}yes"
  4962.   echo "#define" HAVE_UALARM "1" >> confdefs.h
  4963. DEFS="$DEFS -DHAVE_UALARM=1"
  4964. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UALARM\${SEDdB}HAVE_UALARM\${SEDdC}1\${SEDdD}
  4965. \${SEDuA}HAVE_UALARM\${SEDuB}HAVE_UALARM\${SEDuC}1\${SEDuD}
  4966. \${SEDeA}HAVE_UALARM\${SEDeB}HAVE_UALARM\${SEDeC}1\${SEDeD}
  4967. \${SEDfA}HAVE_UALARM\${SEDfB}HAVE_UALARM\${SEDfC}1\${SEDfD}
  4968. "
  4969. else
  4970.   echo "${ac_t}no"
  4971.   :
  4972. fi
  4973. rm -f conftest*
  4974.  
  4975.  
  4976.                       echo $ac_n "checking for setitimer""... $ac_c"
  4977. cat > conftest.c <<EOF
  4978. #include "confdefs.h"
  4979. #include <ctype.h>
  4980. #ifdef __cplusplus
  4981. extern "C" char setitimer();
  4982. #endif
  4983. int main() { exit(0); }
  4984. int t() { 
  4985. /* The GNU C library defines this for functions which it implements
  4986.     to always fail with ENOSYS.  Some functions are actually named
  4987.     something starting with __ and the normal name is an alias.  */
  4988. #if defined (__stub_setitimer) || defined (__stub___setitimer)
  4989. choke me
  4990. #else
  4991. #ifndef __cplusplus
  4992. /* Override any gcc2 internal prototype to avoid an error.  */
  4993. extern char setitimer();
  4994. #endif
  4995. setitimer();
  4996. #endif
  4997.  }
  4998. EOF
  4999. if eval $compile; then
  5000.   echo "${ac_t}yes"
  5001.   echo "#define" HAVE_SETITIMER "1" >> confdefs.h
  5002. DEFS="$DEFS -DHAVE_SETITIMER=1"
  5003. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SETITIMER\${SEDdB}HAVE_SETITIMER\${SEDdC}1\${SEDdD}
  5004. \${SEDuA}HAVE_SETITIMER\${SEDuB}HAVE_SETITIMER\${SEDuC}1\${SEDuD}
  5005. \${SEDeA}HAVE_SETITIMER\${SEDeB}HAVE_SETITIMER\${SEDeC}1\${SEDeD}
  5006. \${SEDfA}HAVE_SETITIMER\${SEDfB}HAVE_SETITIMER\${SEDfC}1\${SEDfD}
  5007. "
  5008. have_setitimer=1
  5009. else
  5010.   echo "${ac_t}no"
  5011.   :
  5012. fi
  5013. rm -f conftest*
  5014. if test -n "$have_setitimer"; then
  5015. echo $ac_n "checking for setitimer declaration""... $ac_c"
  5016. cat > conftest.c <<EOF
  5017. #include "confdefs.h"
  5018.  
  5019. #ifdef STDC_HEADERS
  5020. #include <stdlib.h>
  5021. #endif
  5022. #ifdef HAVE_UNISTD_H
  5023. #include <unistd.h>
  5024. #endif
  5025. #include <sys/time.h>
  5026. extern
  5027. #ifdef __cplusplus
  5028. "C"
  5029. #endif
  5030. #ifdef __STDC__
  5031. int setitimer (int which, struct itimerval * ivalue, struct itimerval * ovalue);
  5032. #else
  5033. int setitimer();
  5034. #endif
  5035. main() { exit(0); }
  5036. EOF
  5037. eval $compile
  5038. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5039.   x=""
  5040. else
  5041.   x="const"
  5042. fi
  5043. if test -f core; then
  5044.   coredir=core`/bin/sh -c 'echo $$'`
  5045.   mkdir $coredir
  5046.   cp confdefs.h $coredir/confdefs.h
  5047.   mv conftest.c $coredir/conftest.c
  5048.   mv conftest $coredir/conftest
  5049.   mv core $coredir/core
  5050.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5051. fi
  5052. rm -f conftest*
  5053. echo "#define" SETITIMER_CONST "$x" >> confdefs.h
  5054. DEFS="$DEFS -DSETITIMER_CONST=$x"
  5055. SEDDEFS="${SEDDEFS}\${SEDdA}SETITIMER_CONST\${SEDdB}SETITIMER_CONST\${SEDdC}$x\${SEDdD}
  5056. \${SEDuA}SETITIMER_CONST\${SEDuB}SETITIMER_CONST\${SEDuC}$x\${SEDuD}
  5057. \${SEDeA}SETITIMER_CONST\${SEDeB}SETITIMER_CONST\${SEDeC}$x\${SEDeD}
  5058. \${SEDfA}SETITIMER_CONST\${SEDfB}SETITIMER_CONST\${SEDfC}$x\${SEDfD}
  5059. "
  5060. ac_proto=`echo "extern int setitimer (int, $x struct itimerval *, struct itimerval *);" | tr -s ' ' | sed -e 's/( /(/g'`
  5061. echo "${ac_t}${ac_tt}${ac_proto}"
  5062. fi
  5063.  
  5064.                       echo $ac_n "checking for usleep""... $ac_c"
  5065. cat > conftest.c <<EOF
  5066. #include "confdefs.h"
  5067. #include <ctype.h>
  5068. #ifdef __cplusplus
  5069. extern "C" char usleep();
  5070. #endif
  5071. int main() { exit(0); }
  5072. int t() { 
  5073. /* The GNU C library defines this for functions which it implements
  5074.     to always fail with ENOSYS.  Some functions are actually named
  5075.     something starting with __ and the normal name is an alias.  */
  5076. #if defined (__stub_usleep) || defined (__stub___usleep)
  5077. choke me
  5078. #else
  5079. #ifndef __cplusplus
  5080. /* Override any gcc2 internal prototype to avoid an error.  */
  5081. extern char usleep();
  5082. #endif
  5083. usleep();
  5084. #endif
  5085.  }
  5086. EOF
  5087. if eval $compile; then
  5088.   echo "${ac_t}yes"
  5089.   echo "#define" HAVE_USLEEP "1" >> confdefs.h
  5090. DEFS="$DEFS -DHAVE_USLEEP=1"
  5091. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_USLEEP\${SEDdB}HAVE_USLEEP\${SEDdC}1\${SEDdD}
  5092. \${SEDuA}HAVE_USLEEP\${SEDuB}HAVE_USLEEP\${SEDuC}1\${SEDuD}
  5093. \${SEDeA}HAVE_USLEEP\${SEDeB}HAVE_USLEEP\${SEDeC}1\${SEDeD}
  5094. \${SEDfA}HAVE_USLEEP\${SEDfB}HAVE_USLEEP\${SEDfC}1\${SEDfD}
  5095. "
  5096. else
  5097.   echo "${ac_t}no"
  5098.   :
  5099. fi
  5100. rm -f conftest*
  5101.  
  5102.  
  5103.                       echo $ac_n "checking for localtime declaration""... $ac_c"
  5104. cat > conftest.c <<EOF
  5105. #include "confdefs.h"
  5106.  
  5107. #ifdef STDC_HEADERS
  5108. #include <stdlib.h>
  5109. #endif
  5110. #ifdef HAVE_UNISTD_H
  5111. #include <unistd.h>
  5112. #endif
  5113. #ifdef TM_IN_SYS_TIME
  5114. #include <sys/time.h>
  5115. #else
  5116. #include <time.h>
  5117. #endif
  5118. extern
  5119. #ifdef __cplusplus
  5120. "C"
  5121. #endif
  5122. #ifdef __STDC__
  5123. struct tm * localtime (time_t* clock);
  5124. #else
  5125. struct tm * localtime();
  5126. #endif
  5127. main() { exit(0); }
  5128. EOF
  5129. eval $compile
  5130. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5131.   x=""
  5132. else
  5133.   x="const"
  5134. fi
  5135. if test -f core; then
  5136.   coredir=core`/bin/sh -c 'echo $$'`
  5137.   mkdir $coredir
  5138.   cp confdefs.h $coredir/confdefs.h
  5139.   mv conftest.c $coredir/conftest.c
  5140.   mv conftest $coredir/conftest
  5141.   mv core $coredir/core
  5142.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5143. fi
  5144. rm -f conftest*
  5145. echo "#define" LOCALTIME_CONST "$x" >> confdefs.h
  5146. DEFS="$DEFS -DLOCALTIME_CONST=$x"
  5147. SEDDEFS="${SEDDEFS}\${SEDdA}LOCALTIME_CONST\${SEDdB}LOCALTIME_CONST\${SEDdC}$x\${SEDdD}
  5148. \${SEDuA}LOCALTIME_CONST\${SEDuB}LOCALTIME_CONST\${SEDuC}$x\${SEDuD}
  5149. \${SEDeA}LOCALTIME_CONST\${SEDeB}LOCALTIME_CONST\${SEDeC}$x\${SEDeD}
  5150. \${SEDfA}LOCALTIME_CONST\${SEDfB}LOCALTIME_CONST\${SEDfC}$x\${SEDfD}
  5151. "
  5152. ac_proto=`echo "extern struct tm * localtime ($x time_t*);" | tr -s ' ' | sed -e 's/( /(/g'`
  5153. echo "${ac_t}${ac_tt}${ac_proto}"
  5154.  
  5155.                       for func in gettimeofday
  5156. do
  5157. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  5158. echo $ac_n "checking for ${func}""... $ac_c"
  5159. cat > conftest.c <<EOF
  5160. #include "confdefs.h"
  5161. #include <ctype.h>
  5162. #ifdef __cplusplus
  5163. extern "C" char ${func}();
  5164. #endif
  5165. int main() { exit(0); }
  5166. int t() { 
  5167. /* The GNU C library defines this for functions which it implements
  5168.     to always fail with ENOSYS.  Some functions are actually named
  5169.     something starting with __ and the normal name is an alias.  */
  5170. #if defined (__stub_${func}) || defined (__stub___${func})
  5171. choke me
  5172. #else
  5173. #ifndef __cplusplus
  5174. /* Override any gcc2 internal prototype to avoid an error.  */
  5175. extern char ${func}();
  5176. #endif
  5177. ${func}();
  5178. #endif
  5179.  }
  5180. EOF
  5181. if eval $compile; then
  5182.   echo "${ac_t}yes"
  5183.   echo "#define" ${trfunc} "1" >> confdefs.h
  5184. DEFS="$DEFS -D${trfunc}=1"
  5185. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  5186. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  5187. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  5188. \${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
  5189. "
  5190. else
  5191.   echo "${ac_t}no"
  5192.   :
  5193. fi
  5194. rm -f conftest*
  5195. done
  5196. case "$DEFS" in
  5197.   *HAVE_GETTIMEOFDAY*)
  5198. echo $ac_n "checking for gettimeofday declaration""... $ac_c"
  5199. cat > conftest.c <<EOF
  5200. #include "confdefs.h"
  5201.  
  5202. #include <sys/types.h>
  5203. #include <sys/time.h>
  5204. extern
  5205. #ifdef __cplusplus
  5206. "C"
  5207. #endif
  5208. #ifdef __STDC__
  5209. int gettimeofday (struct timeval * tp, struct timezone * tzp);
  5210. #else
  5211. int gettimeofday();
  5212. #endif
  5213. main() { exit(0); }
  5214. EOF
  5215. eval $compile
  5216. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5217.   ac_proto=`echo "extern int gettimeofday (struct timeval *, struct timezone *);" | tr -s ' ' | sed -e 's/( /(/g'`
  5218. echo "${ac_t}${ac_tt}${ac_proto}"
  5219. else
  5220.   ac_proto=`echo "extern int gettimeofday (struct timeval *, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
  5221. echo "${ac_t}${ac_tt}${ac_proto}"
  5222. echo "#define" GETTIMEOFDAY_DOTS "1" >> confdefs.h
  5223. DEFS="$DEFS -DGETTIMEOFDAY_DOTS=1"
  5224. SEDDEFS="${SEDDEFS}\${SEDdA}GETTIMEOFDAY_DOTS\${SEDdB}GETTIMEOFDAY_DOTS\${SEDdC}1\${SEDdD}
  5225. \${SEDuA}GETTIMEOFDAY_DOTS\${SEDuB}GETTIMEOFDAY_DOTS\${SEDuC}1\${SEDuD}
  5226. \${SEDeA}GETTIMEOFDAY_DOTS\${SEDeB}GETTIMEOFDAY_DOTS\${SEDeC}1\${SEDeD}
  5227. \${SEDfA}GETTIMEOFDAY_DOTS\${SEDfB}GETTIMEOFDAY_DOTS\${SEDfC}1\${SEDfD}
  5228. "
  5229. fi
  5230. if test -f core; then
  5231.   coredir=core`/bin/sh -c 'echo $$'`
  5232.   mkdir $coredir
  5233.   cp confdefs.h $coredir/confdefs.h
  5234.   mv conftest.c $coredir/conftest.c
  5235.   mv conftest $coredir/conftest
  5236.   mv core $coredir/core
  5237.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5238. fi
  5239. rm -f conftest*
  5240.   ;;
  5241.   *) ;;
  5242. esac
  5243.  
  5244.                       for func in ftime
  5245. do
  5246. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  5247. echo $ac_n "checking for ${func}""... $ac_c"
  5248. cat > conftest.c <<EOF
  5249. #include "confdefs.h"
  5250. #include <ctype.h>
  5251. #ifdef __cplusplus
  5252. extern "C" char ${func}();
  5253. #endif
  5254. int main() { exit(0); }
  5255. int t() { 
  5256. /* The GNU C library defines this for functions which it implements
  5257.     to always fail with ENOSYS.  Some functions are actually named
  5258.     something starting with __ and the normal name is an alias.  */
  5259. #if defined (__stub_${func}) || defined (__stub___${func})
  5260. choke me
  5261. #else
  5262. #ifndef __cplusplus
  5263. /* Override any gcc2 internal prototype to avoid an error.  */
  5264. extern char ${func}();
  5265. #endif
  5266. ${func}();
  5267. #endif
  5268.  }
  5269. EOF
  5270. if eval $compile; then
  5271.   echo "${ac_t}yes"
  5272.   echo "#define" ${trfunc} "1" >> confdefs.h
  5273. DEFS="$DEFS -D${trfunc}=1"
  5274. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  5275. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  5276. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  5277. \${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
  5278. "
  5279. else
  5280.   echo "${ac_t}no"
  5281.   :
  5282. fi
  5283. rm -f conftest*
  5284. done
  5285.  
  5286.                       case "$DEFS" in
  5287.   *HAVE_GETTIMEOFDAY*) ;;
  5288.   *HAVE_FTIME*) ;;
  5289.   *)
  5290. echo $ac_n "checking for times""... $ac_c"
  5291. cat > conftest.c <<EOF
  5292. #include "confdefs.h"
  5293. #include <ctype.h>
  5294. #ifdef __cplusplus
  5295. extern "C" char times();
  5296. #endif
  5297. int main() { exit(0); }
  5298. int t() { 
  5299. /* The GNU C library defines this for functions which it implements
  5300.     to always fail with ENOSYS.  Some functions are actually named
  5301.     something starting with __ and the normal name is an alias.  */
  5302. #if defined (__stub_times) || defined (__stub___times)
  5303. choke me
  5304. #else
  5305. #ifndef __cplusplus
  5306. /* Override any gcc2 internal prototype to avoid an error.  */
  5307. extern char times();
  5308. #endif
  5309. times();
  5310. #endif
  5311.  }
  5312. EOF
  5313. if eval $compile; then
  5314.   echo "${ac_t}yes"
  5315.   :
  5316. else
  5317.   echo "${ac_t}no"
  5318.   no_times=1
  5319. fi
  5320. rm -f conftest*
  5321. if test -z "$no_times"; then
  5322. echo $ac_n "checking for times return value""... $ac_c"
  5323. cat > conftest.c <<EOF
  5324. #include "confdefs.h"
  5325.  
  5326. #include <sys/types.h>
  5327. #include <time.h> /* needed for CLK_TCK */
  5328. #ifndef CLK_TCK
  5329. #include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
  5330. #endif
  5331. #include <sys/times.h>
  5332. main ()
  5333. { struct tms buffer;
  5334.   clock_t result1;
  5335.   clock_t result2;
  5336.   int ticks;
  5337.   result1 = times(&buffer);
  5338.   if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(1);
  5339.   sleep(1);
  5340.   result2 = times(&buffer);
  5341.   if ((result2 == (clock_t)0) || (result2 == (clock_t)(-1))) exit(1);
  5342.   ticks = result2 - result1;
  5343.   exit(!((ticks >= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2)));
  5344. }
  5345. EOF
  5346. eval $compile
  5347. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5348.   echo "${ac_t}yes"
  5349. echo "#define" HAVE_TIMES_CLOCK "1" >> confdefs.h
  5350. DEFS="$DEFS -DHAVE_TIMES_CLOCK=1"
  5351. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TIMES_CLOCK\${SEDdB}HAVE_TIMES_CLOCK\${SEDdC}1\${SEDdD}
  5352. \${SEDuA}HAVE_TIMES_CLOCK\${SEDuB}HAVE_TIMES_CLOCK\${SEDuC}1\${SEDuD}
  5353. \${SEDeA}HAVE_TIMES_CLOCK\${SEDeB}HAVE_TIMES_CLOCK\${SEDeC}1\${SEDeD}
  5354. \${SEDfA}HAVE_TIMES_CLOCK\${SEDfB}HAVE_TIMES_CLOCK\${SEDfC}1\${SEDfD}
  5355. "
  5356. else
  5357.   echo "${ac_t}no"
  5358. fi
  5359. if test -f core; then
  5360.   coredir=core`/bin/sh -c 'echo $$'`
  5361.   mkdir $coredir
  5362.   cp confdefs.h $coredir/confdefs.h
  5363.   mv conftest.c $coredir/conftest.c
  5364.   mv conftest $coredir/conftest
  5365.   mv core $coredir/core
  5366.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5367. fi
  5368. rm -f conftest*
  5369. fi
  5370.   ;;
  5371. esac
  5372.  
  5373.                       echo $ac_n "checking for getpwnam declaration""... $ac_c"
  5374. cat > conftest.c <<EOF
  5375. #include "confdefs.h"
  5376.  
  5377. #ifdef STDC_HEADERS
  5378. #include <stdlib.h>
  5379. #endif
  5380. #ifdef HAVE_UNISTD_H
  5381. #include <unistd.h>
  5382. #endif
  5383. #include <pwd.h>
  5384. extern
  5385. #ifdef __cplusplus
  5386. "C"
  5387. #endif
  5388. #ifdef __STDC__
  5389. struct passwd * getpwnam (char* name);
  5390. #else
  5391. struct passwd * getpwnam();
  5392. #endif
  5393. main() { exit(0); }
  5394. EOF
  5395. eval $compile
  5396. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5397.   x=""
  5398. else
  5399.   x="const"
  5400. fi
  5401. if test -f core; then
  5402.   coredir=core`/bin/sh -c 'echo $$'`
  5403.   mkdir $coredir
  5404.   cp confdefs.h $coredir/confdefs.h
  5405.   mv conftest.c $coredir/conftest.c
  5406.   mv conftest $coredir/conftest
  5407.   mv core $coredir/core
  5408.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5409. fi
  5410. rm -f conftest*
  5411. echo "#define" GETPWNAM_CONST "$x" >> confdefs.h
  5412. DEFS="$DEFS -DGETPWNAM_CONST=$x"
  5413. SEDDEFS="${SEDDEFS}\${SEDdA}GETPWNAM_CONST\${SEDdB}GETPWNAM_CONST\${SEDdC}$x\${SEDdD}
  5414. \${SEDuA}GETPWNAM_CONST\${SEDuB}GETPWNAM_CONST\${SEDuC}$x\${SEDuD}
  5415. \${SEDeA}GETPWNAM_CONST\${SEDeB}GETPWNAM_CONST\${SEDeC}$x\${SEDeD}
  5416. \${SEDfA}GETPWNAM_CONST\${SEDfB}GETPWNAM_CONST\${SEDfC}$x\${SEDfD}
  5417. "
  5418. ac_proto=`echo "extern struct passwd * getpwnam ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  5419. echo "${ac_t}${ac_tt}${ac_proto}"
  5420.  
  5421.                       echo $ac_n "checking for getpwuid declaration""... $ac_c"
  5422. cat > conftest.c <<EOF
  5423. #include "confdefs.h"
  5424.  
  5425. #ifdef STDC_HEADERS
  5426. #include <stdlib.h>
  5427. #endif
  5428. #ifdef HAVE_UNISTD_H
  5429. #include <unistd.h>
  5430. #endif
  5431. #include <pwd.h>
  5432. extern
  5433. #ifdef __cplusplus
  5434. "C"
  5435. #endif
  5436. #ifdef __STDC__
  5437. struct passwd * getpwuid (uid_t uid);
  5438. #else
  5439. struct passwd * getpwuid();
  5440. #endif
  5441. main() { exit(0); }
  5442. EOF
  5443. eval $compile
  5444. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5445.   x="uid_t"
  5446. else
  5447.   x="int"
  5448. fi
  5449. if test -f core; then
  5450.   coredir=core`/bin/sh -c 'echo $$'`
  5451.   mkdir $coredir
  5452.   cp confdefs.h $coredir/confdefs.h
  5453.   mv conftest.c $coredir/conftest.c
  5454.   mv conftest $coredir/conftest
  5455.   mv core $coredir/core
  5456.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5457. fi
  5458. rm -f conftest*
  5459. echo "#define" GETPWUID_UID_T "$x" >> confdefs.h
  5460. DEFS="$DEFS -DGETPWUID_UID_T=$x"
  5461. SEDDEFS="${SEDDEFS}\${SEDdA}GETPWUID_UID_T\${SEDdB}GETPWUID_UID_T\${SEDdC}$x\${SEDdD}
  5462. \${SEDuA}GETPWUID_UID_T\${SEDuB}GETPWUID_UID_T\${SEDuC}$x\${SEDuD}
  5463. \${SEDeA}GETPWUID_UID_T\${SEDeB}GETPWUID_UID_T\${SEDeC}$x\${SEDeD}
  5464. \${SEDfA}GETPWUID_UID_T\${SEDfB}GETPWUID_UID_T\${SEDfC}$x\${SEDfD}
  5465. "
  5466. ac_proto=`echo "extern struct passwd * getpwuid ($x);" | tr -s ' ' | sed -e 's/( /(/g'`
  5467. echo "${ac_t}${ac_tt}${ac_proto}"
  5468.  
  5469.                       echo $ac_n "checking for gethostname""... $ac_c"
  5470. cat > conftest.c <<EOF
  5471. #include "confdefs.h"
  5472. #include <ctype.h>
  5473. #ifdef __cplusplus
  5474. extern "C" char gethostname();
  5475. #endif
  5476. int main() { exit(0); }
  5477. int t() { 
  5478. /* The GNU C library defines this for functions which it implements
  5479.     to always fail with ENOSYS.  Some functions are actually named
  5480.     something starting with __ and the normal name is an alias.  */
  5481. #if defined (__stub_gethostname) || defined (__stub___gethostname)
  5482. choke me
  5483. #else
  5484. #ifndef __cplusplus
  5485. /* Override any gcc2 internal prototype to avoid an error.  */
  5486. extern char gethostname();
  5487. #endif
  5488. gethostname();
  5489. #endif
  5490.  }
  5491. EOF
  5492. if eval $compile; then
  5493.   echo "${ac_t}yes"
  5494.   echo "#define" HAVE_GETHOSTNAME "1" >> confdefs.h
  5495. DEFS="$DEFS -DHAVE_GETHOSTNAME=1"
  5496. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETHOSTNAME\${SEDdB}HAVE_GETHOSTNAME\${SEDdC}1\${SEDdD}
  5497. \${SEDuA}HAVE_GETHOSTNAME\${SEDuB}HAVE_GETHOSTNAME\${SEDuC}1\${SEDuD}
  5498. \${SEDeA}HAVE_GETHOSTNAME\${SEDeB}HAVE_GETHOSTNAME\${SEDeC}1\${SEDeD}
  5499. \${SEDfA}HAVE_GETHOSTNAME\${SEDfB}HAVE_GETHOSTNAME\${SEDfC}1\${SEDfD}
  5500. "
  5501. have_gethostname=1
  5502. else
  5503.   echo "${ac_t}no"
  5504.   :
  5505. fi
  5506. rm -f conftest*
  5507. if test -n "$have_gethostname"; then
  5508. echo $ac_n "checking for gethostname declaration""... $ac_c"
  5509. cat > conftest.c <<EOF
  5510. #include "confdefs.h"
  5511.  
  5512. #ifdef STDC_HEADERS
  5513. #include <stdlib.h>
  5514. #endif
  5515. #ifdef HAVE_UNISTD_H
  5516. #include <unistd.h>
  5517. #endif
  5518. extern
  5519. #ifdef __cplusplus
  5520. "C"
  5521. #endif
  5522. #ifdef __STDC__
  5523. int gethostname (char* name, int namelen);
  5524. #else
  5525. int gethostname();
  5526. #endif
  5527. main() { exit(0); }
  5528. EOF
  5529. eval $compile
  5530. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5531.   x="int"
  5532. else
  5533.   x="size_t"
  5534. fi
  5535. if test -f core; then
  5536.   coredir=core`/bin/sh -c 'echo $$'`
  5537.   mkdir $coredir
  5538.   cp confdefs.h $coredir/confdefs.h
  5539.   mv conftest.c $coredir/conftest.c
  5540.   mv conftest $coredir/conftest
  5541.   mv core $coredir/core
  5542.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5543. fi
  5544. rm -f conftest*
  5545. echo "#define" GETHOSTNAME_SIZE_T "$x" >> confdefs.h
  5546. DEFS="$DEFS -DGETHOSTNAME_SIZE_T=$x"
  5547. SEDDEFS="${SEDDEFS}\${SEDdA}GETHOSTNAME_SIZE_T\${SEDdB}GETHOSTNAME_SIZE_T\${SEDdC}$x\${SEDdD}
  5548. \${SEDuA}GETHOSTNAME_SIZE_T\${SEDuB}GETHOSTNAME_SIZE_T\${SEDuC}$x\${SEDuD}
  5549. \${SEDeA}GETHOSTNAME_SIZE_T\${SEDeB}GETHOSTNAME_SIZE_T\${SEDeC}$x\${SEDeD}
  5550. \${SEDfA}GETHOSTNAME_SIZE_T\${SEDfB}GETHOSTNAME_SIZE_T\${SEDfC}$x\${SEDfD}
  5551. "
  5552. ac_proto=`echo "extern int gethostname (char*, $x);" | tr -s ' ' | sed -e 's/( /(/g'`
  5553. echo "${ac_t}${ac_tt}${ac_proto}"
  5554. fi
  5555.  
  5556.                       case "$DEFS" in
  5557.   *HAVE_NETDB_H*) have_netdb=1 ;;
  5558.   *) echo $ac_n "checking for sun/netdb.h""... $ac_c"
  5559. cat > conftest.c <<EOF
  5560. #include "confdefs.h"
  5561. #include <sun/netdb.h>
  5562. EOF
  5563. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  5564. if test -z "$err"; then
  5565.   echo "${ac_t}yes"
  5566. have_netdb=1
  5567. else
  5568.   echo "${ac_t}no"
  5569.  
  5570. fi
  5571. rm -f conftest*
  5572.  ;;
  5573. esac
  5574. if test -n "$have_netdb"; then
  5575. echo "#define" HAVE_GETHOSTBYNAME "1" >> confdefs.h
  5576. DEFS="$DEFS -DHAVE_GETHOSTBYNAME=1"
  5577. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETHOSTBYNAME\${SEDdB}HAVE_GETHOSTBYNAME\${SEDdC}1\${SEDdD}
  5578. \${SEDuA}HAVE_GETHOSTBYNAME\${SEDuB}HAVE_GETHOSTBYNAME\${SEDuC}1\${SEDuD}
  5579. \${SEDeA}HAVE_GETHOSTBYNAME\${SEDeB}HAVE_GETHOSTBYNAME\${SEDeC}1\${SEDeD}
  5580. \${SEDfA}HAVE_GETHOSTBYNAME\${SEDfB}HAVE_GETHOSTBYNAME\${SEDfC}1\${SEDfD}
  5581. "
  5582. echo $ac_n "checking for gethostbyname declaration""... $ac_c"
  5583. cat > conftest.c <<EOF
  5584. #include "confdefs.h"
  5585.  
  5586. #ifdef STDC_HEADERS
  5587. #include <stdlib.h>
  5588. #endif
  5589. #ifdef HAVE_UNISTD_H
  5590. #include <unistd.h>
  5591. #endif
  5592. #include <sys/types.h>
  5593. #ifdef HAVE_NETDB_H
  5594. #include <sys/socket.h>
  5595. #include <netdb.h>
  5596. #else
  5597. #include <sun/netdb.h>
  5598. #endif
  5599. extern
  5600. #ifdef __cplusplus
  5601. "C"
  5602. #endif
  5603. #ifdef __STDC__
  5604. struct hostent * gethostbyname (char* name);
  5605. #else
  5606. struct hostent * gethostbyname();
  5607. #endif
  5608. main() { exit(0); }
  5609. EOF
  5610. eval $compile
  5611. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5612.   x=""
  5613. else
  5614.   x="const"
  5615. fi
  5616. if test -f core; then
  5617.   coredir=core`/bin/sh -c 'echo $$'`
  5618.   mkdir $coredir
  5619.   cp confdefs.h $coredir/confdefs.h
  5620.   mv conftest.c $coredir/conftest.c
  5621.   mv conftest $coredir/conftest
  5622.   mv core $coredir/core
  5623.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5624. fi
  5625. rm -f conftest*
  5626. echo "#define" GETHOSTBYNAME_CONST "$x" >> confdefs.h
  5627. DEFS="$DEFS -DGETHOSTBYNAME_CONST=$x"
  5628. SEDDEFS="${SEDDEFS}\${SEDdA}GETHOSTBYNAME_CONST\${SEDdB}GETHOSTBYNAME_CONST\${SEDdC}$x\${SEDdD}
  5629. \${SEDuA}GETHOSTBYNAME_CONST\${SEDuB}GETHOSTBYNAME_CONST\${SEDuC}$x\${SEDuD}
  5630. \${SEDeA}GETHOSTBYNAME_CONST\${SEDeB}GETHOSTBYNAME_CONST\${SEDeC}$x\${SEDeD}
  5631. \${SEDfA}GETHOSTBYNAME_CONST\${SEDfB}GETHOSTBYNAME_CONST\${SEDfC}$x\${SEDfD}
  5632. "
  5633. ac_proto=`echo "extern struct hostent * gethostbyname ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  5634. echo "${ac_t}${ac_tt}${ac_proto}"
  5635. fi
  5636.  
  5637.                       echo $ac_n "checking for connect declaration""... $ac_c"
  5638. for x in '' 'const'; do
  5639. for y in 'struct sockaddr *' 'void*'; do
  5640. if test -z "$have_connect"; then
  5641. cat > conftest.c <<EOF
  5642. #include "confdefs.h"
  5643.  
  5644. #ifdef HAVE_UNISTD_H
  5645. #include <unistd.h>
  5646. #endif
  5647. #include <sys/types.h>
  5648. #include <sys/socket.h>
  5649. extern
  5650. #ifdef __cplusplus
  5651. "C"
  5652. #endif
  5653. #ifdef __STDC__
  5654. int connect (int fd, $x $y name, int namelen);
  5655. #else
  5656. int connect();
  5657. #endif
  5658. main() { exit(0); }
  5659. EOF
  5660. eval $compile
  5661. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5662.   echo "#define" CONNECT_CONST "$x" >> confdefs.h
  5663. DEFS="$DEFS -DCONNECT_CONST=$x"
  5664. SEDDEFS="${SEDDEFS}\${SEDdA}CONNECT_CONST\${SEDdB}CONNECT_CONST\${SEDdC}$x\${SEDdD}
  5665. \${SEDuA}CONNECT_CONST\${SEDuB}CONNECT_CONST\${SEDuC}$x\${SEDuD}
  5666. \${SEDeA}CONNECT_CONST\${SEDeB}CONNECT_CONST\${SEDeC}$x\${SEDeD}
  5667. \${SEDfA}CONNECT_CONST\${SEDfB}CONNECT_CONST\${SEDfC}$x\${SEDfD}
  5668. "
  5669. echo "#define" CONNECT_NAME_T "$y" >> confdefs.h
  5670. DEFS="$DEFS -DCONNECT_NAME_T=$y"
  5671. SEDDEFS="${SEDDEFS}\${SEDdA}CONNECT_NAME_T\${SEDdB}CONNECT_NAME_T\${SEDdC}$y\${SEDdD}
  5672. \${SEDuA}CONNECT_NAME_T\${SEDuB}CONNECT_NAME_T\${SEDuC}$y\${SEDuD}
  5673. \${SEDeA}CONNECT_NAME_T\${SEDeB}CONNECT_NAME_T\${SEDeC}$y\${SEDeD}
  5674. \${SEDfA}CONNECT_NAME_T\${SEDfB}CONNECT_NAME_T\${SEDfC}$y\${SEDfD}
  5675. "
  5676. ac_proto=`echo "extern int connect (int, $x $y, int);" | tr -s ' ' | sed -e 's/( /(/g'`
  5677. echo "${ac_t}${ac_tt}${ac_proto}"
  5678. have_connect=1
  5679. fi
  5680. if test -f core; then
  5681.   coredir=core`/bin/sh -c 'echo $$'`
  5682.   mkdir $coredir
  5683.   cp confdefs.h $coredir/confdefs.h
  5684.   mv conftest.c $coredir/conftest.c
  5685.   mv conftest $coredir/conftest
  5686.   mv core $coredir/core
  5687.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5688. fi
  5689. rm -f conftest*
  5690. fi
  5691. done
  5692. done
  5693.  
  5694.                       for hdr in sys/un.h
  5695. do
  5696. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  5697. echo $ac_n "checking for ${hdr}""... $ac_c"
  5698. cat > conftest.c <<EOF
  5699. #include "confdefs.h"
  5700. #include <${hdr}>
  5701. EOF
  5702. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  5703. if test -z "$err"; then
  5704.   echo "${ac_t}yes"
  5705. echo "#define" ${trhdr} "1" >> confdefs.h
  5706. DEFS="$DEFS -D${trhdr}=1"
  5707. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  5708. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  5709. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  5710. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  5711. "
  5712. else
  5713.   echo "${ac_t}no"
  5714.  
  5715. fi
  5716. rm -f conftest*
  5717. done
  5718. case "$DEFS" in
  5719.   *HAVE_SYS_UN_H*)
  5720. echo $ac_n "checking for sun_len in struct sockaddr_un""... $ac_c"
  5721. cat > conftest.c <<EOF
  5722. #include "confdefs.h"
  5723. #include <sys/types.h> /* NetBSD 1.0 needs this */
  5724. #include <sys/un.h>
  5725. int main() { exit(0); }
  5726. int t() { struct sockaddr_un unaddr; unaddr.sun_len; }
  5727. EOF
  5728. if eval $compile; then
  5729.   echo "${ac_t}yes"
  5730.   echo "#define" HAVE_SOCKADDR_UN_LEN "1" >> confdefs.h
  5731. DEFS="$DEFS -DHAVE_SOCKADDR_UN_LEN=1"
  5732. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SOCKADDR_UN_LEN\${SEDdB}HAVE_SOCKADDR_UN_LEN\${SEDdC}1\${SEDdD}
  5733. \${SEDuA}HAVE_SOCKADDR_UN_LEN\${SEDuB}HAVE_SOCKADDR_UN_LEN\${SEDuC}1\${SEDuD}
  5734. \${SEDeA}HAVE_SOCKADDR_UN_LEN\${SEDeB}HAVE_SOCKADDR_UN_LEN\${SEDeC}1\${SEDeD}
  5735. \${SEDfA}HAVE_SOCKADDR_UN_LEN\${SEDfB}HAVE_SOCKADDR_UN_LEN\${SEDfC}1\${SEDfD}
  5736. "
  5737. else
  5738.   echo "${ac_t}no"
  5739.   :
  5740. fi
  5741. rm -f conftest*
  5742.   ;;
  5743.   *) ;;
  5744. esac
  5745.  
  5746.                       for hdr in netinet/in.h arpa/inet.h
  5747. do
  5748. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  5749. echo $ac_n "checking for ${hdr}""... $ac_c"
  5750. cat > conftest.c <<EOF
  5751. #include "confdefs.h"
  5752. #include <${hdr}>
  5753. EOF
  5754. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  5755. if test -z "$err"; then
  5756.   echo "${ac_t}yes"
  5757. echo "#define" ${trhdr} "1" >> confdefs.h
  5758. DEFS="$DEFS -D${trhdr}=1"
  5759. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  5760. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  5761. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  5762. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  5763. "
  5764. else
  5765.   echo "${ac_t}no"
  5766.  
  5767. fi
  5768. rm -f conftest*
  5769. done
  5770. echo $ac_n "checking for inet_addr declaration""... $ac_c"
  5771. cat > conftest.c <<EOF
  5772. #include "confdefs.h"
  5773.  
  5774. #ifdef HAVE_UNISTD_H
  5775. #include <unistd.h>
  5776. #endif
  5777. #include <sys/types.h>
  5778. #include <netinet/in.h>
  5779. #ifdef HAVE_ARPA_INET_H
  5780. #include <arpa/inet.h>
  5781. #endif
  5782. extern
  5783. #ifdef __cplusplus
  5784. "C"
  5785. #endif
  5786. struct in_addr inet_addr();
  5787. main() { exit(0); }
  5788. EOF
  5789. eval $compile
  5790. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5791.   ret_inet_addr_type="struct in_addr"
  5792. echo "#define" INET_ADDR_SUFFIX ".s_addr" >> confdefs.h
  5793. DEFS="$DEFS -DINET_ADDR_SUFFIX=.s_addr"
  5794. SEDDEFS="${SEDDEFS}\${SEDdA}INET_ADDR_SUFFIX\${SEDdB}INET_ADDR_SUFFIX\${SEDdC}.s_addr\${SEDdD}
  5795. \${SEDuA}INET_ADDR_SUFFIX\${SEDuB}INET_ADDR_SUFFIX\${SEDuC}.s_addr\${SEDuD}
  5796. \${SEDeA}INET_ADDR_SUFFIX\${SEDeB}INET_ADDR_SUFFIX\${SEDeC}.s_addr\${SEDeD}
  5797. \${SEDfA}INET_ADDR_SUFFIX\${SEDfB}INET_ADDR_SUFFIX\${SEDfC}.s_addr\${SEDfD}
  5798. "
  5799. have_inet_addr=1
  5800. fi
  5801. if test -f core; then
  5802.   coredir=core`/bin/sh -c 'echo $$'`
  5803.   mkdir $coredir
  5804.   cp confdefs.h $coredir/confdefs.h
  5805.   mv conftest.c $coredir/conftest.c
  5806.   mv conftest $coredir/conftest
  5807.   mv core $coredir/core
  5808.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5809. fi
  5810. rm -f conftest*
  5811. if test -z "$have_inet_addr"; then
  5812. cat > conftest.c <<EOF
  5813. #include "confdefs.h"
  5814.  
  5815. #ifdef HAVE_UNISTD_H
  5816. #include <unistd.h>
  5817. #endif
  5818. #include <sys/types.h>
  5819. #include <netinet/in.h>
  5820. #ifdef HAVE_ARPA_INET_H
  5821. #include <arpa/inet.h>
  5822. #endif
  5823. extern
  5824. #ifdef __cplusplus
  5825. "C"
  5826. #endif
  5827. unsigned long inet_addr();
  5828. main() { exit(0); }
  5829. EOF
  5830. eval $compile
  5831. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5832.   ret_inet_addr_type="unsigned long"
  5833. else
  5834.   ret_inet_addr_type="unsigned int"
  5835. fi
  5836. if test -f core; then
  5837.   coredir=core`/bin/sh -c 'echo $$'`
  5838.   mkdir $coredir
  5839.   cp confdefs.h $coredir/confdefs.h
  5840.   mv conftest.c $coredir/conftest.c
  5841.   mv conftest $coredir/conftest
  5842.   mv core $coredir/core
  5843.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5844. fi
  5845. rm -f conftest*
  5846. echo "#define" INET_ADDR_SUFFIX "" >> confdefs.h
  5847. DEFS="$DEFS -DINET_ADDR_SUFFIX="
  5848. SEDDEFS="${SEDDEFS}\${SEDdA}INET_ADDR_SUFFIX\${SEDdB}INET_ADDR_SUFFIX\${SEDdC}\${SEDdD}
  5849. \${SEDuA}INET_ADDR_SUFFIX\${SEDuB}INET_ADDR_SUFFIX\${SEDuC}\${SEDuD}
  5850. \${SEDeA}INET_ADDR_SUFFIX\${SEDeB}INET_ADDR_SUFFIX\${SEDeC}\${SEDeD}
  5851. \${SEDfA}INET_ADDR_SUFFIX\${SEDfB}INET_ADDR_SUFFIX\${SEDfC}\${SEDfD}
  5852. "
  5853. fi
  5854. echo "#define" RET_INET_ADDR_TYPE "$ret_inet_addr_type" >> confdefs.h
  5855. DEFS="$DEFS -DRET_INET_ADDR_TYPE=$ret_inet_addr_type"
  5856. SEDDEFS="${SEDDEFS}\${SEDdA}RET_INET_ADDR_TYPE\${SEDdB}RET_INET_ADDR_TYPE\${SEDdC}$ret_inet_addr_type\${SEDdD}
  5857. \${SEDuA}RET_INET_ADDR_TYPE\${SEDuB}RET_INET_ADDR_TYPE\${SEDuC}$ret_inet_addr_type\${SEDuD}
  5858. \${SEDeA}RET_INET_ADDR_TYPE\${SEDeB}RET_INET_ADDR_TYPE\${SEDeC}$ret_inet_addr_type\${SEDeD}
  5859. \${SEDfA}RET_INET_ADDR_TYPE\${SEDfB}RET_INET_ADDR_TYPE\${SEDfC}$ret_inet_addr_type\${SEDfD}
  5860. "
  5861. cat > conftest.c <<EOF
  5862. #include "confdefs.h"
  5863.  
  5864. #ifdef HAVE_UNISTD_H
  5865. #include <unistd.h>
  5866. #endif
  5867. #include <sys/types.h>
  5868. #include <netinet/in.h>
  5869. #ifdef HAVE_ARPA_INET_H
  5870. #include <arpa/inet.h>
  5871. #endif
  5872. extern
  5873. #ifdef __cplusplus
  5874. "C"
  5875. #endif
  5876. #ifdef __STDC__
  5877. RET_INET_ADDR_TYPE inet_addr (char* cp);
  5878. #else
  5879. RET_INET_ADDR_TYPE inet_addr();
  5880. #endif
  5881. main() { exit(0); }
  5882. EOF
  5883. eval $compile
  5884. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5885.   x=""
  5886. else
  5887.   x="const"
  5888. fi
  5889. if test -f core; then
  5890.   coredir=core`/bin/sh -c 'echo $$'`
  5891.   mkdir $coredir
  5892.   cp confdefs.h $coredir/confdefs.h
  5893.   mv conftest.c $coredir/conftest.c
  5894.   mv conftest $coredir/conftest
  5895.   mv core $coredir/core
  5896.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5897. fi
  5898. rm -f conftest*
  5899. echo "#define" INET_ADDR_CONST "$x" >> confdefs.h
  5900. DEFS="$DEFS -DINET_ADDR_CONST=$x"
  5901. SEDDEFS="${SEDDEFS}\${SEDdA}INET_ADDR_CONST\${SEDdB}INET_ADDR_CONST\${SEDdC}$x\${SEDdD}
  5902. \${SEDuA}INET_ADDR_CONST\${SEDuB}INET_ADDR_CONST\${SEDuC}$x\${SEDuD}
  5903. \${SEDeA}INET_ADDR_CONST\${SEDeB}INET_ADDR_CONST\${SEDeC}$x\${SEDeD}
  5904. \${SEDfA}INET_ADDR_CONST\${SEDfB}INET_ADDR_CONST\${SEDfC}$x\${SEDfD}
  5905. "
  5906. ac_proto=`echo "extern $ret_inet_addr_type inet_addr ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
  5907. echo "${ac_t}${ac_tt}${ac_proto}"
  5908. for hdr in netinet/tcp.h
  5909. do
  5910. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  5911. echo $ac_n "checking for ${hdr}""... $ac_c"
  5912. cat > conftest.c <<EOF
  5913. #include "confdefs.h"
  5914. #include <${hdr}>
  5915. EOF
  5916. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  5917. if test -z "$err"; then
  5918.   echo "${ac_t}yes"
  5919. echo "#define" ${trhdr} "1" >> confdefs.h
  5920. DEFS="$DEFS -D${trhdr}=1"
  5921. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  5922. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  5923. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  5924. \${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
  5925. "
  5926. else
  5927.   echo "${ac_t}no"
  5928.  
  5929. fi
  5930. rm -f conftest*
  5931. done
  5932.  
  5933.                       echo $ac_n "checking for getpagesize""... $ac_c"
  5934. cat > conftest.c <<EOF
  5935. #include "confdefs.h"
  5936.  
  5937. int main() { exit(0); }
  5938. int t() { getpagesize(); }
  5939. EOF
  5940. if eval $compile; then
  5941.   echo "${ac_t}yes"
  5942.   echo "#define" HAVE_GETPAGESIZE "1" >> confdefs.h
  5943. DEFS="$DEFS -DHAVE_GETPAGESIZE=1"
  5944. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETPAGESIZE\${SEDdB}HAVE_GETPAGESIZE\${SEDdC}1\${SEDdD}
  5945. \${SEDuA}HAVE_GETPAGESIZE\${SEDuB}HAVE_GETPAGESIZE\${SEDuC}1\${SEDuD}
  5946. \${SEDeA}HAVE_GETPAGESIZE\${SEDeB}HAVE_GETPAGESIZE\${SEDeC}1\${SEDeD}
  5947. \${SEDfA}HAVE_GETPAGESIZE\${SEDfB}HAVE_GETPAGESIZE\${SEDfC}1\${SEDfD}
  5948. "
  5949. have_getpagesize=1
  5950. else
  5951.   echo "${ac_t}no"
  5952.   :
  5953. fi
  5954. rm -f conftest*
  5955. if test -n "$have_getpagesize"; then
  5956. echo $ac_n "checking for getpagesize declaration""... $ac_c"
  5957. cat > conftest.c <<EOF
  5958. #include "confdefs.h"
  5959.  
  5960. #ifdef STDC_HEADERS
  5961. #include <stdlib.h>
  5962. #endif
  5963. #ifdef HAVE_UNISTD_H
  5964. #include <unistd.h>
  5965. #endif
  5966. extern
  5967. #ifdef __cplusplus
  5968. "C"
  5969. #endif
  5970. int getpagesize();
  5971. main() { exit(0); }
  5972. EOF
  5973. eval $compile
  5974. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  5975.   x="int"
  5976. else
  5977.   x="size_t"
  5978. fi
  5979. if test -f core; then
  5980.   coredir=core`/bin/sh -c 'echo $$'`
  5981.   mkdir $coredir
  5982.   cp confdefs.h $coredir/confdefs.h
  5983.   mv conftest.c $coredir/conftest.c
  5984.   mv conftest $coredir/conftest
  5985.   mv core $coredir/core
  5986.   echo "warning: test program dumped core -- see subdirectory $coredir"
  5987. fi
  5988. rm -f conftest*
  5989. echo "#define" RETGETPAGESIZETYPE "$x" >> confdefs.h
  5990. DEFS="$DEFS -DRETGETPAGESIZETYPE=$x"
  5991. SEDDEFS="${SEDDEFS}\${SEDdA}RETGETPAGESIZETYPE\${SEDdB}RETGETPAGESIZETYPE\${SEDdC}$x\${SEDdD}
  5992. \${SEDuA}RETGETPAGESIZETYPE\${SEDuB}RETGETPAGESIZETYPE\${SEDuC}$x\${SEDuD}
  5993. \${SEDeA}RETGETPAGESIZETYPE\${SEDeB}RETGETPAGESIZETYPE\${SEDeC}$x\${SEDeD}
  5994. \${SEDfA}RETGETPAGESIZETYPE\${SEDfB}RETGETPAGESIZETYPE\${SEDfC}$x\${SEDfD}
  5995. "
  5996. ac_proto=`echo "extern $x getpagesize (void);" | tr -s ' ' | sed -e 's/( /(/g'`
  5997. echo "${ac_t}${ac_tt}${ac_proto}"
  5998. fi
  5999.  
  6000.                       echo $ac_n "checking for vadvise""... $ac_c"
  6001. cat > conftest.c <<EOF
  6002. #include "confdefs.h"
  6003. #include <sys/vadvise.h>
  6004. int main() { exit(0); }
  6005. int t() { vadvise(0); }
  6006. EOF
  6007. if eval $compile; then
  6008.   echo "${ac_t}yes"
  6009.   echo "#define" HAVE_VADVISE "1" >> confdefs.h
  6010. DEFS="$DEFS -DHAVE_VADVISE=1"
  6011. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_VADVISE\${SEDdB}HAVE_VADVISE\${SEDdC}1\${SEDdD}
  6012. \${SEDuA}HAVE_VADVISE\${SEDuB}HAVE_VADVISE\${SEDuC}1\${SEDuD}
  6013. \${SEDeA}HAVE_VADVISE\${SEDeB}HAVE_VADVISE\${SEDeC}1\${SEDeD}
  6014. \${SEDfA}HAVE_VADVISE\${SEDfB}HAVE_VADVISE\${SEDfC}1\${SEDfD}
  6015. "
  6016. else
  6017.   echo "${ac_t}no"
  6018.   :
  6019. fi
  6020. rm -f conftest*
  6021.  
  6022.                       echo $ac_n "checking for vm_allocate""... $ac_c"
  6023. cat > conftest.c <<EOF
  6024. #include "confdefs.h"
  6025.  
  6026. int main() { exit(0); }
  6027. int t() { vm_allocate(); task_self(); }
  6028. EOF
  6029. if eval $compile; then
  6030.   echo "${ac_t}yes"
  6031.   echo "#define" HAVE_MACH_VM "1" >> confdefs.h
  6032. DEFS="$DEFS -DHAVE_MACH_VM=1"
  6033. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MACH_VM\${SEDdB}HAVE_MACH_VM\${SEDdC}1\${SEDdD}
  6034. \${SEDuA}HAVE_MACH_VM\${SEDuB}HAVE_MACH_VM\${SEDuC}1\${SEDuD}
  6035. \${SEDeA}HAVE_MACH_VM\${SEDeB}HAVE_MACH_VM\${SEDeC}1\${SEDeD}
  6036. \${SEDfA}HAVE_MACH_VM\${SEDfB}HAVE_MACH_VM\${SEDfC}1\${SEDfD}
  6037. "
  6038. else
  6039.   echo "${ac_t}no"
  6040.   :
  6041. fi
  6042. rm -f conftest*
  6043.  
  6044.                       echo $ac_n "checking for sys/mman.h""... $ac_c"
  6045. cat > conftest.c <<EOF
  6046. #include "confdefs.h"
  6047. #include <sys/mman.h>
  6048. EOF
  6049. err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
  6050. if test -z "$err"; then
  6051.   echo "${ac_t}yes"
  6052.  
  6053. else
  6054.   echo "${ac_t}no"
  6055. no_mmap=1
  6056. fi
  6057. rm -f conftest*
  6058. if test -z "$no_mmap"; then
  6059. echo $ac_n "checking for mmap""... $ac_c"
  6060. cat > conftest.c <<EOF
  6061. #include "confdefs.h"
  6062. #include <ctype.h>
  6063. #ifdef __cplusplus
  6064. extern "C" char mmap();
  6065. #endif
  6066. int main() { exit(0); }
  6067. int t() { 
  6068. /* The GNU C library defines this for functions which it implements
  6069.     to always fail with ENOSYS.  Some functions are actually named
  6070.     something starting with __ and the normal name is an alias.  */
  6071. #if defined (__stub_mmap) || defined (__stub___mmap)
  6072. choke me
  6073. #else
  6074. #ifndef __cplusplus
  6075. /* Override any gcc2 internal prototype to avoid an error.  */
  6076. extern char mmap();
  6077. #endif
  6078. mmap();
  6079. #endif
  6080.  }
  6081. EOF
  6082. if eval $compile; then
  6083.   echo "${ac_t}yes"
  6084.   :
  6085. else
  6086.   echo "${ac_t}no"
  6087.   no_mmap=1
  6088. fi
  6089. rm -f conftest*
  6090. if test -z "$no_mmap"; then
  6091. echo "#define" HAVE_MMAP "1" >> confdefs.h
  6092. DEFS="$DEFS -DHAVE_MMAP=1"
  6093. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP\${SEDdB}HAVE_MMAP\${SEDdC}1\${SEDdD}
  6094. \${SEDuA}HAVE_MMAP\${SEDuB}HAVE_MMAP\${SEDuC}1\${SEDuD}
  6095. \${SEDeA}HAVE_MMAP\${SEDeB}HAVE_MMAP\${SEDeC}1\${SEDeD}
  6096. \${SEDfA}HAVE_MMAP\${SEDfB}HAVE_MMAP\${SEDfC}1\${SEDfD}
  6097. "
  6098. echo $ac_n "checking for mmap declaration""... $ac_c"
  6099. # Note: gcc2 does not consider
  6100. #   void* mmap (void*, size_t, int, int, int, off_t);
  6101. #   char* mmap();
  6102. # to be an error, if the first declaration comes from a system include file.
  6103. cat > conftest.c <<EOF
  6104. #include "confdefs.h"
  6105.  
  6106. #ifdef STDC_HEADERS
  6107. #include <stdlib.h>
  6108. #endif
  6109. #ifdef HAVE_UNISTD_H
  6110. #include <unistd.h>
  6111. #endif
  6112. #include <sys/types.h>
  6113. #include <sys/mman.h>
  6114. extern
  6115. #ifdef __cplusplus
  6116. "C"
  6117. #endif
  6118. void* mmap();
  6119. main() { exit(0); }
  6120. EOF
  6121. eval $compile
  6122. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6123.   retmmaptype="void*"
  6124. else
  6125.   retmmaptype="caddr_t"
  6126. fi
  6127. if test -f core; then
  6128.   coredir=core`/bin/sh -c 'echo $$'`
  6129.   mkdir $coredir
  6130.   cp confdefs.h $coredir/confdefs.h
  6131.   mv conftest.c $coredir/conftest.c
  6132.   mv conftest $coredir/conftest
  6133.   mv core $coredir/core
  6134.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6135. fi
  6136. rm -f conftest*
  6137. echo "#define" RETMMAPTYPE "$retmmaptype" >> confdefs.h
  6138. DEFS="$DEFS -DRETMMAPTYPE=$retmmaptype"
  6139. SEDDEFS="${SEDDEFS}\${SEDdA}RETMMAPTYPE\${SEDdB}RETMMAPTYPE\${SEDdC}$retmmaptype\${SEDdD}
  6140. \${SEDuA}RETMMAPTYPE\${SEDuB}RETMMAPTYPE\${SEDuC}$retmmaptype\${SEDuD}
  6141. \${SEDeA}RETMMAPTYPE\${SEDeB}RETMMAPTYPE\${SEDeC}$retmmaptype\${SEDeD}
  6142. \${SEDfA}RETMMAPTYPE\${SEDfB}RETMMAPTYPE\${SEDfC}$retmmaptype\${SEDfD}
  6143. "
  6144. for y in 'int' 'size_t'; do
  6145. for x in 'void*' 'caddr_t'; do
  6146. if test -z "$have_mmap_decl"; then
  6147. cat > conftest.c <<EOF
  6148. #include "confdefs.h"
  6149.  
  6150. #ifdef STDC_HEADERS
  6151. #include <stdlib.h>
  6152. #endif
  6153. #ifdef HAVE_UNISTD_H
  6154. #include <unistd.h>
  6155. #endif
  6156. #include <sys/types.h>
  6157. #include <sys/mman.h>
  6158. extern
  6159. #ifdef __cplusplus
  6160. "C"
  6161. #endif
  6162. #ifdef __STDC__
  6163. RETMMAPTYPE mmap ($x addr, $y length, int prot, int flags, int fd, off_t off);
  6164. #else
  6165. RETMMAPTYPE mmap();
  6166. #endif
  6167. main() { exit(0); }
  6168. EOF
  6169. eval $compile
  6170. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6171.   echo "#define" MMAP_ADDR_T "$x" >> confdefs.h
  6172. DEFS="$DEFS -DMMAP_ADDR_T=$x"
  6173. SEDDEFS="${SEDDEFS}\${SEDdA}MMAP_ADDR_T\${SEDdB}MMAP_ADDR_T\${SEDdC}$x\${SEDdD}
  6174. \${SEDuA}MMAP_ADDR_T\${SEDuB}MMAP_ADDR_T\${SEDuC}$x\${SEDuD}
  6175. \${SEDeA}MMAP_ADDR_T\${SEDeB}MMAP_ADDR_T\${SEDeC}$x\${SEDeD}
  6176. \${SEDfA}MMAP_ADDR_T\${SEDfB}MMAP_ADDR_T\${SEDfC}$x\${SEDfD}
  6177. "
  6178. echo "#define" MMAP_SIZE_T "$y" >> confdefs.h
  6179. DEFS="$DEFS -DMMAP_SIZE_T=$y"
  6180. SEDDEFS="${SEDDEFS}\${SEDdA}MMAP_SIZE_T\${SEDdB}MMAP_SIZE_T\${SEDdC}$y\${SEDdD}
  6181. \${SEDuA}MMAP_SIZE_T\${SEDuB}MMAP_SIZE_T\${SEDuC}$y\${SEDuD}
  6182. \${SEDeA}MMAP_SIZE_T\${SEDeB}MMAP_SIZE_T\${SEDeC}$y\${SEDeD}
  6183. \${SEDfA}MMAP_SIZE_T\${SEDfB}MMAP_SIZE_T\${SEDfC}$y\${SEDfD}
  6184. "
  6185. ac_proto=`echo "extern $retmmaptype mmap ($x, $y, int, int, int, off_t);" | tr -s ' ' | sed -e 's/( /(/g'`
  6186. echo "${ac_t}${ac_tt}${ac_proto}"
  6187. mmap_addr_type="$x"
  6188. mmap_size_type="$y"
  6189. have_mmap_decl=1
  6190. fi
  6191. if test -f core; then
  6192.   coredir=core`/bin/sh -c 'echo $$'`
  6193.   mkdir $coredir
  6194.   cp confdefs.h $coredir/confdefs.h
  6195.   mv conftest.c $coredir/conftest.c
  6196.   mv conftest $coredir/conftest
  6197.   mv core $coredir/core
  6198.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6199. fi
  6200. rm -f conftest*
  6201. fi
  6202. done
  6203. done
  6204. echo $ac_n "checking for working mmap""... $ac_c"
  6205. mmap_prog_1='
  6206. #ifdef STDC_HEADERS
  6207. #include <stdlib.h>
  6208. #endif
  6209. #ifdef HAVE_UNISTD_H
  6210. #include <unistd.h>
  6211. #endif
  6212. #include <fcntl.h>
  6213. #ifdef NEED_SYS_FILE_H
  6214. #include <sys/file.h>
  6215. #endif
  6216. #include <sys/types.h>
  6217. #include <sys/mman.h>
  6218. extern
  6219. #ifdef __cplusplus
  6220. "C"
  6221. #endif
  6222. #ifdef __STDC__
  6223. RETMMAPTYPE mmap (MMAP_ADDR_T addr, MMAP_SIZE_T length, int prot, int flags, int fd, off_t off);
  6224. #else
  6225. RETMMAPTYPE mmap();
  6226. #endif
  6227. main () {
  6228. '
  6229. mmap_prog_2='
  6230. #define my_shift 24
  6231. #define my_low   1
  6232. #ifdef FOR_SUN4_29
  6233. #define my_high  31
  6234. #define my_size  32768 /* hope that 32768 is a multiple of the page size */
  6235. /* i*32 KB for i=1..31 gives a total of 15.5 MB, which is close to what we need */
  6236. #else
  6237. #define my_high  64
  6238. #define my_size  8192 /* hope that 8192 is a multiple of the page size */
  6239. /* i*8 KB for i=1..64 gives a total of 16.25 MB, which is close to what we need */
  6240. #endif
  6241.  {long i;
  6242.   for (i=my_low; i<=my_high; i++)
  6243.     { caddr_t addr = (caddr_t)(i << my_shift);
  6244. #if 0 /* Check for 16 MB. */
  6245.       long size = i*my_size;
  6246. #else /* Check for 8 MB. This is more likely to work on Solaris 2. */
  6247.       long size = ((i+1)/2)*my_size;
  6248. #endif
  6249.       if (mmap(addr,size,PROT_READ|PROT_WRITE,flags|MAP_FIXED,fd,0) == (RETMMAPTYPE)-1) exit(1);
  6250.     }
  6251. #define x(i)  *(unsigned char *) ((i<<my_shift) + (i*i))
  6252. #define y(i)  (unsigned char)((3*i-4)*(7*i+3))
  6253.   for (i=my_low; i<=my_high; i++) { x(i) = y(i); }
  6254.   for (i=my_high; i>=my_low; i--) { if (x(i) != y(i)) exit(1); }
  6255.   exit(0);
  6256. }}
  6257. '
  6258. cat > conftest.c <<EOF
  6259. #include "confdefs.h"
  6260. $mmap_prog_1
  6261.   int flags = MAP_ANON | MAP_PRIVATE;
  6262.   int fd = -1;
  6263. $mmap_prog_2
  6264.  
  6265. EOF
  6266. eval $compile
  6267. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6268.   echo "#define" HAVE_MMAP_ANON "1" >> confdefs.h
  6269. DEFS="$DEFS -DHAVE_MMAP_ANON=1"
  6270. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP_ANON\${SEDdB}HAVE_MMAP_ANON\${SEDdC}1\${SEDdD}
  6271. \${SEDuA}HAVE_MMAP_ANON\${SEDuB}HAVE_MMAP_ANON\${SEDuC}1\${SEDuD}
  6272. \${SEDeA}HAVE_MMAP_ANON\${SEDeB}HAVE_MMAP_ANON\${SEDeC}1\${SEDeD}
  6273. \${SEDfA}HAVE_MMAP_ANON\${SEDfB}HAVE_MMAP_ANON\${SEDfC}1\${SEDfD}
  6274. "
  6275. else
  6276.   rm -f core
  6277. fi
  6278. if test -f core; then
  6279.   coredir=core`/bin/sh -c 'echo $$'`
  6280.   mkdir $coredir
  6281.   cp confdefs.h $coredir/confdefs.h
  6282.   mv conftest.c $coredir/conftest.c
  6283.   mv conftest $coredir/conftest
  6284.   mv core $coredir/core
  6285.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6286. fi
  6287. rm -f conftest*
  6288. cat > conftest.c <<EOF
  6289. #include "confdefs.h"
  6290. $mmap_prog_1
  6291.   int flags = MAP_ANONYMOUS | MAP_PRIVATE;
  6292.   int fd = -1;
  6293. $mmap_prog_2
  6294.  
  6295. EOF
  6296. eval $compile
  6297. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6298.   echo "#define" HAVE_MMAP_ANONYMOUS "1" >> confdefs.h
  6299. DEFS="$DEFS -DHAVE_MMAP_ANONYMOUS=1"
  6300. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP_ANONYMOUS\${SEDdB}HAVE_MMAP_ANONYMOUS\${SEDdC}1\${SEDdD}
  6301. \${SEDuA}HAVE_MMAP_ANONYMOUS\${SEDuB}HAVE_MMAP_ANONYMOUS\${SEDuC}1\${SEDuD}
  6302. \${SEDeA}HAVE_MMAP_ANONYMOUS\${SEDeB}HAVE_MMAP_ANONYMOUS\${SEDeC}1\${SEDeD}
  6303. \${SEDfA}HAVE_MMAP_ANONYMOUS\${SEDfB}HAVE_MMAP_ANONYMOUS\${SEDfC}1\${SEDfD}
  6304. "
  6305. else
  6306.   rm -f core
  6307. fi
  6308. if test -f core; then
  6309.   coredir=core`/bin/sh -c 'echo $$'`
  6310.   mkdir $coredir
  6311.   cp confdefs.h $coredir/confdefs.h
  6312.   mv conftest.c $coredir/conftest.c
  6313.   mv conftest $coredir/conftest
  6314.   mv core $coredir/core
  6315.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6316. fi
  6317. rm -f conftest*
  6318. cat > conftest.c <<EOF
  6319. #include "confdefs.h"
  6320. $mmap_prog_1
  6321. #ifndef MAP_FILE
  6322. #define MAP_FILE 0
  6323. #endif
  6324.   int flags = MAP_FILE | MAP_PRIVATE;
  6325.   int fd = open("/dev/zero",O_RDONLY,0666);
  6326.   if (fd<0) exit(1);
  6327. $mmap_prog_2
  6328.  
  6329. EOF
  6330. eval $compile
  6331. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6332.   echo "#define" HAVE_MMAP_DEVZERO "1" >> confdefs.h
  6333. DEFS="$DEFS -DHAVE_MMAP_DEVZERO=1"
  6334. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP_DEVZERO\${SEDdB}HAVE_MMAP_DEVZERO\${SEDdC}1\${SEDdD}
  6335. \${SEDuA}HAVE_MMAP_DEVZERO\${SEDuB}HAVE_MMAP_DEVZERO\${SEDuC}1\${SEDuD}
  6336. \${SEDeA}HAVE_MMAP_DEVZERO\${SEDeB}HAVE_MMAP_DEVZERO\${SEDeC}1\${SEDeD}
  6337. \${SEDfA}HAVE_MMAP_DEVZERO\${SEDfB}HAVE_MMAP_DEVZERO\${SEDfC}1\${SEDfD}
  6338. "
  6339. else
  6340.   rm -f core
  6341. retry_mmap=1
  6342. fi
  6343. if test -f core; then
  6344.   coredir=core`/bin/sh -c 'echo $$'`
  6345.   mkdir $coredir
  6346.   cp confdefs.h $coredir/confdefs.h
  6347.   mv conftest.c $coredir/conftest.c
  6348.   mv conftest $coredir/conftest
  6349.   mv core $coredir/core
  6350.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6351. fi
  6352. rm -f conftest*
  6353. if test -n "$retry_mmap"; then
  6354. cat > conftest.c <<EOF
  6355. #include "confdefs.h"
  6356. #define FOR_SUN4_29
  6357. $mmap_prog_1
  6358. #ifndef MAP_FILE
  6359. #define MAP_FILE 0
  6360. #endif
  6361.   int flags = MAP_FILE | MAP_PRIVATE;
  6362.   int fd = open("/dev/zero",O_RDONLY,0666);
  6363.   if (fd<0) exit(1);
  6364. $mmap_prog_2
  6365.  
  6366. EOF
  6367. eval $compile
  6368. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6369.   echo "#define" HAVE_MMAP_DEVZERO_SUN4_29 "1" >> confdefs.h
  6370. DEFS="$DEFS -DHAVE_MMAP_DEVZERO_SUN4_29=1"
  6371. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP_DEVZERO_SUN4_29\${SEDdB}HAVE_MMAP_DEVZERO_SUN4_29\${SEDdC}1\${SEDdD}
  6372. \${SEDuA}HAVE_MMAP_DEVZERO_SUN4_29\${SEDuB}HAVE_MMAP_DEVZERO_SUN4_29\${SEDuC}1\${SEDuD}
  6373. \${SEDeA}HAVE_MMAP_DEVZERO_SUN4_29\${SEDeB}HAVE_MMAP_DEVZERO_SUN4_29\${SEDeC}1\${SEDeD}
  6374. \${SEDfA}HAVE_MMAP_DEVZERO_SUN4_29\${SEDfB}HAVE_MMAP_DEVZERO_SUN4_29\${SEDfC}1\${SEDfD}
  6375. "
  6376. else
  6377.   rm -f core
  6378. fi
  6379. if test -f core; then
  6380.   coredir=core`/bin/sh -c 'echo $$'`
  6381.   mkdir $coredir
  6382.   cp confdefs.h $coredir/confdefs.h
  6383.   mv conftest.c $coredir/conftest.c
  6384.   mv conftest $coredir/conftest
  6385.   mv core $coredir/core
  6386.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6387. fi
  6388. rm -f conftest*
  6389. fi
  6390. case "$DEFS" in
  6391.   *HAVE_MMAP_ANON* | *HAVE_MMAP_DEVZERO*) echo "${ac_t}yes"
  6392.   ;;
  6393.   *)                                      echo "${ac_t}no"
  6394.   ;;
  6395. esac
  6396. fi
  6397. fi
  6398.  
  6399.                       if test -z "$no_mmap"; then
  6400. echo $ac_n "checking for munmap""... $ac_c"
  6401. cat > conftest.c <<EOF
  6402. #include "confdefs.h"
  6403. #include <ctype.h>
  6404. #ifdef __cplusplus
  6405. extern "C" char munmap();
  6406. #endif
  6407. int main() { exit(0); }
  6408. int t() { 
  6409. /* The GNU C library defines this for functions which it implements
  6410.     to always fail with ENOSYS.  Some functions are actually named
  6411.     something starting with __ and the normal name is an alias.  */
  6412. #if defined (__stub_munmap) || defined (__stub___munmap)
  6413. choke me
  6414. #else
  6415. #ifndef __cplusplus
  6416. /* Override any gcc2 internal prototype to avoid an error.  */
  6417. extern char munmap();
  6418. #endif
  6419. munmap();
  6420. #endif
  6421.  }
  6422. EOF
  6423. if eval $compile; then
  6424.   echo "${ac_t}yes"
  6425.   echo "#define" HAVE_MUNMAP "1" >> confdefs.h
  6426. DEFS="$DEFS -DHAVE_MUNMAP=1"
  6427. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MUNMAP\${SEDdB}HAVE_MUNMAP\${SEDdC}1\${SEDdD}
  6428. \${SEDuA}HAVE_MUNMAP\${SEDuB}HAVE_MUNMAP\${SEDuC}1\${SEDuD}
  6429. \${SEDeA}HAVE_MUNMAP\${SEDeB}HAVE_MUNMAP\${SEDeC}1\${SEDeD}
  6430. \${SEDfA}HAVE_MUNMAP\${SEDfB}HAVE_MUNMAP\${SEDfC}1\${SEDfD}
  6431. "
  6432. else
  6433.   echo "${ac_t}no"
  6434.   :
  6435. fi
  6436. rm -f conftest*
  6437. fi
  6438.  
  6439.                       echo $ac_n "checking for mprotect""... $ac_c"
  6440. cat > conftest.c <<EOF
  6441. #include "confdefs.h"
  6442. #include <ctype.h>
  6443. #ifdef __cplusplus
  6444. extern "C" char mprotect();
  6445. #endif
  6446. int main() { exit(0); }
  6447. int t() { 
  6448. /* The GNU C library defines this for functions which it implements
  6449.     to always fail with ENOSYS.  Some functions are actually named
  6450.     something starting with __ and the normal name is an alias.  */
  6451. #if defined (__stub_mprotect) || defined (__stub___mprotect)
  6452. choke me
  6453. #else
  6454. #ifndef __cplusplus
  6455. /* Override any gcc2 internal prototype to avoid an error.  */
  6456. extern char mprotect();
  6457. #endif
  6458. mprotect();
  6459. #endif
  6460.  }
  6461. EOF
  6462. if eval $compile; then
  6463.   echo "${ac_t}yes"
  6464.   echo "#define" HAVE_MPROTECT "1" >> confdefs.h
  6465. DEFS="$DEFS -DHAVE_MPROTECT=1"
  6466. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPROTECT\${SEDdB}HAVE_MPROTECT\${SEDdC}1\${SEDdD}
  6467. \${SEDuA}HAVE_MPROTECT\${SEDuB}HAVE_MPROTECT\${SEDuC}1\${SEDuD}
  6468. \${SEDeA}HAVE_MPROTECT\${SEDeB}HAVE_MPROTECT\${SEDeC}1\${SEDeD}
  6469. \${SEDfA}HAVE_MPROTECT\${SEDfB}HAVE_MPROTECT\${SEDfC}1\${SEDfD}
  6470. "
  6471. else
  6472.   echo "${ac_t}no"
  6473.   :
  6474. fi
  6475. rm -f conftest*
  6476. echo $ac_n "checking for mprotect declaration""... $ac_c"
  6477. cat > conftest.c <<EOF
  6478. #include "confdefs.h"
  6479.  
  6480. #ifdef STDC_HEADERS
  6481. #include <stdlib.h>
  6482. #endif
  6483. #ifdef HAVE_UNISTD_H
  6484. #include <unistd.h>
  6485. #endif
  6486. #include <sys/types.h>
  6487. #include <sys/mman.h>
  6488. extern
  6489. #ifdef __cplusplus
  6490. "C"
  6491. #endif
  6492. #ifdef __STDC__
  6493. int mprotect (MMAP_ADDR_T addr, MMAP_SIZE_T len, int prot);
  6494. #else
  6495. int mprotect();
  6496. #endif
  6497. main() { exit(0); }
  6498. EOF
  6499. eval $compile
  6500. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6501.   x=""
  6502. else
  6503.   x="const"
  6504. fi
  6505. if test -f core; then
  6506.   coredir=core`/bin/sh -c 'echo $$'`
  6507.   mkdir $coredir
  6508.   cp confdefs.h $coredir/confdefs.h
  6509.   mv conftest.c $coredir/conftest.c
  6510.   mv conftest $coredir/conftest
  6511.   mv core $coredir/core
  6512.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6513. fi
  6514. rm -f conftest*
  6515. echo "#define" MPROTECT_CONST "$x" >> confdefs.h
  6516. DEFS="$DEFS -DMPROTECT_CONST=$x"
  6517. SEDDEFS="${SEDDEFS}\${SEDdA}MPROTECT_CONST\${SEDdB}MPROTECT_CONST\${SEDdC}$x\${SEDdD}
  6518. \${SEDuA}MPROTECT_CONST\${SEDuB}MPROTECT_CONST\${SEDuC}$x\${SEDuD}
  6519. \${SEDeA}MPROTECT_CONST\${SEDeB}MPROTECT_CONST\${SEDeC}$x\${SEDeD}
  6520. \${SEDfA}MPROTECT_CONST\${SEDfB}MPROTECT_CONST\${SEDfC}$x\${SEDfD}
  6521. "
  6522. ac_proto=`echo "extern int mprotect ($x $mmap_addr_type, $mmap_size_type, int);" | tr -s ' ' | sed -e 's/( /(/g'`
  6523. echo "${ac_t}${ac_tt}${ac_proto}"
  6524. mprotect_prog='
  6525. #include <sys/types.h>
  6526. /* declare malloc() */
  6527. #ifdef HAVE_STDLIB_H
  6528. #include <stdlib.h>
  6529. #endif
  6530. #ifdef HAVE_UNISTD_H
  6531. #include <unistd.h>
  6532. #endif
  6533. #ifndef malloc
  6534. extern
  6535. #ifdef __cplusplus
  6536. "C"
  6537. #endif
  6538. #ifdef __STDC__
  6539. RETMALLOCTYPE malloc (MALLOC_SIZE_T size);
  6540. #else
  6541. RETMALLOCTYPE malloc();
  6542. #endif
  6543. #endif
  6544. /* declare getpagesize() and mprotect() */
  6545. #include <sys/mman.h>
  6546. #ifndef HAVE_GETPAGESIZE
  6547. #include <sys/param.h>
  6548. #define getpagesize() PAGESIZE
  6549. #else
  6550. extern
  6551. #ifdef __cplusplus
  6552. "C"
  6553. #endif
  6554. #ifdef __STDC__
  6555. RETGETPAGESIZETYPE getpagesize (void);
  6556. #else
  6557. RETGETPAGESIZETYPE getpagesize();
  6558. #endif
  6559. #endif
  6560. extern
  6561. #ifdef __cplusplus
  6562. "C"
  6563. #endif
  6564. #ifdef __STDC__
  6565. int mprotect (MPROTECT_CONST MMAP_ADDR_T addr, MMAP_SIZE_T len, int prot);
  6566. #else
  6567. int mprotect();
  6568. #endif
  6569. char foo;
  6570. main () {
  6571.   unsigned long pagesize = getpagesize();
  6572. #define page_align(address)  (char*)((unsigned long)(address) & -pagesize)
  6573. '
  6574. cat > conftest.c <<EOF
  6575. #include "confdefs.h"
  6576. $mprotect_prog
  6577.   if ((pagesize-1) & pagesize) exit(1);
  6578.   exit(0); }
  6579. EOF
  6580. eval $compile
  6581. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6582.   :
  6583. else
  6584.   no_mprotect=1
  6585. fi
  6586. if test -f core; then
  6587.   coredir=core`/bin/sh -c 'echo $$'`
  6588.   mkdir $coredir
  6589.   cp confdefs.h $coredir/confdefs.h
  6590.   mv conftest.c $coredir/conftest.c
  6591.   mv conftest $coredir/conftest
  6592.   mv core $coredir/core
  6593.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6594. fi
  6595. rm -f conftest*
  6596. mprotect_prog="$mprotect_prog"'
  6597.   char* area = malloc(6*pagesize);
  6598.   char* fault_address = area + pagesize*7/2;
  6599. '
  6600. if test -z "$no_mprotect"; then
  6601. cat > conftest.c <<EOF
  6602. #include "confdefs.h"
  6603. $mprotect_prog
  6604.   if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) exit(0);
  6605.   foo = *fault_address; /* this should cause a core dump */
  6606.   exit(0); }
  6607. EOF
  6608. eval $compile
  6609. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6610.   no_mprotect=1
  6611. else
  6612.   rm -f core
  6613. fi
  6614. if test -f core; then
  6615.   coredir=core`/bin/sh -c 'echo $$'`
  6616.   mkdir $coredir
  6617.   cp confdefs.h $coredir/confdefs.h
  6618.   mv conftest.c $coredir/conftest.c
  6619.   mv conftest $coredir/conftest
  6620.   mv core $coredir/core
  6621.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6622. fi
  6623. rm -f conftest*
  6624. fi
  6625. if test -z "$no_mprotect"; then
  6626. cat > conftest.c <<EOF
  6627. #include "confdefs.h"
  6628. $mprotect_prog
  6629.   if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) exit(0);
  6630.   *fault_address = 'z'; /* this should cause a core dump */
  6631.   exit(0); }
  6632. EOF
  6633. eval $compile
  6634. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6635.   no_mprotect=1
  6636. else
  6637.   rm -f core
  6638. fi
  6639. if test -f core; then
  6640.   coredir=core`/bin/sh -c 'echo $$'`
  6641.   mkdir $coredir
  6642.   cp confdefs.h $coredir/confdefs.h
  6643.   mv conftest.c $coredir/conftest.c
  6644.   mv conftest $coredir/conftest
  6645.   mv core $coredir/core
  6646.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6647. fi
  6648. rm -f conftest*
  6649. fi
  6650. if test -z "$no_mprotect"; then
  6651. cat > conftest.c <<EOF
  6652. #include "confdefs.h"
  6653. $mprotect_prog
  6654.   if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) exit(0);
  6655.   *fault_address = 'z'; /* this should cause a core dump */
  6656.   exit(0); }
  6657. EOF
  6658. eval $compile
  6659. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6660.   no_mprotect=1
  6661. else
  6662.   rm -f core
  6663. fi
  6664. if test -f core; then
  6665.   coredir=core`/bin/sh -c 'echo $$'`
  6666.   mkdir $coredir
  6667.   cp confdefs.h $coredir/confdefs.h
  6668.   mv conftest.c $coredir/conftest.c
  6669.   mv conftest $coredir/conftest
  6670.   mv core $coredir/core
  6671.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6672. fi
  6673. rm -f conftest*
  6674. fi
  6675. if test -z "$no_mprotect"; then
  6676. cat > conftest.c <<EOF
  6677. #include "confdefs.h"
  6678. $mprotect_prog
  6679.   if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) exit(1);
  6680.   if (mprotect(page_align(fault_address),pagesize,PROT_READ|PROT_WRITE) < 0) exit(1);
  6681.   *fault_address = 'z'; /* this should not cause a core dump */
  6682.   exit(0); }
  6683. EOF
  6684. eval $compile
  6685. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6686.   :
  6687. else
  6688.   no_mprotect=1
  6689. rm -f core
  6690. fi
  6691. if test -f core; then
  6692.   coredir=core`/bin/sh -c 'echo $$'`
  6693.   mkdir $coredir
  6694.   cp confdefs.h $coredir/confdefs.h
  6695.   mv conftest.c $coredir/conftest.c
  6696.   mv conftest $coredir/conftest
  6697.   mv core $coredir/core
  6698.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6699. fi
  6700. rm -f conftest*
  6701. fi
  6702. if test -z "$no_mprotect"; then
  6703.   echo "#define" HAVE_WORKING_MPROTECT "1" >> confdefs.h
  6704. DEFS="$DEFS -DHAVE_WORKING_MPROTECT=1"
  6705. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WORKING_MPROTECT\${SEDdB}HAVE_WORKING_MPROTECT\${SEDdC}1\${SEDdD}
  6706. \${SEDuA}HAVE_WORKING_MPROTECT\${SEDuB}HAVE_WORKING_MPROTECT\${SEDuC}1\${SEDuD}
  6707. \${SEDeA}HAVE_WORKING_MPROTECT\${SEDeB}HAVE_WORKING_MPROTECT\${SEDeC}1\${SEDeD}
  6708. \${SEDfA}HAVE_WORKING_MPROTECT\${SEDfB}HAVE_WORKING_MPROTECT\${SEDfC}1\${SEDfD}
  6709. "
  6710. fi
  6711.  
  6712.                       case "$DEFS" in
  6713.   *HAVE_SHM*)
  6714. echo $ac_n "checking for shmget declaration""... $ac_c"
  6715. cat > conftest.c <<EOF
  6716. #include "confdefs.h"
  6717.  
  6718. #ifdef STDC_HEADERS
  6719. #include <stdlib.h>
  6720. #endif
  6721. #ifdef HAVE_UNISTD_H
  6722. #include <unistd.h>
  6723. #endif
  6724. #include <sys/types.h>
  6725. #include <sys/ipc.h>
  6726. #include <sys/shm.h>
  6727. extern
  6728. #ifdef __cplusplus
  6729. "C"
  6730. #endif
  6731. #ifdef __STDC__
  6732. int shmget (key_t key, int size, int shmflg);
  6733. #else
  6734. int shmget();
  6735. #endif
  6736. main() { exit(0); }
  6737. EOF
  6738. eval $compile
  6739. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6740.   x="int"
  6741. else
  6742.   x="size_t"
  6743. fi
  6744. if test -f core; then
  6745.   coredir=core`/bin/sh -c 'echo $$'`
  6746.   mkdir $coredir
  6747.   cp confdefs.h $coredir/confdefs.h
  6748.   mv conftest.c $coredir/conftest.c
  6749.   mv conftest $coredir/conftest
  6750.   mv core $coredir/core
  6751.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6752. fi
  6753. rm -f conftest*
  6754. echo "#define" SHMGET_SIZE_T "$x" >> confdefs.h
  6755. DEFS="$DEFS -DSHMGET_SIZE_T=$x"
  6756. SEDDEFS="${SEDDEFS}\${SEDdA}SHMGET_SIZE_T\${SEDdB}SHMGET_SIZE_T\${SEDdC}$x\${SEDdD}
  6757. \${SEDuA}SHMGET_SIZE_T\${SEDuB}SHMGET_SIZE_T\${SEDuC}$x\${SEDuD}
  6758. \${SEDeA}SHMGET_SIZE_T\${SEDeB}SHMGET_SIZE_T\${SEDeC}$x\${SEDeD}
  6759. \${SEDfA}SHMGET_SIZE_T\${SEDfB}SHMGET_SIZE_T\${SEDfC}$x\${SEDfD}
  6760. "
  6761. ac_proto=`echo "extern int shmget (key_t, $x, int);" | tr -s ' ' | sed -e 's/( /(/g'`
  6762. echo "${ac_t}${ac_tt}${ac_proto}"
  6763.   ;;
  6764.   *) ;;
  6765. esac
  6766.  
  6767.                       case "$DEFS" in
  6768.   *HAVE_SHM*)
  6769. echo $ac_n "checking for shmat declaration""... $ac_c"
  6770. cat > conftest.c <<EOF
  6771. #include "confdefs.h"
  6772.  
  6773. #ifdef STDC_HEADERS
  6774. #include <stdlib.h>
  6775. #endif
  6776. #ifdef HAVE_UNISTD_H
  6777. #include <unistd.h>
  6778. #endif
  6779. #include <sys/types.h>
  6780. #include <sys/ipc.h>
  6781. #include <sys/shm.h>
  6782. extern
  6783. #ifdef __cplusplus
  6784. "C"
  6785. #endif
  6786. void* shmat();
  6787. main() { exit(0); }
  6788. EOF
  6789. eval $compile
  6790. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6791.   x="void*"
  6792. else
  6793.   x="char*"
  6794. fi
  6795. if test -f core; then
  6796.   coredir=core`/bin/sh -c 'echo $$'`
  6797.   mkdir $coredir
  6798.   cp confdefs.h $coredir/confdefs.h
  6799.   mv conftest.c $coredir/conftest.c
  6800.   mv conftest $coredir/conftest
  6801.   mv core $coredir/core
  6802.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6803. fi
  6804. rm -f conftest*
  6805. echo "#define" RETSHMATTYPE "$x" >> confdefs.h
  6806. DEFS="$DEFS -DRETSHMATTYPE=$x"
  6807. SEDDEFS="${SEDDEFS}\${SEDdA}RETSHMATTYPE\${SEDdB}RETSHMATTYPE\${SEDdC}$x\${SEDdD}
  6808. \${SEDuA}RETSHMATTYPE\${SEDuB}RETSHMATTYPE\${SEDuC}$x\${SEDuD}
  6809. \${SEDeA}RETSHMATTYPE\${SEDeB}RETSHMATTYPE\${SEDeC}$x\${SEDeD}
  6810. \${SEDfA}RETSHMATTYPE\${SEDfB}RETSHMATTYPE\${SEDfC}$x\${SEDfD}
  6811. "
  6812. cat > conftest.c <<EOF
  6813. #include "confdefs.h"
  6814.  
  6815. #ifdef STDC_HEADERS
  6816. #include <stdlib.h>
  6817. #endif
  6818. #ifdef HAVE_UNISTD_H
  6819. #include <unistd.h>
  6820. #endif
  6821. #include <sys/types.h>
  6822. #include <sys/ipc.h>
  6823. #include <sys/shm.h>
  6824. extern
  6825. #ifdef __cplusplus
  6826. "C"
  6827. #endif
  6828. #ifdef __STDC__
  6829. RETSHMATTYPE shmat (int shmid, RETSHMATTYPE shmaddr, int shmflg);
  6830. #else
  6831. RETSHMATTYPE shmat();
  6832. #endif
  6833. main() { exit(0); }
  6834. EOF
  6835. eval $compile
  6836. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6837.   y=""
  6838. else
  6839.   y="const"
  6840. fi
  6841. if test -f core; then
  6842.   coredir=core`/bin/sh -c 'echo $$'`
  6843.   mkdir $coredir
  6844.   cp confdefs.h $coredir/confdefs.h
  6845.   mv conftest.c $coredir/conftest.c
  6846.   mv conftest $coredir/conftest
  6847.   mv core $coredir/core
  6848.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6849. fi
  6850. rm -f conftest*
  6851. echo "#define" SHMAT_CONST "$y" >> confdefs.h
  6852. DEFS="$DEFS -DSHMAT_CONST=$y"
  6853. SEDDEFS="${SEDDEFS}\${SEDdA}SHMAT_CONST\${SEDdB}SHMAT_CONST\${SEDdC}$y\${SEDdD}
  6854. \${SEDuA}SHMAT_CONST\${SEDuB}SHMAT_CONST\${SEDuC}$y\${SEDuD}
  6855. \${SEDeA}SHMAT_CONST\${SEDeB}SHMAT_CONST\${SEDeC}$y\${SEDeD}
  6856. \${SEDfA}SHMAT_CONST\${SEDfB}SHMAT_CONST\${SEDfC}$y\${SEDfD}
  6857. "
  6858. ac_proto=`echo "extern $retshmattype shmat (int, $y $x, int);" | tr -s ' ' | sed -e 's/( /(/g'`
  6859. echo "${ac_t}${ac_tt}${ac_proto}"
  6860.   ;;
  6861.   *) ;;
  6862. esac
  6863.  
  6864.                       case "$DEFS" in
  6865.   *HAVE_SHM*)
  6866. echo $ac_n "checking for shmctl declaration""... $ac_c"
  6867. cat > conftest.c <<EOF
  6868. #include "confdefs.h"
  6869.  
  6870. #ifdef STDC_HEADERS
  6871. #include <stdlib.h>
  6872. #endif
  6873. #ifdef HAVE_UNISTD_H
  6874. #include <unistd.h>
  6875. #endif
  6876. #include <sys/types.h>
  6877. #include <sys/ipc.h>
  6878. #include <sys/shm.h>
  6879. extern
  6880. #ifdef __cplusplus
  6881. "C"
  6882. #endif
  6883. #ifdef __STDC__
  6884. int shmctl (int shmid, int cmd, struct shmid_ds * buf);
  6885. #else
  6886. int shmctl();
  6887. #endif
  6888. main() { exit(0); }
  6889. EOF
  6890. eval $compile
  6891. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6892.   ac_proto=`echo "extern int shmctl (int, int, struct shmid_ds *);" | tr -s ' ' | sed -e 's/( /(/g'`
  6893. echo "${ac_t}${ac_tt}${ac_proto}"
  6894. else
  6895.   ac_proto=`echo "extern int shmctl (int, int, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
  6896. echo "${ac_t}${ac_tt}${ac_proto}"
  6897. echo "#define" SHMCTL_DOTS "1" >> confdefs.h
  6898. DEFS="$DEFS -DSHMCTL_DOTS=1"
  6899. SEDDEFS="${SEDDEFS}\${SEDdA}SHMCTL_DOTS\${SEDdB}SHMCTL_DOTS\${SEDdC}1\${SEDdD}
  6900. \${SEDuA}SHMCTL_DOTS\${SEDuB}SHMCTL_DOTS\${SEDuC}1\${SEDuD}
  6901. \${SEDeA}SHMCTL_DOTS\${SEDeB}SHMCTL_DOTS\${SEDeC}1\${SEDeD}
  6902. \${SEDfA}SHMCTL_DOTS\${SEDfB}SHMCTL_DOTS\${SEDfC}1\${SEDfD}
  6903. "
  6904. fi
  6905. if test -f core; then
  6906.   coredir=core`/bin/sh -c 'echo $$'`
  6907.   mkdir $coredir
  6908.   cp confdefs.h $coredir/confdefs.h
  6909.   mv conftest.c $coredir/conftest.c
  6910.   mv conftest $coredir/conftest
  6911.   mv core $coredir/core
  6912.   echo "warning: test program dumped core -- see subdirectory $coredir"
  6913. fi
  6914. rm -f conftest*
  6915.   ;;
  6916.   *) ;;
  6917. esac
  6918.  
  6919.                       case "$DEFS" in
  6920.   *HAVE_SHM*)
  6921. echo $ac_n "checking for attachability of removed shared memory""... $ac_c"
  6922. cat > conftest.c <<EOF
  6923. #include "confdefs.h"
  6924.  
  6925. #ifdef STDC_HEADERS
  6926. #include <stdlib.h>
  6927. #endif
  6928. #ifdef HAVE_UNISTD_H
  6929. #include <unistd.h>
  6930. #endif
  6931. #include <sys/types.h>
  6932. #include <sys/ipc.h>
  6933. #include <sys/shm.h>
  6934. #ifdef HAVE_SYS_SYSMACROS_H
  6935. #include <sys/sysmacros.h>
  6936. #endif
  6937. #ifdef __STDC__
  6938. extern
  6939. #ifdef __cplusplus
  6940. "C"
  6941. #endif
  6942. int shmget (key_t key, SHMGET_SIZE_T size, int shmflg);
  6943. extern
  6944. #ifdef __cplusplus
  6945. "C"
  6946. #endif
  6947. RETSHMATTYPE shmat (int shmid, SHMAT_CONST RETSHMATTYPE shmaddr, int shmflg);
  6948. extern
  6949. #ifdef __cplusplus
  6950. "C"
  6951. #endif
  6952. #ifdef SHMCTL_DOTS
  6953. int shmctl (int shmid, int cmd, ...);
  6954. #else
  6955. int shmctl (int shmid, int cmd, struct shmid_ds * buf);
  6956. #endif
  6957. #else
  6958. extern int shmget();
  6959. extern RETSHMATTYPE shmat();
  6960. extern int shmctl();
  6961. #endif
  6962. main ()
  6963. { unsigned int pagesize = 8192; /* should be a multiple of SHMLBA */
  6964.   unsigned long addr = (unsigned long) malloc(2*pagesize);
  6965.   addr += pagesize-1; addr = (addr/pagesize)*pagesize;
  6966.  {unsigned long addr1 = addr + 0x10000;
  6967.   unsigned long addr2 = addr + 0x20000;
  6968.   int id = shmget(IPC_PRIVATE,pagesize,IPC_CREAT|0600);
  6969.   if (id<0)
  6970.     { exit(1); }
  6971.   if (shmat(id,(RETSHMATTYPE)addr1,0) == (RETSHMATTYPE)(-1))
  6972.     { shmctl(id,IPC_RMID,NULL); exit(1); }
  6973.   if (shmctl(id,IPC_RMID,NULL) < 0)
  6974.     { exit(1); }
  6975.   if (shmat(id,(RETSHMATTYPE)addr2,0) == (RETSHMATTYPE)(-1))
  6976.     { shmctl(id,IPC_RMID,NULL); exit(1); }
  6977.   shmctl(id,IPC_RMID,NULL);
  6978.   exit(0);
  6979. }}
  6980.  
  6981. EOF
  6982. eval $compile
  6983. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  6984.   echo "${ac_t}yes"
  6985. echo "#define" SHM_RMID_VALID "1" >> confdefs.h
  6986. DEFS="$DEFS -DSHM_RMID_VALID=1"
  6987. SEDDEFS="${SEDDEFS}\${SEDdA}SHM_RMID_VALID\${SEDdB}SHM_RMID_VALID\${SEDdC}1\${SEDdD}
  6988. \${SEDuA}SHM_RMID_VALID\${SEDuB}SHM_RMID_VALID\${SEDuC}1\${SEDuD}
  6989. \${SEDeA}SHM_RMID_VALID\${SEDeB}SHM_RMID_VALID\${SEDeC}1\${SEDeD}
  6990. \${SEDfA}SHM_RMID_VALID\${SEDfB}SHM_RMID_VALID\${SEDfC}1\${SEDfD}
  6991. "
  6992. else
  6993.   echo "${ac_t}no"
  6994. fi
  6995. if test -f core; then
  6996.   coredir=core`/bin/sh -c 'echo $$'`
  6997.   mkdir $coredir
  6998.   cp confdefs.h $coredir/confdefs.h
  6999.   mv conftest.c $coredir/conftest.c
  7000.   mv conftest $coredir/conftest
  7001.   mv core $coredir/core
  7002.   echo "warning: test program dumped core -- see subdirectory $coredir"
  7003. fi
  7004. rm -f conftest*
  7005.   ;;
  7006.   *) ;;
  7007. esac
  7008.  
  7009.                       echo $ac_n "checking whether characters are unsigned""... $ac_c"
  7010. cat > conftest.c <<EOF
  7011. #include "confdefs.h"
  7012. /* volatile prevents gcc2 from optimizing the test away on sparcs.  */
  7013. #if !__STDC__
  7014. #define volatile
  7015. #endif
  7016. main() { volatile char c = 255; exit(c < 0); }
  7017. EOF
  7018. eval $compile
  7019. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  7020.   echo "${ac_t}yes"
  7021. echo "#define" __CHAR_UNSIGNED__ "1" >> confdefs.h
  7022. DEFS="$DEFS -D__CHAR_UNSIGNED__=1"
  7023. SEDDEFS="${SEDDEFS}\${SEDdA}__CHAR_UNSIGNED__\${SEDdB}__CHAR_UNSIGNED__\${SEDdC}1\${SEDdD}
  7024. \${SEDuA}__CHAR_UNSIGNED__\${SEDuB}__CHAR_UNSIGNED__\${SEDuC}1\${SEDuD}
  7025. \${SEDeA}__CHAR_UNSIGNED__\${SEDeB}__CHAR_UNSIGNED__\${SEDeC}1\${SEDeD}
  7026. \${SEDfA}__CHAR_UNSIGNED__\${SEDfB}__CHAR_UNSIGNED__\${SEDfC}1\${SEDfD}
  7027. "
  7028. else
  7029.   echo "${ac_t}no"
  7030. fi
  7031. if test -f core; then
  7032.   coredir=core`/bin/sh -c 'echo $$'`
  7033.   mkdir $coredir
  7034.   cp confdefs.h $coredir/confdefs.h
  7035.   mv conftest.c $coredir/conftest.c
  7036.   mv conftest $coredir/conftest
  7037.   mv core $coredir/core
  7038.   echo "warning: test program dumped core -- see subdirectory $coredir"
  7039. fi
  7040. rm -f conftest*
  7041.  
  7042.                       echo checking for integer types and behaviour
  7043. cat > conftest.c <<EOF
  7044. #include "confdefs.h"
  7045. EOF
  7046. cat ${srcdir}/machine.c >> conftest.c
  7047. ORIGCC="$CC"
  7048. if test -n "$GCC"; then
  7049. # gcc -O (gcc version <= 2.3.2) crashes when compiling long long shifts for
  7050. # target 80386. Strip "-O".
  7051. CC=`echo "$CC " | sed -e 's/-O //g'`
  7052. fi
  7053. eval $compile
  7054. CC="$ORIGCC"
  7055. if test -s conftest; then
  7056.   echo creating machine.h
  7057.   ./conftest > conftest.h
  7058.   if cmp -s machine.h conftest.h 2>/dev/null; then
  7059.     # The file exists and we would not be changing it
  7060.     rm -f conftest.h
  7061.   else
  7062.     rm -f machine.h
  7063.     mv conftest.h machine.h
  7064.   fi
  7065. else
  7066.   echo creation of machine.h failed
  7067. fi
  7068. rm -f conftest*
  7069.  
  7070.                       # Set default prefixes.
  7071. if test -n "$prefix"; then
  7072.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  7073.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  7074. fi
  7075. if test -n "$exec_prefix"; then
  7076.   prsub="$prsub
  7077. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  7078. fi
  7079. # Quote sed substitution magic chars in DEFS.
  7080. cat >conftest.def <<EOF
  7081. $DEFS
  7082. EOF
  7083. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  7084. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  7085. rm -f conftest.def
  7086. # Substitute for predefined variables.
  7087.  
  7088. trap 'rm -f config.status; exit 1' 1 3 15
  7089. echo creating config.status
  7090. rm -f config.status
  7091. cat > config.status <<EOF
  7092. #!/bin/sh
  7093. # Generated automatically by configure.
  7094. # Run this file to recreate the current configuration.
  7095. # This directory was configured as follows,
  7096. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  7097. #
  7098. # $0 $configure_args
  7099.  
  7100. for arg
  7101. do
  7102.   case "\$arg" in
  7103.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  7104.     echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args
  7105.     exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;;
  7106.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  7107.   esac
  7108. done
  7109.  
  7110. trap 'rm -fr makemake unixconf.h conftest*; exit 1' 1 3 15
  7111. CC='$CC'
  7112. CPP='$CPP'
  7113. CC_GCC='$CC_GCC'
  7114. CC_ANSI='$CC_ANSI'
  7115. CC_NEED_CCPAUX='$CC_NEED_CCPAUX'
  7116. CC_NEED_DEELIF='$CC_NEED_DEELIF'
  7117. CC_NEED_DEERROR='$CC_NEED_DEERROR'
  7118. CC_NEED_DEEMA='$CC_NEED_DEEMA'
  7119. CC_NEED_MERGESTRINGS='$CC_NEED_MERGESTRINGS'
  7120. AS_UNDERSCORE='$AS_UNDERSCORE'
  7121. RANLIB='$RANLIB'
  7122. INSTALL='$INSTALL'
  7123. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  7124. INSTALL_DATA='$INSTALL_DATA'
  7125. CP='$CP'
  7126. LN_S='$LN_S'
  7127. GOOD_SH='$GOOD_SH'
  7128. HAVE_XMKMF='$HAVE_XMKMF'
  7129. X_INCLUDES='$X_INCLUDES'
  7130. X_LIBS='$X_LIBS'
  7131. GMALLOC='$GMALLOC'
  7132. ALLOCA='$ALLOCA'
  7133. LIBS='$LIBS'
  7134. srcdir='$srcdir'
  7135. prefix='$prefix'
  7136. exec_prefix='$exec_prefix'
  7137. prsub='$prsub'
  7138. extrasub='$extrasub'
  7139. EOF
  7140. cat >> config.status <<\EOF
  7141.  
  7142. top_srcdir=$srcdir
  7143.  
  7144. CONFIG_FILES=${CONFIG_FILES-"makemake"}
  7145. for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
  7146.   srcdir=$top_srcdir
  7147.   # Remove last slash and all that follows it.  Not all systems have dirname.
  7148.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  7149.   if test "$dir" != "$file"; then
  7150.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  7151.     test ! -d $dir && mkdir $dir
  7152.   fi
  7153.   echo creating $file
  7154.   rm -f $file
  7155.   touch $file
  7156.   if test `echo $file|sed 's|.*/||'` = makemake; then
  7157.     echo "#! /bin/sh" >> $file
  7158.   fi
  7159.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." >> $file
  7160.   sed -e "
  7161. $prsub
  7162. $extrasub
  7163. s%@CC@%$CC%g
  7164. s%@CPP@%$CPP%g
  7165. s%@CC_GCC@%$CC_GCC%g
  7166. s%@CC_ANSI@%$CC_ANSI%g
  7167. s%@CC_NEED_CCPAUX@%$CC_NEED_CCPAUX%g
  7168. s%@CC_NEED_DEELIF@%$CC_NEED_DEELIF%g
  7169. s%@CC_NEED_DEERROR@%$CC_NEED_DEERROR%g
  7170. s%@CC_NEED_DEEMA@%$CC_NEED_DEEMA%g
  7171. s%@CC_NEED_MERGESTRINGS@%$CC_NEED_MERGESTRINGS%g
  7172. s%@AS_UNDERSCORE@%$AS_UNDERSCORE%g
  7173. s%@RANLIB@%$RANLIB%g
  7174. s%@INSTALL@%$INSTALL%g
  7175. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  7176. s%@INSTALL_DATA@%$INSTALL_DATA%g
  7177. s%@CP@%$CP%g
  7178. s%@LN_S@%$LN_S%g
  7179. s%@GOOD_SH@%$GOOD_SH%g
  7180. s%@HAVE_XMKMF@%$HAVE_XMKMF%g
  7181. s%@X_INCLUDES@%$X_INCLUDES%g
  7182. s%@X_LIBS@%$X_LIBS%g
  7183. s%@GMALLOC@%$GMALLOC%g
  7184. s%@ALLOCA@%$ALLOCA%g
  7185. s%@LIBS@%$LIBS%g
  7186. s%@srcdir@%$srcdir%g
  7187. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  7188.   if test `echo $file|sed 's|.*/||'` = makemake; then
  7189.     chmod a+x $file
  7190.   fi
  7191. fi; done
  7192.  
  7193. CONFIG_HEADERS=${CONFIG_HEADERS-"unixconf.h"}
  7194. for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then
  7195. echo creating $file
  7196.  
  7197. # These sed commands are put into SEDDEFS when defining a macro.
  7198. # They are broken into pieces to make the sed script easier to manage.
  7199. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  7200. # is the cpp macro being defined and VALUE is the value it is being given.
  7201. # Each defining turns into a single global substitution command.
  7202. #
  7203. # SEDd sets the value in "#define NAME VALUE" lines.
  7204. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  7205. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  7206. SEDdC='\3'
  7207. SEDdD='@g'
  7208. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  7209. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  7210. SEDuB='\([     ]\)@\1#\2define\3'
  7211. SEDuC=' '
  7212. SEDuD='\4@g'
  7213. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  7214. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  7215. SEDeB='$@\1#\2define\3'
  7216. SEDeC=' '
  7217. SEDeD='@g'
  7218. # SEDf turns "#define NAME" without trailing blanks into "#define NAME VALUE".
  7219. SEDfA='s@^\([     ]*\)#\([     ]*\)define\([     ][     ]*\)'
  7220. SEDfB='$@\1#\2define\3'
  7221. SEDfC=' '
  7222. SEDfD='@g'
  7223. rm -f conftest.sed
  7224. EOF
  7225. # Turn off quoting long enough to insert the sed commands.
  7226. rm -f conftest.sh
  7227. cat > conftest.sh <<EOF
  7228. $SEDDEFS
  7229. EOF
  7230.  
  7231. # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
  7232. # on the size of here documents.
  7233.  
  7234. # Maximum number of lines to put in a single here document.
  7235. maxshlines=9
  7236.  
  7237. while :
  7238. do
  7239.   # wc gives bogus results for an empty file on some systems.
  7240.   lines=`grep -c . conftest.sh`
  7241.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  7242.   rm -f conftest.s1 conftest.s2
  7243.   sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  7244.   sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  7245.   # Write a limited-size here document to append to conftest.sed.
  7246.   echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  7247.   cat conftest.s1 >> config.status
  7248.   echo 'CONFEOF' >> config.status
  7249.   rm -f conftest.s1 conftest.sh
  7250.   mv conftest.s2 conftest.sh
  7251. done
  7252. rm -f conftest.sh
  7253.  
  7254. # Now back to your regularly scheduled config.status.
  7255. cat >> config.status <<\EOF
  7256. rm -f conftest.h
  7257. # Break up the sed commands because old seds have small limits.
  7258. maxsedlines=20
  7259. cp $top_srcdir/$file.in conftest.h1
  7260. while :
  7261. do
  7262.   lines=`grep -c . conftest.sed`
  7263.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  7264.   rm -f conftest.s1 conftest.s2 conftest.h2
  7265.   sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  7266.   sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  7267.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  7268.   rm -f conftest.s1 conftest.h1 conftest.sed
  7269.   mv conftest.h2 conftest.h1
  7270.   mv conftest.s2 conftest.sed
  7271. done
  7272. rm -f conftest.sed conftest.h
  7273. echo "/* $file.  Generated automatically by configure.  */" > conftest.h
  7274. cat conftest.h1 >> conftest.h
  7275. rm -f conftest.h1
  7276. if cmp -s $file conftest.h 2>/dev/null; then
  7277.   # The file exists and we would not be changing it.
  7278.   echo "$file is unchanged"
  7279.   rm -f conftest.h
  7280. else
  7281.   rm -f $file
  7282.   mv conftest.h $file
  7283. fi
  7284. fi; done
  7285.  
  7286.  
  7287.  
  7288. exit 0
  7289. EOF
  7290. chmod +x config.status
  7291. ${CONFIG_SHELL-/bin/sh} config.status
  7292.  
  7293.  
  7294.