aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/screen/screen-4.0.3/configure.patch
blob: 8789cb73fbd6811579f98acd10b503689ed5bc73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
Index: screen-4.0.3/configure.in
===================================================================
--- screen-4.0.3.orig/configure.in	2009-09-11 16:59:24.085222816 -0700
+++ screen-4.0.3/configure.in	2009-09-11 18:42:08.338231443 -0700
@@ -12,7 +12,7 @@
 dnl
 dnl Define some useful macros
 dnl
-AC_DEFUN(AC_PROGRAM_SOURCE,
+AC_DEFUN([AC_PROGRAM_SOURCE],
 [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF
 #include "confdefs.h"
 [$1]
@@ -362,6 +362,7 @@
 AC_PROG_GCC_TRADITIONAL
 AC_ISC_POSIX
 
+AC_MSG_CHECKING([for compiler sanity])
 AC_TRY_RUN(main(){exit(0);},,[
 if test $CC != cc ; then
 AC_NOTE(Your $CC failed - restarting with CC=cc)
@@ -370,22 +371,17 @@
 export CC
 exec $0 $configure_args
 fi
-])
-
-AC_TRY_RUN(main(){exit(0);},,
-exec 5>&2
-eval $ac_link
-AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
-AC_NOTE($ac_compile)
-AC_MSG_ERROR(Can't run the compiler - sorry))
+],AC_MSG_WARN([skipping test due to crosscompilation]))
 
+AC_MSG_CHECKING([if compiler sets exit status])
 AC_TRY_RUN([
 main()
 {
   int __something_strange_();
   __something_strange_(0);
 }
-],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
+],AC_MSG_ERROR(Your compiler does not set the exit status - sorry),,
+AC_MSG_WARN(skipping test due to crosscompilation))
 
 AC_PROG_AWK
 
@@ -419,6 +415,7 @@
 dnl
 dnl    ****  special unix variants  ****
 dnl
+AH_TEMPLATE(ISC,[])
 if test -n "$ISC"; then
   AC_DEFINE(ISC) LIBS="$LIBS -linet"
 fi
@@ -430,11 +427,13 @@
 dnl fi
 dnl fi
 
+AH_TEMPLATE([sysV68],[])
 if test -f /sysV68 ; then
 AC_DEFINE(sysV68)
 fi
 
 AC_CHECKING(for MIPS)
+AH_TEMPLATE([MIPS],[])
 if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
 oldlibs="$LIBS"
 test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
@@ -448,6 +447,8 @@
 AC_CHECKING(wait3)
 AC_TRY_LINK(,[wait3();], ,
 AC_CHECKING(wait2)
+AH_TEMPLATE([USE_WAIT2],[On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com])
+dnl TODO(Hannes) shipped config.h.in wraps the define in #ifdef BSDWAIT
 AC_TRY_LINK(,[wait2();],
 dnl John Rouillard (rouilj@sni-usa.com):
 dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
@@ -470,9 +471,11 @@
 oldlibs="$LIBS"
 LIBS="$LIBS -lpyr"
 AC_CHECKING(Pyramid OSX)
+AH_TEMPLATE([OSX], [Pyramid OSX])
 AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
 fi
 
+AH_TEMPLATE([POSIX],[Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX).])
 dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
 dnl BBN butterfly is not POSIX, but a MACH BSD system.
 dnl Do not define POSIX and TERMIO.
@@ -499,6 +502,7 @@
 fi
 
 AC_CHECKING(for System V)
+AH_TEMPLATE([SYSV], [Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX)])
 AC_TRY_COMPILE(
 [#include <sys/types.h>
 #include <signal.h>
@@ -514,6 +518,8 @@
 oldlibs="$LIBS"
 LIBS="$LIBS -lelf"
 AC_CHECKING(SVR4)
+AH_TEMPLATE([SVR4])
+AH_TEMPLATE([BUGGYGETLOGIN])
 AC_TRY_LINK([#include <utmpx.h>
 ],,
 [AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
@@ -551,6 +557,9 @@
 dnl
 
 AC_CHECKING(BSD job jontrol)
+AH_TEMPLATE([BSDJOBS],
+[Define BSDJOBS if you have BSD-style job control (both process
+ groups and a tty that deals correctly with them)])
 AC_TRY_LINK(
 [#include <sys/types.h>
 #include <sys/ioctl.h>
@@ -571,6 +580,10 @@
 dnl    ****  setreuid(), seteuid()  ****
 dnl
 AC_CHECKING(setreuid)
+AH_TEMPLATE([HAVE_SETREUID],
+[If your system has the calls setreuid() and setregid(),
+ define HAVE_SETREUID. Otherwise screen will use a forked process to
+ safely create output files without retaining any special privileges.])
 AC_TRY_LINK(,[
 #ifdef __hpux
 setresuid(0, 0, 0);
@@ -585,6 +598,9 @@
 dnl   Solaris seteuid doesn't change the saved uid, bad for
 dnl     multiuser screen sessions
 AC_CHECKING(seteuid)
+AH_TEMPLATE([HAVE_SETEUID],
+[If your system supports BSD4.4's seteuid() and setegid(), define
+ HAVE_SETEUID.])
 AC_TRY_LINK(,[
 #if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
 seteuid_is_broken(0);
@@ -609,6 +625,8 @@
 dnl
 
 AC_CHECKING(fifos)
+AC_CACHE_CHECK([usable fifos],
+               [screen_cv_sys_fifo_usable],
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -673,12 +691,15 @@
     exit(1);
   exit(0);
 }
-], AC_NOTE(- your fifos are usable) fifo=1,
-AC_NOTE(- your fifos are not usable))
+], screen_cv_sys_fifo_usable=yes, screen_cv_sys_fifo_usable=no))
 rm -f /tmp/conftest*
 
-if test -n "$fifo"; then
-AC_CHECKING(for broken fifo implementation)
+if test X"$screen_cv_sys_fifo_usable" = Xyes; then
+AH_TEMPLATE([BROKEN_PIPE],
+[Define this if your system exits select() immediatly if a pipe is
+ opened read-only and no writer has opened it.])
+AC_CACHE_CHECK([broken fifo implementation],
+              [screen_cv_sys_fifo_broken_impl],
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <fcntl.h>
@@ -723,8 +744,11 @@
     exit(1);
   exit(0);
 }
-], AC_NOTE(- your implementation is ok), 
-AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
+], screen_cv_sys_fifo_broken_impl=no,
+screen_cv_sys_fifo_broken_impl=yes))
+if test X"$screen_cv_sys_fifo_broken_impl" = Xyes; then
+       AC_DEFINE(BROKEN_PIPE)
+fi
 rm -f /tmp/conftest*
 fi
 
@@ -735,6 +759,8 @@
 dnl
 
 AC_CHECKING(sockets)
+AC_CACHE_CHECK([sockets are usable],
+              [screen_cv_sys_sockets_usable],
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -785,12 +811,16 @@
     exit(1);
   exit(0);
 }
-], AC_NOTE(- your sockets are usable) sock=1,
-AC_NOTE(- your sockets are not usable))
-rm -f /tmp/conftest*
+], screen_cv_sys_sockets_usable=yes,
+screen_cv_sys_sockets_usable=no))
 
