diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 208 |
1 files changed, 181 insertions, 27 deletions
diff --git a/configure.in b/configure.in index f10734d..98dd2cf 100644 --- a/configure.in +++ b/configure.in @@ -14,11 +14,12 @@ dnl Define some useful macros dnl AC_DEFUN(AC_PROGRAM_SOURCE, [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF +#include "confdefs.h" [$1] _CUT_HERE_ [$2] EOF -eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' > conftest.out" +eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out" . ./conftest.out rm -f conftest* ])dnl @@ -39,6 +40,7 @@ AC_SUBST(VERSION) AC_PREFIX_PROGRAM(screen) AC_PREFIX_PROGRAM(gzip) +old_CFLAGS="$CFLAGS" AC_PROG_CC AC_PROG_CPP AC_PROG_GCC_TRADITIONAL @@ -78,6 +80,26 @@ AC_CHECKING(for buggy tools) sh etc/toolcheck 1>&AC_FD_MSG fi + + +dnl SOCKDIR +AC_MSG_CHECKING(if a system-wide socket dir should be used) +AC_ARG_ENABLE(socket-dir, + [ --disable-socket-dir disable system wide socket-dir and use ~/.screen instead], + [ + AC_MSG_RESULT(no. ~/.screen will be used instead.) + ], + [ + AC_MSG_RESULT(yes) + AC_MSG_CHECKING(for the socket dir) + SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")" + AC_ARG_WITH(socket-dir, [ --with-socket-dir=path where to put the per-user sockets], [ SOCKDIR="\"${withval}\"" ]) + AC_MSG_RESULT(${SOCKDIR}) + AC_DEFINE_UNQUOTED(SOCKDIR, $SOCKDIR) + ] +) + + dnl dnl **** special unix variants **** dnl @@ -288,7 +310,11 @@ char *fin = "/tmp/conftest$$"; main() { struct stat stb; +#ifdef FD_SET + fd_set f; +#else int f; +#endif (void)alarm(5); #ifdef POSIX @@ -322,7 +348,11 @@ main() exit(1); exit(0); } +#ifdef FD_SET + FD_SET(0, &f); +#else f = 1; +#endif if (select(1, &f, 0, 0, 0) == -1) exit(1); exit(0); @@ -351,7 +381,11 @@ char *fin = "/tmp/conftest$$"; main() { struct timeval tv; - int r, x; +#ifdef FD_SET + fd_set f; +#else + int f; +#endif #ifdef POSIX if (mkfifo(fin, 0600)) @@ -362,10 +396,14 @@ main() close(0); if (open(fin, O_RDONLY|O_NONBLOCK)) exit(1); - r = 1; +#ifdef FD_SET + FD_SET(0, &f); +#else + f = 1; +#endif tv.tv_sec = 1; tv.tv_usec = 0; - if (select(1, &r, 0, 0, &tv)) + if (select(1, &f, 0, 0, &tv)) exit(1); exit(0); } @@ -391,8 +429,13 @@ char *son = "/tmp/conftest$$"; main() { - int s1, s2, s3, l; + int s1, s2, l; struct sockaddr_un a; +#ifdef FD_SET + fd_set f; +#else + int f; +#endif (void)alarm(5); if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) @@ -417,8 +460,12 @@ main() close(0); if (accept(s1, &a, &l)) exit(1); - l = 1; - if (select(1, &l, 0, 0, 0) == -1) +#ifdef FD_SET + FD_SET(0, &f); +#else + f = 1; +#endif + if (select(1, &f, 0, 0, 0) == -1) exit(1); exit(0); } @@ -508,7 +555,11 @@ char *nam = "/tmp/conftest$$"; main() { - int l; +#ifdef FD_SET + fd_set f; +#else + int f; +#endif #ifdef __FreeBSD__ /* From Andrew A. Chernov (ache@astral.msk.su): @@ -538,8 +589,13 @@ main() main() { - int s1, s2, s3, l; + int s1, s2, l; struct sockaddr_un a; +#ifdef FD_SET + fd_set f; +#else + int f; +#endif (void)alarm(5); if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) @@ -567,20 +623,25 @@ main() #endif - l = 1; - if (select(1, &l, 0, 0, 0) == -1) +#ifdef FD_SET + FD_SET(0, &f); +#else + f = 1; +#endif + if (select(1, &f, 0, 0, 0) == -1) exit(1); - if (select(1, &l, &l, 0, 0) != 2) + if (select(1, &f, &f, 0, 0) != 2) exit(1); exit(0); } ],AC_NOTE(- select is ok), -AC_NOTE(- it is not usable) AC_DEFINE(SELECT_BROKEN)) +AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN)) dnl dnl **** termcap or terminfo **** dnl AC_CHECKING(for tgetent) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, olibs="$LIBS" LIBS="-lcurses $olibs" AC_CHECKING(libcurses) @@ -600,7 +661,7 @@ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, LIBS="-lncurses $olibs" AC_CHECKING(libncurses) AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, -AC_MSG_ERROR(!!! no tgetent - no screen))))) +AC_MSG_ERROR(!!! no tgetent - no screen)))))) AC_TRY_RUN([ main() @@ -624,6 +685,8 @@ if test -c /dev/ptmx ; then AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],AC_DEFINE(HAVE_SVR4_PTYS)) fi +AC_CHECK_FUNCS(getpt) + AC_CHECKING(for ptyranges) if test -d /dev/ptym ; then pdir='/dev/ptym' @@ -684,14 +747,47 @@ main() ],[ if test -f conftest_grp; then ptygrp=`cat conftest_grp` - AC_NOTE(- pty mode: 0620, group: $ptygrp) + AC_NOTE([- pty mode: 0620, group: $ptygrp]) AC_DEFINE(PTYMODE, 0620) AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) else AC_NOTE(- ptys are world accessable) fi -], - AC_NOTE(- can't determine - assume ptys are world accessable) +],[ + WRITEPATH='' + XTERMPATH='' + AC_PATH_PROG(WRITEPATH, write) + AC_PATH_PROG(XTERMPATH, xterm) + found= + if test -n "$WRITEPATH$XTERMPATH"; then + findfollow= + lsfollow= + found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null` + if test -n "$found"; then + findfollow=-follow + lsfollow=L + fi + if test -n "$XTERMPATH"; then + ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'` + if test tty != "$ptygrpn"; then + XTERMPATH= + fi + fi + fi + if test -n "$WRITEPATH$XTERMPATH"; then + found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print` + if test -n "$found"; then + ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'` + AC_NOTE([- pty mode: 0620, group: $ptygrp]) + AC_DEFINE(PTYMODE, 0620) + AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) + else + AC_NOTE(- ptys are world accessable) + fi + else + AC_NOTE(- can't determine - assume ptys are world accessable) + fi + ] ) rm -f conftest_grp @@ -804,7 +900,8 @@ else ],AC_DEFINE(NLIST_DECLARED)) AC_CHECKING(for avenrun symbol) - for av in avenrun _avenrun _Loadavg ; do + nlist64= + for av in avenrun _avenrun _Loadavg avenrun _avenrun _Loadavg; do AC_TRY_RUN([ #include <sys/types.h> #ifdef NLIST_STRUCT @@ -813,11 +910,7 @@ else #include <a.out.h> #endif -#ifdef __sgi -# if _MIPS_SZLONG == 64 || (defined(_MIPS_ISA) && _MIPS_ISA > 2) -# define nlist nlist64 -# endif -#endif +$nlist64 struct nlist nl[2]; @@ -838,12 +931,19 @@ main() exit(0); } ],avensym=$av;break) + if test "$av" = _Loadavg; then + nlist64='#define nlist nlist64' + fi done if test -z "$avensym" ; then AC_NOTE(- no avenrun symbol found) else AC_NOTE(- using avenrun symbol '$avensym') AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,"$avensym") + if test -n "$nlist64"; then + AC_NOTE(- used nlist64 to find it) + AC_DEFINE(LOADAV_USE_NLIST64) + fi load=1 fi else @@ -862,7 +962,7 @@ AC_PROGRAM_SOURCE([ #include <sys/types.h> #include <sys/param.h> ],[ -#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || !(defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k)) +#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)) loadtype=long # if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) loadscale=65536 @@ -988,7 +1088,7 @@ AC_CHECKING(syslog) AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS" LIBS="$LIBS -lbsd" AC_CHECKING(syslog in libbsd.a) -AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="oldlibs" +AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="$oldlibs" AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])]) AC_EGREP_CPP(yes, @@ -1096,19 +1196,73 @@ AC_MSG_RESULT(no) AC_MSG_CHECKING(for putenv) AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV) )) +AC_MSG_CHECKING([for nl_langinfo(CODESET)]) +AC_TRY_LINK([ +#include <langinfo.h> +],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no)) + +AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime) + +AC_ARG_ENABLE(pam, [ --enable-pam enable PAM support]) +if test "$enable_pam" = "yes"; then + AC_MSG_CHECKING(for PAM support) + oldlibs="$LIBS" + LIBS="$LIBS -lpam" + AC_TRY_LINK([#include <security/pam_appl.h>], [ + pam_start(0, 0, 0, 0); + pam_authenticate(0, 0); + pam_end(0,0); + ], AC_MSG_RESULT(yes);AC_DEFINE(USE_PAM), + AC_MSG_RESULT(no);LIBS="$oldlibs") +fi -AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd) +AC_ARG_ENABLE(use_locale, [ --enable-locale use localized month/day names]) +if test "$enable_use_locale" = "yes"; then + AC_DEFINE(USE_LOCALE) +fi +AC_ARG_ENABLE(telnet, [ --enable-telnet enable builtin telnet]) +if test "$enable_telnet" = "yes"; then + AC_DEFINE(BUILTIN_TELNET) +fi +AC_ARG_ENABLE(colors256, [ --enable-colors256 enable support for 256 colors]) +if test "$enable_colors256" = "yes"; then + AC_DEFINE(COLORS256) +fi +AC_ARG_ENABLE(rxvt_osc, [ --enable-rxvt_osc enable support for rxvt OSC codes]) +if test "$enable_rxvt_osc" = "yes"; then + AC_DEFINE(RXVT_OSC) +fi dnl dnl **** the end **** dnl +if test -z "$old_CFLAGS"; then + if test "x$CFLAGS" = "x-g"; then + CFLAGS="-O" + fi +fi dnl Ptx bug workaround -- insert -lc after -ltermcap test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.)) + +ETCSCREENRC="\"/usr/local/etc/screenrc\"" if test -n "$prefix"; then -AC_DEFINE_UNQUOTED(ETCSCREENRC,"$prefix/etc/screenrc") +ETCSCREENRC="\"$prefix/etc/screenrc\"" +fi +AC_MSG_CHECKING(for the global screenrc file) +AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path where to put the global screenrc file], [ ETCSCREENRC="\"${withval}\"" ]) +AC_DEFINE_UNQUOTED(ETCSCREENRC,$ETCSCREENRC) +AC_MSG_RESULT($ETCSCREENRC) + +SCREENENCODINGS="\"/usr/local/lib/screen/utf8encodings\"" +if test -n "$datadir"; then +eval SCREENENCODINGS="$datadir/screen/utf8encodings" +SCREENENCODINGS="\"$SCREENENCODINGS\"" fi +AC_MSG_CHECKING(for the utf8-encodings location) +AC_DEFINE_UNQUOTED(SCREENENCODINGS,$SCREENENCODINGS) +AC_MSG_RESULT($SCREENENCODINGS) AC_OUTPUT(Makefile doc/Makefile, [[ # a hook for preserving undef directive in config.h |