home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / expect / expect-4.7 / configure < prev    next >
Encoding:
Text File  |  1993-06-07  |  25.8 KB  |  1,037 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=exp_global.h
  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. # Make sure to not get the incompatible SysV /etc/install and
  116. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  117. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  118. # or the AFS install, which mishandles nonexistent args.  (Sigh.)
  119. if test -z "$INSTALL"; then
  120.   echo checking for install
  121.   saveifs="$IFS"; IFS="${IFS}:"
  122.   for dir in $PATH; do
  123.     test -z "$dir" && dir=.
  124.     case $dir in
  125.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
  126.     *)
  127.       if test -f $dir/install; then
  128.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  129.       : # AIX
  130.     else
  131.       INSTALL="$dir/install -c"
  132.       INSTALL_PROGRAM='$(INSTALL)'
  133.       INSTALL_DATA='$(INSTALL) -m 644'
  134.       break
  135.     fi
  136.       fi
  137.       ;;
  138.     esac
  139.   done
  140.   IFS="$saveifs"
  141. fi
  142. INSTALL=${INSTALL-cp}
  143. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  144. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  145.  
  146. if test -z "$RANLIB"; then
  147.   echo checking for ranlib
  148.   saveifs="$IFS"; IFS="${IFS}:"
  149.   for dir in $PATH; do
  150.     test -z "$dir" && dir=.
  151.     if test -f $dir/ranlib; then
  152.       RANLIB="ranlib"
  153.       break
  154.     fi
  155.   done
  156.   IFS="$saveifs"
  157. fi
  158. test -z "$RANLIB" && RANLIB="true"
  159.  
  160.  
  161. echo checking for pid_t in sys/types.h
  162. echo checking how to run the C preprocessor
  163. if test -z "$CPP"; then
  164.   CPP='${CC-cc} -E'
  165.   cat > conftest.c <<EOF
  166. #include <stdio.h>
  167. EOF
  168. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  169. if test -z "$err"; then
  170.   :
  171. else
  172.   CPP=/lib/cpp
  173. fi
  174. rm -f conftest*
  175. fi
  176.  
  177. echo '#include <sys/types.h>' > conftest.c
  178. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  179. if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  180.   :
  181. else 
  182.   DEFS="$DEFS -Dpid_t=int"
  183. SEDDEFS="${SEDDEFS}\${SEDdA}pid_t\${SEDdB}pid_t\${SEDdC}int\${SEDdD}
  184. \${SEDuA}pid_t\${SEDuB}pid_t\${SEDuC}int\${SEDuD}
  185. \${SEDeA}pid_t\${SEDeB}pid_t\${SEDeC}int\${SEDeD}
  186. "
  187. fi
  188. rm -f conftest*
  189.  
  190.  
  191. #
  192. # Look for various header files
  193. #
  194. echo checking for stdlib.h
  195. cat > conftest.c <<EOF
  196. #include <stdlib.h>
  197. EOF
  198. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  199. if test -z "$err"; then
  200.   :
  201. else
  202.   DEFS="$DEFS -DNOSTDLIB=1"
  203. SEDDEFS="${SEDDEFS}\${SEDdA}NOSTDLIB\${SEDdB}NOSTDLIB\${SEDdC}1\${SEDdD}
  204. \${SEDuA}NOSTDLIB\${SEDuB}NOSTDLIB\${SEDuC}1\${SEDuD}
  205. \${SEDeA}NOSTDLIB\${SEDeB}NOSTDLIB\${SEDeC}1\${SEDeD}
  206. "
  207. fi
  208. rm -f conftest*
  209.  
  210. echo checking for sys/wait.h
  211. cat > conftest.c <<EOF
  212. #include <sys/wait.h>
  213. EOF
  214. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  215. if test -z "$err"; then
  216.   DEFS="$DEFS -DHAVE_SYS_WAIT_H=1"
  217. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYS_WAIT_H\${SEDdB}HAVE_SYS_WAIT_H\${SEDdC}1\${SEDdD}
  218. \${SEDuA}HAVE_SYS_WAIT_H\${SEDuB}HAVE_SYS_WAIT_H\${SEDuC}1\${SEDuD}
  219. \${SEDeA}HAVE_SYS_WAIT_H\${SEDeB}HAVE_SYS_WAIT_H\${SEDeC}1\${SEDeD}
  220. "
  221. fi
  222. rm -f conftest*
  223.  
  224. echo checking for sys/stropts.h
  225. cat > conftest.c <<EOF
  226. #include <sys/stropts.h>
  227. EOF
  228. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  229. if test -z "$err"; then
  230.   DEFS="$DEFS -DHAVE_STROPTS_H=1"
  231. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_STROPTS_H\${SEDdB}HAVE_STROPTS_H\${SEDdC}1\${SEDdD}
  232. \${SEDuA}HAVE_STROPTS_H\${SEDuB}HAVE_STROPTS_H\${SEDuC}1\${SEDuD}
  233. \${SEDeA}HAVE_STROPTS_H\${SEDeB}HAVE_STROPTS_H\${SEDeC}1\${SEDeD}
  234. "
  235. fi
  236. rm -f conftest*
  237.  
  238. echo checking for sys/sysconfig.h
  239. cat > conftest.c <<EOF
  240. #include <sys/sysconfig.h>
  241. EOF
  242. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  243. if test -z "$err"; then
  244.   DEFS="$DEFS -DHAVE_SYSCONF_H=1"
  245. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYSCONF_H\${SEDdB}HAVE_SYSCONF_H\${SEDdC}1\${SEDdD}
  246. \${SEDuA}HAVE_SYSCONF_H\${SEDuB}HAVE_SYSCONF_H\${SEDuC}1\${SEDuD}
  247. \${SEDeA}HAVE_SYSCONF_H\${SEDeB}HAVE_SYSCONF_H\${SEDeC}1\${SEDeD}
  248. "
  249. fi
  250. rm -f conftest*
  251.  
  252. echo checking for sys/fcntl.h
  253. cat > conftest.c <<EOF
  254. #include <sys/fcntl.h>
  255. EOF
  256. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  257. if test -z "$err"; then
  258.   DEFS="$DEFS -DHAVE_SYS_FCNTL_H=1"
  259. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYS_FCNTL_H\${SEDdB}HAVE_SYS_FCNTL_H\${SEDdC}1\${SEDdD}
  260. \${SEDuA}HAVE_SYS_FCNTL_H\${SEDuB}HAVE_SYS_FCNTL_H\${SEDuC}1\${SEDuD}
  261. \${SEDeA}HAVE_SYS_FCNTL_H\${SEDeB}HAVE_SYS_FCNTL_H\${SEDeC}1\${SEDeD}
  262. "
  263. fi
  264. rm -f conftest*
  265.  
  266. echo checking for sys/sysmacros.h
  267. cat > conftest.c <<EOF
  268. #include <sys/sysmacros.h>
  269. EOF
  270. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  271. if test -z "$err"; then
  272.   DEFS="$DEFS -DHAVE_SYSMACROS_H=1"
  273. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYSMACROS_H\${SEDdB}HAVE_SYSMACROS_H\${SEDdC}1\${SEDdD}
  274. \${SEDuA}HAVE_SYSMACROS_H\${SEDuB}HAVE_SYSMACROS_H\${SEDuC}1\${SEDuD}
  275. \${SEDeA}HAVE_SYSMACROS_H\${SEDeB}HAVE_SYSMACROS_H\${SEDeC}1\${SEDeD}
  276. "
  277. fi
  278. rm -f conftest*
  279.  
  280. echo checking for unistd.h
  281. cat > conftest.c <<EOF
  282. #include <unistd.h>
  283. EOF
  284. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  285. if test -z "$err"; then
  286.   DEFS="$DEFS -DHAVE_UNISTD_H=1"
  287. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNISTD_H\${SEDdB}HAVE_UNISTD_H\${SEDdC}1\${SEDdD}
  288. \${SEDuA}HAVE_UNISTD_H\${SEDuB}HAVE_UNISTD_H\${SEDuC}1\${SEDuD}
  289. \${SEDeA}HAVE_UNISTD_H\${SEDeB}HAVE_UNISTD_H\${SEDeC}1\${SEDeD}
  290. "
  291. fi
  292. rm -f conftest*
  293.  
  294.  
  295. #
  296. # Look for various functions
  297. #
  298. echo checking for memcpy
  299. cat > conftest.c <<EOF
  300. #include <stdio.h>
  301. main() { exit(0); } 
  302. t() { 
  303. #ifdef __stub_memcpy
  304. choke me
  305. #else
  306. /* Override any gcc2 internal prototype to avoid an error.  */
  307. extern char memcpy(); memcpy();
  308. #endif
  309.  }
  310. EOF
  311. if eval $compile; then
  312.   :
  313. else
  314.   DEFS="$DEFS -DNO_MEMCPY=1"
  315. SEDDEFS="${SEDDEFS}\${SEDdA}NO_MEMCPY\${SEDdB}NO_MEMCPY\${SEDdC}1\${SEDdD}
  316. \${SEDuA}NO_MEMCPY\${SEDuB}NO_MEMCPY\${SEDuC}1\${SEDuD}
  317. \${SEDeA}NO_MEMCPY\${SEDeB}NO_MEMCPY\${SEDeC}1\${SEDeD}
  318. "
  319. fi
  320. rm -f conftest*
  321. #endif
  322.  
  323. echo checking for waitpid
  324. cat > conftest.c <<EOF
  325. #include <stdio.h>
  326. main() { exit(0); } 
  327. t() { 
  328. #ifdef __stub_waitpid
  329. choke me
  330. #else
  331. /* Override any gcc2 internal prototype to avoid an error.  */
  332. extern char waitpid(); waitpid();
  333. #endif
  334.  }
  335. EOF
  336. if eval $compile; then
  337.   :
  338. else
  339.   DEFS="$DEFS -DNOWAITPID=1"
  340. SEDDEFS="${SEDDEFS}\${SEDdA}NOWAITPID\${SEDdB}NOWAITPID\${SEDdC}1\${SEDdD}
  341. \${SEDuA}NOWAITPID\${SEDuB}NOWAITPID\${SEDuC}1\${SEDuD}
  342. \${SEDeA}NOWAITPID\${SEDeB}NOWAITPID\${SEDeC}1\${SEDeD}
  343. "
  344. fi
  345. rm -f conftest*
  346. #endif
  347.  
  348. echo checking for wait4
  349. cat > conftest.c <<EOF
  350. #include <stdio.h>
  351. main() { exit(0); } 
  352. t() { 
  353. #ifdef __stub_wait4
  354. choke me
  355. #else
  356. /* Override any gcc2 internal prototype to avoid an error.  */
  357. extern char wait4(); wait4();
  358. #endif
  359.  }
  360. EOF
  361. if eval $compile; then
  362.   DEFS="$DEFS -DHAVE_WAIT4=1"
  363. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WAIT4\${SEDdB}HAVE_WAIT4\${SEDdC}1\${SEDdD}
  364. \${SEDuA}HAVE_WAIT4\${SEDuB}HAVE_WAIT4\${SEDuC}1\${SEDuD}
  365. \${SEDeA}HAVE_WAIT4\${SEDeB}HAVE_WAIT4\${SEDeC}1\${SEDeD}
  366. "
  367. fi
  368. rm -f conftest*
  369. #endif
  370.  
  371. echo checking for sysconf
  372. cat > conftest.c <<EOF
  373. #include <stdio.h>
  374. main() { exit(0); } 
  375. t() { 
  376. #ifdef __stub_sysconf
  377. choke me
  378. #else
  379. /* Override any gcc2 internal prototype to avoid an error.  */
  380. extern char sysconf(); sysconf();
  381. #endif
  382.  }
  383. EOF
  384. if eval $compile; then
  385.   DEFS="$DEFS -DHAVE_SYSCONF=1"
  386. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYSCONF\${SEDdB}HAVE_SYSCONF\${SEDdC}1\${SEDdD}
  387. \${SEDuA}HAVE_SYSCONF\${SEDuB}HAVE_SYSCONF\${SEDuC}1\${SEDuD}
  388. \${SEDeA}HAVE_SYSCONF\${SEDeB}HAVE_SYSCONF\${SEDeC}1\${SEDeD}
  389. "
  390. fi
  391. rm -f conftest*
  392. #endif
  393.  
  394.  
  395. #
  396. # check how signals work
  397. #
  398.  
  399. # Check for the data type of the function used in signal(). This
  400. # must be before the test for rearming.
  401. echo checking return type of signal handlers
  402. echo '#include <signal.h>' > conftest.c
  403. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  404. if egrep "(void|sighandler_t).*signal" conftest.out >/dev/null 2>&1; then
  405.   retsigtype=void
  406. else 
  407.   DEFS="$DEFS -DRETSIGTYPE=int"
  408. SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}int\${SEDdD}
  409. \${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}int\${SEDuD}
  410. \${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}int\${SEDeD}
  411. " retsigtype=int
  412. fi
  413. rm -f conftest*
  414.  
  415.  
  416. # FIXME: check to see it alarm exists
  417. # Check to see it signals need to be re-armed after use.
  418. echo checking to see if signals need to be re-armed
  419. cat > conftest.c <<EOF
  420.  
  421. #include <signal.h>
  422. #define RETSIGTYPE $retsigtype
  423.  
  424. void
  425. sigquit_handler(n)
  426. int n;
  427. {
  428. }
  429.  
  430. main()
  431. {
  432.     if (0 == fork()) {
  433.         unlink("core");
  434.         signal(SIGQUIT,sigquit_handler);
  435.         kill(getpid(),SIGQUIT);
  436.         kill(getpid(),SIGQUIT);
  437.     } else {
  438.         int status;
  439.  
  440.         wait(&status);
  441.         exit(unlink("core")==-1?0:1);
  442.     }
  443. }
  444. EOF
  445. eval $compile
  446. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  447.   :
  448. else
  449.   DEFS="$DEFS -DREARM_SIG=1"
  450. SEDDEFS="${SEDDEFS}\${SEDdA}REARM_SIG\${SEDdB}REARM_SIG\${SEDdC}1\${SEDdD}
  451. \${SEDuA}REARM_SIG\${SEDuB}REARM_SIG\${SEDuC}1\${SEDuD}
  452. \${SEDeA}REARM_SIG\${SEDeB}REARM_SIG\${SEDeC}1\${SEDeD}
  453. "
  454. fi
  455. rm -f conftest*
  456.  
  457. # HPUX7 has trouble with the big cat so split it
  458. # Owen Rees <rtor@ansa.co.uk> 29Mar93 
  459. SEDDEFS="${SEDDEFS}CONFEOF
  460. cat >> conftest.sed <<CONFEOF
  461. "
  462. #
  463. # Look for various features to determine what kind of pty
  464. # we have. For some weird reason, ac_compile_check would not
  465. # work, but ac_test_program does.
  466. #
  467. echo checking for HP style pty allocation
  468. # following test fails on DECstations and other things that don't grok -c
  469. # but that's ok, since they don't have PTYMs anyway
  470. if test -c /dev/ptym/ptyp0 2>>/dev/null ; then
  471.     DEFS="$DEFS -DHAVE_PTYM=1"
  472. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTYM\${SEDdB}HAVE_PTYM\${SEDdC}1\${SEDdD}
  473. \${SEDuA}HAVE_PTYM\${SEDuB}HAVE_PTYM\${SEDuC}1\${SEDuD}
  474. \${SEDeA}HAVE_PTYM\${SEDeB}HAVE_PTYM\${SEDeC}1\${SEDeD}
  475. "
  476. fi
  477.  
  478. echo checking for HP style pty-trapping
  479. echo '#include <sys/ptyio.h>' > conftest.c
  480. eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  481. if egrep "struct.*request_info" conftest.out >/dev/null 2>&1; then
  482.   DEFS="$DEFS -DHAVE_PTYTRAP=1"
  483. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTYTRAP\${SEDdB}HAVE_PTYTRAP\${SEDdC}1\${SEDdD}
  484. \${SEDuA}HAVE_PTYTRAP\${SEDuB}HAVE_PTYTRAP\${SEDuC}1\${SEDuD}
  485. \${SEDeA}HAVE_PTYTRAP\${SEDeB}HAVE_PTYTRAP\${SEDeC}1\${SEDeD}
  486. "
  487. fi
  488. rm -f conftest*
  489.  
  490.  
  491. echo checking for AIX new-style pty allocation
  492. if test -r /dev/ptc -a -r /dev/pts ; then
  493.     DEFS="$DEFS -DHAVE_PTC_PTS=1"
  494. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTC_PTS\${SEDdB}HAVE_PTC_PTS\${SEDdC}1\${SEDdD}
  495. \${SEDuA}HAVE_PTC_PTS\${SEDuB}HAVE_PTC_PTS\${SEDuC}1\${SEDuD}
  496. \${SEDeA}HAVE_PTC_PTS\${SEDeB}HAVE_PTC_PTS\${SEDeC}1\${SEDeD}
  497. "
  498. fi
  499.  
  500. echo checking for SGI old-style pty allocation
  501. if test -r /dev/ptc -a ! -r /dev/pts ; then
  502.     DEFS="$DEFS -DHAVE_PTC=1"
  503. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTC\${SEDdB}HAVE_PTC\${SEDdC}1\${SEDdD}
  504. \${SEDuA}HAVE_PTC\${SEDuB}HAVE_PTC\${SEDuC}1\${SEDuD}
  505. \${SEDeA}HAVE_PTC\${SEDeB}HAVE_PTC\${SEDeC}1\${SEDeD}
  506. "
  507. fi
  508.  
  509. echo checking for SVR4 style pty allocation
  510. if test -r /dev/ptmx ; then
  511.   DEFS="$DEFS -DHAVE_PTMX=1"
  512. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_PTMX\${SEDdB}HAVE_PTMX\${SEDdC}1\${SEDdD}
  513. \${SEDuA}HAVE_PTMX\${SEDuB}HAVE_PTMX\${SEDuC}1\${SEDuD}
  514. \${SEDeA}HAVE_PTMX\${SEDeB}HAVE_PTMX\${SEDeC}1\${SEDeD}
  515. "
  516.   # aargg. Some systems need libpt.a to use /dev/ptmx
  517.     echo checking for libpt.a
  518.     echo checking for ptsname
  519. cat > conftest.c <<EOF
  520. #include <stdio.h>
  521. main() { exit(0); } 
  522. t() { 
  523. #ifdef __stub_ptsname
  524. choke me
  525. #else
  526. /* Override any gcc2 internal prototype to avoid an error.  */
  527. extern char ptsname(); ptsname();
  528. #endif
  529.  }
  530. EOF
  531. if eval $compile; then
  532.   :
  533. else
  534.   LIBS=-lpt
  535. fi
  536. rm -f conftest*
  537. #endif
  538.  
  539. fi
  540.  
  541. echo checking for tcgetattr
  542. cat > conftest.c <<EOF
  543. #include <stdio.h>
  544. main() { exit(0); } 
  545. t() { 
  546. #ifdef __stub_tcgetattr
  547. choke me
  548. #else
  549. /* Override any gcc2 internal prototype to avoid an error.  */
  550. extern char tcgetattr(); tcgetattr();
  551. #endif
  552.  }
  553. EOF
  554. if eval $compile; then
  555.   tcgetattr=1
  556. fi
  557. rm -f conftest*
  558. #endif
  559.  
  560. echo checking for tcsetattr
  561. cat > conftest.c <<EOF
  562. #include <stdio.h>
  563. main() { exit(0); } 
  564. t() { 
  565. #ifdef __stub_tcsetattr
  566. choke me
  567. #else
  568. /* Override any gcc2 internal prototype to avoid an error.  */
  569. extern char tcsetattr(); tcsetattr();
  570. #endif
  571.  }
  572. EOF
  573. if eval $compile; then
  574.   tcsetattr=1
  575. fi
  576. rm -f conftest*
  577. #endif
  578.  
  579. if test $tcgetattr -a $tcsetattr ; then
  580.     DEFS="$DEFS -DPOSIX=1"
  581. SEDDEFS="${SEDDEFS}\${SEDdA}POSIX\${SEDdB}POSIX\${SEDdC}1\${SEDdD}
  582. \${SEDuA}POSIX\${SEDuB}POSIX\${SEDuC}1\${SEDuD}
  583. \${SEDeA}POSIX\${SEDeB}POSIX\${SEDeC}1\${SEDeD}
  584. "
  585. fi
  586.  
  587. # first check for the pure bsd
  588. echo checking for struct sgttyb
  589. cat > conftest.c <<EOF
  590. #include <sgtty.h>
  591. main()
  592. {
  593.   struct sgttyb tmp;
  594.   exit(0);
  595. }
  596. EOF
  597. eval $compile
  598. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  599.   DEFS="$DEFS -DHAVE_SGTTYB=1"
  600. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SGTTYB\${SEDdB}HAVE_SGTTYB\${SEDdC}1\${SEDdD}
  601. \${SEDuA}HAVE_SGTTYB\${SEDuB}HAVE_SGTTYB\${SEDuC}1\${SEDuD}
  602. \${SEDeA}HAVE_SGTTYB\${SEDeB}HAVE_SGTTYB\${SEDeC}1\${SEDeD}
  603. " PTY_TYPE=sgttyb
  604. fi
  605. rm -f conftest*
  606.  
  607. # next check for the older style ttys
  608. echo checking for struct termio
  609. cat > conftest.c <<EOF
  610. #include <termio.h>
  611. main()
  612. {
  613.   struct termio tmp;
  614.   exit(0);
  615. }
  616. EOF
  617. eval $compile
  618. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  619.   DEFS="$DEFS -DHAVE_TERMIO=1"
  620. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TERMIO\${SEDdB}HAVE_TERMIO\${SEDdC}1\${SEDdD}
  621. \${SEDuA}HAVE_TERMIO\${SEDuB}HAVE_TERMIO\${SEDuC}1\${SEDuD}
  622. \${SEDeA}HAVE_TERMIO\${SEDeB}HAVE_TERMIO\${SEDeC}1\${SEDeD}
  623. " PTY_TYPE=termio
  624. fi
  625. rm -f conftest*
  626.  
  627. # now check for the new style ttys (not yet posix)
  628. echo checking for struct termios
  629. cat > conftest.c <<EOF
  630. #include <termios.h>
  631. main()
  632. {
  633.   struct termios tmp;
  634.   exit(0);
  635. }
  636. EOF
  637. eval $compile
  638. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  639.   DEFS="$DEFS -DHAVE_TERMIOS=1"
  640. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TERMIOS\${SEDdB}HAVE_TERMIOS\${SEDdC}1\${SEDdD}
  641. \${SEDuA}HAVE_TERMIOS\${SEDuB}HAVE_TERMIOS\${SEDuC}1\${SEDuD}
  642. \${SEDeA}HAVE_TERMIOS\${SEDeB}HAVE_TERMIOS\${SEDeC}1\${SEDeD}
  643. " PTY_TYPE=termios
  644. fi
  645. rm -f conftest*
  646.  
  647. # finally check for Cray style ttys
  648. echo checking for Cray-style ptys
  649. SETUID="@:"
  650. cat > conftest.c <<EOF
  651.  
  652. main(){
  653. #ifdef CRAY
  654.     return 0;
  655. #else
  656.     return 1;
  657. #endif
  658. }
  659.  
  660. EOF
  661. eval $compile
  662. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  663.   PTY_TYPE=unicos SETUID="chmod u+s"
  664. fi
  665. rm -f conftest*
  666. #
  667. # Check for select and/or poll. If both exist, we prefer select.
  668. # if neither exists, define SIMPLE_EVENT.
  669. #
  670. select=0
  671. poll=0
  672. echo checking for select
  673. cat > conftest.c <<EOF
  674. #include <stdio.h>
  675. main() { exit(0); } 
  676. t() { 
  677. #ifdef __stub_select
  678. choke me
  679. #else
  680. /* Override any gcc2 internal prototype to avoid an error.  */
  681. extern char select(); select();
  682. #endif
  683.  }
  684. EOF
  685. if eval $compile; then
  686.   select=1
  687. fi
  688. rm -f conftest*
  689. #endif
  690.  
  691. echo checking for poll
  692. cat > conftest.c <<EOF
  693. #include <stdio.h>
  694. main() { exit(0); } 
  695. t() { 
  696. #ifdef __stub_poll
  697. choke me
  698. #else
  699. /* Override any gcc2 internal prototype to avoid an error.  */
  700. extern char poll(); poll();
  701. #endif
  702.  }
  703. EOF
  704. if eval $compile; then
  705.   poll=1
  706. fi
  707. rm -f conftest*
  708. #endif
  709.  
  710. if test $poll -a $select ; then
  711.   EVENT_TYPE=select
  712.   poll=0
  713. elif test $poll ; then
  714.   EVENT_TYPE=poll
  715. elif test $select ; then
  716.   EVENT_TYPE=select
  717. else
  718.   EVENT_TYPE=simple
  719.   DEFS="$DEFS -DSIMPLE_EVENT=1"
  720. SEDDEFS="${SEDDEFS}\${SEDdA}SIMPLE_EVENT\${SEDdB}SIMPLE_EVENT\${SEDdC}1\${SEDdD}
  721. \${SEDuA}SIMPLE_EVENT\${SEDuB}SIMPLE_EVENT\${SEDuC}1\${SEDuD}
  722. \${SEDeA}SIMPLE_EVENT\${SEDeB}SIMPLE_EVENT\${SEDeC}1\${SEDeD}
  723. "
  724. fi
  725.  
  726. for func in getpty
  727. do
  728. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  729. echo checking for ${func}
  730. cat > conftest.c <<EOF
  731. #include <stdio.h>
  732. main() { exit(0); } 
  733. t() { 
  734. #ifdef __stub_${func}
  735. choke me
  736. #else
  737. /* Override any gcc2 internal prototype to avoid an error.  */
  738. extern char ${func}(); ${func}();
  739. #endif
  740.  }
  741. EOF
  742. if eval $compile; then
  743.   DEFS="$DEFS -D${trfunc}=1"
  744. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  745. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  746. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  747. "
  748. fi
  749. rm -f conftest*
  750. #endif
  751. done
  752.  
  753. for func in _getpty
  754. do
  755. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  756. echo checking for ${func}
  757. cat > conftest.c <<EOF
  758. #include <stdio.h>
  759. main() { exit(0); } 
  760. t() { 
  761. #ifdef __stub_${func}
  762. choke me
  763. #else
  764. /* Override any gcc2 internal prototype to avoid an error.  */
  765. extern char ${func}(); ${func}();
  766. #endif
  767.  }
  768. EOF
  769. if eval $compile; then
  770.   DEFS="$DEFS -D${trfunc}=1"
  771. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  772. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  773. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  774. "
  775. fi
  776. rm -f conftest*
  777. #endif
  778. done
  779.  
  780.  
  781. #
  782. # Look for the X11 include files in various places.
  783. #
  784. Xbuild=1
  785. echo checking for the X11 headers
  786. XINCLUDES="# no special path needed"
  787. cat > conftest.c <<EOF
  788. #include <X11/Intrinsic.h>
  789. EOF
  790. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  791. if test -z "$err"; then
  792.   :
  793. else
  794.   XINCLUDES="nope"
  795. fi
  796. rm -f conftest*
  797. if test "$XINCLUDES" = "nope" ; then
  798.   dirs="/usr/local/include/X11 /usr/unsupported/include/X11 /usr/openwin/include/X11 /usr/include/X11R5/X11 /usr/X11R5/include/X11 /usr/include/X11R4/X11"
  799.   for i in $dirs ; do
  800.     if test -r $i/Intrinsic.h; then
  801.       XINCLUDES=" -I$i"
  802.     fi
  803.   done
  804. fi
  805.  
  806. if test "$XINCLUDES" = "nope" ; then
  807.   XINCLUDES="# no X support on this system"
  808.   Xbuild=0
  809. fi
  810.  
  811. #
  812. # Now check for the libraries. The first test merely looks in a few
  813. # different places.
  814. XLIBS="-lX11"
  815. libname=`echo "libX11.a" | sed 's/lib\([^\.]*\)\.a/\1/;s/-l//'`
  816. LIBS_save="${LIBS}"
  817. LIBS="${LIBS} -l${libname}"
  818. have_lib=""
  819. echo checking for -llibX11.a
  820. cat > conftest.c <<EOF
  821.  
  822. main() { exit(0); } 
  823. t() { main(); }
  824. EOF
  825. if eval $compile; then
  826.   have_lib="1"
  827. fi
  828. rm -f conftest*
  829. LIBS="${LIBS_save}"
  830. if test -n "${have_lib}"; then
  831.    :; 
  832. else
  833.    :; XLIBS="nope"
  834. fi
  835.  
  836. if test "$XLIBS" = "nope" ; then
  837.   dirs="/usr/local/lib /usr/lib/X11R4 /usr/lib/X11R5 /usr/X11/lib /usr/lib/X11 /usr/openwin/lib"
  838.   for i in $dirs ; do
  839.     if test -r $i/libX11.a; then
  840.       XLIBS="-L$i -lX11"
  841.     fi
  842.   done
  843. fi
  844.  
  845. #
  846. # HP-UX wants this instead of libX11
  847. #
  848. if test "$XLIBS" = "nope" ; then
  849.   libname=`echo "libXwindow.a" | sed 's/lib\([^\.]*\)\.a/\1/;s/-l//'`
  850. LIBS_save="${LIBS}"
  851. LIBS="${LIBS} -l${libname}"
  852. have_lib=""
  853. echo checking for -llibXwindow.a
  854. cat > conftest.c <<EOF
  855.  
  856. main() { exit(0); } 
  857. t() { main(); }
  858. EOF
  859. if eval $compile; then
  860.   have_lib="1"
  861. fi
  862. rm -f conftest*
  863. LIBS="${LIBS_save}"
  864. if test -n "${have_lib}"; then
  865.    :; XLIBS="-lXwindow"
  866. else
  867.    :; 
  868. fi
  869.  
  870. fi
  871.  
  872. if test "$XLIBS" = "nope" ; then
  873.   Xbuild=0
  874. fi
  875.  
  876. XPROGS=""
  877. if test $Xbuild = 1; then
  878.   XPROGS="expectk \$(LIBEXPTK)"
  879. else
  880.   XPROGS="# no X support on this system"
  881.   echo "No X based programs will be built"
  882. fi
  883.  
  884. #
  885. # Set up makefile substitutions
  886. #
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893. if test -n "$prefix"; then
  894.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  895.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  896. fi
  897. if test -n "$exec_prefix"; then
  898.   prsub="$prsub
  899. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  900. exec_prefix\\1=\\2$exec_prefix%"
  901. fi
  902.  
  903. trap 'rm -f config.status; exit 1' 1 3 15
  904. echo creating config.status
  905. rm -f config.status
  906. cat > config.status <<EOF
  907. #!/bin/sh
  908. # Generated automatically by configure.
  909. # Run this file to recreate the current configuration.
  910. # This directory was configured as follows,
  911. # on host `(hostname || uname -n) 2>/dev/null`:
  912. #
  913. # $0 $*
  914.  
  915. for arg
  916. do
  917.   case "\$arg" in
  918.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  919.     exec /bin/sh $0 $* ;;
  920.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  921.   esac
  922. done
  923.  
  924. trap 'rm -f Makefile exp_conf.h conftest*; exit 1' 1 3 15
  925. INSTALL='$INSTALL'
  926. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  927. INSTALL_DATA='$INSTALL_DATA'
  928. RANLIB='$RANLIB'
  929. CPP='$CPP'
  930. XINCLUDES='$XINCLUDES'
  931. XLIBS='$XLIBS'
  932. XPROGS='$XPROGS'
  933. PTY_TYPE='$PTY_TYPE'
  934. EVENT_TYPE='$EVENT_TYPE'
  935. SETUID='$SETUID'
  936. LIBS='$LIBS'
  937. srcdir='$srcdir'
  938. prefix='$prefix'
  939. exec_prefix='$exec_prefix'
  940. prsub='$prsub'
  941. EOF
  942. cat >> config.status <<\EOF
  943.  
  944. top_srcdir=$srcdir
  945. for file in .. Makefile; do if [ "x$file" != "x.." ]; then
  946.   srcdir=$top_srcdir
  947.   # Remove last slash and all that follows it.  Not all systems have dirname.
  948.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  949.   if test "$dir" != "$file"; then
  950.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  951.     test ! -d $dir && mkdir $dir
  952.   fi
  953.   echo creating $file
  954.   rm -f $file
  955.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  956.   sed -e "
  957. $prsub
  958. s%@INSTALL@%$INSTALL%g
  959. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  960. s%@INSTALL_DATA@%$INSTALL_DATA%g
  961. s%@RANLIB@%$RANLIB%g
  962. s%@CPP@%$CPP%g
  963. s%@XINCLUDES@%$XINCLUDES%g
  964. s%@XLIBS@%$XLIBS%g
  965. s%@XPROGS@%$XPROGS%g
  966. s%@PTY_TYPE@%$PTY_TYPE%g
  967. s%@EVENT_TYPE@%$EVENT_TYPE%g
  968. s%@SETUID@%$SETUID%g
  969. s%@LIBS@%$LIBS%g
  970. s%@srcdir@%$srcdir%g
  971. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  972. fi; done
  973.  
  974. echo creating exp_conf.h
  975. # These sed commands are put into SEDDEFS when defining a macro.
  976. # They are broken into pieces to make the sed script easier to manage.
  977. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  978. # is the cpp macro being defined and VALUE is the value it is being given.
  979. # Each defining turns into a single global substitution command.
  980. #
  981. # SEDd sets the value in "#define NAME VALUE" lines.
  982. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  983. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  984. SEDdC='\3'
  985. SEDdD='@g'
  986. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  987. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  988. SEDuB='\([     ]\)@\1#\2define\3'
  989. SEDuC=' '
  990. SEDuD='\4@g'
  991. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  992. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  993. SEDeB='$@\1#\2define\3'
  994. SEDeC=' '
  995. SEDeD='@g'
  996. rm -f conftest.sed
  997. cat > conftest.sed <<CONFEOF
  998. EOF
  999. # Turn off quoting long enough to insert the sed commands.
  1000. cat >> config.status <<EOF
  1001. $SEDDEFS
  1002. EOF
  1003. cat >> config.status <<\EOF
  1004. CONFEOF
  1005. rm -f conftest.h
  1006. # Break up the sed commands because old seds have small limits.
  1007. cp $top_srcdir/exp_conf.h.in conftest.h1
  1008. while :
  1009. do
  1010.   lines=`grep -c . conftest.sed`
  1011.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  1012.   rm -f conftest.s1 conftest.s2 conftest.h2
  1013.   sed 40q conftest.sed > conftest.s1 # Like head -40.
  1014.   sed 1,40d conftest.sed > conftest.s2 # Like tail +41.
  1015.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  1016.   rm -f conftest.s1 conftest.h1 conftest.sed
  1017.   mv conftest.h2 conftest.h1
  1018.   mv conftest.s2 conftest.sed
  1019. done
  1020. rm -f conftest.sed conftest.h
  1021. echo "/* exp_conf.h.  Generated automatically by configure.  */" > conftest.h
  1022. cat conftest.h1 >> conftest.h
  1023. rm -f conftest.h1
  1024. if cmp -s exp_conf.h conftest.h 2>/dev/null; then
  1025.   # The file exists and we would not be changing it.
  1026.   rm -f conftest.h
  1027. else
  1028.   rm -f exp_conf.h
  1029.   mv conftest.h exp_conf.h
  1030. fi
  1031.  
  1032. EOF
  1033. chmod +x config.status
  1034. test -n "$no_create" || ./config.status
  1035.  
  1036.