-if test -n "$sock"; then
+if test X"$screen_cv_sys_sockets_usable" = Xyes; then
 AC_CHECKING(socket implementation)
+AH_TEMPLATE([SOCK_NOT_IN_FS],
+[Define this if the unix-domain socket implementation doesn't
+ create a socket in the filesystem.])
+AC_CACHE_CHECK([if sockets are not stored in the filesystem],
+              [screen_cv_sys_sockets_nofs],
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -816,22 +846,25 @@
   close(s);
   exit(0);
 }
-],AC_NOTE(- you are normal),
-AC_NOTE(- unix domain sockets are not kept in the filesystem)
-AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
-rm -f /tmp/conftest*
+], screen_cv_sys_sockets_nofs=no,
+screen_cv_sys_sockets_nofs=yes))
+
+if test X"$screen_cv_sys_sockets_nofs" = Xyes; then
+  AC_DEFINE(SOCK_NOT_IN_FS)
+fi
 fi
 
 
 dnl
 dnl    ****  choose sockets or fifos  ****
 dnl
-if test -n "$fifo"; then
-  if test -n "$sock"; then
-    if test -n "$nore"; then
+AH_TEMPLATE([NAMEDPIPE], [Define this if your system supports named pipes.])
+if test X"$screen_cv_sys_fifo_usable" = Xyes; then
+  if test X"$screen_cv_sys_sockets_usable" = Xyes; then
+    if test X"$screen_cv_sys_sockets_nofs" = Xyes; then
       AC_NOTE(- hmmm... better take the fifos)
       AC_DEFINE(NAMEDPIPE)
