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