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
49 AC_TRY_RUN(main(){exit(0);},,[
50 if test $CC != cc ; then
51 AC_NOTE(Your $CC failed - restarting with CC=cc)
55 exec $0 $configure_args
59 AC_TRY_RUN(main(){exit(0);},,
62 AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
64 AC_MSG_ERROR(Can't run the compiler - sorry))
69 int __something_strange_();
70 __something_strange_(0);
72 ],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
78 if test -f etc/toolcheck; then
79 AC_CHECKING(for buggy tools)
80 sh etc/toolcheck 1>&AC_FD_MSG
86 AC_MSG_CHECKING(if a system-wide socket dir should be used)
87 AC_ARG_ENABLE(socket-dir,
88 [ --disable-socket-dir disable system wide socket-dir and use ~/.screen instead],
90 AC_MSG_RESULT(no. ~/.screen will be used instead.)
94 AC_MSG_CHECKING(for the socket dir)
95 SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")"
96 AC_ARG_WITH(socket-dir, [ --with-socket-dir=path where to put the per-user sockets], [
98 *\"*) SOCKDIR="${withval}" ;;
99 *) SOCKDIR="\"${withval}\"" ;;
102 AC_MSG_RESULT(${SOCKDIR})
103 AC_DEFINE_UNQUOTED(SOCKDIR, $SOCKDIR)
109 dnl **** special unix variants ****
111 if test -n "$ISC"; then
112 AC_DEFINE(ISC) LIBS="$LIBS -linet"
115 dnl AC_CHECKING(for OSF1)
116 dnl if test -f /bin/uname ; then
117 dnl if test `/bin/uname` = OSF1 || test -f /osf_boot; then
118 dnl AC_DEFINE(OSF1) # this disables MIPS again....
122 if test -f /sysV68 ; then
126 AC_CHECKING(for MIPS)
127 if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
129 test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
130 dnl djm@eng.umd.edu: "... for one thing, it doubles the size of the executable"
131 AC_CHECKING(mld library)
132 AC_TRY_LINK(,,,LIBS="$oldlibs")
135 if test -r /dev/ptc; then
138 AC_TRY_LINK(,[wait3();], ,
140 AC_TRY_LINK(,[wait2();],
141 dnl John Rouillard (rouilj@sni-usa.com):
142 dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
144 dnl Detect RISCOS if wait2 is present, but not wait3.
145 AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
151 AC_CHECKING(for Ultrix)
153 [#if defined(ultrix) || defined(__ultrix)
158 if test -f /usr/lib/libpyr.a ; then
161 AC_CHECKING(Pyramid OSX)
162 AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
165 dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
166 dnl BBN butterfly is not POSIX, but a MACH BSD system.
167 dnl Do not define POSIX and TERMIO.
168 AC_CHECKING(for butterfly)
170 [#if defined(butterfly)
175 if test -z "$butterfly"; then
176 if test -n "$ULTRIX"; then
177 test -z "$GCC" && CC="$CC -YBSD"
179 AC_CHECKING(for POSIX.1)
181 [#include <sys/types.h>
184 #ifdef _POSIX_VERSION
187 ], AC_NOTE(- you have a POSIX system) AC_DEFINE(POSIX) posix=1)
190 AC_CHECKING(for System V)
192 [#include <sys/types.h>
194 #include <fcntl.h>], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV))
196 AC_CHECKING(for sequent/ptx)
201 ], LIBS="$LIBS -lsocket -linet";seqptx=1)
206 AC_TRY_LINK([#include <utmpx.h>
208 [AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
209 [AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])]
211 AC_CHECK_HEADERS([stropts.h string.h strings.h])
213 AC_CHECKING(for Solaris 2.x)
215 [#if defined(SVR4) && defined(sun)
218 ], LIBS="$LIBS -lsocket -lnsl -lkstat")
221 dnl **** typedefs ****
223 dnl (currently not used)
225 dnl AC_CHECKING(for pid_t)
226 dnl AC_EGREP_CPP(pid_t,[#include <sys/types.h>
227 dnl ],AC_DEFINE(PID_T_DEFINED))
229 dnl AC_CHECKING(for sig_t)
230 dnl AC_EGREP_CPP(sig_t,[#include <sys/types.h>
231 dnl #include <signal.h>
232 dnl ],AC_DEFINE(SIG_T_DEFINED))
234 dnl AC_CHECKING(for uid_t)
235 dnl AC_EGREP_CPP(uid_t,[#include <sys/types.h>
236 dnl ],AC_DEFINE(UID_T_DEFINED))
240 dnl **** Job control ****
243 AC_CHECKING(BSD job jontrol)
245 [#include <sys/types.h>
246 #include <sys/ioctl.h>
258 ], AC_NOTE(- you have jobcontrol) AC_DEFINE(BSDJOBS), AC_NOTE(- you don't have jobcontrol))
261 dnl **** setresuid(), setreuid(), seteuid() ****
263 AC_CHECKING(setresuid)
266 ], AC_DEFINE(HAVE_SETRESUID))
267 AC_CHECKING(setreuid)
270 ], AC_DEFINE(HAVE_SETREUID))
273 dnl linux seteuid was broken before V1.1.11
274 dnl NeXT, AUX, ISC, and ultrix are still broken (no saved uid support)
275 dnl Solaris seteuid doesn't change the saved uid, bad for
276 dnl multiuser screen sessions
279 #if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
280 seteuid_is_broken(0);
284 ], AC_DEFINE(HAVE_SETEUID))
287 dnl **** select() ****
291 AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],,
292 LIBS="$LIBS -lnet -lnsl"
293 AC_CHECKING(select with $LIBS)
294 AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],,
295 AC_MSG_ERROR(!!! no select - no screen))
298 dnl **** FIFO tests ****
303 /* For select - According to POSIX 1003.1-2001 */
304 #include <sys/select.h>
306 /* For select - According to earlier standards */
307 #include <sys/time.h>
308 #include <sys/types.h>
311 #include <sys/stat.h>
315 #define O_NONBLOCK O_NDELAY
318 #define S_IFIFO 0010000
321 char *fin = "/tmp/conftest$$";
331 if (mkfifo(fin, 0777))
333 if (mknod(fin, S_IFIFO|0777, 0))
336 if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
341 * The next test fails under 386BSD, but screen works using fifos.
342 * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
343 * the select() configuration test.
347 if (open(fin, O_RDONLY | O_NONBLOCK))
352 if (open(fin, O_WRONLY | O_NONBLOCK))
355 if (open(fin, O_WRONLY | O_NONBLOCK))
357 if (write(0, "TEST", 4) == -1)
362 if (select(1, &f, 0, 0, 0) == -1)
366 ], AC_NOTE(- your fifos are usable) fifo=1,
367 AC_NOTE(- your fifos are not usable))
370 if test -n "$fifo"; then
371 AC_CHECKING(for broken fifo implementation)
373 /* For select - According to POSIX 1003.1-2001 */
374 #include <sys/select.h>
376 /* For select - According to earlier standards */
377 #include <sys/time.h>
378 #include <sys/types.h>
381 #include <sys/stat.h>
385 #define O_NONBLOCK O_NDELAY
388 #define S_IFIFO 0010000
391 char *fin = "/tmp/conftest$$";
399 if (mkfifo(fin, 0600))
401 if (mknod(fin, S_IFIFO|0600, 0))
405 if (open(fin, O_RDONLY|O_NONBLOCK))
410 if (select(1, &f, 0, 0, &tv))
414 ], AC_NOTE(- your implementation is ok),
415 AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
420 dnl **** SOCKET tests ****
422 dnl may need LIBS="$LIBS -lsocket" here
427 /* For select - According to POSIX 1003.1-2001 */
428 #include <sys/select.h>
430 /* For select - According to earlier standards */
431 #include <sys/time.h>
432 #include <sys/types.h>
435 #include <sys/stat.h>
437 #include <sys/socket.h>
440 char *son = "/tmp/conftest$$";
445 struct sockaddr_un a;
449 if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
451 a.sun_family = AF_UNIX;
452 strcpy(a.sun_path, son);
454 if (bind(s1, (struct sockaddr *) &a, strlen(son)+2) == -1)
460 if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
462 (void)connect(s2, (struct sockaddr *)&a, strlen(son) + 2);
463 if (write(s2, "HELLO", 5) == -1)
469 if (accept(s1, &a, &l))
472 if (select(1, &f, 0, 0, 0) == -1)
476 ], AC_NOTE(- your sockets are usable) sock=1,
477 AC_NOTE(- your sockets are not usable))
480 if test -n "$sock"; then
481 AC_CHECKING(socket implementation)
483 /* For select - According to POSIX 1003.1-2001 */
484 #include <sys/select.h>
486 /* For select - According to earlier standards */
487 #include <sys/time.h>
488 #include <sys/types.h>
491 #include <sys/stat.h>
492 #include <sys/socket.h>
495 char *son = "/tmp/conftest$$";
501 struct sockaddr_un a;
502 if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
504 a.sun_family = AF_UNIX;
505 strcpy(a.sun_path, son);
507 if (bind(s, (struct sockaddr *) &a, strlen(son)+2) == -1)
514 ],AC_NOTE(- you are normal),
515 AC_NOTE(- unix domain sockets are not kept in the filesystem)
516 AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
522 dnl **** choose sockets or fifos ****
524 if test -n "$fifo"; then
525 if test -n "$sock"; then
526 if test -n "$nore"; then
527 AC_NOTE(- hmmm... better take the fifos)
529 elif test -n "$fifobr"; then
530 AC_NOTE(- as your fifos are broken lets use the sockets.)
532 AC_NOTE(- both sockets and fifos usable. let's take sockets.)
535 AC_NOTE(- using named pipes, of course)
538 elif test -n "$sock"; then
539 AC_NOTE(- using unix-domain sockets, of course)
541 AC_MSG_ERROR(you have neither usable sockets nor usable pipes -> no screen)
545 dnl **** check the select implementation ****
548 AC_CHECKING(select return value)
550 /* For select - According to POSIX 1003.1-2001 */
551 #include <sys/select.h>
553 /* For select - According to earlier standards */
554 #include <sys/time.h>
555 #include <sys/types.h>
558 #include <sys/stat.h>
561 char *nam = "/tmp/conftest$$";
566 #define O_NONBLOCK O_NDELAY
569 #define S_IFIFO 0010000
578 /* From Andrew A. Chernov (ache@astral.msk.su):
579 * opening RDWR fifo fails in BSD 4.4, but select return values are
586 if (mkfifo(nam, 0777))
588 if (mknod(nam, S_IFIFO|0777, 0))
592 if (open(nam, O_RDWR | O_NONBLOCK))
594 if (write(0, "TEST", 4) == -1)
599 #include <sys/types.h>
600 #include <sys/socket.h>
606 struct sockaddr_un a;
610 if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
612 a.sun_family = AF_UNIX;
613 strcpy(a.sun_path, nam);
615 if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1)
621 if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
623 (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2);
624 if (write(s2, "HELLO", 5) == -1)
630 if (accept(s1, (struct sockaddr *)&a, &l))
636 if (select(1, &f, 0, 0, 0) == -1)
638 if (select(1, &f, &f, 0, 0) != 2)
642 ],AC_NOTE(- select is ok),
643 AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
646 dnl **** termcap or terminfo ****
648 AC_CHECKING(for tgetent)
649 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
651 LIBS="-lcurses $olibs"
652 AC_CHECKING(libcurses)
655 __sorry_hpux_libcurses_is_totally_broken_in_10_10();
657 tgetent((char *)0, (char *)0);
660 LIBS="-ltermcap $olibs"
661 AC_CHECKING(libtermcap)
662 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
663 LIBS="-ltermlib $olibs"
664 AC_CHECKING(libtermlib)
665 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
666 LIBS="-lncursesw $olibs"
667 AC_CHECKING(libncursesw)
668 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
669 LIBS="-lncurses $olibs"
670 AC_CHECKING(libncurses)
671 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
672 AC_MSG_ERROR(!!! no tgetent - no screen)))))))
677 exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
678 }], AC_NOTE(- you use the termcap database),
679 AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
681 AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
684 dnl **** PTY specific things ****
686 AC_CHECKING(for /dev/ptc)
687 if test -r /dev/ptc; then
688 AC_DEFINE(HAVE_DEV_PTC)
691 AC_CHECKING(for SVR4 ptys)
693 if test -c /dev/ptmx ; then
694 AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
698 AC_CHECK_FUNCS(getpt)
700 dnl check for openpty()
701 if test -z "$sysvr4ptys"; then
702 AC_CHECK_FUNCS(openpty,,
703 [AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])])
706 AC_CHECKING(for ptyranges)
707 if test -d /dev/ptym ; then
717 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
718 dnl if test -c /dev/ptyp19; then
719 dnl ptys=`echo /dev/ptyp??`
721 dnl ptys=`echo $pdir/pty??`
723 if test "$ptys" != "$pdir/pty??" ; then
724 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
725 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
726 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
727 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
730 dnl **** pty mode/group handling ****
732 dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
733 AC_ARG_WITH(pty-mode, [ --with-pty-mode=mode default mode for ptys], [ ptymode="${withval}" ])
734 AC_ARG_WITH(pty-group, [ --with-pty-group=group default group for ptys], [ ptygrp="${withval}" ])
735 test -n "$ptymode" || ptymode=0620
736 if test -n "$ptygrp" ; then
737 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
738 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
741 AC_CHECKING(default tty permissions/group)
744 #include <sys/types.h>
745 #include <sys/stat.h>
754 if (!(x = ttyname(0))) exit(1);
755 if (stat(x, &sb)) exit(1);
757 if (om & 002) exit(0);
758 m = system("mesg y");
759 if (m == -1 || m == 127) exit(1);
760 if (stat(x, &sb)) exit(1);
762 if (chmod(x, om)) exit(1);
763 if (m & 002) exit(0);
764 if (sb.st_gid == getgid()) exit(1);
765 if (!(fp=fopen("conftest_grp", "w")))
767 fprintf(fp, "%d\n", sb.st_gid);
772 if test -f conftest_grp; then
773 ptygrp=`cat conftest_grp`
774 AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
775 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
776 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
778 AC_NOTE(- ptys are world accessable)
783 AC_PATH_PROG(WRITEPATH, write)
784 AC_PATH_PROG(XTERMPATH, xterm)
786 if test -n "$WRITEPATH$XTERMPATH"; then
789 found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null`
790 if test -n "$found"; then
794 if test -n "$XTERMPATH"; then
795 ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'`
796 if test tty != "$ptygrpn"; then
801 if test -n "$WRITEPATH$XTERMPATH"; then
802 found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print`
803 if test -n "$found"; then
804 ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'`
805 AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
806 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
807 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
809 AC_NOTE(- ptys are world accessable)
812 AC_NOTE(- can't determine - assume ptys are world accessable)
820 dnl **** utmp handling ****
822 AC_CHECKING(getutent)
824 #include <time.h> /* to get time_t on SCO */
825 #include <sys/types.h>
826 #if defined(SVR4) && !defined(DGUX)
833 #define pututline _pututline
836 [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT),
839 AC_CHECKING(getutent with -lgen)
842 #include <sys/types.h>
843 #if defined(SVR4) && !defined(DGUX)
850 #define pututline _pututline
853 [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
858 #include <sys/types.h>
859 #if defined(SVR4) && !defined(DGUX)
865 ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST))
866 AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
867 if test "$have_utempter" = yes; then
868 AC_DEFINE(HAVE_UTEMPTER)
869 LIBS="$LIBS -lutempter"
875 AC_CHECKING(for libutil(s))
876 test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
877 test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
879 AC_CHECKING(getloadavg)
880 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
881 AC_DEFINE(LOADAV_GETLOADAVG) load=1,
882 if test -f /usr/lib/libkvm.a ; then
885 AC_CHECKING(getloadavg with -lkvm)
886 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
887 AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
891 if test -z "$load" ; then
893 [#if defined(NeXT) || defined(apollo) || defined(linux)
898 if test -z "$load" ; then
899 AC_CHECKING(for kernelfile)
900 for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do
901 if test -f $core || test -c $core; then
905 if test ! -f $core && test ! -c $core ; then
906 AC_NOTE(- no kernelfile found)
908 AC_NOTE(- using kernelfile '$core')
909 if test -r $core ; then
910 AC_DEFINE_UNQUOTED(LOADAV_UNIX,"$core")
911 AC_CHECK_HEADER(nlist.h,
912 [AC_DEFINE(NLIST_STRUCT)
913 AC_CHECKING(n_un in struct nlist)
914 AC_TRY_COMPILE([#include <nlist.h>],
915 [struct nlist n; n.n_un.n_name = 0;],
916 AC_DEFINE(NLIST_NAME_UNION))])
918 AC_CHECKING(for nlist declaration)
919 AC_EGREP_CPP([nlist(( | )( | )*.*\(|\()],[
925 ],AC_DEFINE(NLIST_DECLARED))
927 AC_CHECKING(for avenrun symbol)
929 for av in avenrun _avenrun _Loadavg avenrun _avenrun _Loadavg; do
931 #include <sys/types.h>
944 #if !defined(_AUX_SOURCE) && !defined(AUX)
945 # ifdef NLIST_NAME_UNION
946 nl[0].n_un.n_name = "$av";
948 nl[0].n_name = "$av";
951 strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name));
953 nlist(LOADAV_UNIX, nl);
954 if (nl[0].n_value == 0)
959 if test "$av" = _Loadavg; then
960 nlist64='#define nlist nlist64'
963 if test -z "$avensym" ; then
964 AC_NOTE(- no avenrun symbol found)
966 AC_NOTE(- using avenrun symbol '$avensym')
967 AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,"$avensym")
968 if test -n "$nlist64"; then
969 AC_NOTE(- used nlist64 to find it)
970 AC_DEFINE(LOADAV_USE_NLIST64)
975 AC_NOTE( Can't configure the load average display feature)
976 AC_NOTE( because $core is not readable by you.)
977 AC_NOTE( To configure the load average display feature,)
978 AC_NOTE( re-run configure as root if possible.)
979 AC_NOTE( If you are not the system administrator then disregard)
980 AC_NOTE( this warning. You can still use screen without)
981 AC_NOTE( the load average display feature.)
987 #include <sys/types.h>
988 #include <sys/param.h>
990 #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))
992 # if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
995 # if defined(FSCALE) && !defined(__osf__)
1003 # if defined(MIPS) || defined(SVR4) || defined(m88k)
1005 # else /* not MIPS */
1006 loadscale=1000 /* our default value */
1009 # endif /* not FSCALE */
1010 # endif /* not apollo */
1022 if test -n "$load" ; then AC_DEFINE(LOADAV) fi
1023 if test -n "$loadtype" ; then AC_DEFINE_UNQUOTED(LOADAV_TYPE,$loadtype) fi
1024 if test -n "$loadnum" ; then AC_DEFINE_UNQUOTED(LOADAV_NUM,$loadnum) fi
1025 if test -n "$loadscale" ; then AC_DEFINE_UNQUOTED(LOADAV_SCALE,$loadscale) fi
1028 dnl **** signal handling ****
1030 if test -n "$posix" ; then
1032 dnl POSIX has reliable signals with void return type.
1033 AC_NOTE(assuming posix signal definition)
1038 AC_CHECKING(return type of signal handlers)
1040 [#include <sys/types.h>
1045 extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
1048 #include <sys/types.h>
1052 sigset(0, (void (*)())0);
1054 sigset(0, (int (*)())0);
1056 ], AC_DEFINE(USESIGSET))
1057 AC_CHECKING(signal implementation)
1059 #include <sys/types.h>
1063 #define SIGCLD SIGCHLD
1066 #define signal sigset
1081 /* on hpux we use sigvec to get bsd signals */
1083 (void)signal(SIGCLD, hand);
1084 kill(getpid(), SIGCLD);
1085 kill(getpid(), SIGCLD);
1091 ],,AC_DEFINE(SYSVSIGS))
1096 dnl **** libraries ****
1099 AC_CHECKING(for crypt and sec libraries)
1100 test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
1102 LIBS="$LIBS -lcrypt"
1104 AC_TRY_LINK(,,,LIBS="$oldlibs")
1105 test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
1106 test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
1109 AC_CHECKING(IRIX sun library)
1110 AC_TRY_LINK(,,,LIBS="$oldlibs")
1113 AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS"
1115 AC_CHECKING(syslog in libbsd.a)
1116 AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="$oldlibs"
1117 AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])])
1123 ], LIBS="$LIBS -lsocket -lcrypt_i")
1126 dnl **** misc things ****
1128 AC_CHECKING(wait union)
1129 AC_TRY_COMPILE([#include <sys/types.h>
1130 #include <sys/wait.h>
1137 ],AC_DEFINE(BSDWAIT))
1139 if test -z "$butterfly"; then
1140 AC_CHECKING(for termio or termios)
1141 AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
1142 if test -n "$posix"; then
1143 AC_TRY_CPP([#include <termios.h>], AC_DEFINE(TERMIO))
1148 dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
1149 AC_CHECKING(getspnam)
1150 AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
1152 AC_CHECKING(getttyent)
1153 AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
1156 AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
1158 AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
1162 strcpy(buf, "abcdefghi");
1163 bcopy(buf, buf + 2, 3);
1164 if (strncmp(buf, "ababcf", 6))
1166 strcpy(buf, "abcdefghi");
1167 bcopy(buf + 2, buf, 3);
1168 if (strncmp(buf, "cdedef", 6))
1170 exit(0); /* libc version works properly. */
1171 }], AC_DEFINE(USEBCOPY))
1174 #define bcopy(s,d,l) memmove(d,s,l)
1177 strcpy(buf, "abcdefghi");
1178 bcopy(buf, buf + 2, 3);
1179 if (strncmp(buf, "ababcf", 6))
1181 strcpy(buf, "abcdefghi");
1182 bcopy(buf + 2, buf, 3);
1183 if (strncmp(buf, "cdedef", 6))
1185 exit(0); /* libc version works properly. */
1186 }], AC_DEFINE(USEMEMMOVE))
1190 #define bcopy(s,d,l) memcpy(d,s,l)
1193 strcpy(buf, "abcdefghi");
1194 bcopy(buf, buf + 2, 3);
1195 if (strncmp(buf, "ababcf", 6))
1197 strcpy(buf, "abcdefghi");
1198 bcopy(buf + 2, buf, 3);
1199 if (strncmp(buf, "cdedef", 6))
1201 exit(0); /* libc version works properly. */
1202 }], AC_DEFINE(USEMEMCPY))
1204 AC_MSG_CHECKING(long file names)
1205 (echo 1 > /tmp/conftest9012345) 2>/dev/null
1206 (echo 2 > /tmp/conftest9012346) 2>/dev/null
1207 val=`cat /tmp/conftest9012345 2>/dev/null`
1208 if test -f /tmp/conftest9012345 && test "$val" = 1; then
1212 AC_DEFINE(NAME_MAX, 14)
1214 rm -f /tmp/conftest*
1216 AC_MSG_CHECKING(for vsprintf)
1217 AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
1221 AC_MSG_CHECKING(for setenv)
1222 if test -z "$ac_setenv_args"; then
1224 [#include <stdlib.h>],
1226 setenv((char *) 0, (char *) 0, 0);
1227 ], ac_setenv_args=3)
1229 if test -z "$ac_setenv_args"; then
1231 [#include <stdlib.h>],
1233 setenv((char *) 0, (char *) 0);
1234 ], ac_setenv_args=2)
1236 if test -n "$ac_setenv_args"; then
1237 AC_DEFINE(USESETENV)
1238 if test "$ac_setenv_args" = 3; then
1239 AC_DEFINE(HAVE_SETENV_3)
1240 elif test "$ac_setenv_args" = 2; then
1241 AC_DEFINE(HAVE_SETENV_2)
1245 AC_MSG_CHECKING(for putenv)
1246 AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV))
1248 AC_MSG_CHECKING([for nl_langinfo(CODESET)])
1250 #include <langinfo.h>
1251 ],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no))
1253 AC_SEARCH_LIBS(gethostname, nsl)
1255 AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime)
1257 AC_ARG_ENABLE(pam, [ --enable-pam enable PAM support])
1258 if test "$enable_pam" = "yes"; then
1259 AC_MSG_CHECKING(for PAM support)
1262 AC_TRY_LINK([#include <security/pam_appl.h>], [
1263 pam_start(0, 0, 0, 0);
1264 pam_authenticate(0, 0);
1266 ], AC_MSG_RESULT(yes);AC_DEFINE(USE_PAM),
1267 AC_MSG_RESULT(no);LIBS="$oldlibs")
1270 AC_ARG_ENABLE(use_locale, [ --enable-locale use localized month/day names])
1271 if test "$enable_use_locale" = "yes"; then
1272 AC_DEFINE(USE_LOCALE)
1274 AC_ARG_ENABLE(telnet, [ --enable-telnet enable builtin telnet])
1275 if test "$enable_telnet" = "yes"; then
1276 AC_DEFINE(BUILTIN_TELNET)
1278 AC_ARG_ENABLE(colors256, [ --enable-colors256 enable support for 256 colors])
1279 if test "$enable_colors256" = "yes"; then
1280 AC_DEFINE(COLORS256)
1282 AC_ARG_ENABLE(rxvt_osc, [ --enable-rxvt_osc enable support for rxvt OSC codes])
1283 if test "$enable_rxvt_osc" = "yes"; then
1288 dnl **** the end ****
1290 if test -z "$old_CFLAGS"; then
1291 if test "x$CFLAGS" = "x-g"; then
1295 dnl Ptx bug workaround -- insert -lc after -ltermcap
1296 test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
1298 AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
1300 AC_OUTPUT(Makefile doc/Makefile, [[
1301 # a hook for preserving undef directive in config.h
1302 mv config.h conftest
1303 sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h
1308 if test -z "$AWK"; then
1309 echo "!!! Since you have no awk you must copy the files 'comm.h.dist'"
1310 echo "!!! and 'term.h.dist' to 'comm.h' and 'term.h'."
1311 echo "!!! Do _not_ change the user configuration section in config.h!"
1312 echo "Please check the pathnames in the Makefile."
1314 echo "Now please check the pathnames in the Makefile and in the user"
1315 echo "configuration section in config.h."
1317 echo "Then type 'make' to make screen. Good luck."