-    elif test -n "$fifobr"; then
+    elif test X"$screen_cv_sys_fifo_broken_impl" = Xyes; then
       AC_NOTE(- as your fifos are broken lets use the sockets.)
     else
       AC_NOTE(- both sockets and fifos usable. let's take fifos.)
@@ -841,7 +874,7 @@
     AC_NOTE(- using named pipes, of course)
     AC_DEFINE(NAMEDPIPE)
   fi
-elif test -n "$sock"; then
+elif test X"$screen_cv_sys_sockets_usable" = Xyes; then
   AC_NOTE(- using unix-domain sockets, of course)
 else
   AC_MSG_ERROR(you have neither usable sockets nor usable pipes -> no screen)
@@ -851,7 +884,11 @@
 dnl    ****  check the select implementation ****
 dnl
 
-AC_CHECKING(select return value)
+AH_TEMPLATE([SELECT_BROKEN],
+[If the select return value doesn't treat a descriptor that is
+ usable for reading and writing as two hits, define SELECT_BROKEN.])
+AC_CACHE_CHECK([for broken select return value],
+              [screen_cv_sys_select_broken_retval],
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -950,17 +987,26 @@
     exit(1);
   exit(0);
 }
-],AC_NOTE(- select is ok),
-AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
+], screen_cv_sys_select_broken_retval=no,
+screen_cv_sys_select_broken_retval=yes))
+if test X"$screen_cv_sys_select_broken_retval" = Xyes; then
+  AC_DEFINE(SELECT_BROKEN)
+fi
 
 dnl
 dnl    ****  termcap or terminfo  ****
 dnl
+AH_TEMPLATE([TERMINFO],
+[Define TERMINFO if your machine emulates the termcap routines
+ with the terminfo database.
+ Thus the .screenrc file is parsed for
+ the command 'terminfo' and not 'termcap'])
+
 AC_CHECKING(for tgetent)
 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
 olibs="$LIBS"
-LIBS="-lcurses $olibs"
 AC_CHECKING(libcurses)
+AC_CHECK_LIB(ncursesw,tgetent)
 AC_TRY_LINK(,[
 #ifdef __hpux
 __sorry_hpux_libcurses_is_totally_broken_in_10_10();
@@ -979,24 +1025,39 @@
 AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
 AC_MSG_ERROR(!!! no tgetent - no screen))))))
 
-AC_TRY_RUN([
+AC_CACHE_CHECK([using terminfo database],[screen_cv_sys_terminfo_used],
+       AC_TRY_RUN([
 main()
 {
  exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
-}], AC_NOTE(- you use the termcap database),
-AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
+}
+       ], screen_cv_sys_terminfo_used=no,
+       screen_cv_sys_terminfo_used=yes)
+)
+
+if test X"$screen_cv_sys_terminfo_used" = Xyes; then
+       AC_DEFINE(TERMINFO)
+fi
+
 AC_CHECKING(ospeed)
+AH_TEMPLATE([NEED_OSPEED],[If your library does not define ospeed, define this.])
 AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
 
 dnl
 dnl    ****  PTY specific things  ****
 dnl
+AH_TEMPLATE([HAVE_DEV_PTC],
+[define HAVE_DEV_PTC if you have a /dev/ptc character special
+ device.])
 AC_CHECKING(for /dev/ptc)
 if test -r /dev/ptc; then
 AC_DEFINE(HAVE_DEV_PTC)
 fi
 
 AC_CHECKING(for SVR4 ptys)
+AH_TEMPLATE([HAVE_SVR4_PTYS],
+[define HAVE_SVR4_PTYS if you have a /dev/ptmx character special
+ device and support the ptsname(), grantpt(), unlockpt() functions.])
 sysvr4ptys=
 if test -c /dev/ptmx ; then
 AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
