1 dnl Process this file with autoconf to produce a configure script.
5 dnl Many thanks to David MacKenzie for writing autoconf and
6 dnl providing a sample configure.in file for screen.
8 AC_REVISION($Revision$)dnl
10 AC_CONFIG_HEADER(config.h)
13 dnl Define some useful macros
15 AC_DEFUN([AC_PROGRAM_SOURCE],
16 [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF
22 eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out"
28 [echo "$1" 1>&AC_FD_MSG
32 dnl Extract version from patchlevel.h
34 rev=`sed < ${srcdir}/patchlevel.h -n -e '/#define REV/s/#define REV *//p'`
35 vers=`sed < ${srcdir}/patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`
36 pat=`sed < ${srcdir}/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`
37 VERSION="$rev.$vers.$pat"
38 AC_NOTE(this is screen version $VERSION)
40 AC_PREFIX_PROGRAM(screen)
41 AC_PREFIX_PROGRAM(gzip)
46 AC_PROG_GCC_TRADITIONAL
48 AC_USE_SYSTEM_EXTENSIONS
50 AC_TRY_RUN(main(){exit(0);},,[
51 if test $CC != cc ; then
52 AC_NOTE(Your $CC failed - restarting with CC=cc)
56 exec $0 $configure_args
60 AC_TRY_RUN(main(){exit(0);},,
63 AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
65 AC_MSG_ERROR(Can't run the compiler - sorry))
70 int __something_strange_();
71 __something_strange_(0);
73 ],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
79 if test -f etc/toolcheck; then
80 AC_CHECKING(for buggy tools)
81 sh etc/toolcheck 1>&AC_FD_MSG
87 AC_MSG_CHECKING(if a system-wide socket dir should be used)
88 AC_ARG_ENABLE(socket-dir,
89 [ --disable-socket-dir disable system wide socket-dir and use ~/.screen instead],
91 AC_MSG_RESULT(no. ~/.screen will be used instead.)
95 AC_MSG_CHECKING(for the socket dir)
96 SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")"
97 AC_ARG_WITH(socket-dir, [ --with-socket-dir=path where to put the per-user sockets], [
99 *\"*) SOCKDIR="${withval}" ;;
100 *) SOCKDIR="\"${withval}\"" ;;
103 AC_MSG_RESULT(${SOCKDIR})
104 AC_DEFINE_UNQUOTED(SOCKDIR, $SOCKDIR)
110 dnl **** special unix variants ****
112 if test -n "$ISC"; then
113 AC_DEFINE(ISC) LIBS="$LIBS -linet"
116 dnl AC_CHECKING(for OSF1)
117 dnl if test -f /bin/uname ; then
118 dnl if test `/bin/uname` = OSF1 || test -f /osf_boot; then
119 dnl AC_DEFINE(OSF1) # this disables MIPS again....
123 if test -f /sysV68 ; then
127 AC_CHECKING(for MIPS)
128 if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
130 test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
131 dnl djm@eng.umd.edu: "... for one thing, it doubles the size of the executable"
132 AC_CHECKING(mld library)
133 AC_TRY_LINK(,,,LIBS="$oldlibs")
136 if test -r /dev/ptc; then
139 AC_TRY_LINK(,[wait3();], ,
141 AC_TRY_LINK(,[wait2();],
142 dnl John Rouillard (rouilj@sni-usa.com):
143 dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
145 dnl Detect RISCOS if wait2 is present, but not wait3.
146 AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
152 AC_CHECKING(for Ultrix)
154 [#if defined(ultrix) || defined(__ultrix)
159 if test -f /usr/lib/libpyr.a ; then
162 AC_CHECKING(Pyramid OSX)
163 AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
166 dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
167 dnl BBN butterfly is not POSIX, but a MACH BSD system.
168 dnl Do not define POSIX and TERMIO.
169 AC_CHECKING(for butterfly)
171 [#if defined(butterfly)
176 if test -z "$butterfly"; then
177 if test -n "$ULTRIX"; then
178 test -z "$GCC" && CC="$CC -YBSD"
180 AC_CHECKING(for POSIX.1)
182 [#include <sys/types.h>
185 #ifdef _POSIX_VERSION
188 ], AC_NOTE(- you have a POSIX system) AC_DEFINE(POSIX) posix=1)
191 AC_CHECKING(for System V)
193 [#include <sys/types.h>
195 #include <fcntl.h>], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV))
197 AC_CHECKING(for sequent/ptx)
202 ], LIBS="$LIBS -lsocket -linet";seqptx=1)
207 AC_TRY_LINK([#include <utmpx.h>
209 [AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
210 [AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])]
212 AC_CHECK_HEADERS([stropts.h string.h strings.h])
214 AC_CHECKING(for Solaris 2.x)
216 [#if defined(SVR4) && defined(sun)
219 ], LIBS="$LIBS -lsocket -lnsl -lkstat")
222 dnl **** typedefs ****
224 dnl (currently not used)
226 dnl AC_CHECKING(for pid_t)
227 dnl AC_EGREP_CPP(pid_t,[#include <sys/types.h>
228 dnl ],AC_DEFINE(PID_T_DEFINED))
230 dnl AC_CHECKING(for sig_t)
231 dnl AC_EGREP_CPP(sig_t,[#include <sys/types.h>
232 dnl #include <signal.h>
233 dnl ],AC_DEFINE(SIG_T_DEFINED))
235 dnl AC_CHECKING(for uid_t)
236 dnl AC_EGREP_CPP(uid_t,[#include <sys/types.h>
237 dnl ],AC_DEFINE(UID_T_DEFINED))
241 dnl **** Job control ****
244 AC_CHECKING(BSD job jontrol)
246 [#include <sys/types.h>
247 #include <sys/ioctl.h>
259 ], AC_NOTE(- you have jobcontrol) AC_DEFINE(BSDJOBS), AC_NOTE(- you don't have jobcontrol))
262 dnl **** setresuid(), setreuid(), seteuid() ****
264 AC_CHECKING(setresuid)
267 ], AC_DEFINE(HAVE_SETRESUID))
268 AC_CHECKING(setreuid)
271 ], AC_DEFINE(HAVE_SETREUID))
274 dnl linux seteuid was broken before V1.1.11
275 dnl NeXT, AUX, ISC, and ultrix are still broken (no saved uid support)
276 dnl Solaris seteuid doesn't change the saved uid, bad for
277 dnl multiuser screen sessions
280 #if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
281 seteuid_is_broken(0);
285 ], AC_DEFINE(HAVE_SETEUID))
291 ], AC_DEFINE(HAVE_EXECVPE))
294 dnl **** select() ****
298 AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],,
299 LIBS="$LIBS -lnet -lnsl"
300 AC_CHECKING(select with $LIBS)
301 AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],,
302 AC_MSG_ERROR(!!! no select - no screen))
305 dnl **** FIFO tests ****
310 /* For select - According to POSIX 1003.1-2001 */
311 #include <sys/select.h>
313 /* For select - According to earlier standards */
314 #include <sys/time.h>
315 #include <sys/types.h>
318 #include <sys/stat.h>
322 #define O_NONBLOCK O_NDELAY
325 #define S_IFIFO 0010000
328 char *fin = "/tmp/conftest$$";
338 if (mkfifo(fin, 0777))
340 if (mknod(fin, S_IFIFO|0777, 0))
343 if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
348 * The next test fails under 386BSD, but screen works using fifos.
349 * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
350 * the select() configuration test.
354 if (open(fin, O_RDONLY | O_NONBLOCK))
359 if (open(fin, O_WRONLY | O_NONBLOCK))
362 if (open(fin, O_WRONLY | O_NONBLOCK))
364 if (write(0, "TEST", 4) == -1)
369 if (select(1, &f, 0, 0, 0) == -1)
373 ], AC_NOTE(- your fifos are usable) fifo=1,
374 AC_NOTE(- your fifos are not usable))
377 if test -n "$fifo"; then
378 AC_CHECKING(for broken fifo implementation)
380 /* For select - According to POSIX 1003.1-2001 */
381 #include <sys/select.h>
383 /* For select - According to earlier standards */
384 #include <sys/time.h>
385 #include <sys/types.h>
388 #include <sys/stat.h>
392 #define O_NONBLOCK O_NDELAY
395 #define S_IFIFO 0010000
398 char *fin = "/tmp/conftest$$";
406 if (mkfifo(fin, 0600))
408 if (mknod(fin, S_IFIFO|0600, 0))
412 if (open(fin, O_RDONLY|O_NONBLOCK))
417 if (select(1, &f, 0, 0, &tv))
421 ], AC_NOTE(- your implementation is ok),
422 AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
427 dnl **** SOCKET tests ****
429 dnl may need LIBS="$LIBS -lsocket" here
434 /* For select - According to POSIX 1003.1-2001 */
435 #include <sys/select.h>
437 /* For select - According to earlier standards */
438 #include <sys/time.h>
439 #include <sys/types.h>
442 #include <sys/stat.h>
444 #include <sys/socket.h>
447 char *son = "/tmp/conftest$$";
452 struct sockaddr_un a;
456 if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
458 a.sun_family = AF_UNIX;
459 strcpy(a.sun_path, son);
461 if (bind(s1, (struct sockaddr *) &a, strlen(son)+2) == -1)
467 if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
469 (void)connect(s2, (struct sockaddr *)&a, strlen(son) + 2);
470 if (write(s2, "HELLO", 5) == -1)
476 if (accept(s1, &a, &l))
479 if (select(1, &f, 0, 0, 0) == -1)
483 ], AC_NOTE(- your sockets are usable) sock=1,
484 AC_NOTE(- your sockets are not usable))
487 if test -n "$sock"; then
488 AC_CHECKING(socket implementation)
490 /* For select - According to POSIX 1003.1-2001 */
491 #include <sys/select.h>
493 /* For select - According to earlier standards */
494 #include <sys/time.h>
495 #include <sys/types.h>
498 #include <sys/stat.h>
499 #include <sys/socket.h>
502 char *son = "/tmp/conftest$$";
508 struct sockaddr_un a;
509 if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
511 a.sun_family = AF_UNIX;
512 strcpy(a.sun_path, son);
514 if (bind(s, (struct sockaddr *) &a, strlen(son)+2) == -1)
521 ],AC_NOTE(- you are normal),
522 AC_NOTE(- unix domain sockets are not kept in the filesystem)
523 AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
529 dnl **** choose sockets or fifos ****
531 if test -n "$fifo"; then
532 if test -n "$sock"; then
533 if test -n "$nore"; then
534 AC_NOTE(- hmmm... better take the fifos)
536 elif test -n "$fifobr"; then
537 AC_NOTE(- as your fifos are broken lets use the sockets.)
539 AC_NOTE(- both sockets and fifos usable. let's take sockets.)
542 AC_NOTE(- using named pipes, of course)
545 elif test -n "$sock"; then
546 AC_NOTE(- using unix-domain sockets, of course)
548 AC_MSG_ERROR(you have neither usable sockets nor usable pipes -> no screen)
552 dnl **** check the select implementation ****
555 AC_CHECKING(select return value)
557 /* For select - According to POSIX 1003.1-2001 */
558 #include <sys/select.h>
560 /* For select - According to earlier standards */
561 #include <sys/time.h>
562 #include <sys/types.h>
565 #include <sys/stat.h>
568 char *nam = "/tmp/conftest$$";
573 #define O_NONBLOCK O_NDELAY
576 #define S_IFIFO 0010000
585 /* From Andrew A. Chernov (ache@astral.msk.su):
586 * opening RDWR fifo fails in BSD 4.4, but select return values are
593 if (mkfifo(nam, 0777))
595 if (mknod(nam, S_IFIFO|0777, 0))
599 if (open(nam, O_RDWR | O_NONBLOCK))
601 if (write(0, "TEST", 4) == -1)
606 #include <sys/types.h>
607 #include <sys/socket.h>
613 struct sockaddr_un a;
617 if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
619 a.sun_family = AF_UNIX;
620 strcpy(a.sun_path, nam);
622 if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1)
628 if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
630 (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2);
631 if (write(s2, "HELLO", 5) == -1)
637 if (accept(s1, (struct sockaddr *)&a, &l))
643 if (select(1, &f, 0, 0, 0) == -1)
645 if (select(1, &f, &f, 0, 0) != 2)
649 ],AC_NOTE(- select is ok),
650 AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
653 dnl **** termcap or terminfo ****
655 AC_CHECKING(for tgetent)
656 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
658 LIBS="-lcurses $olibs"
659 AC_CHECKING(libcurses)
662 __sorry_hpux_libcurses_is_totally_broken_in_10_10();
664 tgetent((char *)0, (char *)0);
667 LIBS="-ltermcap $olibs"
668 AC_CHECKING(libtermcap)
669 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
670 LIBS="-ltermlib $olibs"
671 AC_CHECKING(libtermlib)
672 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
673 LIBS="-lncursesw $olibs"
674 AC_CHECKING(libncursesw)
675 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
676 LIBS="-lncurses $olibs"
677 AC_CHECKING(libncurses)
678 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
679 AC_MSG_ERROR(!!! no tgetent - no screen)))))))
684 exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
685 }], AC_NOTE(- you use the termcap database),
686 AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
688 AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
691 dnl **** PTY specific things ****
693 AC_CHECKING(for /dev/ptc)
694 if test -r /dev/ptc; then
695 AC_DEFINE(HAVE_DEV_PTC)
698 AC_CHECKING(for SVR4 ptys)
700 if test -c /dev/ptmx ; then
701 AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
705 AC_CHECK_FUNCS(getpt)
707 dnl check for openpty()
708 if test -z "$sysvr4ptys"; then
709 AC_CHECK_FUNCS(openpty,,
710 [AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])])
713 AC_CHECKING(for ptyranges)
714 if test -d /dev/ptym ; then
724 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
725 dnl if test -c /dev/ptyp19; then
726 dnl ptys=`echo /dev/ptyp??`
728 dnl ptys=`echo $pdir/pty??`
730 if test "$ptys" != "$pdir/pty??" ; then
731 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
732 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
733 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
734 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
737 dnl **** pty mode/group handling ****
739 dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
740 AC_ARG_WITH(pty-mode, [ --with-pty-mode=mode default mode for ptys], [ ptymode="${withval}" ])
741 AC_ARG_WITH(pty-group, [ --with-pty-group=group default group for ptys], [ ptygrp="${withval}" ])
742 test -n "$ptymode" || ptymode=0620
743 if test -n "$ptygrp" ; then
744 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
745 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
748 AC_CHECKING(default tty permissions/group)
751 #include <sys/types.h>
752 #include <sys/stat.h>
761 if (!(x = ttyname(0))) exit(1);
762 if (stat(x, &sb)) exit(1);
764 if (om & 002) exit(0);
765 m = system("mesg y");
766 if (m == -1 || m == 127) exit(1);
767 if (stat(x, &sb)) exit(1);
769 if (chmod(x, om)) exit(1);
770 if (m & 002) exit(0);
771 if (sb.st_gid == getgid()) exit(1);
772 if (!(fp=fopen("conftest_grp", "w")))
774 fprintf(fp, "%d\n", sb.st_gid);
779 if test -f conftest_grp; then
780 ptygrp=`cat conftest_grp`
781 AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
782 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
783 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
785 AC_NOTE(- ptys are world accessable)
790 AC_PATH_PROG(WRITEPATH, write)
791 AC_PATH_PROG(XTERMPATH, xterm)
793 if test -n "$WRITEPATH$XTERMPATH"; then
796 found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null`
797 if test -n "$found"; then
801 if test -n "$XTERMPATH"; then
802 ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'`
803 if test tty != "$ptygrpn"; then
808 if test -n "$WRITEPATH$XTERMPATH"; then
809 found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print`
810 if test -n "$found"; then
811 ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'`
812 AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
813 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
814 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
816 AC_NOTE(- ptys are world accessable)
819 AC_NOTE(- can't determine - assume ptys are world accessable)
827 dnl **** utmp handling ****
829 AC_CHECKING(getutent)
831 #include <time.h> /* to get time_t on SCO */
832 #include <sys/types.h>
833 #if defined(SVR4) && !defined(DGUX)
840 #define pututline _pututline
843 [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT),
846 AC_CHECKING(getutent with -lgen)
849 #include <sys/types.h>
850 #if defined(SVR4) && !defined(DGUX)
857 #define pututline _pututline
860 [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
865 #include <sys/types.h>
866 #if defined(SVR4) && !defined(DGUX)
872 ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST))
873 AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
874 if test "$have_utempter" = yes; then
875 AC_DEFINE(HAVE_UTEMPTER)
876 LIBS="$LIBS -lutempter"
882 AC_CHECKING(for libutil(s))
883 test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
884 test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
886 AC_CHECKING(getloadavg)
887 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
888 AC_DEFINE(LOADAV_GETLOADAVG) load=1,
889 if test -f /usr/lib/libkvm.a ; then
892 AC_CHECKING(getloadavg with -lkvm)
893 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
894 AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
898 if test -z "$load" ; then
900 [#if defined(NeXT) || defined(apollo) || defined(linux)
905 if test -z "$load" ; then
906 AC_CHECKING(for kernelfile)
907 for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do
908 if test -f $core || test -c $core; then
912 if test ! -f $core && test ! -c $core ; then
913 AC_NOTE(- no kernelfile found)
915 AC_NOTE(- using kernelfile '$core')
916 if test -r $core ; then
917 AC_DEFINE_UNQUOTED(LOADAV_UNIX,"$core")
918 AC_CHECK_HEADER(nlist.h,
919 [AC_DEFINE(NLIST_STRUCT)
920 AC_CHECKING(n_un in struct nlist)
921 AC_TRY_COMPILE([#include <nlist.h>],
922 [struct nlist n; n.n_un.n_name = 0;],
923 AC_DEFINE(NLIST_NAME_UNION))])
925 AC_CHECKING(for nlist declaration)
926 AC_EGREP_CPP([nlist(( | )( | )*.*\(|\()],[
932 ],AC_DEFINE(NLIST_DECLARED))
934 AC_CHECKING(for avenrun symbol)
936 for av in avenrun _avenrun _Loadavg avenrun _avenrun _Loadavg; do
938 #include <sys/types.h>
951 #if !defined(_AUX_SOURCE) && !defined(AUX)
952 # ifdef NLIST_NAME_UNION
953 nl[0].n_un.n_name = "$av";
955 nl[0].n_name = "$av";
958 strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name));
960 nlist(LOADAV_UNIX, nl);
961 if (nl[0].n_value == 0)
966 if test "$av" = _Loadavg; then
967 nlist64='#define nlist nlist64'
970 if test -z "$avensym" ; then
971 AC_NOTE(- no avenrun symbol found)
973 AC_NOTE(- using avenrun symbol '$avensym')
974 AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,"$avensym")
975 if test -n "$nlist64"; then
976 AC_NOTE(- used nlist64 to find it)
977 AC_DEFINE(LOADAV_USE_NLIST64)
982 AC_NOTE( Can't configure the load average display feature)
983 AC_NOTE( because $core is not readable by you.)
984 AC_NOTE( To configure the load average display feature,)
985 AC_NOTE( re-run configure as root if possible.)
986 AC_NOTE( If you are not the system administrator then disregard)
987 AC_NOTE( this warning. You can still use screen without)
988 AC_NOTE( the load average display feature.)
994 #include <sys/types.h>
995 #include <sys/param.h>
997 #if !defined(LOADAV_GETLOADAVG) && ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || (defined(SVR4) && !defined(__hpux)) || defined(sony_news) || (!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
999 # if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
1002 # if defined(FSCALE) && !defined(__osf__)
1010 # if defined(MIPS) || defined(SVR4) || defined(m88k)
1012 # else /* not MIPS */
1013 loadscale=1000 /* our default value */
1016 # endif /* not FSCALE */
1017 # endif /* not apollo */
1029 if test -n "$load" ; then AC_DEFINE(LOADAV) fi
1030 if test -n "$loadtype" ; then AC_DEFINE_UNQUOTED(LOADAV_TYPE,$loadtype) fi
1031 if test -n "$loadnum" ; then AC_DEFINE_UNQUOTED(LOADAV_NUM,$loadnum) fi
1032 if test -n "$loadscale" ; then AC_DEFINE_UNQUOTED(LOADAV_SCALE,$loadscale) fi
1035 dnl **** signal handling ****
1037 if test -n "$posix" ; then
1039 dnl POSIX has reliable signals with void return type.
1040 AC_NOTE(assuming posix signal definition)
1045 AC_CHECKING(return type of signal handlers)
1047 [#include <sys/types.h>
1052 extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
1055 #include <sys/types.h>
1059 sigset(0, (void (*)())0);
1061 sigset(0, (int (*)())0);
1063 ], AC_DEFINE(USESIGSET))
1064 AC_CHECKING(signal implementation)
1066 #include <sys/types.h>
1070 #define SIGCLD SIGCHLD
1073 #define signal sigset
1088 /* on hpux we use sigvec to get bsd signals */
1090 (void)signal(SIGCLD, hand);
1091 kill(getpid(), SIGCLD);
1092 kill(getpid(), SIGCLD);
1098 ],,AC_DEFINE(SYSVSIGS))
1103 dnl **** libraries ****
1106 AC_CHECKING(for crypt and sec libraries)
1107 test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
1109 LIBS="$LIBS -lcrypt"
1111 AC_TRY_LINK(,,,LIBS="$oldlibs")
1112 test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
1113 test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
1116 AC_CHECKING(IRIX sun library)
1117 AC_TRY_LINK(,,,LIBS="$oldlibs")
1120 AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS"
1122 AC_CHECKING(syslog in libbsd.a)
1123 AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="$oldlibs"
1124 AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])])
1130 ], LIBS="$LIBS -lsocket -lcrypt_i")
1133 dnl **** misc things ****
1135 AC_CHECKING(wait union)
1136 AC_TRY_COMPILE([#include <sys/types.h>
1137 #include <sys/wait.h>
1144 ],AC_DEFINE(BSDWAIT))
1146 if test -z "$butterfly"; then
1147 AC_CHECKING(for termio or termios)
1148 AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
1149 if test -n "$posix"; then
1150 AC_TRY_CPP([#include <termios.h>], AC_DEFINE(TERMIO))
1155 dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
1156 AC_CHECKING(getspnam)
1157 AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
1159 AC_CHECKING(getttyent)
1160 AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
1163 AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
1165 AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
1169 strcpy(buf, "abcdefghi");
1170 bcopy(buf, buf + 2, 3);
1171 if (strncmp(buf, "ababcf", 6))
1173 strcpy(buf, "abcdefghi");
1174 bcopy(buf + 2, buf, 3);
1175 if (strncmp(buf, "cdedef", 6))
1177 exit(0); /* libc version works properly. */
1178 }], AC_DEFINE(USEBCOPY))
1181 #define bcopy(s,d,l) memmove(d,s,l)
1184 strcpy(buf, "abcdefghi");
1185 bcopy(buf, buf + 2, 3);
1186 if (strncmp(buf, "ababcf", 6))
1188 strcpy(buf, "abcdefghi");
1189 bcopy(buf + 2, buf, 3);
1190 if (strncmp(buf, "cdedef", 6))
1192 exit(0); /* libc version works properly. */
1193 }], AC_DEFINE(USEMEMMOVE))
1197 #define bcopy(s,d,l) memcpy(d,s,l)
1200 strcpy(buf, "abcdefghi");
1201 bcopy(buf, buf + 2, 3);
1202 if (strncmp(buf, "ababcf", 6))
1204 strcpy(buf, "abcdefghi");
1205 bcopy(buf + 2, buf, 3);
1206 if (strncmp(buf, "cdedef", 6))
1208 exit(0); /* libc version works properly. */
1209 }], AC_DEFINE(USEMEMCPY))
1211 AC_SYS_LONG_FILE_NAMES
1213 AC_MSG_CHECKING(for vsprintf)
1214 AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
1218 AC_MSG_CHECKING(for setenv)
1219 if test -z "$ac_setenv_args"; then
1221 [#include <stdlib.h>],
1223 setenv((char *) 0, (char *) 0, 0);
1224 ], ac_setenv_args=3)
1226 if test -z "$ac_setenv_args"; then
1228 [#include <stdlib.h>],
1230 setenv((char *) 0, (char *) 0);
1231 ], ac_setenv_args=2)
1233 if test -n "$ac_setenv_args"; then
1234 AC_DEFINE(USESETENV)
1235 if test "$ac_setenv_args" = 3; then
1236 AC_DEFINE(HAVE_SETENV_3)
1237 elif test "$ac_setenv_args" = 2; then
1238 AC_DEFINE(HAVE_SETENV_2)
1242 AC_MSG_CHECKING(for putenv)
1243 AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV))
1245 AC_MSG_CHECKING([for nl_langinfo(CODESET)])
1247 #include <langinfo.h>
1248 ],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no))
1250 AC_SEARCH_LIBS(gethostname, nsl)
1252 AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime)
1254 AC_ARG_ENABLE(pam, [ --enable-pam enable PAM support])
1255 if test "$enable_pam" = "yes"; then
1256 AC_MSG_CHECKING(for PAM support)
1259 AC_TRY_LINK([#include <security/pam_appl.h>], [
1260 pam_start(0, 0, 0, 0);
1261 pam_authenticate(0, 0);
1263 ], AC_MSG_RESULT(yes);AC_DEFINE(USE_PAM),
1264 AC_MSG_RESULT(no);LIBS="$oldlibs")
1267 AC_ARG_ENABLE(use_locale, [ --enable-locale use localized month/day names])
1268 if test "$enable_use_locale" = "yes"; then
1269 AC_DEFINE(USE_LOCALE)
1271 AC_ARG_ENABLE(telnet, [ --enable-telnet enable builtin telnet])
1272 if test "$enable_telnet" = "yes"; then
1273 AC_DEFINE(BUILTIN_TELNET)
1275 AC_ARG_ENABLE(colors256, [ --enable-colors256 enable support for 256 colors])
1276 if test "$enable_colors256" = "yes"; then
1277 AC_DEFINE(COLORS256)
1279 AC_ARG_ENABLE(rxvt_osc, [ --enable-rxvt_osc enable support for rxvt OSC codes])
1280 if test "$enable_rxvt_osc" = "yes"; then
1285 dnl **** the end ****
1287 if test -z "$old_CFLAGS"; then
1288 if test "x$CFLAGS" = "x-g"; then
1292 dnl Ptx bug workaround -- insert -lc after -ltermcap
1293 test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
1295 AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
1298 AC_MSG_CHECKING(for the global screenrc file)
1299 AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path to the global screenrc file], [ ETCSCREENRC="${withval}" ])
1300 AC_SUBST(ETCSCREENRC)
1302 AC_OUTPUT(Makefile doc/Makefile, [[
1303 # a hook for preserving undef directive in config.h
1304 mv config.h conftest
1305 sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h
1310 if test -z "$AWK"; then
1311 echo "!!! Since you have no awk you must copy the files 'comm.h.dist'"
1312 echo "!!! and 'term.h.dist' to 'comm.h' and 'term.h'."
1313 echo "!!! Do _not_ change the user configuration section in config.h!"
1314 echo "Please check the pathnames in the Makefile."
1316 echo "Now please check the pathnames in the Makefile and in the user"
1317 echo "configuration section in config.h."
1319 echo "Then type 'make' to make screen. Good luck."