]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/screen/screen-4.0.2/configure.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / screen / screen-4.0.2 / configure.patch
1
2 #
3 # Patch by Hannes Reich (hannes@skynet.ie) 22-Jul-2005
4 # Resolves _some_ of the cross-compilation issues in screen's configure.in
5 #
6
7 --- screen-4.0.1/configure.in~configure
8 +++ screen-4.0.1/configure.in
9 @@ -37,6 +37,323 @@
10  VERSION="$rev.$vers.$pat"
11  AC_NOTE(this is screen version $VERSION)
12  AC_SUBST(VERSION)
13 +
14 +AH_TOP([
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
19 + *
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.
24 + *
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.
29 + *
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
34 + *
35 + */
36 +
37 +
38 +/**********************************************************************
39 + *
40 + *     User Configuration Section
41 + */
42 +
43 +/*
44 + * Maximum of simultaneously allowed windows per screen session.
45 + */
46 +#ifndef MAXWIN
47 +# define MAXWIN 40
48 +#endif
49 +
50 +/*
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.
60 + *
61 + * Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison).
62 + */
63 +#undef SOCKDIR
64 +
65 +/*
66 + * Define this if the SOCKDIR is not shared between hosts.
67 + */
68 +#define SOCKDIR_IS_LOCAL_TO_HOST
69 +
70 +/*
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.
74 + */
75 +#ifndef ETCSCREENRC
76 +# define ETCSCREENRC "/usr/local/etc/screenrc"
77 +#endif
78 +
79 +/*
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.
84 + */
85 +#define ALLOW_SYSSCREENRC 1
86 +
87 +/*
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.
91 + */
92 +#ifndef SCREENENCODINGS
93 +# define SCREENENCODINGS "/usr/local/lib/screen/encodings"
94 +#endif
95 +/*
96 + * Define CHECKLOGIN to force Screen users to enter their Unix password
97 + * in addition to the screen password.
98 + *
99 + * Define NOSYSLOG if yo do not have logging facilities. Currently
100 + * syslog() will be used to trace ``su'' commands only.
101 + */
102 +#define CHECKLOGIN 1
103 +#undef NOSYSLOG
104 +
105 +
106 +/* 
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).
116 + */
117 +#undef PTYMODE
118 +#undef PTYGROUP
119 +#undef PTYROFS
120 +
121 +/*
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.
127 + */
128 +#undef LOCKPTY
129 +
130 +/*
131 + * If you'd rather see the status line on the first line of your
132 + * terminal rather than the last, define TOPSTAT.
133 + */
134 +#undef TOPSTAT
135 +
136 +/*
137 + * define DETACH can detach a session. An absolute 'must'.
138 + */
139 +#define DETACH
140 +
141 +/*
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
158 + *        sets.
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
169 + */
170 +#undef SIMPLESCREEN
171 +#ifndef SIMPLESCREEN
172 +# define LOCK
173 +# define PASSWORD
174 +# define COPY_PASTE
175 +# define REMOTE_DETACH
176 +# define POW_DETACH
177 +# define AUTO_NUKE
178 +# define PSEUDOS
179 +# define MULTI
180 +# define MULTIUSER
181 +# define MAPKEYS
182 +# define COLOR
183 +# define FONT
184 +# define DW_CHARS
185 +# define ENCODINGS
186 +# define UTF8
187 +# define COLORS16
188 +# define ZMODEM
189 +# define BLANKER_PRG
190 +#endif /* SIMPLESCREEN */
191 +
192 +#undef BUILTIN_TELNET
193 +#undef RXVT_OSC
194 +#undef COLORS256
195 +
196 +
197 +/*
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!
203 + */
204 +#undef HAVE_BRAILLE
205 +
206 +
207 +/*
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.
211 + */
212 +#ifndef NONETHACK
213 +# define NETHACK
214 +#endif /* NONETHACK */
215 +
216 +/*
217 + * If screen is installed with permissions to update /etc/utmp (such
218 + * as if it is installed set-uid root), define UTMPOK.
219 + */
220 +#define UTMPOK
221 +
222 +/* Set LOGINDEFAULT to one (1)
223 + * if you want entries added to /etc/utmp by default, else set it to
224 + * zero (0).
225 + * LOGINDEFAULT will be one (1) whenever LOGOUTOK is undefined!
226 + */
227 +#define LOGINDEFAULT   1
228 +
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
233 + * database. 
234 + * Negative examples: suns usually have a world writable utmp file, 
235 + * xterm will run perfectly without s-bit.
236 + *
237 + * If LOGOUTOK is undefined and UTMPOK is defined, all windows are
238 + * initially and permanently logged in.
239 + *
240 + * Set CAREFULUTMP to one (1) if you want that users have at least one
241 + * window per screen session logged in.
242 + */
243 +#define LOGOUTOK 1
244 +#undef CAREFULUTMP
245 +
246 +
247 +/*
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
253 + * license.
254 + */
255 +#undef USRLIMIT
256 +
257 +/*
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.)
261 + */
262 +#define POSIX_HAS_A_GOOD_TCSENDBREAK
263 +#define SUNOS4_AND_WE_TRUST_TCSENDBREAK
264 +
265 +/*
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)
269 + * for details.
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.)
273 + */
274 +#define TTYVMIN 100
275 +#define TTYVTIME 2
276 +
277 +/*
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.
282 + */
283 +#ifdef bsdi
284 +# define TTY_DISABLE_FNBLOCK /* select barfs without it ... */
285 +#endif
286 +
287 +
288 +/*
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.
295 + */
296 +#undef USE_SGR
297 +
298 +
299 +/*
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.
302 + */
303 +#define USE_LOCALE
304 +
305 +/*
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.)
309 + */
310 +#undef USE_PAM
311 +
312 +/*
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.
316 + */
317 +#undef CHECK_SCREEN_W
318 +
319 +/**********************************************************************
320 + *
321 + *     End of User Configuration Section
322 + *
323 + *      Rest of this file is modified by 'configure'
324 + *      Change at your own risk!
325 + *
326 + */
327 +])
328 +# end of AH_TOP
329 +
330  AC_PREFIX_PROGRAM(screen)
331  AC_PREFIX_PROGRAM(gzip)
332  
333 @@ -46,6 +363,7 @@
334  AC_PROG_GCC_TRADITIONAL
335  AC_ISC_POSIX
336  
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)
341 @@ -54,22 +372,17 @@
342  export CC
343  exec $0 $configure_args
344  fi
345 -])
346 -
347 -AC_TRY_RUN(main(){exit(0);},,
348 -exec 5>&2
349 -eval $ac_link
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]))
354  
355 +AC_MSG_CHECKING([if compiler sets exit status])
356  AC_TRY_RUN([
357  main()
358  {
359    int __something_strange_();
360    __something_strange_(0);
361  }
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))
365  
366  AC_PROG_AWK
367  
368 @@ -103,6 +416,7 @@
369  dnl
370  dnl    ****  special unix variants  ****
371  dnl
372 +AH_TEMPLATE(ISC,[])
373  if test -n "$ISC"; then
374    AC_DEFINE(ISC) LIBS="$LIBS -linet"
375  fi
376 @@ -114,11 +428,13 @@
377  dnl fi
378  dnl fi
379  
380 +AH_TEMPLATE([sysV68],[])
381  if test -f /sysV68 ; then
382  AC_DEFINE(sysV68)
383  fi
384  
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
388  oldlibs="$LIBS"
389  test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
390 @@ -132,6 +448,8 @@
391  AC_CHECKING(wait3)
392  AC_TRY_LINK(,[wait3();], ,
393  AC_CHECKING(wait2)
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
399 @@ -154,9 +472,11 @@
400  oldlibs="$LIBS"
401  LIBS="$LIBS -lpyr"
402  AC_CHECKING(Pyramid OSX)
403 +AH_TEMPLATE([OSX], [Pyramid OSX])
404  AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
405  fi
406  
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.
411 @@ -183,6 +503,7 @@
412  fi
413  
414  AC_CHECKING(for System V)
415 +AH_TEMPLATE([SYSV], [Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX)])
416  AC_TRY_COMPILE(
417  [#include <sys/types.h>
418  #include <signal.h>
419 @@ -198,6 +519,11 @@
420  oldlibs="$LIBS"
421  LIBS="$LIBS -lelf"
422  AC_CHECKING(SVR4)
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>
429  ],,
430  [AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
431 @@ -235,6 +561,9 @@
432  dnl
433  
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)])
438  AC_TRY_LINK(
439  [#include <sys/types.h>
440  #include <sys/ioctl.h>
441 @@ -255,6 +584,10 @@
442  dnl    ****  setreuid(), seteuid()  ****
443  dnl
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.])
449  AC_TRY_LINK(,[
450  #ifdef __hpux
451  setresuid(0, 0, 0);
452 @@ -269,6 +602,9 @@
453  dnl   Solaris seteuid doesn't change the saved uid, bad for
454  dnl     multiuser screen sessions
455  AC_CHECKING(seteuid)
456 +AH_TEMPLATE([HAVE_SETEUID],
457 +[If your system supports BSD4.4's seteuid() and setegid(), define
458 + HAVE_SETEUID.])
459  AC_TRY_LINK(,[
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);
462 @@ -292,7 +628,8 @@
463  dnl    ****  FIFO tests  ****
464  dnl
465  
466 -AC_CHECKING(fifos)
467 +AC_CACHE_CHECK([usable fifos],
468 +               [screen_cv_sys_fifo_usable],
469  AC_TRY_RUN([
470  #include <sys/types.h>
471  #include <sys/stat.h>
472 @@ -357,12 +694,14 @@
473      exit(1);
474    exit(0);
475  }
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))
480  
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],
489  AC_TRY_RUN([
490  #include <sys/types.h>
491  #include <fcntl.h>
492 @@ -407,9 +746,11 @@
493      exit(1);
494    exit(0);
495  }
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)
503 +fi
504  fi
505  
506  dnl
507 @@ -418,7 +759,8 @@
508  dnl    may need        LIBS="$LIBS -lsocket"   here
509  dnl
510  
511 -AC_CHECKING(sockets)
512 +AC_CACHE_CHECK([sockets are usable],
513 +              [screen_cv_sys_sockets_usable],
514  AC_TRY_RUN([
515  #include <sys/types.h>
516  #include <sys/socket.h>
517 @@ -469,12 +811,16 @@
518      exit(1);
519    exit(0);
520  }
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))
526  
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],
535  AC_TRY_RUN([
536  #include <sys/types.h>
537  #include <sys/stat.h>
538 @@ -500,22 +846,25 @@
539    close(s);
540    exit(0);
541  }
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))
548 +
549 +if test X"$screen_cv_sys_sockets_nofs" = Xyes; then
550 +  AC_DEFINE(SOCK_NOT_IN_FS)
551 +fi
552  fi
553  
554  
555  dnl
556  dnl    ****  choose sockets or fifos  ****
557  dnl
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)
566        AC_DEFINE(NAMEDPIPE)
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.)
570      else
571        AC_NOTE(- both sockets and fifos usable. let's take fifos.)
572 @@ -525,7 +874,7 @@
573      AC_NOTE(- using named pipes, of course)
574      AC_DEFINE(NAMEDPIPE)
575    fi
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)
579  else
580    AC_MSG_ERROR(you have neither usable sockets nor usable pipes -> no screen)
581 @@ -535,7 +884,11 @@
582  dnl    ****  check the select implementation ****
583  dnl
584  
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],
591  AC_TRY_RUN([
592  #include <sys/types.h>
593  #include <sys/stat.h>
594 @@ -634,19 +987,26 @@
595      exit(1);
596    exit(0);
597  }
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)
604 +fi
605  
606  dnl
607  dnl    ****  termcap or terminfo  ****
608  dnl
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'])
614 +
615  AC_CHECKING(for tgetent)
616  AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
617  olibs="$LIBS"
618 -if test -f /usr/lib/libncursesw.so ; then
619 -    LIBS="-lncursesw $olibs"
620 -fi
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)))))))
629  
630 -AC_TRY_RUN([
631 +AC_CACHE_CHECK([using terminfo database],[screen_cv_sys_terminfo_used],
632 +       AC_TRY_RUN([
633  main()
634  {
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))
638 +}
639 +       ], screen_cv_sys_terminfo_used=no,
640 +       screen_cv_sys_terminfo_used=yes)
641 +)
642 +
643 +if test X"$screen_cv_sys_terminfo_used" = Xyes; then
644 +       AC_DEFINE(TERMINFO)
645 +fi
646 +
647  AC_CHECKING(ospeed)
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))
650  
651  dnl
652  dnl    ****  PTY specific things  ****
653  dnl
654 +AH_TEMPLATE([HAVE_DEV_PTC], 
655 +[define HAVE_DEV_PTC if you have a /dev/ptc character special
656 + device.])
657  AC_CHECKING(for /dev/ptc)
658  if test -r /dev/ptc; then
659  AC_DEFINE(HAVE_DEV_PTC)
660  fi
661  
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.])
666  sysvr4ptys=
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 @@
670  fi
671  
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
681  pdir='/dev/ptym'
682  else
683 @@ -817,6 +1199,9 @@
684  dnl    ****  utmp handling  ****
685  dnl
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.])
690  AC_TRY_LINK([
691  #include <time.h> /* to get time_t on SCO */
692  #include <sys/types.h>
693 @@ -850,6 +1235,7 @@
694  [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
695  )
696  AC_CHECKING(ut_host)
697 +AH_TEMPLATE([UTHOST],[Define UTHOST if the utmp file has a host field.])
698  AC_TRY_COMPILE([
699  #include <time.h>
700  #include <sys/types.h>
701 @@ -860,8 +1246,9 @@
702  #include <utmp.h>
703  #endif
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"
711  fi
712 @@ -869,20 +1256,39 @@
713  dnl
714  dnl    ****  loadav  ****
715  dnl
716 +
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.
722 +])
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])
730 +
731 +AH_TEMPLATE([NLIST_DECLARED])
732 +AH_TEMPLATE([NLIST_STRUCT])
733 +AH_TEMPLATE([NLIST_NAME_UNION])
734 +
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)
741  
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
746  olibs="$LIBS"
747 -LIBS="$LIBS -lkvm"
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")
752 -fi
753 +)
754  )
755  
756  if test -z "$load" ; then
757 @@ -1024,6 +1430,11 @@
758  dnl
759  dnl    ****  signal handling  ****
760  dnl
761 +
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.])
765 +
766  if test -n "$posix" ; then
767  
768  dnl POSIX has reliable signals with void return type.
769 @@ -1041,6 +1452,7 @@
770  #endif
771  extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
772  AC_CHECKING(sigset)
773 +AH_TEMPLATE([USESIGSET], [Define USESIGSET if you have sigset for BSD 4.1 reliable signals.])
774  AC_TRY_LINK([
775  #include <sys/types.h>
776  #include <signal.h>
777 @@ -1052,6 +1464,9 @@
778  #endif
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.])
784  AC_TRY_RUN([
785  #include <sys/types.h>
786  #include <signal.h>
787 @@ -1094,13 +1509,14 @@
788  dnl
789  
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)
794  oldlibs="$LIBS"
795 -LIBS="$LIBS -lcrypt"
796  AC_CHECKING(crypt)
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)
803  oldlibs="$LIBS"
804  LIBS="$LIBS -lsun"
805  AC_CHECKING(IRIX sun library)
806 @@ -1123,6 +1539,13 @@
807  dnl    ****  misc things  ****
808  dnl
809  AC_CHECKING(wait union)
810 +AH_TEMPLATE([BSDWAIT], 
811 +[Define BSDWAIT if your system defines a 'union wait' in <sys/wait.h>
812 +
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
816 +])
817  AC_TRY_COMPILE([#include <sys/types.h>
818  #include <sys/wait.h>
819  ],[
820 @@ -1133,6 +1556,12 @@
821  #endif
822  ],AC_DEFINE(BSDWAIT))
823  
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
828 + struct termios.])
829 +
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 @@
834  )
835  fi
836  
837 +AH_TEMPLATE([CYTERMIO], [Define CYTERMIO if you have cyrillic termio modes.])
838 +
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))
845  
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))
851  
852  AC_CHECKING(fdwalk)
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))
858  
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().])
864 +
865 +AC_CACHE_CHECK([if bcopy handles overlap],
866 +              [screen_cv_sys_bcopy_overlap],
867  AC_TRY_RUN([
868  main() {
869    char buf[10];
870 @@ -1165,8 +1612,21 @@
871    if (strncmp(buf, "cdedef", 6))
872      exit(1);
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)
879 +fi
880  
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)
887 +])
888 +AC_CACHE_CHECK([if memmove handles overlap],
889 +              [screen_cv_sys_memmove_overlap],
890  AC_TRY_RUN([
891  #define bcopy(s,d,l) memmove(d,s,l)
892  main() {
893 @@ -1180,9 +1640,15 @@
894    if (strncmp(buf, "cdedef", 6))
895      exit(1);
896    exit(0); /* libc version works properly.  */
897 -}], AC_DEFINE(USEMEMMOVE))
898 -
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)
903 +fi
904  
905 +AH_TEMPLATE([USEMEMCPY],[])
906 +AC_CACHE_CHECK([if memcpy handles overlap],
907 +              [screen_cv_sys_memcpy_overlap],
908  AC_TRY_RUN([
909  #define bcopy(s,d,l) memcpy(d,s,l)
910  main() {
911 @@ -1196,9 +1662,19 @@
912    if (strncmp(buf, "cdedef", 6))
913      exit(1);
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)
920 +fi
921  
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 */
928 +dnl ahead of this
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 @@
933  rm -f /tmp/conftest*
934  
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))
941  
942  AC_HEADER_DIRENT
943  
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),
947  AC_MSG_RESULT(no)
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)
953  ))
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.])
958  AC_TRY_LINK([
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"
964  
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))
968  
969  ETCSCREENRC="\"/usr/local/etc/screenrc\""
970  if test -n "$prefix"; then