@@ -1012,6 +1073,13 @@
 fi
 
 AC_CHECKING(for ptyranges)
+AH_TEMPLATE([PTYRANGE0],
+[define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen
+ to unusual environments. E.g. For SunOs the defaults are "qpr" and
+ "0123456789abcdef". For SunOs 4.1.2
+ #define PTYRANGE0 "pqrstuvwxyzPQRST"
+ is recommended by Dan Jacobson.])
+AH_TEMPLATE([PTYRANGE1],[])
 if test -d /dev/ptym ; then
 pdir='/dev/ptym'
 else
@@ -1117,7 +1185,7 @@
 	AC_NOTE(- ptys are world accessable)
       fi
     else
-      AC_NOTE(- can't determine - assume ptys are world accessable)
+      AC_NOTE(- cannot determine - assume ptys are world accessable)
     fi
   ]
 )
@@ -1128,6 +1196,7 @@
 dnl    ****  utmp handling  ****
 dnl
 AC_CHECKING(getutent)
+AH_TEMPLATE([GETUTENT], [If your system has setutent() and getutent() define GETUTENT])
 AC_TRY_LINK([
 #include <time.h> /* to get time_t on SCO */
 #include <sys/types.h>
@@ -1141,7 +1210,8 @@
 #define pututline _pututline
 #endif
 ],
-[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT),
+[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();],
+[AC_MSG_RESULT(yes); AC_DEFINE(GETUTENT)],[AC_MSG_RESULT(no)])
 olibs="$LIBS"
 LIBS="$LIBS -lgen"
 AC_CHECKING(getutent with -lgen)
@@ -1158,9 +1228,11 @@
 #define pututline _pututline
 #endif
 ],
-[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs")
-)
+[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();],
+[AC_MSG_RESULT(yes); AC_DEFINE(GETUTENT)], [AC_MSG_RESULT(no)])
+LIBS="$olibs"
 AC_CHECKING(ut_host)
+AH_TEMPLATE([UTHOST])
 AC_TRY_COMPILE([
 #include <time.h>
 #include <sys/types.h>
@@ -1171,6 +1243,7 @@
 #include <utmp.h>
 #endif
 ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST))
+AH_TEMPLATE([HAVE_UTEMPTER])
 AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
 if test "$have_utempter" = yes; then
   AC_DEFINE(HAVE_UTEMPTER)
@@ -1180,20 +1253,39 @@
 dnl
 dnl    ****  loadav  ****
 dnl
+
+AH_TEMPLATE([LOADAV],
+[If you want the "time" command to display the current load average
+ define LOADAV. Maybe you must install screen with the needed
+ privileges to read /dev/kmem.
+ Note that NLIST_ stuff is only checked, when getloadavg() is not available.
+])
+AH_TEMPLATE([LOADAV_NUM])
+AH_TEMPLATE([LOADAV_TYPE])
+AH_TEMPLATE([LOADAV_SCALE])
+AH_TEMPLATE([LOADAV_GETLOADAVG])
+AH_TEMPLATE([LOADAV_UNIX])
+AH_TEMPLATE([LOADAV_AVENRUN])
+AH_TEMPLATE([LOADAV_USE_NLIST64])
+
+AH_TEMPLATE([NLIST_DECLARED])
+AH_TEMPLATE([NLIST_STRUCT])
+AH_TEMPLATE([NLIST_NAME_UNION])
+
 AC_CHECKING(for libutil(s))
-test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
-test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
+dnl I have no idea whether "login" is an appropriate symbol to check for here - Hannes
+AC_CHECK_LIB(utils,login)
+AC_CHECK_LIB(util,login)
 
 AC_CHECKING(getloadavg)
 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
 AC_DEFINE(LOADAV_GETLOADAVG) load=1,
-if test -f /usr/lib/libkvm.a ; then
 olibs="$LIBS"
-LIBS="$LIBS -lkvm"
+AC_CHECK_LIB(kvm,kvm_open,
 AC_CHECKING(getloadavg with -lkvm)
 AC_TRY_LINK(,[getloadavg((double *)0, 0);],
 AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
-fi
+)
 )
 
 if test -z "$load" ; then
@@ -1335,6 +1427,11 @@
 dnl
 dnl    ****  signal handling  ****
 dnl
