home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / screen-3.5 / part07 / configure next >
Encoding:
Text File  |  1993-07-25  |  51.6 KB  |  2,117 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      *) ;;
  74.     esac
  75.   fi
  76. done
  77.  
  78. trap 'rm -f conftest* core; exit 1' 1 3 15
  79.  
  80. rm -f conftest*
  81. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  82.  
  83. # A filename unique to this package, relative to the directory that
  84. # configure is in, which we can look for to find out if srcdir is correct.
  85. unique_file=screen.c
  86.  
  87. # Find the source files, if location was not specified.
  88. if test -z "$srcdir"; then
  89.   srcdirdefaulted=yes
  90.   # Try the directory containing this script, then `..'.
  91.   prog=$0
  92.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  93.   test "X$confdir" = "X$prog" && confdir=.
  94.   srcdir=$confdir
  95.   if test ! -r $srcdir/$unique_file; then
  96.     srcdir=..
  97.   fi
  98. fi
  99. if test ! -r $srcdir/$unique_file; then
  100.   if test x$srcdirdefaulted = xyes; then
  101.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  102.   else
  103.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  104.   fi
  105.   exit 1
  106. fi
  107. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  108. # But we can't avoid them for `..', to make subdirectories work.
  109. case $srcdir in
  110.   .|/*|~*) ;;
  111.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  112. esac
  113.  
  114.  
  115.  
  116.  
  117. rev=`sed < patchlevel.h -n -e '/#define REV/s/#define REV  *//p'`
  118. vers=`sed < patchlevel.h -n -e '/#define VERS/s/#define VERS  *//p'`
  119. pat=`sed < patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL  *//p'`
  120. VERSION="$rev.$vers.$pat"
  121. echo "this is screen version $VERSION"
  122.  
  123.  
  124. if test -z "$CC"; then
  125.   echo checking for gcc
  126.   saveifs="$IFS"; IFS="${IFS}:"
  127.   for dir in $PATH; do
  128.     test -z "$dir" && dir=.
  129.     if test -f $dir/gcc; then
  130.       CC="gcc"
  131.       break
  132.     fi
  133.   done
  134.   IFS="$saveifs"
  135. fi
  136. test -z "$CC" && CC="cc"
  137.  
  138. # Find out if we are using GNU C, under whatever name.
  139. cat > conftest.c <<EOF
  140. #ifdef __GNUC__
  141.   yes
  142. #endif
  143. EOF
  144. ${CC-cc} -E conftest.c > conftest.out 2>&1
  145. if egrep yes conftest.out >/dev/null 2>&1; then
  146.   GCC=1 # For later tests.
  147. fi
  148. rm -f conftest*
  149.  
  150. echo checking how to run the C preprocessor
  151. if test -z "$CPP"; then
  152.   CPP='${CC-cc} -E'
  153.   cat > conftest.c <<EOF
  154. #include <stdio.h>
  155. EOF
  156. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  157. if test -z "$err"; then
  158.   :
  159. else
  160.   CPP=/lib/cpp
  161. fi
  162. rm -f conftest*
  163. fi
  164.  
  165. if test -n "$GCC"; then
  166.   echo checking whether -traditional is needed
  167.   pattern="Autoconf.*'x'"
  168.   prog='#include <sgtty.h>
  169. Autoconf TIOCGETP'
  170.   cat > conftest.c <<EOF
  171. $prog
  172. EOF
  173. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  174. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  175.   need_trad=1
  176. fi
  177. rm -f conftest*
  178.  
  179.  
  180.   if test -z "$need_trad"; then
  181.     prog='#include <termio.h>
  182. Autoconf TCGETA'
  183.     cat > conftest.c <<EOF
  184. $prog
  185. EOF
  186. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  187. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  188.   need_trad=1
  189. fi
  190. rm -f conftest*
  191.  
  192.   fi
  193.   test -n "$need_trad" && CC="$CC -traditional"
  194. fi
  195.  
  196. echo checking for POSIXized ISC
  197. if test -d /etc/conf/kconfig.d &&
  198.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  199. then
  200.   ISC=1 # If later tests want to check for ISC.
  201.   DEFS="$DEFS -D_POSIX_SOURCE=1"
  202. SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
  203. \${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
  204. \${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
  205. "
  206.   if test -n "$GCC"; then
  207.     CC="$CC -posix"
  208.   else
  209.     CC="$CC -Xp"
  210.   fi
  211. fi
  212.  
  213.  
  214.  
  215. cat > conftest.c <<EOF
  216. main(){exit(0);}
  217. EOF
  218. eval $compile
  219. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  220.   :
  221. else
  222.   echo "Can't run the compiler - sorry";exit
  223. fi
  224. rm -f conftest*
  225. for p in mawk gawk nawk awk
  226. do
  227. if test -z "$AWK"; then
  228.   echo checking for $p
  229.   saveifs="$IFS"; IFS="${IFS}:"
  230.   for dir in $PATH; do
  231.     test -z "$dir" && dir=.
  232.     if test -f $dir/$p; then
  233.       AWK="$p"
  234.       break
  235.     fi
  236.   done
  237.   IFS="$saveifs"
  238. fi
  239. test -z "$AWK" && AWK=""
  240.  
  241. test -n "$AWK" && break
  242. done
  243.  
  244.  
  245. # Make sure to not get the incompatible SysV /etc/install and
  246. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  247. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  248. # or the AFS install, which mishandles nonexistent args.  (Sigh.)
  249. if test -z "$INSTALL"; then
  250.   echo checking for install
  251.   saveifs="$IFS"; IFS="${IFS}:"
  252.   for dir in $PATH; do
  253.     test -z "$dir" && dir=.
  254.     case $dir in
  255.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
  256.     *)
  257.       if test -f $dir/install; then
  258.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  259.       : # AIX
  260.     else
  261.       INSTALL="$dir/install -c"
  262.       INSTALL_PROGRAM='$(INSTALL)'
  263.       INSTALL_DATA='$(INSTALL) -m 644'
  264.       break
  265.     fi
  266.       fi
  267.       ;;
  268.     esac
  269.   done
  270.   IFS="$saveifs"
  271. fi
  272. INSTALL=${INSTALL-cp}
  273. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  274. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  275.  
  276.  
  277. if test -n "$ISC"; then
  278.   DEFS="$DEFS -DISC=1"
  279. SEDDEFS="${SEDDEFS}\${SEDdA}ISC\${SEDdB}ISC\${SEDdC}1\${SEDdD}
  280. \${SEDuA}ISC\${SEDuB}ISC\${SEDuC}1\${SEDuD}
  281. \${SEDeA}ISC\${SEDeB}ISC\${SEDeC}1\${SEDeD}
  282. " LIBS="$LIBS -linet"
  283. fi
  284.  
  285. echo checking for MIPS
  286. if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
  287. DEFS="$DEFS -DMIPS=1"
  288. SEDDEFS="${SEDDEFS}\${SEDdA}MIPS\${SEDdB}MIPS\${SEDdC}1\${SEDdD}
  289. \${SEDuA}MIPS\${SEDuB}MIPS\${SEDuC}1\${SEDuD}
  290. \${SEDeA}MIPS\${SEDeB}MIPS\${SEDeC}1\${SEDeD}
  291. " LIBS="$LIBS -lmld" # for nlist.
  292. echo checking for wait3
  293. cat > conftest.c <<EOF
  294.  
  295. main() { exit(0); } 
  296. t() { wait3(); }
  297. EOF
  298. if eval $compile; then
  299.   :
  300. else
  301.   echo checking for wait2
  302. cat > conftest.c <<EOF
  303.  
  304. main() { exit(0); } 
  305. t() { wait2(); }
  306. EOF
  307. if eval $compile; then
  308.   DEFS="$DEFS -DUSE_WAIT2=1"
  309. SEDDEFS="${SEDDEFS}\${SEDdA}USE_WAIT2\${SEDdB}USE_WAIT2\${SEDdC}1\${SEDdD}
  310. \${SEDuA}USE_WAIT2\${SEDuB}USE_WAIT2\${SEDuC}1\${SEDuD}
  311. \${SEDeA}USE_WAIT2\${SEDeB}USE_WAIT2\${SEDeC}1\${SEDeD}
  312. " LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
  313.  
  314. fi
  315. rm -f conftest*
  316.  
  317. fi
  318. rm -f conftest*
  319.  
  320. fi
  321.  
  322. echo checking for Ultrix
  323. cat > conftest.c <<EOF
  324. #if defined(ultrix) || defined(__ultrix)
  325.   yes
  326. #endif
  327.  
  328. EOF
  329. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  330. if egrep "yes" conftest.out >/dev/null 2>&1; then
  331.   ULTRIX=1
  332. fi
  333. rm -f conftest*
  334.  
  335.  
  336. if test -n "$ULTRIX"; then
  337.   test -z "$GCC" && CC="$CC -YBSD"
  338. else
  339.   # POSIX termios is broken on Ultrix so don't look for it.
  340. echo checking for POSIX.1
  341. cat > conftest.c <<EOF
  342. #include <sys/types.h>
  343. #include <unistd.h>
  344. main () {
  345. #ifdef _POSIX_VERSION
  346.   yes
  347. #endif
  348.  
  349. EOF
  350. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  351. if egrep "yes" conftest.out >/dev/null 2>&1; then
  352.   echo "- you have a POSIX system";DEFS="$DEFS -DPOSIX=1"
  353. SEDDEFS="${SEDDEFS}\${SEDdA}POSIX\${SEDdB}POSIX\${SEDdC}1\${SEDdD}
  354. \${SEDuA}POSIX\${SEDuB}POSIX\${SEDuC}1\${SEDuD}
  355. \${SEDeA}POSIX\${SEDeB}POSIX\${SEDeC}1\${SEDeD}
  356. "
  357. fi
  358. rm -f conftest*
  359.  
  360. fi
  361.  
  362. echo checking for System V
  363. cat > conftest.c <<EOF
  364. #include <sys/types.h>
  365. #include <signal.h>
  366. #include <fcntl.h>
  367. main() { exit(0); } 
  368. t() { int x = SIGCHLD | FNDELAY; }
  369. EOF
  370. if eval $compile; then
  371.   :
  372. else
  373.   DEFS="$DEFS -DSYSV=1"
  374. SEDDEFS="${SEDDEFS}\${SEDdA}SYSV\${SEDdB}SYSV\${SEDdC}1\${SEDdD}
  375. \${SEDuA}SYSV\${SEDuB}SYSV\${SEDuC}1\${SEDuD}
  376. \${SEDeA}SYSV\${SEDeB}SYSV\${SEDeC}1\${SEDeD}
  377. "
  378. fi
  379. rm -f conftest*
  380.  
  381.  
  382. echo checking for sequent/ptx
  383. cat > conftest.c <<EOF
  384. #ifdef _SEQUENT_
  385.   yes
  386. #endif
  387.  
  388. EOF
  389. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  390. if egrep "yes" conftest.out >/dev/null 2>&1; then
  391.   LIBS="$LIBS -lsocket -linet";seqptx=1
  392. fi
  393. rm -f conftest*
  394.  
  395.  
  396. oldlibs="$LIBS"
  397. LIBS="$LIBS -lelf"
  398. echo checking for SVR4
  399. cat > conftest.c <<EOF
  400.  
  401. main() { exit(0); } 
  402. t() {  }
  403. EOF
  404. if eval $compile; then
  405.   echo checking for dwarf.h
  406. cat > conftest.c <<EOF
  407. #include <dwarf.h>
  408. EOF
  409. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  410. if test -z "$err"; then
  411.   DEFS="$DEFS -DSVR4=1"
  412. SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
  413. \${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
  414. \${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
  415. " ; DEFS="$DEFS -DBUGGYGETLOGIN=1"
  416. SEDDEFS="${SEDDEFS}\${SEDdA}BUGGYGETLOGIN\${SEDdB}BUGGYGETLOGIN\${SEDdC}1\${SEDdD}
  417. \${SEDuA}BUGGYGETLOGIN\${SEDuB}BUGGYGETLOGIN\${SEDuC}1\${SEDuD}
  418. \${SEDeA}BUGGYGETLOGIN\${SEDeB}BUGGYGETLOGIN\${SEDeC}1\${SEDeD}
  419. " ; LIBS="$LIBS -lelf"
  420. else
  421.   echo checking for elf.h
  422. cat > conftest.c <<EOF
  423. #include <elf.h>
  424. EOF
  425. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  426. if test -z "$err"; then
  427.   DEFS="$DEFS -DSVR4=1"
  428. SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
  429. \${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
  430. \${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
  431. " ; DEFS="$DEFS -DBUGGYGETLOGIN=1"
  432. SEDDEFS="${SEDDEFS}\${SEDdA}BUGGYGETLOGIN\${SEDdB}BUGGYGETLOGIN\${SEDdC}1\${SEDdD}
  433. \${SEDuA}BUGGYGETLOGIN\${SEDuB}BUGGYGETLOGIN\${SEDuC}1\${SEDuD}
  434. \${SEDeA}BUGGYGETLOGIN\${SEDeB}BUGGYGETLOGIN\${SEDeC}1\${SEDeD}
  435. " ; LIBS="$LIBS -lelf"
  436. fi
  437. rm -f conftest*
  438.  
  439. fi
  440. rm -f conftest*
  441.  
  442.  
  443. else
  444.   LIBS="$oldlibs"
  445. fi
  446. rm -f conftest*
  447.  
  448.  
  449.  
  450.  
  451. echo checking for putenv declaration
  452. cat > conftest.c <<EOF
  453. #include <sys/types.h>
  454. #include <unistd.h>
  455. #include <stdlib.h>
  456.  
  457. EOF
  458. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  459. if egrep "putenv( |    |\()" conftest.out >/dev/null 2>&1; then
  460.   DEFS="$DEFS -DPUTENV_DECLARED=1"
  461. SEDDEFS="${SEDDEFS}\${SEDdA}PUTENV_DECLARED\${SEDdB}PUTENV_DECLARED\${SEDdC}1\${SEDdD}
  462. \${SEDuA}PUTENV_DECLARED\${SEDuB}PUTENV_DECLARED\${SEDuC}1\${SEDuD}
  463. \${SEDeA}PUTENV_DECLARED\${SEDeB}PUTENV_DECLARED\${SEDeC}1\${SEDeD}
  464. "
  465. fi
  466. rm -f conftest*
  467.  
  468.  
  469. echo checking for getdtablesize declaration
  470. cat > conftest.c <<EOF
  471. #include <sys/types.h>
  472. #include <unistd.h>
  473.  
  474. EOF
  475. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  476. if egrep "getdtablesize( |    |\()" conftest.out >/dev/null 2>&1; then
  477.   DEFS="$DEFS -DGETDTABLESIZE_DECLARED=1"
  478. SEDDEFS="${SEDDEFS}\${SEDdA}GETDTABLESIZE_DECLARED\${SEDdB}GETDTABLESIZE_DECLARED\${SEDdC}1\${SEDdD}
  479. \${SEDuA}GETDTABLESIZE_DECLARED\${SEDuB}GETDTABLESIZE_DECLARED\${SEDuC}1\${SEDuD}
  480. \${SEDeA}GETDTABLESIZE_DECLARED\${SEDeB}GETDTABLESIZE_DECLARED\${SEDeC}1\${SEDeD}
  481. "
  482. fi
  483. rm -f conftest*
  484.  
  485.  
  486. echo checking for select declaration
  487. cat > conftest.c <<EOF
  488. #include <sys/types.h>
  489. #include <sys/time.h>
  490. #include <unistd.h>
  491.  
  492. EOF
  493. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  494. if egrep "select( |    |\()" conftest.out >/dev/null 2>&1; then
  495.   DEFS="$DEFS -DSELECT_DECLARED=1"
  496. SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_DECLARED\${SEDdB}SELECT_DECLARED\${SEDdC}1\${SEDdD}
  497. \${SEDuA}SELECT_DECLARED\${SEDuB}SELECT_DECLARED\${SEDuC}1\${SEDuD}
  498. \${SEDeA}SELECT_DECLARED\${SEDeB}SELECT_DECLARED\${SEDeC}1\${SEDeD}
  499. "
  500. fi
  501. rm -f conftest*
  502.  
  503.  
  504. echo checking for vsprintf declaration
  505. cat > conftest.c <<EOF
  506. #include <sys/types.h>
  507. #include <stdio.h>
  508. #ifdef __STDC__
  509. #include <stdarg.h>
  510. #else
  511. #include <varargs.h>
  512. #endif
  513.  
  514. EOF
  515. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  516. if egrep "vsprintf( |    |\()" conftest.out >/dev/null 2>&1; then
  517.   DEFS="$DEFS -DVPRNT_DECLARED=1"
  518. SEDDEFS="${SEDDEFS}\${SEDdA}VPRNT_DECLARED\${SEDdB}VPRNT_DECLARED\${SEDdC}1\${SEDdD}
  519. \${SEDuA}VPRNT_DECLARED\${SEDuB}VPRNT_DECLARED\${SEDuC}1\${SEDuD}
  520. \${SEDeA}VPRNT_DECLARED\${SEDeB}VPRNT_DECLARED\${SEDeC}1\${SEDeD}
  521. "
  522. fi
  523. rm -f conftest*
  524.  
  525.  
  526. echo checking for setreuid declaration
  527. cat > conftest.c <<EOF
  528. #include <sys/types.h>
  529. #include <unistd.h>
  530.  
  531. EOF
  532. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  533. if egrep "setres?uid( |    |\()" conftest.out >/dev/null 2>&1; then
  534.   DEFS="$DEFS -DREUID_DECLARED=1"
  535. SEDDEFS="${SEDDEFS}\${SEDdA}REUID_DECLARED\${SEDdB}REUID_DECLARED\${SEDdC}1\${SEDdD}
  536. \${SEDuA}REUID_DECLARED\${SEDuB}REUID_DECLARED\${SEDuC}1\${SEDuD}
  537. \${SEDeA}REUID_DECLARED\${SEDeB}REUID_DECLARED\${SEDeC}1\${SEDeD}
  538. "
  539. fi
  540. rm -f conftest*
  541.  
  542.  
  543. echo checking for wait declaration
  544. cat > conftest.c <<EOF
  545. #include <sys/types.h>
  546. #include <signal.h>
  547. #include <sys/wait.h>
  548.  
  549. EOF
  550. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  551. if egrep "wait( |    |\()" conftest.out >/dev/null 2>&1; then
  552.   DEFS="$DEFS -DWAITSTUFF_DECLARED=1"
  553. SEDDEFS="${SEDDEFS}\${SEDdA}WAITSTUFF_DECLARED\${SEDdB}WAITSTUFF_DECLARED\${SEDdC}1\${SEDdD}
  554. \${SEDuA}WAITSTUFF_DECLARED\${SEDuB}WAITSTUFF_DECLARED\${SEDuC}1\${SEDuD}
  555. \${SEDeA}WAITSTUFF_DECLARED\${SEDeB}WAITSTUFF_DECLARED\${SEDeC}1\${SEDeD}
  556. "
  557. fi
  558. rm -f conftest*
  559.  
  560.  
  561. echo checking for memfuncs declaration
  562. cat > conftest.c <<EOF
  563. #include <sys/types.h>
  564. #include <unistd.h>
  565. #include <string.h>
  566. #include <strings.h>
  567.  
  568. EOF
  569. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  570. if egrep "(memcpy|memmove|bcopy)( |    |\()" conftest.out >/dev/null 2>&1; then
  571.   DEFS="$DEFS -DMEMFUNCS_DECLARED=1"
  572. SEDDEFS="${SEDDEFS}\${SEDdA}MEMFUNCS_DECLARED\${SEDdB}MEMFUNCS_DECLARED\${SEDdC}1\${SEDdD}
  573. \${SEDuA}MEMFUNCS_DECLARED\${SEDuB}MEMFUNCS_DECLARED\${SEDuC}1\${SEDuD}
  574. \${SEDeA}MEMFUNCS_DECLARED\${SEDeB}MEMFUNCS_DECLARED\${SEDeC}1\${SEDeD}
  575. "
  576. fi
  577. rm -f conftest*
  578.  
  579.  
  580. echo checking for index declaration
  581. cat > conftest.c <<EOF
  582. #include <sys/types.h>
  583. #include <strings.h>
  584.  
  585. EOF
  586. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  587. if egrep "index( |    |\()" conftest.out >/dev/null 2>&1; then
  588.   DEFS="$DEFS -DINDEX_DECLARED=1"
  589. SEDDEFS="${SEDDEFS}\${SEDdA}INDEX_DECLARED\${SEDdB}INDEX_DECLARED\${SEDdC}1\${SEDdD}
  590. \${SEDuA}INDEX_DECLARED\${SEDuB}INDEX_DECLARED\${SEDuC}1\${SEDuD}
  591. \${SEDeA}INDEX_DECLARED\${SEDeB}INDEX_DECLARED\${SEDeC}1\${SEDeD}
  592. "
  593. fi
  594. rm -f conftest*
  595.  
  596.  
  597. echo checking for crypt declaration
  598. cat > conftest.c <<EOF
  599. #include <sys/types.h>
  600. #include <unistd.h>
  601.  
  602. EOF
  603. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  604. if egrep "crypt( |    |\()" conftest.out >/dev/null 2>&1; then
  605.   DEFS="$DEFS -DCRYPT_DECLARED=1"
  606. SEDDEFS="${SEDDEFS}\${SEDdA}CRYPT_DECLARED\${SEDdB}CRYPT_DECLARED\${SEDdC}1\${SEDdD}
  607. \${SEDuA}CRYPT_DECLARED\${SEDuB}CRYPT_DECLARED\${SEDuC}1\${SEDuD}
  608. \${SEDeA}CRYPT_DECLARED\${SEDeB}CRYPT_DECLARED\${SEDeC}1\${SEDeD}
  609. "
  610. fi
  611. rm -f conftest*
  612.  
  613.  
  614. echo checking for mknod declaration
  615. cat > conftest.c <<EOF
  616. #include <sys/types.h>
  617. #include <sys/stat.h>
  618.  
  619. EOF
  620. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  621. if egrep "mknod( |    |\()" conftest.out >/dev/null 2>&1; then
  622.   DEFS="$DEFS -DMKNOD_DECLARED=1"
  623. SEDDEFS="${SEDDEFS}\${SEDdA}MKNOD_DECLARED\${SEDdB}MKNOD_DECLARED\${SEDdC}1\${SEDdD}
  624. \${SEDuA}MKNOD_DECLARED\${SEDuB}MKNOD_DECLARED\${SEDuC}1\${SEDuD}
  625. \${SEDeA}MKNOD_DECLARED\${SEDeB}MKNOD_DECLARED\${SEDeC}1\${SEDeD}
  626. "
  627. fi
  628. rm -f conftest*
  629.  
  630.  
  631. echo checking for setpgid declaration
  632. cat > conftest.c <<EOF
  633. #include <sys/types.h>
  634. #include <unistd.h>
  635.  
  636. EOF
  637. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  638. if egrep "setpgid( |    |\()" conftest.out >/dev/null 2>&1; then
  639.   DEFS="$DEFS -DSETPGID_DECLARED=1"
  640. SEDDEFS="${SEDDEFS}\${SEDdA}SETPGID_DECLARED\${SEDdB}SETPGID_DECLARED\${SEDdC}1\${SEDdD}
  641. \${SEDuA}SETPGID_DECLARED\${SEDuB}SETPGID_DECLARED\${SEDuC}1\${SEDuD}
  642. \${SEDeA}SETPGID_DECLARED\${SEDeB}SETPGID_DECLARED\${SEDeC}1\${SEDeD}
  643. "
  644. fi
  645. rm -f conftest*
  646.  
  647.  
  648. echo checking for kill declaration
  649. cat > conftest.c <<EOF
  650. #include <sys/types.h>
  651. #include <unistd.h>
  652. #include <signal.h>
  653.  
  654. EOF
  655. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  656. if egrep "kill( |    |\()" conftest.out >/dev/null 2>&1; then
  657.   DEFS="$DEFS -DKILLSTUFF_DECLARED=1"
  658. SEDDEFS="${SEDDEFS}\${SEDdA}KILLSTUFF_DECLARED\${SEDdB}KILLSTUFF_DECLARED\${SEDdC}1\${SEDdD}
  659. \${SEDuA}KILLSTUFF_DECLARED\${SEDuB}KILLSTUFF_DECLARED\${SEDuC}1\${SEDuD}
  660. \${SEDeA}KILLSTUFF_DECLARED\${SEDeB}KILLSTUFF_DECLARED\${SEDeC}1\${SEDeD}
  661. "
  662. fi
  663. rm -f conftest*
  664.  
  665.  
  666. echo checking for gethostname declaration
  667. cat > conftest.c <<EOF
  668. #include <sys/types.h>
  669. #include <unistd.h>
  670.  
  671. EOF
  672. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  673. if egrep "gethostname( |    |\()" conftest.out >/dev/null 2>&1; then
  674.   DEFS="$DEFS -DGETHOSTNAME_DECLARED=1"
  675. SEDDEFS="${SEDDEFS}\${SEDdA}GETHOSTNAME_DECLARED\${SEDdB}GETHOSTNAME_DECLARED\${SEDdC}1\${SEDdD}
  676. \${SEDuA}GETHOSTNAME_DECLARED\${SEDuB}GETHOSTNAME_DECLARED\${SEDuC}1\${SEDuD}
  677. \${SEDeA}GETHOSTNAME_DECLARED\${SEDeB}GETHOSTNAME_DECLARED\${SEDeC}1\${SEDeD}
  678. "
  679. fi
  680. rm -f conftest*
  681.  
  682.  
  683. echo checking for pid_t
  684. cat > conftest.c <<EOF
  685. #include <sys/types.h>
  686.  
  687. EOF
  688. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  689. if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  690.   DEFS="$DEFS -DPID_T_DEFINED=1"
  691. SEDDEFS="${SEDDEFS}\${SEDdA}PID_T_DEFINED\${SEDdB}PID_T_DEFINED\${SEDdC}1\${SEDdD}
  692. \${SEDuA}PID_T_DEFINED\${SEDuB}PID_T_DEFINED\${SEDuC}1\${SEDuD}
  693. \${SEDeA}PID_T_DEFINED\${SEDeB}PID_T_DEFINED\${SEDeC}1\${SEDeD}
  694. "
  695. fi
  696. rm -f conftest*
  697.  
  698.  
  699. echo checking for sig_t
  700. cat > conftest.c <<EOF
  701. #include <sys/types.h>
  702. #include <signal.h>
  703.  
  704. EOF
  705. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  706. if egrep "sig_t" conftest.out >/dev/null 2>&1; then
  707.   DEFS="$DEFS -DSIG_T_DEFINED=1"
  708. SEDDEFS="${SEDDEFS}\${SEDdA}SIG_T_DEFINED\${SEDdB}SIG_T_DEFINED\${SEDdC}1\${SEDdD}
  709. \${SEDuA}SIG_T_DEFINED\${SEDuB}SIG_T_DEFINED\${SEDuC}1\${SEDuD}
  710. \${SEDeA}SIG_T_DEFINED\${SEDeB}SIG_T_DEFINED\${SEDeC}1\${SEDeD}
  711. "
  712. fi
  713. rm -f conftest*
  714.  
  715.  
  716. echo checking for uid_t
  717. cat > conftest.c <<EOF
  718. #include <sys/types.h>
  719.  
  720. EOF
  721. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  722. if egrep "uid_t" conftest.out >/dev/null 2>&1; then
  723.   DEFS="$DEFS -DUID_T_DEFINED=1"
  724. SEDDEFS="${SEDDEFS}\${SEDdA}UID_T_DEFINED\${SEDdB}UID_T_DEFINED\${SEDdC}1\${SEDdD}
  725. \${SEDuA}UID_T_DEFINED\${SEDuB}UID_T_DEFINED\${SEDuC}1\${SEDuD}
  726. \${SEDeA}UID_T_DEFINED\${SEDeB}UID_T_DEFINED\${SEDeC}1\${SEDeD}
  727. "
  728. fi
  729. rm -f conftest*
  730.  
  731.  
  732.  
  733. echo checking for BSD job control
  734. cat > conftest.c <<EOF
  735. #include <sys/types.h>
  736. #include <sys/ioctl.h>
  737.  
  738. main() { exit(0); } 
  739. t() { 
  740. #ifdef POSIX
  741. tcsetpgrp(0, 0);
  742. #else
  743. int x = TIOCSPGRP;
  744. #ifdef SYSV
  745. setpgrp();
  746. #else
  747. int y = TIOCNOTTY;
  748. #endif
  749. #endif
  750.  }
  751. EOF
  752. if eval $compile; then
  753.   echo "- you have jobcontrol";DEFS="$DEFS -DBSDJOBS=1"
  754. SEDDEFS="${SEDDEFS}\${SEDdA}BSDJOBS\${SEDdB}BSDJOBS\${SEDdC}1\${SEDdD}
  755. \${SEDuA}BSDJOBS\${SEDuB}BSDJOBS\${SEDuC}1\${SEDuD}
  756. \${SEDeA}BSDJOBS\${SEDeB}BSDJOBS\${SEDeC}1\${SEDeD}
  757. "
  758. else
  759.   echo "- you don't have jobcontrol"
  760. fi
  761. rm -f conftest*
  762.  
  763.  
  764. echo checking for setreuid
  765. cat > conftest.c <<EOF
  766.  
  767. main() { exit(0); } 
  768. t() { 
  769. #ifdef hpux
  770. setresuid(0, 0, 0);
  771. #else
  772. setreuid(0, 0);
  773. #endif
  774.  }
  775. EOF
  776. if eval $compile; then
  777.   :
  778. else
  779.   DEFS="$DEFS -DNOREUID=1"
  780. SEDDEFS="${SEDDEFS}\${SEDdA}NOREUID\${SEDdB}NOREUID\${SEDdC}1\${SEDdD}
  781. \${SEDuA}NOREUID\${SEDuB}NOREUID\${SEDuC}1\${SEDuD}
  782. \${SEDeA}NOREUID\${SEDeB}NOREUID\${SEDeC}1\${SEDeD}
  783. "
  784. fi
  785. rm -f conftest*
  786.  
  787.  
  788.  
  789.  
  790. echo checking for select
  791. cat > conftest.c <<EOF
  792.  
  793. main() { exit(0); } 
  794. t() { select(0, 0, 0, 0, 0); }
  795. EOF
  796. if eval $compile; then
  797.   :
  798. else
  799.   LIBS="$LIBS -lnet -lnsl"
  800. echo checking for select with $LIBS
  801. cat > conftest.c <<EOF
  802.  
  803. main() { exit(0); } 
  804. t() { select(0, 0, 0, 0, 0); }
  805. EOF
  806. if eval $compile; then
  807.   :
  808. else
  809.   echo '!!! no select - no screen';exit
  810. fi
  811. rm -f conftest*
  812.  
  813.  
  814. fi
  815. rm -f conftest*
  816.  
  817.  
  818. echo checking fifos
  819. cat > conftest.c <<EOF
  820.  
  821. #include <sys/types.h>
  822. #include <sys/stat.h>
  823. #include <fcntl.h>
  824.  
  825. #ifndef O_NDELAY
  826. #define O_NDELAY O_NONBLOCK
  827. #endif
  828. #ifndef S_IFIFO
  829. #define S_IFIFO 0010000
  830. #endif
  831.  
  832. char *fin = "/tmp/conftest$$";
  833.  
  834. main()
  835. {
  836.   struct stat stb;
  837.   int f;
  838.  
  839.   (void)alarm(5);
  840.   if (mknod(fin, S_IFIFO|0777, 0))
  841.     exit(1);
  842.   if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
  843.     exit(1);
  844.   close(0);
  845.   if (open(fin, O_RDWR | O_NDELAY))
  846.     exit(1);
  847.   if (write(0, "TEST", 4) == -1)
  848.     exit(1);
  849.   f = 1;
  850.   if (select(1, &f, 0, 0, 0) == -1)
  851.     exit(1);
  852.   exit(0);
  853. }
  854.  
  855. EOF
  856. eval $compile
  857. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  858.   echo "- your fifos are usable"; fifo=1
  859. else
  860.   echo "- your fifos are not usable"
  861. fi
  862. rm -f conftest*
  863. rm -f /tmp/conftest*
  864.  
  865. if test -n "$fifo"; then
  866. echo "checking for broken fifo implementation"
  867. cat > conftest.c <<EOF
  868.  
  869. #include <sys/types.h>
  870. #include <fcntl.h>
  871. #include <sys/time.h>
  872. #include <sys/stat.h>
  873.  
  874. #ifndef O_NDELAY
  875. #define O_NDELAY O_NONBLOCK
  876. #endif
  877. #ifndef S_IFIFO
  878. #define S_IFIFO 0010000
  879. #endif
  880.  
  881. char *fin = "/tmp/conftest$$";
  882.  
  883. main()
  884. {
  885.   struct timeval tv;
  886.   int r, x;
  887.  
  888.   if (mknod(fin, S_IFIFO|0600))
  889.     exit(1);
  890.   close(0);
  891.   if (open(fin, O_RDONLY|O_NDELAY))
  892.     exit(1);
  893.   r = 1;
  894.   tv.tv_sec = 1;
  895.   tv.tv_usec = 0;
  896.   if (select(1, &r, 0, 0, &tv))
  897.     exit(1);
  898.   exit(0);
  899. }
  900.  
  901. EOF
  902. eval $compile
  903. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  904.   echo "- your implementation is ok"
  905. else
  906.   echo "- you have a broken implementation";DEFS="$DEFS -DBROKEN_PIPE=1"
  907. SEDDEFS="${SEDDEFS}\${SEDdA}BROKEN_PIPE\${SEDdB}BROKEN_PIPE\${SEDdC}1\${SEDdD}
  908. \${SEDuA}BROKEN_PIPE\${SEDuB}BROKEN_PIPE\${SEDuC}1\${SEDuD}
  909. \${SEDeA}BROKEN_PIPE\${SEDeB}BROKEN_PIPE\${SEDeC}1\${SEDeD}
  910. ";fifobr=1
  911. fi
  912. rm -f conftest*
  913. rm -f /tmp/conftest*
  914. fi
  915.  
  916.  
  917. echo checking sockets
  918. cat > conftest.c <<EOF
  919.  
  920. #include <sys/types.h>
  921. #include <sys/socket.h>
  922. #include <sys/un.h>
  923. #include <fcntl.h>
  924.  
  925. #ifndef O_NDELAY
  926. #define O_NDELAY O_NONBLOCK
  927. #endif
  928. #ifndef FNDELAY
  929. #define FNDELAY O_NDELAY
  930. #endif
  931.  
  932. char *son = "/tmp/conftest$$";
  933.  
  934. main()
  935. {
  936.   int s1, s2, s3, l;
  937.   struct sockaddr_un a;
  938.  
  939.   (void)alarm(5);
  940.   if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  941.     exit(1);
  942.   a.sun_family = AF_UNIX;
  943.   strcpy(a.sun_path, son);
  944.   (void) unlink(son);
  945.   if (bind(s1, (struct sockaddr *) &a, strlen(son)+2) == -1)
  946.     exit(1);
  947.   if (listen(s1, 2))
  948.     exit(1);
  949.   if (fork() == 0)
  950.     {
  951.       if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  952.     kill(getppid(), 3);
  953.       (void)connect(s2, &a, strlen(son) + 2);
  954.       if (write(s2, "HELLO", 5) == -1)
  955.     kill(getppid(), 3);
  956.       exit(0);
  957.     }
  958.   l = sizeof(a);
  959.   close(0);
  960.   if (accept(s1, &a, &l))
  961.     exit(1);
  962.   l = 1;
  963.   if (select(1, &l, 0, 0, 0) == -1)
  964.     exit(1);
  965.   exit(0);
  966. }
  967.  
  968. EOF
  969. eval $compile
  970. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  971.   echo "- your sockets are usable"; sock=1
  972. else
  973.   echo "- your sockets are not usable"
  974. fi
  975. rm -f conftest*
  976. rm -f /tmp/conftest*
  977.  
  978. if test -n "$sock"; then
  979. echo "checking socket implementation"
  980. cat > conftest.c <<EOF
  981.  
  982. #include <sys/types.h>
  983. #include <sys/stat.h>
  984. #include <sys/socket.h>
  985. #include <sys/un.h>
  986.  
  987. char *son = "/tmp/conftest$$";
  988.  
  989. main()
  990. {
  991.   int s;
  992.   struct stat stb;
  993.   struct sockaddr_un a;
  994.   if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  995.     exit(0);
  996.   a.sun_family = AF_UNIX;
  997.   strcpy(a.sun_path, son);
  998.   (void) unlink(son);
  999.   if (bind(s, (struct sockaddr *) &a, strlen(son)+2) == -1)
  1000.     exit(0);
  1001.   if (stat(son, &stb))
  1002.     exit(1);
  1003.   close(s);
  1004.   exit(0);
  1005. }
  1006.  
  1007. EOF
  1008. eval $compile
  1009. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1010.   echo "- you are normal"
  1011. else
  1012.   echo "- unix domain sockets are not kept in the filesystem";DEFS="$DEFS -DSOCK_NOT_IN_FS=1"
  1013. SEDDEFS="${SEDDEFS}\${SEDdA}SOCK_NOT_IN_FS\${SEDdB}SOCK_NOT_IN_FS\${SEDdC}1\${SEDdD}
  1014. \${SEDuA}SOCK_NOT_IN_FS\${SEDuB}SOCK_NOT_IN_FS\${SEDuC}1\${SEDuD}
  1015. \${SEDeA}SOCK_NOT_IN_FS\${SEDeB}SOCK_NOT_IN_FS\${SEDeC}1\${SEDeD}
  1016. ";socknofs=1
  1017. fi
  1018. rm -f conftest*
  1019. rm -f /tmp/conftest*
  1020. fi
  1021.  
  1022.  
  1023. if test -n "$fifo"; then
  1024.   if test -n "$sock"; then
  1025.     if test -n "$nore"; then
  1026.       echo "- hmmm... better take the fifos"
  1027.       DEFS="$DEFS -DNAMEDPIPE=1"
  1028. SEDDEFS="${SEDDEFS}\${SEDdA}NAMEDPIPE\${SEDdB}NAMEDPIPE\${SEDdC}1\${SEDdD}
  1029. \${SEDuA}NAMEDPIPE\${SEDuB}NAMEDPIPE\${SEDuC}1\${SEDuD}
  1030. \${SEDeA}NAMEDPIPE\${SEDeB}NAMEDPIPE\${SEDeC}1\${SEDeD}
  1031. "
  1032.     elif test -n "$fifobr"; then
  1033.       echo "- as your fifos are broken lets use the sockets."
  1034.     else
  1035.       echo "- both sockets and fifos usable. let's take fifos."
  1036.       DEFS="$DEFS -DNAMEDPIPE=1"
  1037. SEDDEFS="${SEDDEFS}\${SEDdA}NAMEDPIPE\${SEDdB}NAMEDPIPE\${SEDdC}1\${SEDdD}
  1038. \${SEDuA}NAMEDPIPE\${SEDuB}NAMEDPIPE\${SEDuC}1\${SEDuD}
  1039. \${SEDeA}NAMEDPIPE\${SEDeB}NAMEDPIPE\${SEDeC}1\${SEDeD}
  1040. "
  1041.     fi
  1042.   else
  1043.     echo "- using named pipes, of course"
  1044.     DEFS="$DEFS -DNAMEDPIPE=1"
  1045. SEDDEFS="${SEDDEFS}\${SEDdA}NAMEDPIPE\${SEDdB}NAMEDPIPE\${SEDdC}1\${SEDdD}
  1046. \${SEDuA}NAMEDPIPE\${SEDuB}NAMEDPIPE\${SEDuC}1\${SEDuD}
  1047. \${SEDeA}NAMEDPIPE\${SEDeB}NAMEDPIPE\${SEDeC}1\${SEDeD}
  1048. "
  1049.   fi
  1050. elif test -n "$sock"; then
  1051.   echo "- using unix-domain sockets, of course"
  1052. else
  1053.   echo "!!! you have neither usable sockets nor usable pipes -> no screen"
  1054.   exit
  1055. fi
  1056.  
  1057.  
  1058. echo "checking select return value"
  1059. cat > conftest.c <<EOF
  1060.  
  1061. #include <sys/types.h>
  1062. #include <sys/stat.h>
  1063. #include <fcntl.h>
  1064.  
  1065. char *nam = "/tmp/conftest$$";
  1066.  
  1067. #ifdef NAMEDPIPE
  1068.  
  1069. #ifndef O_NDELAY
  1070. #define O_NDELAY O_NONBLOCK
  1071. #endif
  1072. #ifndef S_IFIFO
  1073. #define S_IFIFO 0010000
  1074. #endif
  1075.  
  1076.  
  1077. main()
  1078. {
  1079.   int l;
  1080.  
  1081.   (void)alarm(5);
  1082.   if (mknod(nam, S_IFIFO|0777, 0))
  1083.     exit(1);
  1084.   close(0);
  1085.   if (open(nam, O_RDWR | O_NDELAY))
  1086.     exit(1);
  1087.   if (write(0, "TEST", 4) == -1)
  1088.     exit(1);
  1089.  
  1090. #else
  1091.  
  1092. #include <sys/types.h>
  1093. #include <sys/socket.h>
  1094. #include <sys/un.h>
  1095.  
  1096. main()
  1097. {
  1098.   int s1, s2, s3, l;
  1099.   struct sockaddr_un a;
  1100.  
  1101.   (void)alarm(5);
  1102.   if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  1103.     exit(1);
  1104.   a.sun_family = AF_UNIX;
  1105.   strcpy(a.sun_path, nam);
  1106.   (void) unlink(nam);
  1107.   if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1)
  1108.     exit(1);
  1109.   if (listen(s1, 2))
  1110.     exit(1);
  1111.   if (fork() == 0)
  1112.     {
  1113.       if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  1114.     kill(getppid(), 3);
  1115.       (void)connect(s2, &a, strlen(nam) + 2);
  1116.       if (write(s2, "HELLO", 5) == -1)
  1117.     kill(getppid(), 3);
  1118.       exit(0);
  1119.     }
  1120.   l = sizeof(a);
  1121.   close(0);
  1122.   if (accept(s1, &a, &l))
  1123.     exit(1);
  1124. #endif
  1125.  
  1126.  
  1127.   l = 1;
  1128.   if (select(1, &l, 0, 0, 0) == -1)
  1129.     exit(1);
  1130.   if (select(1, &l, &l, 0, 0) != 2)
  1131.     exit(1);
  1132.   exit(0);
  1133. }
  1134.  
  1135. EOF
  1136. eval $compile
  1137. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1138.   echo "- select is ok"
  1139. else
  1140.   echo "- it is not usable";DEFS="$DEFS -DSELECT_BROKEN=1"
  1141. SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_BROKEN\${SEDdB}SELECT_BROKEN\${SEDdC}1\${SEDdD}
  1142. \${SEDuA}SELECT_BROKEN\${SEDuB}SELECT_BROKEN\${SEDuC}1\${SEDuD}
  1143. \${SEDeA}SELECT_BROKEN\${SEDeB}SELECT_BROKEN\${SEDeC}1\${SEDeD}
  1144. "
  1145. fi
  1146. rm -f conftest*
  1147.  
  1148. echo searching for tgetent
  1149. olibs="$LIBS"
  1150. LIBS="-ltermcap $LIBS"
  1151. echo checking for libtermcap
  1152. cat > conftest.c <<EOF
  1153.  
  1154. main() { exit(0); } 
  1155. t() { tgetent((char *)0, (char *)0); }
  1156. EOF
  1157. if eval $compile; then
  1158.   :
  1159. else
  1160.   LIBS="-lcurses $olibs"
  1161. echo checking for libcurses
  1162. cat > conftest.c <<EOF
  1163.  
  1164. main() { exit(0); } 
  1165. t() { tgetent((char *)0, (char *)0); }
  1166. EOF
  1167. if eval $compile; then
  1168.   :
  1169. else
  1170.   echo "!!! no tgetent - no screen";exit
  1171. fi
  1172. rm -f conftest*
  1173.  
  1174.  
  1175. fi
  1176. rm -f conftest*
  1177.  
  1178. TERMCAP="xx|scrdumm:xx:"
  1179. TERM=scrdumm
  1180. export TERMCAP
  1181. export TERM
  1182. cat > conftest.c <<EOF
  1183.  
  1184. main()
  1185. {
  1186.   char buf[1024];
  1187.   if (tgetent(buf, "scrdumm") != 1)
  1188.     exit(1);
  1189.   exit(0);
  1190. }
  1191. EOF
  1192. eval $compile
  1193. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1194.   echo "- you use the termcap database"
  1195. else
  1196.   echo "- you use the terminfo database";DEFS="$DEFS -DTERMINFO=1"
  1197. SEDDEFS="${SEDDEFS}\${SEDdA}TERMINFO\${SEDdB}TERMINFO\${SEDdC}1\${SEDdD}
  1198. \${SEDuA}TERMINFO\${SEDuB}TERMINFO\${SEDuC}1\${SEDuD}
  1199. \${SEDeA}TERMINFO\${SEDeB}TERMINFO\${SEDeC}1\${SEDeD}
  1200. "
  1201. fi
  1202. rm -f conftest*
  1203. echo checking for ospeed
  1204. cat > conftest.c <<EOF
  1205. extern short ospeed;
  1206. main() { exit(0); } 
  1207. t() { ospeed=5; }
  1208. EOF
  1209. if eval $compile; then
  1210.   :
  1211. else
  1212.   DEFS="$DEFS -DNEED_OSPEED=1"
  1213. SEDDEFS="${SEDDEFS}\${SEDdA}NEED_OSPEED\${SEDdB}NEED_OSPEED\${SEDdC}1\${SEDdD}
  1214. \${SEDuA}NEED_OSPEED\${SEDuB}NEED_OSPEED\${SEDuC}1\${SEDuD}
  1215. \${SEDeA}NEED_OSPEED\${SEDeB}NEED_OSPEED\${SEDeC}1\${SEDeD}
  1216. "
  1217. fi
  1218. rm -f conftest*
  1219.  
  1220.  
  1221. echo checking for ptyranges
  1222. if test -d /dev/ptym ; then
  1223. pdir='/dev/ptym'
  1224. else
  1225. pdir='/dev'
  1226. fi
  1227. ptys=`echo $pdir/pty??`
  1228. if test "$ptys" != "$pdir/pty??" ; then
  1229. p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | tr ' ' '\012' | sort -u | sed -n -e H -e g -e 's/\n//g' -e '$p'`
  1230. p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | tr ' ' '\012' | sort -u | sed -n -e H -e g -e 's/\n//g' -e '$p'`
  1231. DEFS="$DEFS -DPTYRANGE0=\"$p0\""
  1232. SEDDEFS="${SEDDEFS}\${SEDdA}PTYRANGE0\${SEDdB}PTYRANGE0\${SEDdC}\"$p0\"\${SEDdD}
  1233. \${SEDuA}PTYRANGE0\${SEDuB}PTYRANGE0\${SEDuC}\"$p0\"\${SEDuD}
  1234. \${SEDeA}PTYRANGE0\${SEDeB}PTYRANGE0\${SEDeC}\"$p0\"\${SEDeD}
  1235. "
  1236. DEFS="$DEFS -DPTYRANGE1=\"$p1\""
  1237. SEDDEFS="${SEDDEFS}\${SEDdA}PTYRANGE1\${SEDdB}PTYRANGE1\${SEDdC}\"$p1\"\${SEDdD}
  1238. \${SEDuA}PTYRANGE1\${SEDuB}PTYRANGE1\${SEDuC}\"$p1\"\${SEDuD}
  1239. \${SEDeA}PTYRANGE1\${SEDeB}PTYRANGE1\${SEDeC}\"$p1\"\${SEDeD}
  1240. "
  1241. fi
  1242.  
  1243.  
  1244. echo checking for getutent
  1245. cat > conftest.c <<EOF
  1246. #include <time.h> /* to get time_t on SCO */
  1247. #include <sys/types.h>
  1248. #ifdef SVR4
  1249. #include <utmpx.h>
  1250. #else
  1251. #include <utmp.h>
  1252. #endif
  1253. #ifdef hpux
  1254. #define pututline _pututline
  1255. #endif
  1256.  
  1257. main() { exit(0); } 
  1258. t() { int x = DEAD_PROCESS; struct utmp *y = pututline((struct utmp *)0); getutent(); }
  1259. EOF
  1260. if eval $compile; then
  1261.   DEFS="$DEFS -DGETUTENT=1"
  1262. SEDDEFS="${SEDDEFS}\${SEDdA}GETUTENT\${SEDdB}GETUTENT\${SEDdC}1\${SEDdD}
  1263. \${SEDuA}GETUTENT\${SEDuB}GETUTENT\${SEDuC}1\${SEDuD}
  1264. \${SEDeA}GETUTENT\${SEDeB}GETUTENT\${SEDeC}1\${SEDeD}
  1265. "
  1266. fi
  1267. rm -f conftest*
  1268.  
  1269. echo checking for ut_host
  1270. cat > conftest.c <<EOF
  1271. #include <time.h>
  1272. #include <sys/types.h>
  1273. #ifdef SVR4
  1274. #include <utmpx.h>
  1275. #else
  1276. #include <utmp.h>
  1277. #endif
  1278.  
  1279. main() { exit(0); } 
  1280. t() { struct utmp u; u.ut_host[0] = 0; }
  1281. EOF
  1282. if eval $compile; then
  1283.   DEFS="$DEFS -DUTHOST=1"
  1284. SEDDEFS="${SEDDEFS}\${SEDdA}UTHOST\${SEDdB}UTHOST\${SEDdC}1\${SEDdD}
  1285. \${SEDuA}UTHOST\${SEDuB}UTHOST\${SEDuC}1\${SEDuD}
  1286. \${SEDeA}UTHOST\${SEDeB}UTHOST\${SEDeC}1\${SEDeD}
  1287. "
  1288. fi
  1289. rm -f conftest*
  1290.  
  1291.  
  1292.  
  1293. echo "checking for libutil(s)"
  1294. test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
  1295. test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
  1296.  
  1297. echo checking for getloadavg
  1298. cat > conftest.c <<EOF
  1299.  
  1300. main() { exit(0); } 
  1301. t() { getloadavg((double *)0, 0); }
  1302. EOF
  1303. if eval $compile; then
  1304.   DEFS="$DEFS -DLOADAV_GETLOADAVG=1"
  1305. SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_GETLOADAVG\${SEDdB}LOADAV_GETLOADAVG\${SEDdC}1\${SEDdD}
  1306. \${SEDuA}LOADAV_GETLOADAVG\${SEDuB}LOADAV_GETLOADAVG\${SEDuC}1\${SEDuD}
  1307. \${SEDeA}LOADAV_GETLOADAVG\${SEDeB}LOADAV_GETLOADAVG\${SEDeC}1\${SEDeD}
  1308. ";load=1
  1309. fi
  1310. rm -f conftest*
  1311.  
  1312. if test -z "$load" ; then
  1313. cat > conftest.c <<EOF
  1314. #if defined(NeXT) || defined(apollo) || defined(linux)
  1315.   yes
  1316. #endif
  1317.  
  1318. EOF
  1319. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  1320. if egrep "yes" conftest.out >/dev/null 2>&1; then
  1321.   load=1
  1322. fi
  1323. rm -f conftest*
  1324.  
  1325. fi
  1326. if test -z "$load" ; then
  1327. echo "searching for kernelfile"
  1328. for core in /unix /vmunix /dynix /hp-ux /xelos /386bsd /kernel/unix ; do
  1329.   if test -f $core ; then
  1330.     break
  1331.   fi
  1332. done
  1333. if test ! -f $core ; then
  1334.   echo "- no kernelfile found"
  1335. else
  1336.   echo "- using kernelfile '$core'"
  1337.   DEFS="$DEFS -DLOADAV_UNIX=\"$core\""
  1338. SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_UNIX\${SEDdB}LOADAV_UNIX\${SEDdC}\"$core\"\${SEDdD}
  1339. \${SEDuA}LOADAV_UNIX\${SEDuB}LOADAV_UNIX\${SEDuC}\"$core\"\${SEDuD}
  1340. \${SEDeA}LOADAV_UNIX\${SEDeB}LOADAV_UNIX\${SEDeC}\"$core\"\${SEDeD}
  1341. "
  1342.   echo checking for nlist.h
  1343. cat > conftest.c <<EOF
  1344. #include <nlist.h>
  1345. EOF
  1346. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  1347. if test -z "$err"; then
  1348.   DEFS="$DEFS -DNLIST_STRUCT=1"
  1349. SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_STRUCT\${SEDdB}NLIST_STRUCT\${SEDdC}1\${SEDdD}
  1350. \${SEDuA}NLIST_STRUCT\${SEDuB}NLIST_STRUCT\${SEDuC}1\${SEDuD}
  1351. \${SEDeA}NLIST_STRUCT\${SEDeB}NLIST_STRUCT\${SEDeC}1\${SEDeD}
  1352. "
  1353.      echo checking for n_un in struct nlist
  1354. cat > conftest.c <<EOF
  1355. #include <nlist.h>
  1356. main() { exit(0); } 
  1357. t() { struct nlist n; n.n_un.n_name = 0; }
  1358. EOF
  1359. if eval $compile; then
  1360.   DEFS="$DEFS -DNLIST_NAME_UNION=1"
  1361. SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_NAME_UNION\${SEDdB}NLIST_NAME_UNION\${SEDdC}1\${SEDdD}
  1362. \${SEDuA}NLIST_NAME_UNION\${SEDuB}NLIST_NAME_UNION\${SEDuC}1\${SEDuD}
  1363. \${SEDeA}NLIST_NAME_UNION\${SEDeB}NLIST_NAME_UNION\${SEDeC}1\${SEDeD}
  1364. "
  1365. fi
  1366. rm -f conftest*
  1367.  
  1368. fi
  1369. rm -f conftest*
  1370.  
  1371.  
  1372.   echo checking for nlist declaration
  1373.   cat > conftest.c <<EOF
  1374.  
  1375. #ifdef NLIST_STRUCT
  1376. # include <nlist.h>
  1377. #else
  1378. # include <a.out.h>
  1379. #endif
  1380.  
  1381. EOF
  1382. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  1383. if egrep "nlist( |    |\()" conftest.out >/dev/null 2>&1; then
  1384.   DEFS="$DEFS -DNLIST_DECLARED=1"
  1385. SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_DECLARED\${SEDdB}NLIST_DECLARED\${SEDdC}1\${SEDdD}
  1386. \${SEDuA}NLIST_DECLARED\${SEDuB}NLIST_DECLARED\${SEDuC}1\${SEDuD}
  1387. \${SEDeA}NLIST_DECLARED\${SEDeB}NLIST_DECLARED\${SEDeC}1\${SEDeD}
  1388. "
  1389. fi
  1390. rm -f conftest*
  1391.  
  1392.  
  1393.   echo searching for avenrun symbol
  1394.   for av in avenrun _avenrun _Loadavg ; do
  1395.   cat > conftest.c <<EOF
  1396.  
  1397. #include <sys/types.h>
  1398. #ifdef NLIST_STRUCT
  1399. #include <nlist.h>
  1400. #else
  1401. #include <a.out.h>
  1402. #endif
  1403.  
  1404. struct nlist nl[2];
  1405.  
  1406. main()
  1407. {
  1408. #ifdef NLIST_NAME_UNION
  1409.   nl[0].n_un.n_name = "$av";
  1410. #else
  1411.   nl[0].n_name = "$av";
  1412. #endif
  1413.   nlist(LOADAV_UNIX, nl);
  1414.   if (nl[0].n_value == 0)
  1415.     exit(1);
  1416.   exit(0);
  1417. }
  1418.   
  1419. EOF
  1420. eval $compile
  1421. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1422.   avensym=$av;break
  1423. fi
  1424. rm -f conftest*
  1425.   done
  1426.   if test -z "$avensym" ; then
  1427.     echo "- no avenrun symbol found"
  1428.   else
  1429.     echo "- using avenrun symbol '$avensym'"
  1430.     DEFS="$DEFS -DLOADAV_AVENRUN=\"$avensym\""
  1431. SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_AVENRUN\${SEDdB}LOADAV_AVENRUN\${SEDdC}\"$avensym\"\${SEDdD}
  1432. \${SEDuA}LOADAV_AVENRUN\${SEDuB}LOADAV_AVENRUN\${SEDuC}\"$avensym\"\${SEDuD}
  1433. \${SEDeA}LOADAV_AVENRUN\${SEDeB}LOADAV_AVENRUN\${SEDeC}\"$avensym\"\${SEDeD}
  1434. ";
  1435.     load=1
  1436.   fi
  1437. fi
  1438. fi
  1439.  
  1440. cat > conftest.c <<EOF
  1441.  
  1442. #include <sys/types.h>
  1443. #include <sys/param.h>
  1444.  
  1445. _CUT_HERE_
  1446.  
  1447. #if ((defined(hp300) && !defined(hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news))
  1448. loadtype=long
  1449. # ifdef apollo
  1450. loadscale=65536
  1451. # else
  1452. #  ifdef FSCALE
  1453. #   undef FSCALE
  1454. loadscale=FSCALE
  1455. #  else
  1456. #   ifdef sgi
  1457. loadscale=1024
  1458. #   else
  1459. #    if defined(MIPS) || defined(SVR4)
  1460. loadscale=256
  1461. #    else /* not MIPS */
  1462. loadscale=1000     /* our default value */
  1463. #    endif /* MIPS */
  1464. #   endif /* sgi */
  1465. #  endif /* not FSCALE */
  1466. # endif /* not apollo */
  1467. #else
  1468. loadtype=double
  1469. loadscale=1
  1470. #endif
  1471. #ifdef alliant
  1472. loadnum=4
  1473. #else
  1474. loadnum=3
  1475. #endif
  1476.  
  1477. EOF
  1478. eval "$CPP $DEFS conftest.c 2>/dev/null | sed -e '1,/_CUT_HERE_/d' > conftest.out"
  1479. . ./conftest.out
  1480. rm -f conftest*
  1481.  
  1482.  
  1483. if test -n "$load" ; then DEFS="$DEFS -DLOADAV=1"
  1484. SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV\${SEDdB}LOADAV\${SEDdC}1\${SEDdD}
  1485. \${SEDuA}LOADAV\${SEDuB}LOADAV\${SEDuC}1\${SEDuD}
  1486. \${SEDeA}LOADAV\${SEDeB}LOADAV\${SEDeC}1\${SEDeD}
  1487. " ; fi
  1488. if test -n "$loadtype" ; then DEFS="$DEFS -DLOADAV_TYPE=$loadtype"
  1489. SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_TYPE\${SEDdB}LOADAV_TYPE\${SEDdC}$loadtype\${SEDdD}
  1490. \${SEDuA}LOADAV_TYPE\${SEDuB}LOADAV_TYPE\${SEDuC}$loadtype\${SEDuD}
  1491. \${SEDeA}LOADAV_TYPE\${SEDeB}LOADAV_TYPE\${SEDeC}$loadtype\${SEDeD}
  1492. " ; fi
  1493. if test -n "$loadnum" ; then DEFS="$DEFS -DLOADAV_NUM=$loadnum"
  1494. SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_NUM\${SEDdB}LOADAV_NUM\${SEDdC}$loadnum\${SEDdD}
  1495. \${SEDuA}LOADAV_NUM\${SEDuB}LOADAV_NUM\${SEDuC}$loadnum\${SEDuD}
  1496. \${SEDeA}LOADAV_NUM\${SEDeB}LOADAV_NUM\${SEDeC}$loadnum\${SEDeD}
  1497. " ; fi
  1498. if test -n "$loadscale" ; then DEFS="$DEFS -DLOADAV_SCALE=$loadscale"
  1499. SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_SCALE\${SEDdB}LOADAV_SCALE\${SEDdC}$loadscale\${SEDdD}
  1500. \${SEDuA}LOADAV_SCALE\${SEDuB}LOADAV_SCALE\${SEDuC}$loadscale\${SEDuD}
  1501. \${SEDeA}LOADAV_SCALE\${SEDeB}LOADAV_SCALE\${SEDeC}$loadscale\${SEDeD}
  1502. " ; fi
  1503.  
  1504.  
  1505. echo '#include <signal.h>' > conftest.c
  1506. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  1507. if egrep "(void|sighandler_t).*signal" conftest.out >/dev/null 2>&1; then
  1508.   DEFS="$DEFS -DSIGVOID=1"
  1509. SEDDEFS="${SEDDEFS}\${SEDdA}SIGVOID\${SEDdB}SIGVOID\${SEDdC}1\${SEDdD}
  1510. \${SEDuA}SIGVOID\${SEDuB}SIGVOID\${SEDuC}1\${SEDuD}
  1511. \${SEDeA}SIGVOID\${SEDeB}SIGVOID\${SEDeC}1\${SEDeD}
  1512. "
  1513. fi
  1514. rm -f conftest*
  1515.  
  1516. echo checking for sigset
  1517. cat > conftest.c <<EOF
  1518.  
  1519. #include <sys/types.h>
  1520. #include <signal.h>
  1521.  
  1522. main() { exit(0); } 
  1523. t() { 
  1524. #ifdef SIGVOID
  1525. sigset(0, (void (*)())0);
  1526. #else
  1527. sigset(0, (int (*)())0);
  1528. #endif
  1529.  }
  1530. EOF
  1531. if eval $compile; then
  1532.   DEFS="$DEFS -DUSESIGSET=1"
  1533. SEDDEFS="${SEDDEFS}\${SEDdA}USESIGSET\${SEDdB}USESIGSET\${SEDdC}1\${SEDdD}
  1534. \${SEDuA}USESIGSET\${SEDuB}USESIGSET\${SEDuC}1\${SEDuD}
  1535. \${SEDeA}USESIGSET\${SEDeB}USESIGSET\${SEDeC}1\${SEDeD}
  1536. "
  1537. fi
  1538. rm -f conftest*
  1539.  
  1540. echo checking signal implementation
  1541. cat > conftest.c <<EOF
  1542.  
  1543. #include <sys/types.h>
  1544. #include <signal.h>
  1545.  
  1546. #ifndef SIGCHLD
  1547. #define SIGCHLD SIGCLD
  1548. #endif
  1549. #ifdef USESIGSET
  1550. #define signal sigset
  1551. #endif
  1552.  
  1553. int got;
  1554.  
  1555. #ifdef SIGVOID
  1556. void
  1557. #endif
  1558. hand()
  1559. {
  1560.   got++;
  1561. }
  1562.  
  1563. main()
  1564. {
  1565.   (void)signal(SIGCHLD, hand);
  1566.   kill(getpid(), SIGCHLD);
  1567.   kill(getpid(), SIGCHLD);
  1568.   if (got < 2)
  1569.     exit(1);
  1570.   exit(0);
  1571. }
  1572.  
  1573. EOF
  1574. eval $compile
  1575. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1576.   :
  1577. else
  1578.   DEFS="$DEFS -DSYSVSIGS=1"
  1579. SEDDEFS="${SEDDEFS}\${SEDdA}SYSVSIGS\${SEDdB}SYSVSIGS\${SEDdC}1\${SEDdD}
  1580. \${SEDuA}SYSVSIGS\${SEDuB}SYSVSIGS\${SEDuC}1\${SEDuD}
  1581. \${SEDeA}SYSVSIGS\${SEDeB}SYSVSIGS\${SEDeC}1\${SEDeD}
  1582. "
  1583. fi
  1584. rm -f conftest*
  1585.  
  1586.  
  1587. echo checking for crypt and sec libraries
  1588. test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
  1589. test -f /lib/libcrypt.a || test -f /usr/lib/libcrypt.a && LIBS="$LIBS -lcrypt"
  1590. test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
  1591.  
  1592. oldlibs="$LIBS"
  1593. LIBS="$LIBS -lsun"
  1594. echo checking for IRIX sun library
  1595. cat > conftest.c <<EOF
  1596.  
  1597. main() { exit(0); } 
  1598. t() {  }
  1599. EOF
  1600. if eval $compile; then
  1601.   :
  1602. else
  1603.   LIBS="$oldlibs"
  1604. fi
  1605. rm -f conftest*
  1606.  
  1607.  
  1608.  
  1609. echo checking for wait union
  1610. cat > conftest.c <<EOF
  1611. #include <sys/types.h>
  1612. #include <sys/wait.h>
  1613.  
  1614. main() { exit(0); } 
  1615. t() { 
  1616.   union wait x;
  1617.   int y;
  1618. #ifdef WEXITSTATUS
  1619.   y = WEXITSTATUS(x);
  1620. #endif
  1621.  }
  1622. EOF
  1623. if eval $compile; then
  1624.   DEFS="$DEFS -DBSDWAIT=1"
  1625. SEDDEFS="${SEDDEFS}\${SEDdA}BSDWAIT\${SEDdB}BSDWAIT\${SEDdC}1\${SEDdD}
  1626. \${SEDuA}BSDWAIT\${SEDuB}BSDWAIT\${SEDuC}1\${SEDuD}
  1627. \${SEDeA}BSDWAIT\${SEDeB}BSDWAIT\${SEDeC}1\${SEDeD}
  1628. "
  1629. fi
  1630. rm -f conftest*
  1631.  
  1632.  
  1633. echo checking for termio or termios
  1634. cat > conftest.c <<EOF
  1635. #include <termios.h>
  1636. EOF
  1637. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  1638. if test -z "$err"; then
  1639.   DEFS="$DEFS -DTERMIO=1"
  1640. SEDDEFS="${SEDDEFS}\${SEDdA}TERMIO\${SEDdB}TERMIO\${SEDdC}1\${SEDdD}
  1641. \${SEDuA}TERMIO\${SEDuB}TERMIO\${SEDuC}1\${SEDuD}
  1642. \${SEDeA}TERMIO\${SEDeB}TERMIO\${SEDeC}1\${SEDeD}
  1643. "
  1644. else
  1645.   cat > conftest.c <<EOF
  1646. #include <termio.h>
  1647. EOF
  1648. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  1649. if test -z "$err"; then
  1650.   DEFS="$DEFS -DTERMIO=1"
  1651. SEDDEFS="${SEDDEFS}\${SEDdA}TERMIO\${SEDdB}TERMIO\${SEDdC}1\${SEDdD}
  1652. \${SEDuA}TERMIO\${SEDuB}TERMIO\${SEDuC}1\${SEDuD}
  1653. \${SEDeA}TERMIO\${SEDeB}TERMIO\${SEDeC}1\${SEDeD}
  1654. "
  1655. fi
  1656. rm -f conftest*
  1657. fi
  1658. rm -f conftest*
  1659.  
  1660. echo checking for getspnam
  1661. cat > conftest.c <<EOF
  1662. #include <shadow.h>
  1663. main() { exit(0); } 
  1664. t() { getspnam(); }
  1665. EOF
  1666. if eval $compile; then
  1667.   DEFS="$DEFS -DSHADOWPW=1"
  1668. SEDDEFS="${SEDDEFS}\${SEDdA}SHADOWPW\${SEDdB}SHADOWPW\${SEDdC}1\${SEDdD}
  1669. \${SEDuA}SHADOWPW\${SEDuB}SHADOWPW\${SEDuC}1\${SEDuD}
  1670. \${SEDeA}SHADOWPW\${SEDeB}SHADOWPW\${SEDeC}1\${SEDeD}
  1671. "
  1672. fi
  1673. rm -f conftest*
  1674.  
  1675.  
  1676. echo checking for getttyent
  1677. cat > conftest.c <<EOF
  1678.  
  1679. main() { exit(0); } 
  1680. t() { getttyent(); }
  1681. EOF
  1682. if eval $compile; then
  1683.   DEFS="$DEFS -DGETTTYENT=1"
  1684. SEDDEFS="${SEDDEFS}\${SEDdA}GETTTYENT\${SEDdB}GETTTYENT\${SEDdC}1\${SEDdD}
  1685. \${SEDuA}GETTTYENT\${SEDuB}GETTTYENT\${SEDuC}1\${SEDuD}
  1686. \${SEDeA}GETTTYENT\${SEDeB}GETTTYENT\${SEDeC}1\${SEDeD}
  1687. "
  1688. fi
  1689. rm -f conftest*
  1690.  
  1691.  
  1692. echo checking whether memcpy/memmove/bcopy handles overlapping arguments
  1693. cat > conftest.c <<EOF
  1694.  
  1695. main() {
  1696.   char buf[10];
  1697.   strcpy(buf, "abcdefghi");
  1698.   bcopy(buf, buf + 2, 3);
  1699.   if (strncmp(buf, "ababcf", 6))
  1700.     exit(1);
  1701.   strcpy(buf, "abcdefghi");
  1702.   bcopy(buf + 2, buf, 3);
  1703.   if (strncmp(buf, "cdedef", 6))
  1704.     exit(1);
  1705.   exit(0); /* libc version works properly.  */
  1706. }
  1707. EOF
  1708. eval $compile
  1709. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1710.   DEFS="$DEFS -DUSEBCOPY=1"
  1711. SEDDEFS="${SEDDEFS}\${SEDdA}USEBCOPY\${SEDdB}USEBCOPY\${SEDdC}1\${SEDdD}
  1712. \${SEDuA}USEBCOPY\${SEDuB}USEBCOPY\${SEDuC}1\${SEDuD}
  1713. \${SEDeA}USEBCOPY\${SEDeB}USEBCOPY\${SEDeC}1\${SEDeD}
  1714. "
  1715. fi
  1716. rm -f conftest*
  1717.  
  1718. cat > conftest.c <<EOF
  1719.  
  1720. #define bcopy(s,d,l) memmove(d,s,l)
  1721. main() {
  1722.   char buf[10];
  1723.   strcpy(buf, "abcdefghi");
  1724.   bcopy(buf, buf + 2, 3);
  1725.   if (strncmp(buf, "ababcf", 6))
  1726.     exit(1);
  1727.   strcpy(buf, "abcdefghi");
  1728.   bcopy(buf + 2, buf, 3);
  1729.   if (strncmp(buf, "cdedef", 6))
  1730.     exit(1);
  1731.   exit(0); /* libc version works properly.  */
  1732. }
  1733. EOF
  1734. eval $compile
  1735. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1736.   DEFS="$DEFS -DUSEMEMMOVE=1"
  1737. SEDDEFS="${SEDDEFS}\${SEDdA}USEMEMMOVE\${SEDdB}USEMEMMOVE\${SEDdC}1\${SEDdD}
  1738. \${SEDuA}USEMEMMOVE\${SEDuB}USEMEMMOVE\${SEDuC}1\${SEDuD}
  1739. \${SEDeA}USEMEMMOVE\${SEDeB}USEMEMMOVE\${SEDeC}1\${SEDeD}
  1740. "
  1741. fi
  1742. rm -f conftest*
  1743.  
  1744.  
  1745. cat > conftest.c <<EOF
  1746.  
  1747. #define bcopy(s,d,l) memcpy(d,s,l)
  1748. main() {
  1749.   char buf[10];
  1750.   strcpy(buf, "abcdefghi");
  1751.   bcopy(buf, buf + 2, 3);
  1752.   if (strncmp(buf, "ababcf", 6))
  1753.     exit(1);
  1754.   strcpy(buf, "abcdefghi");
  1755.   bcopy(buf + 2, buf, 3);
  1756.   if (strncmp(buf, "cdedef", 6))
  1757.     exit(1);
  1758.   exit(0); /* libc version works properly.  */
  1759. }
  1760. EOF
  1761. eval $compile
  1762. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1763.   DEFS="$DEFS -DUSEMEMCPY=1"
  1764. SEDDEFS="${SEDDEFS}\${SEDdA}USEMEMCPY\${SEDdB}USEMEMCPY\${SEDdC}1\${SEDdD}
  1765. \${SEDuA}USEMEMCPY\${SEDuB}USEMEMCPY\${SEDuC}1\${SEDuD}
  1766. \${SEDeA}USEMEMCPY\${SEDeB}USEMEMCPY\${SEDeC}1\${SEDeD}
  1767. "
  1768. fi
  1769. rm -f conftest*
  1770.  
  1771. echo checking for long file names
  1772. (echo 1 > /tmp/conftest9012345) 2>/dev/null
  1773. (echo 2 > /tmp/conftest9012346) 2>/dev/null
  1774. val=`cat /tmp/conftest9012345 2>/dev/null`
  1775. if test -f /tmp/conftest9012345 && test "$val" = 1; then :
  1776. else DEFS="$DEFS -DNAME_MAX=14"
  1777. SEDDEFS="${SEDDEFS}\${SEDdA}NAME_MAX\${SEDdB}NAME_MAX\${SEDdC}14\${SEDdD}
  1778. \${SEDuA}NAME_MAX\${SEDuB}NAME_MAX\${SEDuC}14\${SEDuD}
  1779. \${SEDeA}NAME_MAX\${SEDeB}NAME_MAX\${SEDeC}14\${SEDeD}
  1780. "
  1781. fi
  1782. rm -f /tmp/conftest*
  1783.  
  1784. echo checking for vsprintf
  1785. cat > conftest.c <<EOF
  1786. #include <varargs.h>
  1787. #include <stdio.h>
  1788. main() { exit(0); } 
  1789. t() { vsprintf(); }
  1790. EOF
  1791. if eval $compile; then
  1792.   DEFS="$DEFS -DUSEVARARGS=1"
  1793. SEDDEFS="${SEDDEFS}\${SEDdA}USEVARARGS\${SEDdB}USEVARARGS\${SEDdC}1\${SEDdD}
  1794. \${SEDuA}USEVARARGS\${SEDuB}USEVARARGS\${SEDuC}1\${SEDuD}
  1795. \${SEDeA}USEVARARGS\${SEDeB}USEVARARGS\${SEDeC}1\${SEDeD}
  1796. "
  1797. fi
  1798. rm -f conftest*
  1799.  
  1800.  
  1801. echo checking for directory library header
  1802. echo checking for dirent.h
  1803. cat > conftest.c <<EOF
  1804. #include <dirent.h>
  1805. EOF
  1806. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  1807. if test -z "$err"; then
  1808.   DEFS="$DEFS -DDIRENT=1"
  1809. SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
  1810. \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
  1811. \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
  1812. " dirheader=dirent.h
  1813. fi
  1814. rm -f conftest*
  1815.  
  1816. if test -z "$dirheader"; then
  1817. echo checking for sys/ndir.h
  1818. cat > conftest.c <<EOF
  1819. #include <sys/ndir.h>
  1820. EOF
  1821. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  1822. if test -z "$err"; then
  1823.   DEFS="$DEFS -DSYSNDIR=1"
  1824. SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
  1825. \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
  1826. \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
  1827. " dirheader=sys/ndir.h
  1828. fi
  1829. rm -f conftest*
  1830.  
  1831. fi
  1832. if test -z "$dirheader"; then
  1833. echo checking for sys/dir.h
  1834. cat > conftest.c <<EOF
  1835. #include <sys/dir.h>
  1836. EOF
  1837. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  1838. if test -z "$err"; then
  1839.   DEFS="$DEFS -DSYSDIR=1"
  1840. SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
  1841. \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
  1842. \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
  1843. " dirheader=sys/dir.h
  1844. fi
  1845. rm -f conftest*
  1846.  
  1847. fi
  1848. if test -z "$dirheader"; then
  1849. echo checking for ndir.h
  1850. cat > conftest.c <<EOF
  1851. #include <ndir.h>
  1852. EOF
  1853. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  1854. if test -z "$err"; then
  1855.   DEFS="$DEFS -DNDIR=1"
  1856. SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
  1857. \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
  1858. \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
  1859. " dirheader=ndir.h
  1860. fi
  1861. rm -f conftest*
  1862.  
  1863. fi
  1864.  
  1865. echo checking for closedir return value
  1866. cat > conftest.c <<EOF
  1867. #include <sys/types.h>
  1868. #include <$dirheader>
  1869. int closedir(); main() { exit(0); }
  1870. EOF
  1871. eval $compile
  1872. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1873.   :
  1874. else
  1875.   DEFS="$DEFS -DVOID_CLOSEDIR=1"
  1876. SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
  1877. \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
  1878. \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
  1879. "
  1880. fi
  1881. rm -f conftest*
  1882.  
  1883. echo checking for Xenix
  1884. cat > conftest.c <<EOF
  1885. #if defined(M_XENIX) && !defined(M_UNIX)
  1886.   yes
  1887. #endif
  1888.  
  1889. EOF
  1890. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  1891. if egrep "yes" conftest.out >/dev/null 2>&1; then
  1892.   XENIX=1
  1893. fi
  1894. rm -f conftest*
  1895.  
  1896. if test -n "$XENIX"; then
  1897.   DEFS="$DEFS -DVOID_CLOSEDIR=1"
  1898. SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
  1899. \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
  1900. \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
  1901. "
  1902.   LIBS="$LIBS -lx"
  1903.   case "$DEFS" in
  1904.   *SYSNDIR*) ;;
  1905.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  1906.   esac
  1907. fi
  1908.  
  1909.  
  1910. echo checking for setenv
  1911. cat > conftest.c <<EOF
  1912.  
  1913. main() { exit(0); } 
  1914. t() { setenv((char *)0,(char *)0);unsetenv((char *)0); }
  1915. EOF
  1916. if eval $compile; then
  1917.   DEFS="$DEFS -DUSESETENV=1"
  1918. SEDDEFS="${SEDDEFS}\${SEDdA}USESETENV\${SEDdB}USESETENV\${SEDdC}1\${SEDdD}
  1919. \${SEDuA}USESETENV\${SEDuB}USESETENV\${SEDuC}1\${SEDuD}
  1920. \${SEDeA}USESETENV\${SEDeB}USESETENV\${SEDeC}1\${SEDeD}
  1921. "
  1922. else
  1923.   echo checking for putenv
  1924. cat > conftest.c <<EOF
  1925.  
  1926. main() { exit(0); } 
  1927. t() { putenv((char *)0);unsetenv((char *)0); }
  1928. EOF
  1929. if eval $compile; then
  1930.   :
  1931. else
  1932.   DEFS="$DEFS -DNEEDPUTENV=1"
  1933. SEDDEFS="${SEDDEFS}\${SEDdA}NEEDPUTENV\${SEDdB}NEEDPUTENV\${SEDdC}1\${SEDdD}
  1934. \${SEDuA}NEEDPUTENV\${SEDuB}NEEDPUTENV\${SEDuC}1\${SEDuD}
  1935. \${SEDeA}NEEDPUTENV\${SEDeB}NEEDPUTENV\${SEDeC}1\${SEDeD}
  1936. "
  1937.  
  1938. fi
  1939. rm -f conftest*
  1940.  
  1941. fi
  1942. rm -f conftest*
  1943.  
  1944.  
  1945. test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lsec -lseq"
  1946.  
  1947. cat > conftest.c <<EOF
  1948. main(){exit(0);}
  1949. EOF
  1950. eval $compile
  1951. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1952.   :
  1953. else
  1954.   echo "Can't run the compiler - internal error. Sorry.";exit
  1955. fi
  1956. rm -f conftest*
  1957. if test -n "$prefix"; then
  1958.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  1959.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  1960. fi
  1961. if test -n "$exec_prefix"; then
  1962.   prsub="$prsub
  1963. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  1964. exec_prefix\\1=\\2$exec_prefix%"
  1965. fi
  1966.  
  1967. trap 'rm -f config.status; exit 1' 1 3 15
  1968. echo creating config.status
  1969. rm -f config.status
  1970. cat > config.status <<EOF
  1971. #!/bin/sh
  1972. # Generated automatically by configure.
  1973. # Run this file to recreate the current configuration.
  1974. # This directory was configured as follows,
  1975. # on host `(hostname || uname -n) 2>/dev/null`:
  1976. #
  1977. # $0 $*
  1978.  
  1979. for arg
  1980. do
  1981.   case "\$arg" in
  1982.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  1983.     exec /bin/sh $0 $* ;;
  1984.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  1985.   esac
  1986. done
  1987.  
  1988. trap 'rm -f Makefile config.h conftest*; exit 1' 1 3 15
  1989. VERSION='$VERSION'
  1990. CC='$CC'
  1991. CPP='$CPP'
  1992. AWK='$AWK'
  1993. INSTALL='$INSTALL'
  1994. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  1995. INSTALL_DATA='$INSTALL_DATA'
  1996. LIBS='$LIBS'
  1997. srcdir='$srcdir'
  1998. prefix='$prefix'
  1999. exec_prefix='$exec_prefix'
  2000. prsub='$prsub'
  2001. EOF
  2002. cat >> config.status <<\EOF
  2003.  
  2004. top_srcdir=$srcdir
  2005. for file in .. Makefile; do if [ "x$file" != "x.." ]; then
  2006.   srcdir=$top_srcdir
  2007.   # Remove last slash and all that follows it.  Not all systems have dirname.
  2008.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  2009.   if test "$dir" != "$file"; then
  2010.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  2011.     test ! -d $dir && mkdir $dir
  2012.   fi
  2013.   echo creating $file
  2014.   rm -f $file
  2015.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  2016.   sed -e "
  2017. $prsub
  2018. s%@VERSION@%$VERSION%g
  2019. s%@CC@%$CC%g
  2020. s%@CPP@%$CPP%g
  2021. s%@AWK@%$AWK%g
  2022. s%@INSTALL@%$INSTALL%g
  2023. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  2024. s%@INSTALL_DATA@%$INSTALL_DATA%g
  2025. s%@LIBS@%$LIBS%g
  2026. s%@srcdir@%$srcdir%g
  2027. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  2028. fi; done
  2029.  
  2030. echo creating config.h
  2031. # These sed commands are put into SEDDEFS when defining a macro.
  2032. # They are broken into pieces to make the sed script easier to manage.
  2033. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  2034. # is the cpp macro being defined and VALUE is the value it is being given.
  2035. # Each defining turns into a single global substitution command.
  2036. #
  2037. # SEDd sets the value in "#define NAME VALUE" lines.
  2038. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  2039. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  2040. SEDdC='\3'
  2041. SEDdD='@g'
  2042. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  2043. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  2044. SEDuB='\([     ]\)@\1#\2define\3'
  2045. SEDuC=' '
  2046. SEDuD='\4@g'
  2047. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  2048. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  2049. SEDeB='$@\1#\2define\3'
  2050. SEDeC=' '
  2051. SEDeD='@g'
  2052. rm -f conftest.sed
  2053. cat > conftest.sed <<CONFEOF
  2054. EOF
  2055. # Turn off quoting long enough to insert the sed commands.
  2056. cat >> config.status <<EOF
  2057. $SEDDEFS
  2058. EOF
  2059. cat >> config.status <<\EOF
  2060. CONFEOF
  2061. rm -f conftest.h
  2062. # Break up the sed commands because old seds have small limits.
  2063. cp $top_srcdir/config.h.in conftest.h1
  2064. while :
  2065. do
  2066.   lines=`grep -c . conftest.sed`
  2067.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  2068.   rm -f conftest.s1 conftest.s2 conftest.h2
  2069.   sed 30q conftest.sed > conftest.s1 # Like head -30.
  2070.   sed 1,30d conftest.sed > conftest.s2 # Like tail +31.
  2071.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  2072.   rm -f conftest.s1 conftest.h1 conftest.sed
  2073.   mv conftest.h2 conftest.h1
  2074.   mv conftest.s2 conftest.sed
  2075. done
  2076. rm -f conftest.sed conftest.h
  2077. echo "/* config.h.  Generated automatically by configure.  */" > conftest.h
  2078. cat conftest.h1 >> conftest.h
  2079. rm -f conftest.h1
  2080. if cmp -s config.h conftest.h 2>/dev/null; then
  2081.   # The file exists and we would not be changing it.
  2082.   rm -f conftest.h
  2083. else
  2084.   rm -f config.h
  2085.   mv conftest.h config.h
  2086. fi
  2087.  
  2088. EOF
  2089. chmod +x config.status
  2090. test -n "$no_create" || ./config.status
  2091.  
  2092.  
  2093. # a hook for preserving undef directive in config.h
  2094. if test -z "$no_create" ; then
  2095. mv config.h conftest
  2096. sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2    /\*\3@' < conftest > config.h
  2097. rm -f conftest
  2098. fi
  2099. cat >> config.status << EOF
  2100. mv config.h conftest
  2101. sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2    /\*\3@' < conftest > config.h
  2102. rm -f conftest
  2103. EOF
  2104.  
  2105. echo ""
  2106. if test -z "$AWK"; then
  2107. echo "!!! Since you have no awk you must copy the files 'comm.h.dist'"
  2108. echo "!!! and 'term.h.dist' to 'comm.h' and 'term.h'."
  2109. echo "!!! Do _not_ change the user configuration section in config.h!"
  2110. echo "Please check the pathnames in the Makefile."
  2111. else
  2112. echo "Now please check the pathnames in the Makefile and the user"
  2113. echo "configuration section in config.h."
  2114. fi
  2115. echo "Then type 'make' to make screen. Good luck."
  2116. echo ""
  2117.