home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume27 / screen-3.5.1 / part03 / configure.in < prev    next >
Text File  |  1993-08-08  |  19KB  |  842 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl
  3. dnl $Id: configure.in,v 1.8 1993/08/05 14:23:43 mlschroe Exp $ FAU
  4. dnl
  5. dnl Many thanks to David MacKenzie for writing autoconf and
  6. dnl providing a sample configure.in file for screen.
  7. dnl
  8. AC_INIT(screen.c)
  9. AC_CONFIG_HEADER(config.h)
  10.  
  11. dnl
  12. dnl Define some useful macros
  13. dnl
  14. define(AC_PROGRAM_SOURCE,
  15. [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF
  16. [$1]
  17. _CUT_HERE_
  18. [$2]
  19. EOF
  20. eval "$CPP $DEFS conftest.c 2>/dev/null | sed -e '1,/_CUT_HERE_/d' > conftest.out"
  21. . ./conftest.out
  22. rm -f conftest*
  23. ])dnl
  24.  
  25. rev=`sed < ${srcdir}/patchlevel.h -n -e '/#define REV/s/#define REV  *//p'`
  26. vers=`sed < ${srcdir}/patchlevel.h -n -e '/#define VERS/s/#define VERS  *//p'`
  27. pat=`sed < ${srcdir}/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL  *//p'`
  28. VERSION="$rev.$vers.$pat"
  29. echo "this is screen version $VERSION"
  30. AC_SUBST(VERSION)
  31.  
  32. AC_PROG_CC
  33. AC_PROG_CPP
  34. AC_GCC_TRADITIONAL
  35. AC_ISC_POSIX
  36.  
  37.  
  38. AC_TEST_PROGRAM(main(){exit(0);},,echo "Can't run the compiler - sorry";exit)
  39. AC_PROG_AWK
  40.  
  41. AC_PROG_INSTALL
  42.  
  43. dnl
  44. dnl    ****  special unix variants  ****
  45. dnl
  46. if test -n "$ISC"; then
  47.   AC_DEFINE(ISC) LIBS="$LIBS -linet"
  48. fi
  49.  
  50. echo checking for OSF1
  51. if test -f /bin/uname ; then
  52. if test `/bin/uname` = OSF1 || test -f /osf_boot; then
  53. AC_DEFINE(OSF1)    # this disables MIPS again....
  54. fi
  55. fi
  56.  
  57. echo checking for MIPS
  58. if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
  59. LIBS="$LIBS -lmld" # for nlist.
  60. if test -c /dev/ptc; then
  61. AC_DEFINE(MIPS)
  62. AC_COMPILE_CHECK(wait3, , [wait3();], ,
  63. AC_COMPILE_CHECK(wait2, , [wait2();],
  64. dnl John Rouillard (rouilj@sni-usa.com):
  65. dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
  66. dnl job control etc.
  67. dnl Detect RISCOS if wait2 is present, but not wait3.
  68. AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
  69. ))
  70. fi
  71. fi
  72.  
  73. echo checking for Ultrix
  74. AC_PROGRAM_EGREP(yes,
  75. [#if defined(ultrix) || defined(__ultrix)
  76.   yes
  77. #endif
  78. ], ULTRIX=1)
  79.  
  80. dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
  81. dnl BBN butterfly is not POSIX, but a MACH BSD system.
  82. dnl Do not define POSIX and TERMIO.
  83. echo checking for butterfly
  84. AC_PROGRAM_EGREP(yes,
  85. [#if defined(butterfly)
  86.   yes
  87. #endif
  88. ], butterfly=1)
  89.  
  90. if test -z "$butterfly"; then
  91. if test -n "$ULTRIX"; then
  92.   test -z "$GCC" && CC="$CC -YBSD"
  93. fi
  94. echo checking for POSIX.1
  95. AC_PROGRAM_EGREP(yes,
  96. [#include <sys/types.h>
  97. #include <unistd.h>
  98. main () {
  99. #ifdef _POSIX_VERSION
  100.   yes
  101. #endif
  102. ], echo "- you have a POSIX system";AC_DEFINE(POSIX))
  103. fi
  104.  
  105. AC_COMPILE_CHECK([System V],
  106. [#include <sys/types.h>
  107. #include <signal.h>
  108. #include <fcntl.h>], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV))
  109.  
  110. echo checking for sequent/ptx
  111. AC_PROGRAM_EGREP(yes,
  112. [#ifdef _SEQUENT_
  113.   yes
  114. #endif
  115. ], LIBS="$LIBS -lsocket -linet";seqptx=1)
  116.  
  117. oldlibs="$LIBS"
  118. LIBS="$LIBS -lelf"
  119. AC_COMPILE_CHECK(SVR4,,,
  120. AC_HEADER_CHECK(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN) LIBS="$LIBS -lelf",
  121. AC_HEADER_CHECK(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN) LIBS="$LIBS -lelf"))
  122. ,LIBS="$oldlibs")
  123.  
  124.  
  125. dnl
  126. dnl    ****  typedefs ****
  127. dnl
  128. echo checking for pid_t
  129. AC_PROGRAM_EGREP(pid_t,[#include <sys/types.h>
  130. ],AC_DEFINE(PID_T_DEFINED))
  131.  
  132. echo checking for sig_t
  133. AC_PROGRAM_EGREP(sig_t,[#include <sys/types.h>
  134. #include <signal.h>
  135. ],AC_DEFINE(SIG_T_DEFINED))
  136.  
  137. echo checking for uid_t
  138. AC_PROGRAM_EGREP(uid_t,[#include <sys/types.h>
  139. ],AC_DEFINE(UID_T_DEFINED))
  140.  
  141. dnl
  142. dnl   ****     Job control     ****
  143. dnl
  144.  
  145. AC_COMPILE_CHECK([BSD job control], 
  146. [#include <sys/types.h>
  147. #include <sys/ioctl.h>
  148. ], [
  149. #ifdef POSIX
  150. tcsetpgrp(0, 0);
  151. #else
  152. int x = TIOCSPGRP;
  153. #ifdef SYSV
  154. setpgrp();
  155. #else
  156. int y = TIOCNOTTY;
  157. #endif
  158. #endif
  159. ], echo "- you have jobcontrol" AC_DEFINE(BSDJOBS), echo "- you don't have jobcontrol")
  160.  
  161. dnl
  162. dnl    ****  setreuid()  ****
  163. dnl
  164. AC_COMPILE_CHECK(setreuid, , 
  165. [
  166. #ifdef hpux
  167. setresuid(0, 0, 0);
  168. #else
  169. setreuid(0, 0);
  170. #endif
  171. ], , AC_DEFINE(NOREUID))
  172.  
  173.  
  174. dnl    ****  select()  ****
  175. dnl
  176.  
  177. AC_COMPILE_CHECK(select,,[select(0, 0, 0, 0, 0);],, 
  178. LIBS="$LIBS -lnet -lnsl"
  179. AC_COMPILE_CHECK(select with $LIBS,,[select(0, 0, 0, 0, 0);],, 
  180. echo '!!! no select - no screen';exit)
  181. )
  182. dnl
  183. dnl    ****  FIFO tests  ****
  184. dnl
  185.  
  186. echo checking fifos
  187. AC_TEST_PROGRAM([
  188. #include <sys/types.h>
  189. #include <sys/stat.h>
  190. #include <fcntl.h>
  191.  
  192. #ifndef O_NDELAY
  193. #define O_NDELAY O_NONBLOCK
  194. #endif
  195. #ifndef S_IFIFO
  196. #define S_IFIFO 0010000
  197. #endif
  198.  
  199. char *fin = "/tmp/conftest$$";
  200.  
  201. main()
  202. {
  203.   struct stat stb;
  204.   int f;
  205.  
  206.   (void)alarm(5);
  207.   if (mknod(fin, S_IFIFO|0777, 0))
  208.     exit(1);
  209.   if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
  210.     exit(1);
  211.   close(0);
  212.   if (open(fin, O_RDWR | O_NDELAY))
  213.     exit(1);
  214.   if (write(0, "TEST", 4) == -1)
  215.     exit(1);
  216.   f = 1;
  217.   if (select(1, &f, 0, 0, 0) == -1)
  218.     exit(1);
  219.   exit(0);
  220. }
  221. ], echo "- your fifos are usable"; fifo=1, echo "- your fifos are not usable")
  222. rm -f /tmp/conftest*
  223.  
  224. if test -n "$fifo"; then
  225. echo "checking for broken fifo implementation"
  226. AC_TEST_PROGRAM([
  227. #include <sys/types.h>
  228. #include <fcntl.h>
  229. #include <sys/time.h>
  230. #include <sys/stat.h>
  231.  
  232. #ifndef O_NDELAY
  233. #define O_NDELAY O_NONBLOCK
  234. #endif
  235. #ifndef S_IFIFO
  236. #define S_IFIFO 0010000
  237. #endif
  238.  
  239. char *fin = "/tmp/conftest$$";
  240.  
  241. main()
  242. {
  243.   struct timeval tv;
  244.   int r, x;
  245.  
  246.   if (mknod(fin, S_IFIFO|0600, 0))
  247.     exit(1);
  248.   close(0);
  249.   if (open(fin, O_RDONLY|O_NDELAY))
  250.     exit(1);
  251.   r = 1;
  252.   tv.tv_sec = 1;
  253.   tv.tv_usec = 0;
  254.   if (select(1, &r, 0, 0, &tv))
  255.     exit(1);
  256.   exit(0);
  257. }
  258. ], echo "- your implementation is ok", 
  259. echo "- you have a broken implementation" AC_DEFINE(BROKEN_PIPE) fifobr=1)
  260. rm -f /tmp/conftest*
  261. fi
  262.  
  263. dnl
  264. dnl    ****  SOCKET tests  ****
  265. dnl 
  266. dnl     may need      LIBS="$LIBS -lsocket"     here
  267. dnl
  268.  
  269. echo checking sockets
  270. AC_TEST_PROGRAM([
  271. #include <sys/types.h>
  272. #include <sys/socket.h>
  273. #include <sys/un.h>
  274. #include <fcntl.h>
  275.  
  276. #ifndef O_NDELAY
  277. #define O_NDELAY O_NONBLOCK
  278. #endif
  279. #ifndef FNDELAY
  280. #define FNDELAY O_NDELAY
  281. #endif
  282.  
  283. char *son = "/tmp/conftest$$";
  284.  
  285. main()
  286. {
  287.   int s1, s2, s3, l;
  288.   struct sockaddr_un a;
  289.  
  290.   (void)alarm(5);
  291.   if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  292.     exit(1);
  293.   a.sun_family = AF_UNIX;
  294.   strcpy(a.sun_path, son);
  295.   (void) unlink(son);
  296.   if (bind(s1, (struct sockaddr *) &a, strlen(son)+2) == -1)
  297.     exit(1);
  298.   if (listen(s1, 2))
  299.     exit(1);
  300.   if (fork() == 0)
  301.     {
  302.       if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  303.     kill(getppid(), 3);
  304.       (void)connect(s2, (struct sockaddr *)&a, strlen(son) + 2);
  305.       if (write(s2, "HELLO", 5) == -1)
  306.     kill(getppid(), 3);
  307.       exit(0);
  308.     }
  309.   l = sizeof(a);
  310.   close(0);
  311.   if (accept(s1, &a, &l))
  312.     exit(1);
  313.   l = 1;
  314.   if (select(1, &l, 0, 0, 0) == -1)
  315.     exit(1);
  316.   exit(0);
  317. }
  318. ], echo "- your sockets are usable"; sock=1, echo "- your sockets are not usable")
  319. rm -f /tmp/conftest*
  320.  
  321. if test -n "$sock"; then
  322. echo "checking socket implementation"
  323. AC_TEST_PROGRAM([
  324. #include <sys/types.h>
  325. #include <sys/stat.h>
  326. #include <sys/socket.h>
  327. #include <sys/un.h>
  328.  
  329. char *son = "/tmp/conftest$$";
  330.  
  331. main()
  332. {
  333.   int s;
  334.   struct stat stb;
  335.   struct sockaddr_un a;
  336.   if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  337.     exit(0);
  338.   a.sun_family = AF_UNIX;
  339.   strcpy(a.sun_path, son);
  340.   (void) unlink(son);
  341.   if (bind(s, (struct sockaddr *) &a, strlen(son)+2) == -1)
  342.     exit(0);
  343.   if (stat(son, &stb))
  344.     exit(1);
  345.   close(s);
  346.   exit(0);
  347. }
  348. ],echo "- you are normal",
  349. echo "- unix domain sockets are not kept in the filesystem"
  350. AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
  351. rm -f /tmp/conftest*
  352. fi
  353.  
  354.  
  355. dnl
  356. dnl    ****  choose sockets or fifos  ****
  357. dnl
  358. if test -n "$fifo"; then
  359.   if test -n "$sock"; then
  360.     if test -n "$nore"; then
  361.       echo "- hmmm... better take the fifos"
  362.       AC_DEFINE(NAMEDPIPE)
  363.     elif test -n "$fifobr"; then
  364.       echo "- as your fifos are broken lets use the sockets."
  365.     else
  366.       echo "- both sockets and fifos usable. let's take fifos."
  367.       AC_DEFINE(NAMEDPIPE)
  368.     fi
  369.   else
  370.     echo "- using named pipes, of course"
  371.     AC_DEFINE(NAMEDPIPE)
  372.   fi
  373. elif test -n "$sock"; then
  374.   echo "- using unix-domain sockets, of course"
  375. else
  376.   echo "!!! you have neither usable sockets nor usable pipes -> no screen"
  377.   exit
  378. fi
  379.  
  380. dnl
  381. dnl    ****  check the select implementation ****
  382. dnl
  383.  
  384. echo "checking select return value"
  385. AC_TEST_PROGRAM([
  386. #include <sys/types.h>
  387. #include <sys/stat.h>
  388. #include <fcntl.h>
  389.  
  390. char *nam = "/tmp/conftest$$";
  391.  
  392. #ifdef NAMEDPIPE
  393.  
  394. #ifndef O_NDELAY
  395. #define O_NDELAY O_NONBLOCK
  396. #endif
  397. #ifndef S_IFIFO
  398. #define S_IFIFO 0010000
  399. #endif
  400.  
  401.  
  402. main()
  403. {
  404.   int l;
  405.  
  406.   (void)alarm(5);
  407.   if (mknod(nam, S_IFIFO|0777, 0))
  408.     exit(1);
  409.   close(0);
  410.   if (open(nam, O_RDWR | O_NDELAY))
  411.     exit(1);
  412.   if (write(0, "TEST", 4) == -1)
  413.     exit(1);
  414.  
  415. #else
  416.  
  417. #include <sys/types.h>
  418. #include <sys/socket.h>
  419. #include <sys/un.h>
  420.  
  421. main()
  422. {
  423.   int s1, s2, s3, l;
  424.   struct sockaddr_un a;
  425.  
  426.   (void)alarm(5);
  427.   if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  428.     exit(1);
  429.   a.sun_family = AF_UNIX;
  430.   strcpy(a.sun_path, nam);
  431.   (void) unlink(nam);
  432.   if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1)
  433.     exit(1);
  434.   if (listen(s1, 2))
  435.     exit(1);
  436.   if (fork() == 0)
  437.     {
  438.       if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
  439.     kill(getppid(), 3);
  440.       (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2);
  441.       if (write(s2, "HELLO", 5) == -1)
  442.     kill(getppid(), 3);
  443.       exit(0);
  444.     }
  445.   l = sizeof(a);
  446.   close(0);
  447.   if (accept(s1, (struct sockaddr *)&a, &l))
  448.     exit(1);
  449. #endif
  450.  
  451.  
  452.   l = 1;
  453.   if (select(1, &l, 0, 0, 0) == -1)
  454.     exit(1);
  455.   if (select(1, &l, &l, 0, 0) != 2)
  456.     exit(1);
  457.   exit(0);
  458. }
  459. ],echo "- select is ok",echo "- it is not usable"
  460. AC_DEFINE(SELECT_BROKEN))
  461.  
  462. dnl
  463. dnl    ****  termcap or terminfo  ****
  464. dnl
  465. echo searching for tgetent
  466. olibs="$LIBS"
  467. LIBS="-ltermcap $LIBS"
  468. AC_COMPILE_CHECK(libtermcap,,tgetent((char *)0, (char *)0);,,
  469. LIBS="-lcurses $olibs"
  470. AC_COMPILE_CHECK(libcurses,,tgetent((char *)0, (char *)0);,,
  471. echo "!!! no tgetent - no screen";exit)
  472. )
  473. TERMCAP="xx|scrdumm:xx:"
  474. TERM=scrdumm
  475. export TERMCAP
  476. export TERM
  477. AC_TEST_PROGRAM([
  478. main()
  479. {
  480.   char buf[1024];
  481.   if (tgetent(buf, "scrdumm") != 1)
  482.     exit(1);
  483.   exit(0);
  484. }], echo "- you use the termcap database", echo "- you use the terminfo database"
  485. AC_DEFINE(TERMINFO))
  486. AC_COMPILE_CHECK(ospeed,extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
  487.  
  488. dnl
  489. dnl    ****  PTY ranges  ****
  490. dnl
  491. echo checking for ptyranges
  492. if test -d /dev/ptym ; then
  493. pdir='/dev/ptym'
  494. else
  495. pdir='/dev'
  496. fi
  497. ptys=`echo $pdir/pty??`
  498. if test "$ptys" != "$pdir/pty??" ; then
  499. 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'`
  500. 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'`
  501. AC_DEFINE_UNQUOTED(PTYRANGE0,\"$p0\")
  502. AC_DEFINE_UNQUOTED(PTYRANGE1,\"$p1\")
  503. fi
  504.  
  505.  
  506. dnl
  507. dnl    ****  utmp handling  ****
  508. dnl
  509. dnl linux has a void pututline, grrr, gcc will error when evaluating it.
  510. AC_COMPILE_CHECK(getutent, [#include <time.h> /* to get time_t on SCO */
  511. #include <sys/types.h>
  512. #ifdef SVR4
  513. #include <utmpx.h>
  514. #else
  515. #include <utmp.h>
  516. #endif
  517. #ifdef hpux
  518. #define pututline _pututline
  519. #endif
  520. ],
  521. [int x = DEAD_PROCESS; struct utmp *y = pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT))
  522. AC_COMPILE_CHECK(ut_host, [#include <time.h>
  523. #include <sys/types.h>
  524. #ifdef SVR4
  525. #include <utmpx.h>
  526. #else
  527. #include <utmp.h>
  528. #endif
  529. ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST))
  530.  
  531.  
  532. dnl
  533. dnl    ****  loadav  ****
  534. dnl
  535. echo "checking for libutil(s)"
  536. test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
  537. test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
  538.  
  539. AC_COMPILE_CHECK(getloadavg, , [getloadavg((double *)0, 0);],
  540. AC_DEFINE(LOADAV_GETLOADAVG) load=1)
  541. if test -z "$load" ; then
  542. AC_PROGRAM_EGREP(yes,
  543. [#if defined(NeXT) || defined(apollo) || defined(linux)
  544.   yes
  545. #endif
  546. ], load=1)
  547. fi
  548. if test -z "$load" ; then
  549. echo "searching for kernelfile"
  550. for core in /unix /vmunix /dynix /hp-ux /xelos /386bsd /kernel/unix ; do
  551.   if test -f $core ; then
  552.     break
  553.   fi
  554. done
  555. if test ! -f $core ; then
  556.   echo "- no kernelfile found"
  557. else
  558.   echo "- using kernelfile '$core'"
  559.   AC_DEFINE_UNQUOTED(LOADAV_UNIX,\"$core\")
  560.   AC_HEADER_CHECK(nlist.h,
  561.     [AC_DEFINE(NLIST_STRUCT)
  562.      AC_COMPILE_CHECK(n_un in struct nlist, [#include <nlist.h>],
  563.        [struct nlist n; n.n_un.n_name = 0;],
  564.         AC_DEFINE(NLIST_NAME_UNION))])
  565.  
  566.   echo checking for nlist declaration
  567.   AC_PROGRAM_EGREP([nlist( |    |\()],[
  568. #ifdef NLIST_STRUCT
  569. # include <nlist.h>
  570. #else
  571. # include <a.out.h>
  572. #endif
  573. ],AC_DEFINE(NLIST_DECLARED))
  574.  
  575.   echo searching for avenrun symbol
  576.   for av in avenrun _avenrun _Loadavg ; do
  577.   AC_TEST_PROGRAM([
  578. #include <sys/types.h>
  579. #ifdef NLIST_STRUCT
  580. #include <nlist.h>
  581. #else
  582. #include <a.out.h>
  583. #endif
  584.  
  585. struct nlist nl[2];
  586.  
  587. main()
  588. {
  589. #ifdef NLIST_NAME_UNION
  590.   nl[0].n_un.n_name = "$av";
  591. #else
  592.   nl[0].n_name = "$av";
  593. #endif
  594.   nlist(LOADAV_UNIX, nl);
  595.   if (nl[0].n_value == 0)
  596.     exit(1);
  597.   exit(0);
  598. }
  599.   ],avensym=$av;break)
  600.   done
  601.   if test -z "$avensym" ; then
  602.     echo "- no avenrun symbol found"
  603.   else
  604.     echo "- using avenrun symbol '$avensym'"
  605.     AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,\"$avensym\")
  606.     load=1
  607.   fi
  608. fi
  609. fi
  610.  
  611. AC_PROGRAM_SOURCE([
  612. #include <sys/types.h>
  613. #include <sys/param.h>
  614. ],[
  615. #if ((defined(hp300) && !defined(hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || defined(__alpha))
  616. loadtype=long
  617. # ifdef apollo
  618. loadscale=65536
  619. # else
  620. #  ifdef FSCALE
  621. #   undef FSCALE
  622. loadscale=FSCALE
  623. #  else
  624. #   ifdef sgi
  625. loadscale=1024
  626. #   else
  627. #    if defined(MIPS) || defined(SVR4)
  628. loadscale=256
  629. #    else /* not MIPS */
  630. loadscale=1000     /* our default value */
  631. #    endif /* MIPS */
  632. #   endif /* sgi */
  633. #  endif /* not FSCALE */
  634. # endif /* not apollo */
  635. #else
  636. loadtype=double
  637. loadscale=1
  638. #endif
  639. #ifdef alliant
  640. loadnum=4
  641. #else
  642. loadnum=3
  643. #endif
  644. ])
  645.  
  646. if test -n "$load" ; then AC_DEFINE(LOADAV) fi
  647. if test -n "$loadtype" ; then AC_DEFINE_UNQUOTED(LOADAV_TYPE,$loadtype) fi
  648. if test -n "$loadnum" ; then AC_DEFINE_UNQUOTED(LOADAV_NUM,$loadnum) fi
  649. if test -n "$loadscale" ; then AC_DEFINE_UNQUOTED(LOADAV_SCALE,$loadscale) fi
  650.  
  651.  
  652. dnl
  653. dnl    ****  signal handling  ****
  654. dnl
  655. AC_HEADER_EGREP([(void|sighandler_t).*signal], signal.h, 
  656.   AC_DEFINE(SIGVOID))
  657. AC_COMPILE_CHECK(sigset, [
  658. #include <sys/types.h>
  659. #include <signal.h>
  660. ], [
  661. #ifdef SIGVOID
  662. sigset(0, (void (*)())0);
  663. #else
  664. sigset(0, (int (*)())0);
  665. #endif
  666. ], AC_DEFINE(USESIGSET))
  667. echo checking signal implementation
  668. AC_TEST_PROGRAM([
  669. #include <sys/types.h>
  670. #include <signal.h>
  671.  
  672. #ifndef SIGCHLD
  673. #define SIGCHLD SIGCLD
  674. #endif
  675. #ifdef USESIGSET
  676. #define signal sigset
  677. #endif
  678.  
  679. int got;
  680.  
  681. #ifdef SIGVOID
  682. void
  683. #endif
  684. hand()
  685. {
  686.   got++;
  687. }
  688.  
  689. main()
  690. {
  691.   (void)signal(SIGCHLD, hand);
  692.   kill(getpid(), SIGCHLD);
  693.   kill(getpid(), SIGCHLD);
  694.   if (got < 2)
  695.     exit(1);
  696.   exit(0);
  697. }
  698. ],,AC_DEFINE(SYSVSIGS))
  699.  
  700. dnl
  701. dnl    ****  libraries  ****
  702. dnl
  703.  
  704. echo checking for crypt and sec libraries
  705. test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
  706. test -f /lib/libcrypt.a || test -f /usr/lib/libcrypt.a && LIBS="$LIBS -lcrypt"
  707. test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
  708.  
  709. oldlibs="$LIBS"
  710. LIBS="$LIBS -lsun"
  711. AC_COMPILE_CHECK(IRIX sun library,,,,LIBS="$oldlibs")
  712.  
  713.  
  714. dnl
  715. dnl    ****  misc things  ****
  716. dnl
  717. AC_COMPILE_CHECK(wait union,[#include <sys/types.h>
  718. #include <sys/wait.h>
  719. ],[
  720.   union wait x;
  721.   int y;
  722. #ifdef WEXITSTATUS
  723.   y = WEXITSTATUS(x);
  724. #endif
  725. ],AC_DEFINE(BSDWAIT))
  726.  
  727. if test -z "$butterfly"; then
  728. echo checking for termio or termios
  729. AC_TEST_CPP([#include <termios.h>], AC_DEFINE(TERMIO),
  730.             AC_TEST_CPP([#include <termio.h>], AC_DEFINE(TERMIO)))
  731. fi
  732.  
  733. dnl AC_HEADER_CHECK(shadow.h, AC_DEFINE(SHADOWPW))
  734. AC_COMPILE_CHECK(getspnam, [#include <shadow.h>], [getspnam("x");],
  735.          AC_DEFINE(SHADOWPW))
  736.  
  737. AC_COMPILE_CHECK(getttyent, , [getttyent();], AC_DEFINE(GETTTYENT))
  738.  
  739. echo checking whether memcpy/memmove/bcopy handles overlapping arguments
  740. AC_TEST_PROGRAM([
  741. main() {
  742.   char buf[10];
  743.   strcpy(buf, "abcdefghi");
  744.   bcopy(buf, buf + 2, 3);
  745.   if (strncmp(buf, "ababcf", 6))
  746.     exit(1);
  747.   strcpy(buf, "abcdefghi");
  748.   bcopy(buf + 2, buf, 3);
  749.   if (strncmp(buf, "cdedef", 6))
  750.     exit(1);
  751.   exit(0); /* libc version works properly.  */
  752. }], AC_DEFINE(USEBCOPY))
  753.  
  754. AC_TEST_PROGRAM([
  755. #define bcopy(s,d,l) memmove(d,s,l)
  756. main() {
  757.   char buf[10];
  758.   strcpy(buf, "abcdefghi");
  759.   bcopy(buf, buf + 2, 3);
  760.   if (strncmp(buf, "ababcf", 6))
  761.     exit(1);
  762.   strcpy(buf, "abcdefghi");
  763.   bcopy(buf + 2, buf, 3);
  764.   if (strncmp(buf, "cdedef", 6))
  765.     exit(1);
  766.   exit(0); /* libc version works properly.  */
  767. }], AC_DEFINE(USEMEMMOVE))
  768.  
  769.  
  770. AC_TEST_PROGRAM([
  771. #define bcopy(s,d,l) memcpy(d,s,l)
  772. main() {
  773.   char buf[10];
  774.   strcpy(buf, "abcdefghi");
  775.   bcopy(buf, buf + 2, 3);
  776.   if (strncmp(buf, "ababcf", 6))
  777.     exit(1);
  778.   strcpy(buf, "abcdefghi");
  779.   bcopy(buf + 2, buf, 3);
  780.   if (strncmp(buf, "cdedef", 6))
  781.     exit(1);
  782.   exit(0); /* libc version works properly.  */
  783. }], AC_DEFINE(USEMEMCPY))
  784.  
  785. echo checking for long file names
  786. (echo 1 > /tmp/conftest9012345) 2>/dev/null
  787. (echo 2 > /tmp/conftest9012346) 2>/dev/null
  788. val=`cat /tmp/conftest9012345 2>/dev/null`
  789. if test -f /tmp/conftest9012345 && test "$val" = 1; then :
  790. else AC_DEFINE(NAME_MAX, 14)
  791. fi
  792. rm -f /tmp/conftest*
  793.  
  794. AC_COMPILE_CHECK(vsprintf, [#include <varargs.h>
  795. #include <stdio.h>], [vsprintf();], AC_DEFINE(USEVARARGS))
  796.  
  797. AC_DIR_HEADER
  798. AC_XENIX_DIR
  799.  
  800. AC_COMPILE_CHECK(setenv, , [setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_DEFINE(USESETENV),
  801. AC_COMPILE_CHECK(putenv, , [putenv((char *)0);unsetenv((char *)0);], ,
  802. AC_DEFINE(NEEDPUTENV)
  803. ))
  804.  
  805. dnl
  806. dnl    ****  the end  ****
  807. dnl
  808. dnl Ptx bug workaround -- insert -lc after -ltermcap
  809. test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lsec -lseq"
  810.  
  811. AC_TEST_PROGRAM(main(){exit(0);},,echo "Can't run the compiler - internal error. Sorry.";exit)
  812. if test -n "$prefix"; then
  813. AC_DEFINE_UNQUOTED(ETCSCREENRC,\"$prefix/etc/screenrc\")
  814. fi
  815.  
  816. AC_OUTPUT(Makefile doc/Makefile)
  817.  
  818. # a hook for preserving undef directive in config.h
  819. if test -z "$no_create" ; then
  820. mv config.h conftest
  821. sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2    /\*\3@' < conftest > config.h
  822. rm -f conftest
  823. fi
  824. cat >> config.status << EOF
  825. mv config.h conftest
  826. sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2    /\*\3@' < conftest > config.h
  827. rm -f conftest
  828. EOF
  829.  
  830. echo ""
  831. if test -z "$AWK"; then
  832. echo "!!! Since you have no awk you must copy the files 'comm.h.dist'"
  833. echo "!!! and 'term.h.dist' to 'comm.h' and 'term.h'."
  834. echo "!!! Do _not_ change the user configuration section in config.h!"
  835. echo "Please check the pathnames in the Makefile."
  836. else
  837. echo "Now please check the pathnames in the Makefile and the user"
  838. echo "configuration section in config.h."
  839. fi
  840. echo "Then type 'make' to make screen. Good luck."
  841. echo ""
  842.