1
dnl Process this file with autoconf to produce a configure script.
3
dnl $Id: configure.in,v 1.18 1994/09/06 16:59:54 mlschroe Exp $ FAU
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: 1.18 $)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], [ SOCKDIR="\"${withval}\"" ])
97
AC_MSG_RESULT(${SOCKDIR})
98
AC_DEFINE_UNQUOTED(SOCKDIR, $SOCKDIR)
104
dnl **** special unix variants ****
106
if test -n "$ISC"; then
107
AC_DEFINE(ISC) LIBS="$LIBS -linet"
110
dnl AC_CHECKING(for OSF1)
111
dnl if test -f /bin/uname ; then
112
dnl if test `/bin/uname` = OSF1 || test -f /osf_boot; then
113
dnl AC_DEFINE(OSF1) # this disables MIPS again....
117
if test -f /sysV68 ; then
121
AC_CHECKING(for MIPS)
122
if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
124
test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
125
dnl djm@eng.umd.edu: "... for one thing, it doubles the size of the executable"
126
AC_CHECKING(mld library)
127
AC_TRY_LINK(,,,LIBS="$oldlibs")
130
if test -r /dev/ptc; then
133
AC_TRY_LINK(,[wait3();], ,
135
AC_TRY_LINK(,[wait2();],
136
dnl John Rouillard (rouilj@sni-usa.com):
137
dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
139
dnl Detect RISCOS if wait2 is present, but not wait3.
140
AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
146
AC_CHECKING(for Ultrix)
148
[#if defined(ultrix) || defined(__ultrix)
153
if test -f /usr/lib/libpyr.a ; then
156
AC_CHECKING(Pyramid OSX)
157
AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
160
dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
161
dnl BBN butterfly is not POSIX, but a MACH BSD system.
162
dnl Do not define POSIX and TERMIO.
163
AC_CHECKING(for butterfly)
165
[#if defined(butterfly)
170
if test -z "$butterfly"; then
171
if test -n "$ULTRIX"; then
172
test -z "$GCC" && CC="$CC -YBSD"
174
AC_CHECKING(for POSIX.1)
176
[#include <sys/types.h>
179
#ifdef _POSIX_VERSION
182
], AC_NOTE(- you have a POSIX system) AC_DEFINE(POSIX) posix=1)
185
AC_CHECKING(for System V)
187
[#include <sys/types.h>
189
#include <fcntl.h>], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV))
191
AC_CHECKING(for sequent/ptx)
196
], LIBS="$LIBS -lsocket -linet";seqptx=1)
201
AC_TRY_LINK([#include <utmpx.h>
203
[AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
204
[AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])]
207
AC_CHECKING(for Solaris 2.x)
209
[#if defined(SVR4) && defined(sun)
212
], LIBS="$LIBS -lsocket -lnsl -lkstat")
215
dnl **** typedefs ****
217
dnl (currently not used)
219
dnl AC_CHECKING(for pid_t)
220
dnl AC_EGREP_CPP(pid_t,[#include <sys/types.h>
221
dnl ],AC_DEFINE(PID_T_DEFINED))
223
dnl AC_CHECKING(for sig_t)
224
dnl AC_EGREP_CPP(sig_t,[#include <sys/types.h>
225
dnl #include <signal.h>
226
dnl ],AC_DEFINE(SIG_T_DEFINED))
228
dnl AC_CHECKING(for uid_t)
229
dnl AC_EGREP_CPP(uid_t,[#include <sys/types.h>
230
dnl ],AC_DEFINE(UID_T_DEFINED))
234
dnl **** Job control ****
237
AC_CHECKING(BSD job jontrol)
239
[#include <sys/types.h>
240
#include <sys/ioctl.h>
252
], AC_NOTE(- you have jobcontrol) AC_DEFINE(BSDJOBS), AC_NOTE(- you don't have jobcontrol))
255
dnl **** setreuid(), seteuid() ****
257
AC_CHECKING(setreuid)
264
], AC_DEFINE(HAVE_SETREUID))
267
dnl linux seteuid was broken before V1.1.11
268
dnl NeXT, AUX, ISC, and ultrix are still broken (no saved uid support)
269
dnl Solaris seteuid doesn't change the saved uid, bad for
270
dnl multiuser screen sessions
273
#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
274
seteuid_is_broken(0);
278
], AC_DEFINE(HAVE_SETEUID))
281
dnl **** select() ****
285
AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],,
286
LIBS="$LIBS -lnet -lnsl"
287
AC_CHECKING(select with $LIBS)
288
AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],,
289
AC_MSG_ERROR(!!! no select - no screen))
292
dnl **** FIFO tests ****
297
#include <sys/types.h>
298
#include <sys/stat.h>
302
#define O_NONBLOCK O_NDELAY
305
#define S_IFIFO 0010000
308
char *fin = "/tmp/conftest$$";
321
if (mkfifo(fin, 0777))
323
if (mknod(fin, S_IFIFO|0777, 0))
326
if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
331
* The next test fails under 386BSD, but screen works using fifos.
332
* Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
333
* the select() configuration test.
337
if (open(fin, O_RDONLY | O_NONBLOCK))
342
if (open(fin, O_WRONLY | O_NONBLOCK))
345
if (open(fin, O_WRONLY | O_NONBLOCK))
347
if (write(0, "TEST", 4) == -1)
356
if (select(1, &f, 0, 0, 0) == -1)
360
], AC_NOTE(- your fifos are usable) fifo=1,
361
AC_NOTE(- your fifos are not usable))
364
if test -n "$fifo"; then
365
AC_CHECKING(for broken fifo implementation)
367
#include <sys/types.h>
369
#include <sys/time.h>
370
#include <sys/stat.h>
373
#define O_NONBLOCK O_NDELAY
376
#define S_IFIFO 0010000
379
char *fin = "/tmp/conftest$$";
391
if (mkfifo(fin, 0600))
393
if (mknod(fin, S_IFIFO|0600, 0))
397
if (open(fin, O_RDONLY|O_NONBLOCK))
406
if (select(1, &f, 0, 0, &tv))
410
], AC_NOTE(- your implementation is ok),
411
AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
416
dnl **** SOCKET tests ****
418
dnl may need LIBS="$LIBS -lsocket" here
423
#include <sys/types.h>
424
#include <sys/socket.h>
428
char *son = "/tmp/conftest$$";
433
struct sockaddr_un a;
441
if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
443
a.sun_family = AF_UNIX;
444
strcpy(a.sun_path, son);
446
if (bind(s1, (struct sockaddr *) &a, strlen(son)+2) == -1)
452
if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
454
(void)connect(s2, (struct sockaddr *)&a, strlen(son) + 2);
455
if (write(s2, "HELLO", 5) == -1)
461
if (accept(s1, &a, &l))
468
if (select(1, &f, 0, 0, 0) == -1)
472
], AC_NOTE(- your sockets are usable) sock=1,
473
AC_NOTE(- your sockets are not usable))
476
if test -n "$sock"; then
477
AC_CHECKING(socket implementation)
479
#include <sys/types.h>
480
#include <sys/stat.h>
481
#include <sys/socket.h>
484
char *son = "/tmp/conftest$$";
490
struct sockaddr_un a;
491
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
493
a.sun_family = AF_UNIX;
494
strcpy(a.sun_path, son);
496
if (bind(s, (struct sockaddr *) &a, strlen(son)+2) == -1)
503
],AC_NOTE(- you are normal),
504
AC_NOTE(- unix domain sockets are not kept in the filesystem)
505
AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
511
dnl **** choose sockets or fifos ****
513
if test -n "$fifo"; then
514
if test -n "$sock"; then
515
if test -n "$nore"; then
516
AC_NOTE(- hmmm... better take the fifos)
518
elif test -n "$fifobr"; then
519
AC_NOTE(- as your fifos are broken lets use the sockets.)
521
AC_NOTE(- both sockets and fifos usable. let's take fifos.)
525
AC_NOTE(- using named pipes, of course)
528
elif test -n "$sock"; then
529
AC_NOTE(- using unix-domain sockets, of course)
531
AC_MSG_ERROR(you have neither usable sockets nor usable pipes -> no screen)
535
dnl **** check the select implementation ****
538
AC_CHECKING(select return value)
540
#include <sys/types.h>
541
#include <sys/stat.h>
544
char *nam = "/tmp/conftest$$";
549
#define O_NONBLOCK O_NDELAY
552
#define S_IFIFO 0010000
565
/* From Andrew A. Chernov (ache@astral.msk.su):
566
* opening RDWR fifo fails in BSD 4.4, but select return values are
573
if (mkfifo(nam, 0777))
575
if (mknod(nam, S_IFIFO|0777, 0))
579
if (open(nam, O_RDWR | O_NONBLOCK))
581
if (write(0, "TEST", 4) == -1)
586
#include <sys/types.h>
587
#include <sys/socket.h>
593
struct sockaddr_un a;
601
if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
603
a.sun_family = AF_UNIX;
604
strcpy(a.sun_path, nam);
606
if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1)
612
if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
614
(void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2);
615
if (write(s2, "HELLO", 5) == -1)
621
if (accept(s1, (struct sockaddr *)&a, &l))
631
if (select(1, &f, 0, 0, 0) == -1)
633
if (select(1, &f, &f, 0, 0) != 2)
637
],AC_NOTE(- select is ok),
638
AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
641
dnl **** termcap or terminfo ****
643
AC_CHECKING(for tgetent)
644
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
646
LIBS="-lcurses $olibs"
647
AC_CHECKING(libcurses)
650
__sorry_hpux_libcurses_is_totally_broken_in_10_10();
652
tgetent((char *)0, (char *)0);
655
LIBS="-ltermcap $olibs"
656
AC_CHECKING(libtermcap)
657
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
658
LIBS="-ltermlib $olibs"
659
AC_CHECKING(libtermlib)
660
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
661
LIBS="-lncurses $olibs"
662
AC_CHECKING(libncurses)
663
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
664
AC_MSG_ERROR(!!! no tgetent - no screen))))))
669
exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
670
}], AC_NOTE(- you use the termcap database),
671
AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
673
AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
676
dnl **** PTY specific things ****
678
AC_CHECKING(for /dev/ptc)
679
if test -r /dev/ptc; then
680
AC_DEFINE(HAVE_DEV_PTC)
683
AC_CHECKING(for SVR4 ptys)
685
if test -c /dev/ptmx ; then
686
AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
690
AC_CHECK_FUNCS(getpt)
692
dnl check for openpty()
693
if test -z "$sysvr4ptys"; then
694
AC_CHECK_FUNCS(openpty,,
695
[AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])])
698
AC_CHECKING(for ptyranges)
699
if test -d /dev/ptym ; then
709
], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
710
dnl if test -c /dev/ptyp19; then
711
dnl ptys=`echo /dev/ptyp??`
713
dnl ptys=`echo $pdir/pty??`
715
if test "$ptys" != "$pdir/pty??" ; then
716
p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
717
p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
718
AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
719
AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
722
dnl **** pty mode/group handling ****
724
dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
725
AC_ARG_WITH(pty-mode, [ --with-pty-mode=mode default mode for ptys], [ ptymode="${withval}" ])
726
AC_ARG_WITH(pty-group, [ --with-pty-group=group default group for ptys], [ ptygrp="${withval}" ])
727
test -n "$ptymode" || ptymode=0620
728
if test -n "$ptygrp" ; then
729
AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
730
AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
733
AC_CHECKING(default tty permissions/group)
736
#include <sys/types.h>
737
#include <sys/stat.h>
746
if (!(x = ttyname(0))) exit(1);
747
if (stat(x, &sb)) exit(1);
749
if (om & 002) exit(0);
750
m = system("mesg y");
751
if (m == -1 || m == 127) exit(1);
752
if (stat(x, &sb)) exit(1);
754
if (chmod(x, om)) exit(1);
755
if (m & 002) exit(0);
756
if (sb.st_gid == getgid()) exit(1);
757
if (!(fp=fopen("conftest_grp", "w")))
759
fprintf(fp, "%d\n", sb.st_gid);
764
if test -f conftest_grp; then
765
ptygrp=`cat conftest_grp`
766
AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
767
AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
768
AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
770
AC_NOTE(- ptys are world accessable)
775
AC_PATH_PROG(WRITEPATH, write)
776
AC_PATH_PROG(XTERMPATH, xterm)
778
if test -n "$WRITEPATH$XTERMPATH"; then
781
found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null`
782
if test -n "$found"; then
786
if test -n "$XTERMPATH"; then
787
ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'`
788
if test tty != "$ptygrpn"; then
793
if test -n "$WRITEPATH$XTERMPATH"; then
794
found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print`
795
if test -n "$found"; then
796
ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'`
797
AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
798
AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
799
AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
801
AC_NOTE(- ptys are world accessable)
804
AC_NOTE(- can't determine - assume ptys are world accessable)
812
dnl **** utmp handling ****
814
AC_CHECKING(getutent)
816
#include <time.h> /* to get time_t on SCO */
817
#include <sys/types.h>
818
#if defined(SVR4) && !defined(DGUX)
825
#define pututline _pututline
828
[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT),
831
AC_CHECKING(getutent with -lgen)
834
#include <sys/types.h>
835
#if defined(SVR4) && !defined(DGUX)
842
#define pututline _pututline
845
[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
850
#include <sys/types.h>
851
#if defined(SVR4) && !defined(DGUX)
857
],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST))
858
AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
859
if test "$have_utempter" = yes; then
860
AC_DEFINE(HAVE_UTEMPTER)
861
LIBS="$LIBS -lutempter"
867
AC_CHECKING(for libutil(s))
868
test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
869
test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
871
AC_CHECKING(getloadavg)
872
AC_TRY_LINK(,[getloadavg((double *)0, 0);],
873
AC_DEFINE(LOADAV_GETLOADAVG) load=1,
874
if test -f /usr/lib/libkvm.a ; then
877
AC_CHECKING(getloadavg with -lkvm)
878
AC_TRY_LINK(,[getloadavg((double *)0, 0);],
879
AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
883
if test -z "$load" ; then
885
[#if defined(NeXT) || defined(apollo) || defined(linux)
890
if test -z "$load" ; then
891
AC_CHECKING(for kernelfile)
892
for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do
893
if test -f $core || test -c $core; then
897
if test ! -f $core && test ! -c $core ; then
898
AC_NOTE(- no kernelfile found)
900
AC_NOTE(- using kernelfile '$core')
901
if test -r $core ; then
902
AC_DEFINE_UNQUOTED(LOADAV_UNIX,"$core")
903
AC_CHECK_HEADER(nlist.h,
904
[AC_DEFINE(NLIST_STRUCT)
905
AC_CHECKING(n_un in struct nlist)
906
AC_TRY_COMPILE([#include <nlist.h>],
907
[struct nlist n; n.n_un.n_name = 0;],
908
AC_DEFINE(NLIST_NAME_UNION))])
910
AC_CHECKING(for nlist declaration)
911
AC_EGREP_CPP([nlist(( | )( | )*.*\(|\()],[
917
],AC_DEFINE(NLIST_DECLARED))
919
AC_CHECKING(for avenrun symbol)
921
for av in avenrun _avenrun _Loadavg avenrun _avenrun _Loadavg; do
923
#include <sys/types.h>
936
#if !defined(_AUX_SOURCE) && !defined(AUX)
937
# ifdef NLIST_NAME_UNION
938
nl[0].n_un.n_name = "$av";
940
nl[0].n_name = "$av";
943
strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name));
945
nlist(LOADAV_UNIX, nl);
946
if (nl[0].n_value == 0)
951
if test "$av" = _Loadavg; then
952
nlist64='#define nlist nlist64'
955
if test -z "$avensym" ; then
956
AC_NOTE(- no avenrun symbol found)
958
AC_NOTE(- using avenrun symbol '$avensym')
959
AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,"$avensym")
960
if test -n "$nlist64"; then
961
AC_NOTE(- used nlist64 to find it)
962
AC_DEFINE(LOADAV_USE_NLIST64)
967
AC_NOTE( Can't configure the load average display feature)
968
AC_NOTE( because $core is not readable by you.)
969
AC_NOTE( To configure the load average display feature,)
970
AC_NOTE( re-run configure as root if possible.)
971
AC_NOTE( If you are not the system administrator then disregard)
972
AC_NOTE( this warning. You can still use screen without)
973
AC_NOTE( the load average display feature.)
979
#include <sys/types.h>
980
#include <sys/param.h>
982
#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))
984
# if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
987
# if defined(FSCALE) && !defined(__osf__)
995
# if defined(MIPS) || defined(SVR4) || defined(m88k)
997
# else /* not MIPS */
998
loadscale=1000 /* our default value */
1001
# endif /* not FSCALE */
1002
# endif /* not apollo */
1014
if test -n "$load" ; then AC_DEFINE(LOADAV) fi
1015
if test -n "$loadtype" ; then AC_DEFINE_UNQUOTED(LOADAV_TYPE,$loadtype) fi
1016
if test -n "$loadnum" ; then AC_DEFINE_UNQUOTED(LOADAV_NUM,$loadnum) fi
1017
if test -n "$loadscale" ; then AC_DEFINE_UNQUOTED(LOADAV_SCALE,$loadscale) fi
1020
dnl **** signal handling ****
1022
if test -n "$posix" ; then
1024
dnl POSIX has reliable signals with void return type.
1025
AC_NOTE(assuming posix signal definition)
1030
AC_CHECKING(return type of signal handlers)
1032
[#include <sys/types.h>
1037
extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
1040
#include <sys/types.h>
1044
sigset(0, (void (*)())0);
1046
sigset(0, (int (*)())0);
1048
], AC_DEFINE(USESIGSET))
1049
AC_CHECKING(signal implementation)
1051
#include <sys/types.h>
1055
#define SIGCLD SIGCHLD
1058
#define signal sigset
1073
/* on hpux we use sigvec to get bsd signals */
1075
(void)signal(SIGCLD, hand);
1076
kill(getpid(), SIGCLD);
1077
kill(getpid(), SIGCLD);
1083
],,AC_DEFINE(SYSVSIGS))
1088
dnl **** libraries ****
1091
AC_CHECKING(for crypt and sec libraries)
1092
test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
1094
LIBS="$LIBS -lcrypt"
1096
AC_TRY_LINK(,,,LIBS="$oldlibs")
1097
test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
1098
test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
1101
AC_CHECKING(IRIX sun library)
1102
AC_TRY_LINK(,,,LIBS="$oldlibs")
1105
AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS"
1107
AC_CHECKING(syslog in libbsd.a)
1108
AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="$oldlibs"
1109
AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])])
1115
], LIBS="$LIBS -lsocket -lcrypt_i")
1118
dnl **** misc things ****
1120
AC_CHECKING(wait union)
1121
AC_TRY_COMPILE([#include <sys/types.h>
1122
#include <sys/wait.h>
1129
],AC_DEFINE(BSDWAIT))
1131
if test -z "$butterfly"; then
1132
AC_CHECKING(for termio or termios)
1133
AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
1134
if test -n "$posix"; then
1135
AC_TRY_CPP([#include <termios.h>], AC_DEFINE(TERMIO))
1140
dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
1141
AC_CHECKING(getspnam)
1142
AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
1144
AC_CHECKING(getttyent)
1145
AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
1148
AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
1150
AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
1154
strcpy(buf, "abcdefghi");
1155
bcopy(buf, buf + 2, 3);
1156
if (strncmp(buf, "ababcf", 6))
1158
strcpy(buf, "abcdefghi");
1159
bcopy(buf + 2, buf, 3);
1160
if (strncmp(buf, "cdedef", 6))
1162
exit(0); /* libc version works properly. */
1163
}], AC_DEFINE(USEBCOPY))
1166
#define bcopy(s,d,l) memmove(d,s,l)
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(USEMEMMOVE))
1182
#define bcopy(s,d,l) memcpy(d,s,l)
1185
strcpy(buf, "abcdefghi");
1186
bcopy(buf, buf + 2, 3);
1187
if (strncmp(buf, "ababcf", 6))
1189
strcpy(buf, "abcdefghi");
1190
bcopy(buf + 2, buf, 3);
1191
if (strncmp(buf, "cdedef", 6))
1193
exit(0); /* libc version works properly. */
1194
}], AC_DEFINE(USEMEMCPY))
1196
AC_MSG_CHECKING(long file names)
1197
(echo 1 > /tmp/conftest9012345) 2>/dev/null
1198
(echo 2 > /tmp/conftest9012346) 2>/dev/null
1199
val=`cat /tmp/conftest9012345 2>/dev/null`
1200
if test -f /tmp/conftest9012345 && test "$val" = 1; then
1204
AC_DEFINE(NAME_MAX, 14)
1206
rm -f /tmp/conftest*
1208
AC_MSG_CHECKING(for vsprintf)
1209
AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
1213
AC_MSG_CHECKING(for setenv)
1214
AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
1216
AC_MSG_CHECKING(for putenv)
1217
AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)
1219
AC_MSG_CHECKING([for nl_langinfo(CODESET)])
1221
#include <langinfo.h>
1222
],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no))
1224
AC_SEARCH_LIBS(gethostname, nsl)
1226
AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime)
1228
AC_ARG_ENABLE(pam, [ --enable-pam enable PAM support])
1229
if test "$enable_pam" = "yes"; then
1230
AC_MSG_CHECKING(for PAM support)
1233
AC_TRY_LINK([#include <security/pam_appl.h>], [
1234
pam_start(0, 0, 0, 0);
1235
pam_authenticate(0, 0);
1237
], AC_MSG_RESULT(yes);AC_DEFINE(USE_PAM),
1238
AC_MSG_RESULT(no);LIBS="$oldlibs")
1241
AC_ARG_ENABLE(use_locale, [ --enable-locale use localized month/day names])
1242
if test "$enable_use_locale" = "yes"; then
1243
AC_DEFINE(USE_LOCALE)
1245
AC_ARG_ENABLE(telnet, [ --enable-telnet enable builtin telnet])
1246
if test "$enable_telnet" = "yes"; then
1247
AC_DEFINE(BUILTIN_TELNET)
1249
AC_ARG_ENABLE(colors256, [ --enable-colors256 enable support for 256 colors])
1250
if test "$enable_colors256" = "yes"; then
1251
AC_DEFINE(COLORS256)
1253
AC_ARG_ENABLE(rxvt_osc, [ --enable-rxvt_osc enable support for rxvt OSC codes])
1254
if test "$enable_rxvt_osc" = "yes"; then
1259
dnl **** the end ****
1261
if test -z "$old_CFLAGS"; then
1262
if test "x$CFLAGS" = "x-g"; then
1266
dnl Ptx bug workaround -- insert -lc after -ltermcap
1267
test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
1269
AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
1271
ETCSCREENRC="\"/usr/local/etc/screenrc\""
1272
if test -n "$prefix"; then
1273
ETCSCREENRC="\"$prefix/etc/screenrc\""
1275
AC_MSG_CHECKING(for the global screenrc file)
1276
AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path where to put the global screenrc file], [ ETCSCREENRC="\"${withval}\"" ])
1277
AC_DEFINE_UNQUOTED(ETCSCREENRC,$ETCSCREENRC)
1278
AC_MSG_RESULT($ETCSCREENRC)
1280
SCREENENCODINGS="\"/usr/local/lib/screen/utf8encodings\""
1281
if test -n "$datadir"; then
1282
eval SCREENENCODINGS="$datadir/screen/utf8encodings"
1283
SCREENENCODINGS="\"$SCREENENCODINGS\""
1285
AC_MSG_CHECKING(for the utf8-encodings location)
1286
AC_DEFINE_UNQUOTED(SCREENENCODINGS,$SCREENENCODINGS)
1287
AC_MSG_RESULT($SCREENENCODINGS)
1289
AC_OUTPUT(Makefile doc/Makefile, [[
1290
# a hook for preserving undef directive in config.h
1291
mv config.h conftest
1292
sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h
1297
if test -z "$AWK"; then
1298
echo "!!! Since you have no awk you must copy the files 'comm.h.dist'"
1299
echo "!!! and 'term.h.dist' to 'comm.h' and 'term.h'."
1300
echo "!!! Do _not_ change the user configuration section in config.h!"
1301
echo "Please check the pathnames in the Makefile."
1303
echo "Now please check the pathnames in the Makefile and in the user"
1304
echo "configuration section in config.h."
1306
echo "Then type 'make' to make screen. Good luck."