3 # Patch by Hannes Reich (hannes@skynet.ie) 22-Jul-2005
4 # Resolves _some_ of the cross-compilation issues in screen's configure.in
7 --- screen-4.0.1/configure.in~configure
8 +++ screen-4.0.1/configure.in
10 VERSION="$rev.$vers.$pat"
11 AC_NOTE(this is screen version $VERSION)
15 +/* Copyright (c) 1993-2000
16 + * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
17 + * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
18 + * Copyright (c) 1987 Oliver Laumann
20 + * This program is free software; you can redistribute it and/or modify
21 + * it under the terms of the GNU General Public License as published by
22 + * the Free Software Foundation; either version 2, or (at your option)
23 + * any later version.
25 + * This program is distributed in the hope that it will be useful,
26 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 + * GNU General Public License for more details.
30 + * You should have received a copy of the GNU General Public License
31 + * along with this program (see the file COPYING); if not, write to the
32 + * Free Software Foundation, Inc.,
33 + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
38 +/**********************************************************************
40 + * User Configuration Section
44 + * Maximum of simultaneously allowed windows per screen session.
51 + * Define SOCKDIR to be the directory to contain the named sockets
52 + * screen creates. This should be in a common subdirectory, such as
53 + * /usr/local or /tmp. It makes things a little more secure if you
54 + * choose a directory which is not writable by everyone or where the
55 + * "sticky" bit is on, but this isn't required.
56 + * If SOCKDIR is not defined screen will put the named sockets in
57 + * the user's home directory. Notice that this can cause you problems
58 + * if some user's HOME directories are AFS- or NFS-mounted. Especially
59 + * AFS is unlikely to support named sockets.
61 + * Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison).
66 + * Define this if the SOCKDIR is not shared between hosts.
68 +#define SOCKDIR_IS_LOCAL_TO_HOST
71 + * Screen sources two startup files. First a global file with a path
72 + * specified here, second your local $HOME/.screenrc
73 + * Don't define this, if you don't want it.
76 +# define ETCSCREENRC "/usr/local/etc/screenrc"
80 + * Screen can look for the environment variable $SYSSCREENRC and -if it
81 + * exists- load the file specified in that variable as global screenrc.
82 + * If you want to enable this feature, define ALLOW_SYSSCREENRC to one (1).
83 + * Otherwise ETCSCREENRC is always loaded.
85 +#define ALLOW_SYSSCREENRC 1
88 + * Screen needs encoding files for the translation of utf8
89 + * into some encodings, e.g. JIS, BIG5.
90 + * Only needed if FONT, ENCODINGS and UTF8 are defined.
92 +#ifndef SCREENENCODINGS
93 +# define SCREENENCODINGS "/usr/local/lib/screen/encodings"
96 + * Define CHECKLOGIN to force Screen users to enter their Unix password
97 + * in addition to the screen password.
99 + * Define NOSYSLOG if yo do not have logging facilities. Currently
100 + * syslog() will be used to trace ``su'' commands only.
102 +#define CHECKLOGIN 1
107 + * define PTYMODE if you do not like the default of 0622, which allows
108 + * public write to your pty.
109 + * define PTYGROUP to some numerical group-id if you do not want the
110 + * tty to be in "your" group.
111 + * Note, screen is unable to change mode or group of the pty if it
112 + * is not installed with sufficient privilege. (e.g. set-uid-root)
113 + * define PTYROFS if the /dev/pty devices are mounted on a read-only
114 + * filesystem so screen should not even attempt to set mode or group
115 + * even if running as root (e.g. on TiVo).
122 + * If screen is NOT installed set-uid root, screen can provide tty
123 + * security by exclusively locking the ptys. While this keeps other
124 + * users from opening your ptys, it also keeps your own subprocesses
125 + * from being able to open /dev/tty. Define LOCKPTY to add this
126 + * exclusive locking.
131 + * If you'd rather see the status line on the first line of your
132 + * terminal rather than the last, define TOPSTAT.
137 + * define DETACH can detach a session. An absolute 'must'.
142 + * here come the erlangen extensions to screen:
143 + * define LOCK if you want to use a lock program for a screenlock.
144 + * define PASSWORD for secure reattach of your screen.
145 + * define COPY_PASTE to use the famous hacker's treasure zoo.
146 + * define POW_DETACH to have a detach_and_logout key (requires DETACH).
147 + * define REMOTE_DETACH (-d option) to move screen between terminals.
148 + * define AUTO_NUKE to enable Tim MacKenzies clear screen nuking
149 + * define PSEUDOS to allow window input/output filtering
150 + * define MULTI to allow multiple attaches.
151 + * define MULTIUSER to allow other users attach to your session
152 + * (if they are in the acl, of course)
153 + * define MAPKEYS to include input keyboard translation.
154 + * define FONT to support ISO2022/alternet charset support
155 + * define COLOR to include ansi color support. This may expose
156 + * a bug in x11r6-color-xterm.
157 + * define DW_CHARS to include support for double-width character
159 + * define ENCODINGS to include support for encodings like euc or big5.
160 + * Needs FONT to work.
161 + * define UTF8 if you want support for UTF-8 encoding.
162 + * Needs FONT and ENCODINGS to work.
163 + * define COLORS16 if you want 16 colors.
164 + * Needs COLOR to work.
165 + * define BUILTIN_TELNET to add telnet support to screen.
166 + * Syntax: screen //telnet host [port]
167 + * define RXVT_OSC if you want support for rxvts special
168 + * change fgcolor/bgcolor/bgpicture sequences
171 +#ifndef SIMPLESCREEN
175 +# define REMOTE_DETACH
189 +# define BLANKER_PRG
190 +#endif /* SIMPLESCREEN */
192 +#undef BUILTIN_TELNET
198 + * If you have a braille display you should define HAVE_BRAILLE.
199 + * The code inside #ifdef HAVE_BRAILLE was contributed by Hadi Bargi
200 + * Rangin (bargi@dots.physics.orst.edu).
201 + * WARNING: this is more or less unsupported code, it may be full of
202 + * bugs leading to security holes, enable at your own risk!
208 + * As error messages are mostly meaningless to the user, we
209 + * try to throw out phrases that are somewhat more familiar
210 + * to ...well, at least familiar to us NetHack players.
214 +#endif /* NONETHACK */
217 + * If screen is installed with permissions to update /etc/utmp (such
218 + * as if it is installed set-uid root), define UTMPOK.
222 +/* Set LOGINDEFAULT to one (1)
223 + * if you want entries added to /etc/utmp by default, else set it to
225 + * LOGINDEFAULT will be one (1) whenever LOGOUTOK is undefined!
227 +#define LOGINDEFAULT 1
229 +/* Set LOGOUTOK to one (1)
230 + * if you want the user to be able to log her/his windows out.
231 + * (Meaning: They are there, but not visible in /etc/utmp).
232 + * Disabling this feature only makes sense if you have a secure /etc/utmp
234 + * Negative examples: suns usually have a world writable utmp file,
235 + * xterm will run perfectly without s-bit.
237 + * If LOGOUTOK is undefined and UTMPOK is defined, all windows are
238 + * initially and permanently logged in.
240 + * Set CAREFULUTMP to one (1) if you want that users have at least one
241 + * window per screen session logged in.
248 + * If UTMPOK is defined and your system (incorrectly) counts logins by
249 + * counting non-null entries in /etc/utmp (instead of counting non-null
250 + * entries with no hostname that are not on a pseudo tty), define USRLIMIT
251 + * to have screen put an upper-limit on the number of entries to write
252 + * into /etc/utmp. This helps to keep you from exceeding a limited-user
258 + * both must be defined if you want to favor tcsendbreak over
259 + * other calls to generate a break condition on serial lines.
260 + * (Do not bother, if you are not using plain tty windows.)
262 +#define POSIX_HAS_A_GOOD_TCSENDBREAK
263 +#define SUNOS4_AND_WE_TRUST_TCSENDBREAK
266 + * to lower the interrupt load on the host machine, you may want to
267 + * adjust the VMIN and VTIME settings used for plain tty windows.
268 + * See the termio(4) manual page (Non-Canonical Mode Input Processing)
270 + * if undefined, VMIN=1, VTIME=0 is used as a default - this gives you
271 + * best user responsiveness, but highest interrupt frequency.
272 + * (Do not bother, if you are not using plain tty windows.)
278 + * looks like the above values are ignored by setting FNDELAY.
279 + * This is default for all pty/ttys, you may disable it for
280 + * ttys here. After playing with it for a while, one may find out
281 + * that this feature may cause screen to lock up.
284 +# define TTY_DISABLE_FNBLOCK /* select barfs without it ... */
289 + * Some terminals, e.g. Wyse 120, use a bitfield to select attributes.
290 + * This doesn't work with the standard so/ul/m? terminal entries,
291 + * because they will cancel each other out.
292 + * On TERMINFO machines, "sa" (sgr) may work. If you want screen
293 + * to switch attributes only with sgr, define USE_SGR.
294 + * This is *not* recomended, do this only if you must.
300 + * Define USE_LOCALE if you want screen to use the locale names
301 + * for the name of the month and day of the week.
306 + * Define USE_PAM if your system supports PAM (Pluggable Authentication
307 + * Modules) and you want screen to use it instead of calling crypt().
308 + * (You may also need to add -lpam to LIBS in the Makefile.)
313 + * Define CHECK_SCREEN_W if you want screen to set TERM to screen-w
314 + * if the terminal width is greater than 131 columns. No longer needed
315 + * on modern systems which use $COLUMNS or the tty settings instead.
317 +#undef CHECK_SCREEN_W
319 +/**********************************************************************
321 + * End of User Configuration Section
323 + * Rest of this file is modified by 'configure'
324 + * Change at your own risk!
330 AC_PREFIX_PROGRAM(screen)
331 AC_PREFIX_PROGRAM(gzip)
334 AC_PROG_GCC_TRADITIONAL
337 +AC_MSG_CHECKING([for compiler sanity])
338 AC_TRY_RUN(main(){exit(0);},,[
339 if test $CC != cc ; then
340 AC_NOTE(Your $CC failed - restarting with CC=cc)
343 exec $0 $configure_args
347 -AC_TRY_RUN(main(){exit(0);},,
350 -AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
351 -AC_NOTE($ac_compile)
352 -AC_MSG_ERROR(Can't run the compiler - sorry))
353 +],AC_MSG_WARN([skipping test due to crosscompilation]))
355 +AC_MSG_CHECKING([if compiler sets exit status])
359 int __something_strange_();
360 __something_strange_(0);
362 -],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
363 +],AC_MSG_ERROR(Your compiler does not set the exit status - sorry),,
364 +AC_MSG_WARN(skipping test due to crosscompilation))
370 dnl **** special unix variants ****
373 if test -n "$ISC"; then
374 AC_DEFINE(ISC) LIBS="$LIBS -linet"
376 @@ -114,11 +428,13 @@
380 +AH_TEMPLATE([sysV68],[])
381 if test -f /sysV68 ; then
385 AC_CHECKING(for MIPS)
386 +AH_TEMPLATE([MIPS],[])
387 if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
389 test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
392 AC_TRY_LINK(,[wait3();], ,
394 +AH_TEMPLATE([USE_WAIT2],[On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com])
395 +dnl TODO(Hannes) shipped config.h.in wraps the define in #ifdef BSDWAIT
396 AC_TRY_LINK(,[wait2();],
397 dnl John Rouillard (rouilj@sni-usa.com):
398 dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
402 AC_CHECKING(Pyramid OSX)
403 +AH_TEMPLATE([OSX], [Pyramid OSX])
404 AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
407 +AH_TEMPLATE([POSIX],[Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX).])
408 dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
409 dnl BBN butterfly is not POSIX, but a MACH BSD system.
410 dnl Do not define POSIX and TERMIO.
414 AC_CHECKING(for System V)
415 +AH_TEMPLATE([SYSV], [Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX)])
417 [#include <sys/types.h>
423 +AH_TEMPLATE([SVR4],[])
424 +AH_TEMPLATE([BUGGYGETLOGIN],
425 +[If ttyslot() breaks getlogin() by returning indexes to utmp entries
426 + of type DEAD_PROCESS, then our getlogin() replacement should be
427 + selected by defining BUGGYGETLOGIN.])
428 AC_TRY_LINK([#include <utmpx.h>
430 [AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
434 AC_CHECKING(BSD job jontrol)
435 +AH_TEMPLATE([BSDJOBS],
436 +[Define BSDJOBS if you have BSD-style job control (both process
437 + groups and a tty that deals correctly with them)])
439 [#include <sys/types.h>
440 #include <sys/ioctl.h>
442 dnl **** setreuid(), seteuid() ****
444 AC_CHECKING(setreuid)
445 +AH_TEMPLATE([HAVE_SETREUID],
446 +[If your system has the calls setreuid() and setregid(),
447 + define HAVE_SETREUID. Otherwise screen will use a forked process to
448 + safely create output files without retaining any special privileges.])
453 dnl Solaris seteuid doesn't change the saved uid, bad for
454 dnl multiuser screen sessions
456 +AH_TEMPLATE([HAVE_SETEUID],
457 +[If your system supports BSD4.4's seteuid() and setegid(), define
460 #if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
461 seteuid_is_broken(0);
463 dnl **** FIFO tests ****
467 +AC_CACHE_CHECK([usable fifos],
468 + [screen_cv_sys_fifo_usable],
470 #include <sys/types.h>
471 #include <sys/stat.h>
472 @@ -357,12 +694,14 @@
476 -], AC_NOTE(- your fifos are usable) fifo=1,
477 -AC_NOTE(- your fifos are not usable))
478 -rm -f /tmp/conftest*
479 +], screen_cv_sys_fifo_usable=yes, screen_cv_sys_fifo_usable=no))
481 -if test -n "$fifo"; then
482 -AC_CHECKING(for broken fifo implementation)
483 +if test X"$screen_cv_sys_fifo_usable" = Xyes; then
484 +AH_TEMPLATE([BROKEN_PIPE],
485 +[Define this if your system exits select() immediatly if a pipe is
486 + opened read-only and no writer has opened it.])
487 +AC_CACHE_CHECK([broken fifo implementation],
488 + [screen_cv_sys_fifo_broken_impl],
490 #include <sys/types.h>
496 -], AC_NOTE(- your implementation is ok),
497 -AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
498 -rm -f /tmp/conftest*
499 +], screen_cv_sys_fifo_broken_impl=no,
500 +screen_cv_sys_fifo_broken_impl=yes))
501 +if test X"$screen_cv_sys_fifo_broken_impl" = Xyes; then
502 + AC_DEFINE(BROKEN_PIPE)
508 dnl may need LIBS="$LIBS -lsocket" here
511 -AC_CHECKING(sockets)
512 +AC_CACHE_CHECK([sockets are usable],
513 + [screen_cv_sys_sockets_usable],
515 #include <sys/types.h>
516 #include <sys/socket.h>
517 @@ -469,12 +811,16 @@
521 -], AC_NOTE(- your sockets are usable) sock=1,
522 -AC_NOTE(- your sockets are not usable))
523 -rm -f /tmp/conftest*
524 +], screen_cv_sys_sockets_usable=yes,
525 +screen_cv_sys_sockets_usable=no))
527 -if test -n "$sock"; then
528 +if test X"$screen_cv_sys_sockets_usable" = Xyes; then
529 AC_CHECKING(socket implementation)
530 +AH_TEMPLATE([SOCK_NOT_IN_FS],
531 +[Define this if the unix-domain socket implementation doesn't
532 + create a socket in the filesystem.])
533 +AC_CACHE_CHECK([if sockets are not stored in the filesystem],
534 + [screen_cv_sys_sockets_nofs],
536 #include <sys/types.h>
537 #include <sys/stat.h>
538 @@ -500,22 +846,25 @@
542 -],AC_NOTE(- you are normal),
543 -AC_NOTE(- unix domain sockets are not kept in the filesystem)
544 -AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
545 -rm -f /tmp/conftest*
546 +], screen_cv_sys_sockets_nofs=no,
547 +screen_cv_sys_sockets_nofs=yes))
549 +if test X"$screen_cv_sys_sockets_nofs" = Xyes; then
550 + AC_DEFINE(SOCK_NOT_IN_FS)
556 dnl **** choose sockets or fifos ****
558 -if test -n "$fifo"; then
559 - if test -n "$sock"; then
560 - if test -n "$nore"; then
561 +AH_TEMPLATE([NAMEDPIPE], [Define this if your system supports named pipes.])
562 +if test X"$screen_cv_sys_fifo_usable" = Xyes; then
563 + if test X"$screen_cv_sys_sockets_usable" = Xyes; then
564 + if test X"$screen_cv_sys_sockets_nofs" = Xyes; then
565 AC_NOTE(- hmmm... better take the fifos)
567 - elif test -n "$fifobr"; then
568 + elif test X"$screen_cv_sys_fifo_broken_impl" = Xyes; then
569 AC_NOTE(- as your fifos are broken lets use the sockets.)
571 AC_NOTE(- both sockets and fifos usable. let's take fifos.)
573 AC_NOTE(- using named pipes, of course)
576 -elif test -n "$sock"; then
577 +elif test X"$screen_cv_sys_sockets_usable" = Xyes; then
578 AC_NOTE(- using unix-domain sockets, of course)
580 AC_MSG_ERROR(you have neither usable sockets nor usable pipes -> no screen)
582 dnl **** check the select implementation ****
585 -AC_CHECKING(select return value)
586 +AH_TEMPLATE([SELECT_BROKEN],
587 +[If the select return value doesn't treat a descriptor that is
588 + usable for reading and writing as two hits, define SELECT_BROKEN.])
589 +AC_CACHE_CHECK([for broken select return value],
590 + [screen_cv_sys_select_broken_retval],
592 #include <sys/types.h>
593 #include <sys/stat.h>
594 @@ -634,19 +987,26 @@
598 -],AC_NOTE(- select is ok),
599 -AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
600 +], screen_cv_sys_select_broken_retval=no,
601 +screen_cv_sys_select_broken_retval=yes))
602 +if test X"$screen_cv_sys_select_broken_retval" = Xyes; then
603 + AC_DEFINE(SELECT_BROKEN)
607 dnl **** termcap or terminfo ****
609 +AH_TEMPLATE([TERMINFO],
610 +[Define TERMINFO if your machine emulates the termcap routines
611 + with the terminfo database.
612 + Thus the .screenrc file is parsed for
613 + the command 'terminfo' and not 'termcap'])
615 AC_CHECKING(for tgetent)
616 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
618 -if test -f /usr/lib/libncursesw.so ; then
619 - LIBS="-lncursesw $olibs"
621 AC_CHECKING(libncursesw)
622 +AC_CHECK_LIB(ncursesw,tgetent)
623 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
624 LIBS="-lcurses $olibs"
625 AC_CHECKING(libcurses)
626 @@ -668,24 +1028,39 @@
627 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
628 AC_MSG_ERROR(!!! no tgetent - no screen)))))))
631 +AC_CACHE_CHECK([using terminfo database],[screen_cv_sys_terminfo_used],
635 exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
636 -}], AC_NOTE(- you use the termcap database),
637 -AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
639 + ], screen_cv_sys_terminfo_used=no,
640 + screen_cv_sys_terminfo_used=yes)
643 +if test X"$screen_cv_sys_terminfo_used" = Xyes; then
644 + AC_DEFINE(TERMINFO)
648 +AH_TEMPLATE([NEED_OSPEED],[If your library does not define ospeed, define this.])
649 AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
652 dnl **** PTY specific things ****
654 +AH_TEMPLATE([HAVE_DEV_PTC],
655 +[define HAVE_DEV_PTC if you have a /dev/ptc character special
657 AC_CHECKING(for /dev/ptc)
658 if test -r /dev/ptc; then
659 AC_DEFINE(HAVE_DEV_PTC)
662 AC_CHECKING(for SVR4 ptys)
663 +AH_TEMPLATE([HAVE_SVR4_PTYS],
664 +[define HAVE_SVR4_PTYS if you have a /dev/ptmx character special
665 + device and support the ptsname(), grantpt(), unlockpt() functions.])
667 if test -c /dev/ptmx ; then
668 AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
669 @@ -701,6 +1076,13 @@
672 AC_CHECKING(for ptyranges)
673 +AH_TEMPLATE([PTYRANGE0],
674 +[define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen
675 + to unusual environments. E.g. For SunOs the defaults are "qpr" and
676 + "0123456789abcdef". For SunOs 4.1.2
677 + #define PTYRANGE0 "pqrstuvwxyzPQRST"
678 + is recommended by Dan Jacobson.])
679 +AH_TEMPLATE([PTYRANGE1],[])
680 if test -d /dev/ptym ; then
684 dnl **** utmp handling ****
686 AC_CHECKING(getutent)
687 +AH_TEMPLATE([GETUTENT],
688 +[If your system has getutent(), pututline(), etc. to write to the
689 + utmp file, define GETUTENT.])
691 #include <time.h> /* to get time_t on SCO */
692 #include <sys/types.h>
694 [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
697 +AH_TEMPLATE([UTHOST],[Define UTHOST if the utmp file has a host field.])
700 #include <sys/types.h>
704 ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST))
705 +AH_TEMPLATE([HAVE_UTEMPTER],[Define if you have the utempter utmp helper program])
706 AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
707 -if test "$have_utempter" = yes; then
708 +if test X"$have_utempter" = Xyes; then
709 AC_DEFINE(HAVE_UTEMPTER)
710 LIBS="$LIBS -lutempter"
712 @@ -869,20 +1256,39 @@
717 +AH_TEMPLATE([LOADAV],
718 +[If you want the "time" command to display the current load average
719 + define LOADAV. Maybe you must install screen with the needed
720 + privileges to read /dev/kmem.
721 + Note that NLIST_ stuff is only checked, when getloadavg() is not available.
723 +AH_TEMPLATE([LOADAV_NUM])
724 +AH_TEMPLATE([LOADAV_TYPE])
725 +AH_TEMPLATE([LOADAV_SCALE])
726 +AH_TEMPLATE([LOADAV_GETLOADAVG])
727 +AH_TEMPLATE([LOADAV_UNIX])
728 +AH_TEMPLATE([LOADAV_AVENRUN])
729 +AH_TEMPLATE([LOADAV_USE_NLIST64])
731 +AH_TEMPLATE([NLIST_DECLARED])
732 +AH_TEMPLATE([NLIST_STRUCT])
733 +AH_TEMPLATE([NLIST_NAME_UNION])
735 AC_CHECKING(for libutil(s))
736 -test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
737 -test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
738 +dnl I have no idea whether "login" is an appropriate symbol to check for here - Hannes
739 +AC_CHECK_LIB(utils,login)
740 +AC_CHECK_LIB(util,login)
742 AC_CHECKING(getloadavg)
743 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
744 AC_DEFINE(LOADAV_GETLOADAVG) load=1,
745 -if test -f /usr/lib/libkvm.a ; then
748 +AC_CHECK_LIB(kvm,kvm_open,
749 AC_CHECKING(getloadavg with -lkvm)
750 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
751 AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
756 if test -z "$load" ; then
757 @@ -1024,6 +1430,11 @@
759 dnl **** signal handling ****
762 +AH_TEMPLATE([SIGVOID],
763 +[Define SIGVOID if your signal handlers return void. On older
764 + systems, signal returns int, but on newer ones, it returns void.])
766 if test -n "$posix" ; then
768 dnl POSIX has reliable signals with void return type.
769 @@ -1041,6 +1452,7 @@
771 extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
773 +AH_TEMPLATE([USESIGSET], [Define USESIGSET if you have sigset for BSD 4.1 reliable signals.])
775 #include <sys/types.h>
777 @@ -1052,6 +1464,9 @@
779 ], AC_DEFINE(USESIGSET))
780 AC_CHECKING(signal implementation)
781 +AH_TEMPLATE([SYSVSIGS],
782 +[Define SYSVSIGS if signal handlers must be reinstalled after
783 + they have been called.])
785 #include <sys/types.h>
787 @@ -1094,13 +1509,14 @@
790 AC_CHECKING(for crypt and sec libraries)
791 -test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
792 +dnl I have no idea whether "crypt" is an appropriate symbol to check for here - Hannes
793 +AC_CHECK_LIB(crypt_d,crypt)
795 -LIBS="$LIBS -lcrypt"
797 AC_TRY_LINK(,,,LIBS="$oldlibs")
798 -test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
799 -test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
800 +AC_CHECK_LIB(crypt,crypt)
801 +AC_CHECK_LIB(sec,crypt)
802 +AC_CHECK_LIB(shadow,getspnam)
805 AC_CHECKING(IRIX sun library)
806 @@ -1123,6 +1539,13 @@
807 dnl **** misc things ****
809 AC_CHECKING(wait union)
810 +AH_TEMPLATE([BSDWAIT],
811 +[Define BSDWAIT if your system defines a 'union wait' in <sys/wait.h>
813 + Only allow BSDWAIT i.e. wait3 on nonposix systems, since
814 + posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl
815 + TODO(Hannes) shipped config.h.in does that with a #ifdef
817 AC_TRY_COMPILE([#include <sys/types.h>
818 #include <sys/wait.h>
820 @@ -1133,6 +1556,12 @@
822 ],AC_DEFINE(BSDWAIT))
824 +AH_TEMPLATE([TERMIO],
825 +[Define TERMIO if you have struct termio instead of struct sgttyb.
826 + This is usually the case for SVID systems, where BSD uses sgttyb.
827 + POSIX systems should define this anyway, even though they use
830 if test -z "$butterfly"; then
831 AC_CHECKING(for termio or termios)
832 AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
833 @@ -1142,17 +1571,35 @@
837 +AH_TEMPLATE([CYTERMIO], [Define CYTERMIO if you have cyrillic termio modes.])
839 dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
840 AC_CHECKING(getspnam)
841 +AH_TEMPLATE([SHADOWPW],
842 +[If the passwords are stored in a shadow file and you want the
843 + builtin lock to work properly, define SHADOWPW.])
844 AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
846 AC_CHECKING(getttyent)
847 +AH_TEMPLATE([GETTTYENT],
848 +[If your system has the new format /etc/ttys (like 4.3 BSD) and the
849 + getttyent(3) library functions, define GETTTYENT.])
850 AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
853 +AH_TEMPLATE([HAVE_FDWALK],
854 +[Newer versions of Solaris include fdwalk, which can greatly improve
855 + the startup time of screen; otherwise screen spends a lot of time
856 + closing file descriptors.])
857 AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
859 -AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
860 +AH_TEMPLATE([USEBCOPY],
861 +[Define USEBCOPY if the bcopy/memcpy from your system's C library
862 + supports the overlapping of source and destination blocks. When
863 + undefined, screen uses its own (probably slower) version of bcopy().])
865 +AC_CACHE_CHECK([if bcopy handles overlap],
866 + [screen_cv_sys_bcopy_overlap],
870 @@ -1165,8 +1612,21 @@
871 if (strncmp(buf, "cdedef", 6))
873 exit(0); /* libc version works properly. */
874 -}], AC_DEFINE(USEBCOPY))
875 +}], screen_cv_sys_bcopy_overlap=yes,
876 +screen_cv_sys_bcopy_overlap=no))
877 +if test X"$screen_cv_sys_bcopy_overlap" = Xyes; then
878 + AC_DEFINE(USEBCOPY)
881 +AH_TEMPLATE([USEMEMMOVE],
882 +[SYSV machines may have a working memcpy() -- Oh, this is
883 + quite unlikely. Tell me if you see one.
884 + "But then, memmove() should work, if at all available" he thought...
885 + Boing, never say "works everywhere" unless you checked SCO UNIX.
886 + Their memove fails the test in the configure script. Sigh. (Juergen)
888 +AC_CACHE_CHECK([if memmove handles overlap],
889 + [screen_cv_sys_memmove_overlap],
891 #define bcopy(s,d,l) memmove(d,s,l)
893 @@ -1180,9 +1640,15 @@
894 if (strncmp(buf, "cdedef", 6))
896 exit(0); /* libc version works properly. */
897 -}], AC_DEFINE(USEMEMMOVE))
899 +}], screen_cv_sys_memmove_overlap=yes,
900 +screen_cv_sys_memmove_overlap=no))
901 +if test X"$screen_cv_sys_memmove_overlap" = Xyes; then
902 + AC_DEFINE(USEMEMMOVE)
905 +AH_TEMPLATE([USEMEMCPY],[])
906 +AC_CACHE_CHECK([if memcpy handles overlap],
907 + [screen_cv_sys_memcpy_overlap],
909 #define bcopy(s,d,l) memcpy(d,s,l)
911 @@ -1196,9 +1662,19 @@
912 if (strncmp(buf, "cdedef", 6))
914 exit(0); /* libc version works properly. */
915 -}], AC_DEFINE(USEMEMCPY))
916 +}], screen_cv_sys_memcpy_overlap=yes,
917 +screen_cv_sys_memcpy_overlap=no))
918 +if test X"$screen_cv_sys_memcpy_overlap" = Xyes; then
919 + AC_DEFINE(USEMEMCPY)
922 AC_MSG_CHECKING(long file names)
923 +AH_TEMPLATE([NAME_MAX],
924 +[If you are on a SYS V machine that restricts filename length to 14
925 + characters, you may need to enforce that by setting NAME_MAX to 14])
926 +dnl TODO(Hannes) shipped config.h.in has
927 +dnl #undef NAME_MAX /* KEEP_UNDEF_HERE override system value */
929 (echo 1 > /tmp/conftest9012345) 2>/dev/null
930 (echo 2 > /tmp/conftest9012346) 2>/dev/null
931 val=`cat /tmp/conftest9012345 2>/dev/null`
932 @@ -1211,17 +1687,28 @@
935 AC_MSG_CHECKING(for vsprintf)
936 +AH_TEMPLATE([USEVARARGS],
937 +[If your system has vsprintf() and requires the use of the macros in
938 + "varargs.h" to use functions with variable arguments,
939 + define USEVARARGS.])
940 AC_TRY_LINK([#include <stdarg.h>],[va_list valist; vsprintf(0,0,valist);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
944 AC_MSG_CHECKING(for setenv)
945 +AH_TEMPLATE([USESETENV], [If your system has setenv() and unsetenv() define USESETENV])
946 AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
948 AC_MSG_CHECKING(for putenv)
949 +AH_TEMPLATE([NEEDPUTENV],
950 +[If your system does not come with a setenv()/putenv()/getenv()
951 + functions, you may bring in our own code by defining NEEDPUTENV.])
952 AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)
954 AC_MSG_CHECKING([for nl_langinfo(CODESET)])
955 +AH_TEMPLATE([HAVE_NL_LANGINFO],
956 +[define HAVE_NL_LANGINFO if your system has the nl_langinfo() call
957 + and <langinfo.h> defines CODESET.])
959 #include <langinfo.h>
960 ],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no))
961 @@ -1271,7 +1758,8 @@
962 dnl Ptx bug workaround -- insert -lc after -ltermcap
963 test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
965 -AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
966 +AC_MSG_CHECKING(compiler sanity)
967 +AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.), AC_MSG_WARN(Skipping test due to crosscompilation))
969 ETCSCREENRC="\"/usr/local/etc/screenrc\""
970 if test -n "$prefix"; then