+
+AH_TEMPLATE([SIGVOID],
+[Define SIGVOID if your signal handlers return void.  On older
+ systems, signal returns int, but on newer ones, it returns void.])
+
 if test -n "$posix" ; then
 
 dnl POSIX has reliable signals with void return type.
@@ -1344,6 +1441,7 @@
 else
 
 AC_CHECKING(return type of signal handlers)
+AH_TEMPLATE([USESIGSET], [Define USESIGSET if you have sigset for BSD 4.1 reliable signals.])
 AC_TRY_COMPILE(
 [#include <sys/types.h>
 #include <signal.h>
@@ -1363,6 +1461,9 @@
 #endif
 ], AC_DEFINE(USESIGSET))
 AC_CHECKING(signal implementation)
+AH_TEMPLATE([SYSVSIGS],
+[Define SYSVSIGS if signal handlers must be reinstalled after
+ they have been called.])
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <signal.h>
@@ -1405,13 +1506,14 @@
 dnl
 
 AC_CHECKING(for crypt and sec libraries)
-test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
+dnl I have no idea whether "crypt" is an appropriate symbol to check for here - Hannes
+AC_CHECK_LIB(crypt_d,crypt)
 oldlibs="$LIBS"
-LIBS="$LIBS -lcrypt"
 AC_CHECKING(crypt)
 AC_TRY_LINK(,,,LIBS="$oldlibs")
-test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
-test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
+AC_CHECK_LIB(crypt,crypt)
+AC_CHECK_LIB(sec,crypt)
+AC_CHECK_LIB(shadow,getspnam)
 oldlibs="$LIBS"
 LIBS="$LIBS -lsun"
 AC_CHECKING(IRIX sun library)
@@ -1434,6 +1536,13 @@
 dnl    ****  misc things  ****
 dnl
 AC_CHECKING(wait union)
+AH_TEMPLATE([BSDWAIT],
+[Define BSDWAIT if your system defines a 'union wait' in <sys/wait.h>
+
+ Only allow BSDWAIT i.e. wait3 on nonposix systems, since
+ posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl
+ TODO(Hannes) shipped config.h.in does that with a #ifdef
+])
 AC_TRY_COMPILE([#include <sys/types.h>
 #include <sys/wait.h>
 ],[
@@ -1444,6 +1553,13 @@
 #endif
 ],AC_DEFINE(BSDWAIT))
 
+AH_TEMPLATE([TERMIO],
+[Define TERMIO if you have struct termio instead of struct sgttyb.
+ This is usually the case for SVID systems, where BSD uses sgttyb.
+ POSIX systems should define this anyway, even though they use
+ struct termios.])
+
+
 if test -z "$butterfly"; then
 AC_CHECKING(for termio or termios)
 AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
@@ -1453,17 +1569,35 @@
 )
 fi
 
+AH_TEMPLATE([CYTERMIO], [Define CYTERMIO if you have cyrillic termio modes.])
+
 dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
 AC_CHECKING(getspnam)
+AH_TEMPLATE([SHADOWPW],
+[If the passwords are stored in a shadow file and you want the
+ builtin lock to work properly, define SHADOWPW.])
 AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
 
 AC_CHECKING(getttyent)
+AH_TEMPLATE([GETTTYENT],
+[If your system has the new format /etc/ttys (like 4.3 BSD) and the
+ getttyent(3) library functions, define GETTTYENT.])
 AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
 
 AC_CHECKING(fdwalk)
+AH_TEMPLATE([HAVE_FDWALK],
+[Newer versions of Solaris include fdwalk, which can greatly improve
+ the startup time of screen; otherwise screen spends a lot of time
+ closing file descriptors.])
 AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
 
-AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
+AH_TEMPLATE([USEBCOPY],
+[Define USEBCOPY if the bcopy/memcpy from your system's C library
+ supports the overlapping of source and destination blocks.  When
+ undefined, screen uses its own (probably slower) version of bcopy().])
+
+AC_CACHE_CHECK([if bcopy handles overlap],
+              [screen_cv_sys_bcopy_overlap],
 AC_TRY_RUN([
 main() {
   char buf[10];
@@ -1476,7 +1610,21 @@
   if (strncmp(buf, "cdedef", 6))
     exit(1);
   exit(0); /* libc version works properly.  */
-}], AC_DEFINE(USEBCOPY))
+}], screen_cv_sys_bcopy_overlap=yes,
+screen_cv_sys_bcopy_overlap=no))
+if test X"$screen_cv_sys_bcopy_overlap" = Xyes; then
+  AC_DEFINE(USEBCOPY)
+fi
+
+AH_TEMPLATE([USEMEMMOVE],
+[SYSV machines may have a working memcpy() -- Oh, this is
+ quite unlikely. Tell me if you see one.
+ "But then, memmove() should work, if at all available" he thought...
+ Boing, never say "works everywhere" unless you checked SCO UNIX.
+ Their memove fails the test in the configure script. Sigh. (Juergen)
+])
+AC_CACHE_CHECK([if memmove handles overlap],
+              [screen_cv_sys_memmove_overlap],
 
 AC_TRY_RUN([
 #define bcopy(s,d,l) memmove(d,s,l)
@@ -1491,9 +1639,15 @@
   if (strncmp(buf, "cdedef", 6))
     exit(1);
   exit(0); /* libc version works properly.  */
-}], AC_DEFINE(USEMEMMOVE))
-
+}], screen_cv_sys_memmove_overlap=yes,
+screen_cv_sys_memmove_overlap=no))
+if test X"$screen_cv_sys_memmove_overlap" = Xyes; then
+  AC_DEFINE(USEMEMMOVE)
+fi
 
+AH_TEMPLATE([USEMEMCPY],[])
+AC_CACHE_CHECK([if memcpy handles overlap],
+              [screen_cv_sys_memcpy_overlap],
 AC_TRY_RUN([
 #define bcopy(s,d,l) memcpy(d,s,l)
 main() {
@@ -1507,9 +1661,19 @@
   if (strncmp(buf, "cdedef", 6))
     exit(1);
   exit(0); /* libc version works properly.  */
-}], AC_DEFINE(USEMEMCPY))
+}], screen_cv_sys_memcpy_overlap=yes,
+screen_cv_sys_memcpy_overlap=no))
+if test X"$screen_cv_sys_memcpy_overlap" = Xyes; then
+  AC_DEFINE(USEMEMCPY)
+fi
 
 AC_MSG_CHECKING(long file names)
+AH_TEMPLATE([NAME_MAX],
+[If you are on a SYS V machine that restricts filename length to 14
+ characters, you may need to enforce that by setting NAME_MAX to 14])
+dnl TODO(Hannes) shipped config.h.in has
+dnl #undef NAME_MAX            /* KEEP_UNDEF_HERE override system value */
+dnl ahead of this
 (echo 1 > /tmp/conftest9012345) 2>/dev/null
 (echo 2 > /tmp/conftest9012346) 2>/dev/null
 val=`cat /tmp/conftest9012345 2>/dev/null`
@@ -1522,17 +1686,28 @@
 rm -f /tmp/conftest*
 
 AC_MSG_CHECKING(for vsprintf)
+AH_TEMPLATE([USEVARARGS],
+[If your system has vsprintf() and requires the use of the macros in
+ "varargs.h" to use functions with variable arguments,
+ define USEVARARGS.])
 AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
 
 AC_HEADER_DIRENT
 
 AC_MSG_CHECKING(for setenv)
+AH_TEMPLATE([USESETENV], [If your system has setenv() and unsetenv() define USESETENV])
 AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
 AC_MSG_RESULT(no)
 AC_MSG_CHECKING(for putenv)
+AH_TEMPLATE([NEEDPUTENV],
+[If your system does not come with a setenv()/putenv()/getenv()
+ functions, you may bring in our own code by defining NEEDPUTENV.])
 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)])
+AH_TEMPLATE([HAVE_NL_LANGINFO],
+[define HAVE_NL_LANGINFO if your system has the nl_langinfo() call
+ and <langinfo.h> defines CODESET.])
 AC_TRY_LINK([
 #include <langinfo.h>
 ],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no))
@@ -1582,7 +1757,8 @@
 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.))
+AC_MSG_CHECKING(compiler sanity)
+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))
 
 ETCSCREENRC="\"/usr/local/etc/screenrc\""
 if test -n "$prefix"; then