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])
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="-lncurses $olibs"
667 AC_CHECKING(libncurses)
668 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
669 AC_MSG_ERROR(!!! no tgetent - no screen))))))
674 exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
675 }], AC_NOTE(- you use the termcap database),
676 AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
678 AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
681 dnl **** PTY specific things ****
683 AC_CHECKING(for /dev/ptc)
684 if test -r /dev/ptc; then
685 AC_DEFINE(HAVE_DEV_PTC)
688 AC_CHECKING(for SVR4 ptys)
690 if test -c /dev/ptmx ; then
691 AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
695 AC_CHECK_FUNCS(getpt)
697 dnl check for openpty()
698 if test -z "$sysvr4ptys"; then
699 AC_CHECK_FUNCS(openpty,,
700 [AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])])
703 AC_CHECKING(for ptyranges)
704 if test -d /dev/ptym ; then
714 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
715 dnl if test -c /dev/ptyp19; then
716 dnl ptys=`echo /dev/ptyp??`
718 dnl ptys=`echo $pdir/pty??`
720 if test "$ptys" != "$pdir/pty??" ; then
721 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
722 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
723 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
724 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
727 dnl **** pty mode/group handling ****
729 dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
730 AC_ARG_WITH(pty-mode, [ --with-pty-mode=mode default mode for ptys], [ ptymode="${withval}" ])
731 AC_ARG_WITH(pty-group, [ --with-pty-group=group default group for ptys], [ ptygrp="${withval}" ])
732 test -n "$ptymode" || ptymode=0620
733 if test -n "$ptygrp" ; then
734 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
735 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
738 AC_CHECKING(default tty permissions/group)
741 #include <sys/types.h>
742 #include <sys/stat.h>
751 if (!(x = ttyname(0))) exit(1);
752 if (stat(x, &sb)) exit(1);
754 if (om & 002) exit(0);
755 m = system("mesg y");
756 if (m == -1 || m == 127) exit(1);
757 if (stat(x, &sb)) exit(1);
759 if (chmod(x, om)) exit(1);
760 if (m & 002) exit(0);
761 if (sb.st_gid == getgid()) exit(1);
762 if (!(fp=fopen("conftest_grp", "w")))
764 fprintf(fp, "%d\n", sb.st_gid);
769 if test -f conftest_grp; then
770 ptygrp=`cat conftest_grp`
771 AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
772 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
773 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
775 AC_NOTE(- ptys are world accessable)
780 AC_PATH_PROG(WRITEPATH, write)
781 AC_PATH_PROG(XTERMPATH, xterm)
783 if test -n "$WRITEPATH$XTERMPATH"; then
786 found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null`
787 if test -n "$found"; then
791 if test -n "$XTERMPATH"; then
792 ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'`
793 if test tty != "$ptygrpn"; then
798 if test -n "$WRITEPATH$XTERMPATH"; then
799 found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print`
800 if test -n "$found"; then
801 ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'`
802 AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
803 AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
804 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
806 AC_NOTE(- ptys are world accessable)
809 AC_NOTE(- can't determine - assume ptys are world accessable)
817 dnl **** utmp handling ****
819 AC_CHECKING(getutent)
821 #include <time.h> /* to get time_t on SCO */
822 #include <sys/types.h>
823 #if defined(SVR4) && !defined(DGUX)
830 #define pututline _pututline
833 [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT),
836 AC_CHECKING(getutent with -lgen)
839 #include <sys/types.h>
840 #if defined(SVR4) && !defined(DGUX)
847 #define pututline _pututline
850 [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
855 #include <sys/types.h>
856 #if defined(SVR4) && !defined(DGUX)
862 ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST))
863 AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
864 if test "$have_utempter" = yes; then
865 AC_DEFINE(HAVE_UTEMPTER)
866 LIBS="$LIBS -lutempter"
872 AC_CHECKING(for libutil(s))
873 test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
874 test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
876 AC_CHECKING(getloadavg)
877 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
878 AC_DEFINE(LOADAV_GETLOADAVG) load=1,
879 if test -f /usr/lib/libkvm.a ; then
882 AC_CHECKING(getloadavg with -lkvm)
883 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
884 AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
888 if test -z "$load" ; then
890 [#if defined(NeXT) || defined(apollo) || defined(linux)
895 if test -z "$load" ; then
896 AC_CHECKING(for kernelfile)
897 for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do
898 if test -f $core || test -c $core; then
902 if test ! -f $core && test ! -c $core ; then
903 AC_NOTE(- no kernelfile found)
905 AC_NOTE(- using kernelfile '$core')
906 if test -r $core ; then
907 AC_DEFINE_UNQUOTED(LOADAV_UNIX,"$core")
908 AC_CHECK_HEADER(nlist.h,
909 [AC_DEFINE(NLIST_STRUCT)
910 AC_CHECKING(n_un in struct nlist)
911 AC_TRY_COMPILE([#include <nlist.h>],
912 [struct nlist n; n.n_un.n_name = 0;],
913 AC_DEFINE(NLIST_NAME_UNION))])
915 AC_CHECKING(for nlist declaration)
916 AC_EGREP_CPP([nlist(( | )( | )*.*\(|\()],[
922 ],AC_DEFINE(NLIST_DECLARED))
924 AC_CHECKING(for avenrun symbol)
926 for av in avenrun _avenrun _Loadavg avenrun _avenrun _Loadavg; do
928 #include <sys/types.h>
941 #if !defined(_AUX_SOURCE) && !defined(AUX)
942 # ifdef NLIST_NAME_UNION
943 nl[0].n_un.n_name = "$av";
945 nl[0].n_name = "$av";
948 strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name));
950 nlist(LOADAV_UNIX, nl);
951 if (nl[0].n_value == 0)
956 if test "$av" = _Loadavg; then
957 nlist64='#define nlist nlist64'
960 if test -z "$avensym" ; then
961 AC_NOTE(- no avenrun symbol found)
963 AC_NOTE(- using avenrun symbol '$avensym')
964 AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,"$avensym")
965 if test -n "$nlist64"; then
966 AC_NOTE(- used nlist64 to find it)
967 AC_DEFINE(LOADAV_USE_NLIST64)
972 AC_NOTE( Can't configure the load average display feature)
973 AC_NOTE( because $core is not readable by you.)
974 AC_NOTE( To configure the load average display feature,)
975 AC_NOTE( re-run configure as root if possible.)
976 AC_NOTE( If you are not the system administrator then disregard)
977 AC_NOTE( this warning. You can still use screen without)
978 AC_NOTE( the load average display feature.)
984 #include <sys/types.h>
985 #include <sys/param.h>
987 #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))
989 # if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
992 # if defined(FSCALE) && !defined(__osf__)
1000 # if defined(MIPS) || defined(SVR4) || defined(m88k)
1002 # else /* not MIPS */
1003 loadscale=1000 /* our default value */
1006 # endif /* not FSCALE */
1007 # endif /* not apollo */
1019 if test -n "$load" ; then AC_DEFINE(LOADAV) fi
1020 if test -n "$loadtype" ; then AC_DEFINE_UNQUOTED(LOADAV_TYPE,$loadtype) fi
1021 if test -n "$loadnum" ; then AC_DEFINE_UNQUOTED(LOADAV_NUM,$loadnum) fi
1022 if test -n "$loadscale" ; then AC_DEFINE_UNQUOTED(LOADAV_SCALE,$loadscale) fi
1025 dnl **** signal handling ****
1027 if test -n "$posix" ; then
1029 dnl POSIX has reliable signals with void return type.
1030 AC_NOTE(assuming posix signal definition)
1035 AC_CHECKING(return type of signal handlers)
1037 [#include <sys/types.h>
1042 extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
1045 #include <sys/types.h>
1049 sigset(0, (void (*)())0);
1051 sigset(0, (int (*)())0);
1053 ], AC_DEFINE(USESIGSET))
1054 AC_CHECKING(signal implementation)
1056 #include <sys/types.h>
1060 #define SIGCLD SIGCHLD
1063 #define signal sigset
1078 /* on hpux we use sigvec to get bsd signals */
1080 (void)signal(SIGCLD, hand);
1081 kill(getpid(), SIGCLD);
1082 kill(getpid(), SIGCLD);
1088 ],,AC_DEFINE(SYSVSIGS))
1093 dnl **** libraries ****
1096 AC_CHECKING(for crypt and sec libraries)
1097 test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
1099 LIBS="$LIBS -lcrypt"
1101 AC_TRY_LINK(,,,LIBS="$oldlibs")
1102 test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
1103 test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
1106 AC_CHECKING(IRIX sun library)
1107 AC_TRY_LINK(,,,LIBS="$oldlibs")
1110 AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS"
1112 AC_CHECKING(syslog in libbsd.a)
1113 AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="$oldlibs"
1114 AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])])
1120 ], LIBS="$LIBS -lsocket -lcrypt_i")
1123 dnl **** misc things ****
1125 AC_CHECKING(wait union)
1126 AC_TRY_COMPILE([#include <sys/types.h>
1127 #include <sys/wait.h>
1134 ],AC_DEFINE(BSDWAIT))
1136 if test -z "$butterfly"; then
1137 AC_CHECKING(for termio or termios)
1138 AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
1139 if test -n "$posix"; then
1140 AC_TRY_CPP([#include <termios.h>], AC_DEFINE(TERMIO))
1145 dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
1146 AC_CHECKING(getspnam)
1147 AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
1149 AC_CHECKING(getttyent)
1150 AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
1153 AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
1155 AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
1159 strcpy(buf, "abcdefghi");
1160 bcopy(buf, buf + 2, 3);
1161 if (strncmp(buf, "ababcf", 6))
1163 strcpy(buf, "abcdefghi");
1164 bcopy(buf + 2, buf, 3);
1165 if (strncmp(buf, "cdedef", 6))
1167 exit(0); /* libc version works properly. */
1168 }], AC_DEFINE(USEBCOPY))
1171 #define bcopy(s,d,l) memmove(d,s,l)
1174 strcpy(buf, "abcdefghi");
1175 bcopy(buf, buf + 2, 3);
1176 if (strncmp(buf, "ababcf", 6))
1178 strcpy(buf, "abcdefghi");
1179 bcopy(buf + 2, buf, 3);
1180 if (strncmp(buf, "cdedef", 6))
1182 exit(0); /* libc version works properly. */
1183 }], AC_DEFINE(USEMEMMOVE))
1187 #define bcopy(s,d,l) memcpy(d,s,l)
1190 strcpy(buf, "abcdefghi");
1191 bcopy(buf, buf + 2, 3);
1192 if (strncmp(buf, "ababcf", 6))
1194 strcpy(buf, "abcdefghi");
1195 bcopy(buf + 2, buf, 3);
1196 if (strncmp(buf, "cdedef", 6))
1198 exit(0); /* libc version works properly. */
1199 }], AC_DEFINE(USEMEMCPY))
1201 AC_MSG_CHECKING(long file names)
1202 (echo 1 > /tmp/conftest9012345) 2>/dev/null
1203 (echo 2 > /tmp/conftest9012346) 2>/dev/null
1204 val=`cat /tmp/conftest9012345 2>/dev/null`
1205 if test -f /tmp/conftest9012345 && test "$val" = 1; then
1209 AC_DEFINE(NAME_MAX, 14)
1211 rm -f /tmp/conftest*
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 AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
1221 AC_MSG_CHECKING(for putenv)
1222 AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)
1224 AC_MSG_CHECKING([for nl_langinfo(CODESET)])
1226 #include <langinfo.h>
1227 ],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no))
1229 AC_SEARCH_LIBS(gethostname, nsl)
1231 AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime)
1233 AC_ARG_ENABLE(pam, [ --enable-pam enable PAM support])
1234 if test "$enable_pam" = "yes"; then
1235 AC_MSG_CHECKING(for PAM support)
1238 AC_TRY_LINK([#include <security/pam_appl.h>], [
1239 pam_start(0, 0, 0, 0);
1240 pam_authenticate(0, 0);
1242 ], AC_MSG_RESULT(yes);AC_DEFINE(USE_PAM),
1243 AC_MSG_RESULT(no);LIBS="$oldlibs")
1246 AC_ARG_ENABLE(use_locale, [ --enable-locale use localized month/day names])
1247 if test "$enable_use_locale" = "yes"; then
1248 AC_DEFINE(USE_LOCALE)
1250 AC_ARG_ENABLE(telnet, [ --enable-telnet enable builtin telnet])
1251 if test "$enable_telnet" = "yes"; then
1252 AC_DEFINE(BUILTIN_TELNET)
1254 AC_ARG_ENABLE(colors256, [ --enable-colors256 enable support for 256 colors])
1255 if test "$enable_colors256" = "yes"; then
1256 AC_DEFINE(COLORS256)
1258 AC_ARG_ENABLE(rxvt_osc, [ --enable-rxvt_osc enable support for rxvt OSC codes])
1259 if test "$enable_rxvt_osc" = "yes"; then
1264 dnl **** the end ****
1266 if test -z "$old_CFLAGS"; then
1267 if test "x$CFLAGS" = "x-g"; then
1271 dnl Ptx bug workaround -- insert -lc after -ltermcap
1272 test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
1274 AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
1276 ETCSCREENRC="\"/usr/local/etc/screenrc\""
1277 if test -n "$prefix"; then
1278 ETCSCREENRC="\"$prefix/etc/screenrc\""
1280 AC_MSG_CHECKING(for the global screenrc file)
1281 AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path where to put the global screenrc file], [ ETCSCREENRC="\"${withval}\"" ])
1282 AC_DEFINE_UNQUOTED(ETCSCREENRC,$ETCSCREENRC)
1283 AC_MSG_RESULT($ETCSCREENRC)
1285 SCREENENCODINGS="\"/usr/local/lib/screen/utf8encodings\""
1286 if test -n "$datadir"; then
1287 eval SCREENENCODINGS="$datadir/screen/utf8encodings"
1288 SCREENENCODINGS="\"$SCREENENCODINGS\""
1290 AC_MSG_CHECKING(for the utf8-encodings location)
1291 AC_DEFINE_UNQUOTED(SCREENENCODINGS,$SCREENENCODINGS)
1292 AC_MSG_RESULT($SCREENENCODINGS)
1294 AC_OUTPUT(Makefile doc/Makefile, [[
1295 # a hook for preserving undef directive in config.h
1296 mv config.h conftest
1297 sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h
1302 if test -z "$AWK"; then
1303 echo "!!! Since you have no awk you must copy the files 'comm.h.dist'"
1304 echo "!!! and 'term.h.dist' to 'comm.h' and 'term.h'."
1305 echo "!!! Do _not_ change the user configuration section in config.h!"
1306 echo "Please check the pathnames in the Makefile."
1308 echo "Now please check the pathnames in the Makefile and in the user"
1309 echo "configuration section in config.h."
1311 echo "Then type 'make' to make screen. Good luck."