File: configure.in

package info (click to toggle)
scrollz 2.2.3-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 8,232 kB
  • ctags: 5,992
  • sloc: ansic: 79,460; tcl: 2,866; makefile: 703; sh: 508
file content (1500 lines) | stat: -rw-r--r-- 36,436 bytes parent folder | download | duplicates (3)
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
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
dnl configure.in for ScrollZ
dnl
dnl Copyright (c) 1993-2002 Matthew R. Green.
dnl All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl 1. Redistributions of source code must retain the above copyright
dnl    notice, this list of conditions and the following disclaimer.
dnl 2. Redistributions in binary form must reproduce the above copyright
dnl    notice, this list of conditions and the following disclaimer in the
dnl    documentation and/or other materials provided with the distribution.
dnl 3. The name of the author may not be used to endorse or promote products
dnl    derived from this software without specific prior written permission.
dnl
dnl THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
dnl OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
dnl IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
dnl INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
dnl BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
dnl AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
dnl SUCH DAMAGE.
dnl
dnl certain portions have other attributions, see below.
dnl
dnl thanks to the screen 3.3 configure.in for giving me examples to
dnl work from and steal ;)
dnl
dnl @(#)$Id: configure.in,v 1.56 2009-12-21 14:56:02 f Exp $

AC_REVISION($Revision: 1.56 $)dnl
AC_INIT(${srcdir}/source/irc.c)
AC_CONFIG_HEADER(include/defs.h)

# So many systems seem to need this that it is better do it here automatically.
if test "x$prefix" != xNONE; then
  if test -d "$prefix/lib"; then
    LIBS="-L${prefix}/lib $LIBS"
  fi
else
  if test -d "$ac_default_prefix/lib"; then
    LIBS="-L${ac_default_prefix}/lib $LIBS"
  fi
fi

dnl
dnl grok the version number - from source/irc.c
dnl

VERSION=`sed -n -e 's/"$//' -e '/#define[ 	]*SCROLLZ_VERSION[ 	]*"/s///p' -e '/#define SCROLLZ_VERSION/q' < ${srcdir}/source/irc.c`
IRCIIVERSION=`sed -n -e 's/"[[^"]]*$//' -e '/^#define[ 	]*IRCII_VERSION[ 	]*"/s///p' -e '/^#define IRCII_VERSION/q' < ${srcdir}/source/irc.c` 
echo this is ScrollZ version $VERSION + ircII version $IRCIIVERSION
echo
AC_SUBST(VERSION)

CATEGORIES='build change-request doc pending runtime'
AC_SUBST(CATEGORIES)

dnl so that the generated configure has an id.
echo '$Id: configure.in,v 1.56 2009-12-21 14:56:02 f Exp $' > /dev/null

dnl
dnl initial stuff
dnl

AC_PROG_CC
AC_PROG_CPP
AC_ISC_POSIX

dnl
dnl setup variables
dnl
srcdir=`(cd $srcdir; pwd)`
AC_SUBST(srcdir)
objdir=`pwd`
AC_SUBST(objdir)

dnl
dnl check for NeXT.. and -bsd switch
dnl

AC_MSG_CHECKING(for NeXT)
AC_EGREP_CPP(yes,
[#if defined(NeXT) || defined(__NeXT) || defined(__NeXT__)
  yes
#endif
],nextstep=1)

if test -n "$nextstep"; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

dnl AC_AIX is broken.  blah.

AC_MSG_CHECKING(for AIX)
AC_EGREP_CPP(yes,
[
#ifdef _AIX
  yes
#endif
],AC_MSG_RESULT(yes)
  aix=1
  AC_DEFINE(_ALL_SOURCE),
  AC_MSG_RESULT(no))

AC_PROG_GCC_TRADITIONAL
AC_CHECK_LIB(sun, getpwnam)

AC_MSG_CHECKING(for qnx)
case "`uname -s`" in
dnl bleck - wish i could ditch this qnx test, but we need to bump the stack
  QNX*)
    AC_MSG_RESULT(yes)
    if test -z "$GCC"; then
      LDFLAGS="-N256k -M"
      CFLAGS="-w4 -Otax -zc -Wc,-fr= -Wc,-wcd=121"
    fi
    ;;
  *)
    AC_MSG_RESULT(no)
esac

AC_MSG_CHECKING(for solaris)
if /bin/sun 2> /dev/null
then
  uname=`uname -r`
  case "$uname" in
    4.*)
      AC_MSG_RESULT(no) 
      sunos4=1
      ;;
    5.*)
      svr4=1
      ;;
  esac
else
  AC_MSG_RESULT(no)
  AC_MSG_CHECKING(for SVR4)
  AC_EGREP_CPP(yes,
[#if defined(SVR4) || defined(__svr4__) || defined(__SVR4)
  yes
#endif
],svr4=1)
fi

if test -n "$svr4"
then
  AC_MSG_RESULT(yes)
  LIBS="-L/usr/ccs/lib $LIBS"
else
  if test ! -n "$sunos4"
  then
    AC_MSG_RESULT(no)
  fi
fi

dnl
dnl testing for svr3/wollengong tcp's /usr/netinclude
dnl

AC_MSG_CHECKING(for -I/usr/netinclude)
if test -d /usr/netinclude; then
  AC_MSG_RESULT(yes)
  CFLAGS="$CFLAGS -I/usr/netinclude"
else
  AC_MSG_RESULT(no)
fi

dnl
dnl check for hpux, and hpux version
dnl

AC_MSG_CHECKING(for hpux version)
if test -f /hp-ux -o -f /stand/vmunix; then
  AC_MSG_RESULT(yes)
  hpux=1
  uname=`uname -r` 2> /dev/null
  case $uname in
	A.09* | A.9* | a.9* | a.09* | 9* | 09* | B.09*)
		;;
	A.08* | A.8* | a.8* | a.08* | 8* | 08*)
		AC_DEFINE(HPUX8)
		;;
	A.07* | A.B7* | A.7* | a.7* | a.07* | 7* | 07*)
		AC_DEFINE(HPUX7)
		;;
	*)
		AC_DEFINE(HPUXUNKNOWN)
		;;
  esac
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for ultrix)
AC_EGREP_CPP(yes,
[#if defined(ultrix) || defined(__ultrix) || defined(__ultrix)
  yes
#endif
], ultrix=1)
if test -n "$ultrix"; then
  AC_MSG_RESULT(yes)
  test -z "$GCC" && CC="$CC -YBSD"
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for sequent/ptx)
AC_EGREP_CPP(yes,
[#ifdef _SEQUENT_
  yes
#endif
], LIBS="$LIBS -lseq" seqptx=1 AC_MSG_RESULT(yes), AC_MSG_RESULT(no))

AC_MSG_CHECKING(whether to enable UTF-8 (iconv) support)
AC_ARG_ENABLE(utf8,
[  --disable-utf8          Disable UTF-8 (iconv) support],
[ case "$enableval" in
  no) AC_MSG_RESULT(no)
      ;;
  *) AC_MSG_RESULT(yes)
     ;;
  esac ],
[ AC_MSG_RESULT(yes)
  enable_utf8=yes
])

dnl check for FreeBSD, so we can find iconv.h in /usr/local/include
AC_MSG_CHECKING(for FreeBSD)
case "`uname -s`" in
  FreeBSD*)
    AC_MSG_RESULT(yes)
    CFLAGS="$CFLAGS -I/usr/local/include"
    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
    LIBS="$LIBS -L/usr/local/lib"
    freebsd=1
    ;;
  *)
    AC_MSG_RESULT(no)
esac

dnl check for IRIX, so we can find iconv.h in /usr/nekoware/include
AC_MSG_CHECKING(for IRIX)
case "`uname -s`" in
  IRIX*)
    AC_MSG_RESULT(yes)
    CFLAGS="$CFLAGS -I/usr/nekoware/include"
    CPPFLAGS="$CPPFLAGS -I/usr/nekoware/include"
    LIBS="$LIBS -L/usr/nekoware/lib"
    freebsd=1
    ;;
  *)
    AC_MSG_RESULT(no)
esac

if test "x$enable_utf8" = "xyes" ; then
  if test -n "$freebsd"; then
     case "`uname -r`" in
       10.*)
         ;;
       *)
         LIBS="$LIBS -liconv"
         ;;
     esac
  fi
fi

AC_CHECK_HEADERS(sys/un.h sys/select.h sys/fcntl.h sys/ioctl.h sys/file.h sys/time.h sys/wait.h sys/twg_config.h sys/ptem.h sys/uio.h)dnl sys/ ones
AC_CHECK_HEADERS(unistd.h fcntl.h string.h memory.h netdb.h limits.h)dnl non sys/ ones
AC_CHECK_HEADERS(stdarg.h varargs.h, break)dnl look for varadic function header
AC_CHECK_HEADERS(process.h termcap.h)dnl others

if test "x$enable_utf8" = "xyes" ; then
AC_CHECK_HEADERS(iconv.h)
fi

if test -n "$ultrix" -o -n "$nextstep"; then
  # POSIX termios is broken on Ultrix so don't look for it.
  # NEXTSTEP POSIX is broken so don't look for it.
  AC_CHECK_HEADERS(termio.h sgtty.h, break)dnl sigh.
else
  AC_CHECK_HEADERS(termios.h termio.h sgtty.h, break)dnl sigh.
fi

AC_CHECK_FUNC(fchmod,, AC_DEFINE(NEED_FCHMOD))
AC_CHECK_FUNC(getcwd,, AC_DEFINE(NEED_GETCWD))
AC_CHECK_FUNC(getpgid, AC_DEFINE(HAVE_GETPGID),)
AC_CHECK_FUNC(getsid, AC_DEFINE(HAVE_GETSID),)
AC_CHECK_FUNC(getloadavg, AC_DEFINE(HAVEGETLOADAVG),)
AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE),)
AC_CHECK_FUNC(scandir, AC_DEFINE(HAVE_SCANDIR),)
AC_CHECK_FUNC(setsid, AC_DEFINE(HAVE_SETSID),)
AC_CHECK_FUNC(strerror,, AC_DEFINE(NEED_STRERROR))
AC_CHECK_FUNC(strftime, AC_DEFINE(HAVE_STRFTIME),)
AC_CHECK_FUNC(uname, AC_DEFINE(HAVE_UNAME),)
AC_CHECK_FUNC(writev, AC_DEFINE(HAVE_WRITEV),)
AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF),)
AC_CHECK_FUNC(fputc, AC_DEFINE(HAVE_FPUTC),)
AC_CHECK_FUNC(fwrite, AC_DEFINE(HAVE_FWRITE),)
AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF),)
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF),)

if test "x$enable_utf8" = "xyes" ; then
AC_CHECK_FUNC(iconv_open, AC_DEFINE([HAVE_ICONV_OPEN]),)
fi

AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_DIRENT

AC_TYPE_SIGNAL
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPE(ssize_t,int)

if test x$ac_cv_header_sys_twg_config_h = xyes
then
  AC_DEFINE(WINS)
fi

dnl
dnl check if we need snprintf.c
dnl
if test x$ac_cv_func_snprintf != xyes || test x$ac_cv_func_vsnprintf != xyes
then
  EXTRA_OBJECTS=snprintf.o
  EXTRA_SOURCES=snprintf.c
else
  EXTRA_OBJECTS=
  EXTRA_SOURCES=
fi
AC_SUBST(EXTRA_OBJECTS)
AC_SUBST(EXTRA_SOURCES)

dnl
dnl check for struct linger
dnl

AC_MSG_CHECKING(for struct linger)
AC_EGREP_HEADER([struct( |	)*linger], sys/socket.h, AC_MSG_RESULT(yes), AC_DEFINE(NO_STRUCT_LINGER) AC_MSG_RESULT(no, ugh.))

dnl
dnl grok process groups
dnl

if test x$ac_cv_func_getsid != xyes && test x$ac_cv_func_getpgid != xyes
then
  AC_MSG_CHECKING(if getpgrp takes an argument)
  AC_TRY_RUN([
main()
{
  int pid;
  int pgid;

  pid = fork();

  if (0 == pid)
  {
#ifdef HAVE_SETSID
    setsid();
#else
    setpgrp(0, getpid());
#endif /* HAVE_SETSID */
    sleep(10);
  }
  else
  {
    sleep(2);
    pgid = getpgrp(pid);
    kill(pid,9);
    if (pid != pgid)
      exit(1);
  }
  exit(0);
}
],
  AC_MSG_RESULT(yes),
  AC_MSG_RESULT(no your getpgrp is painful)
  AC_DEFINE(BROKEN_GETPGRP), :)
fi

dnl
dnl work out wait type..
dnl

AC_CHECK_FUNC(waitpid,,
  AC_MSG_RESULT(no)
  AC_MSG_CHECKING(for bsd wait)
  AC_TRY_LINK([
#include <sys/types.h>
#include <sys/wait.h>
],[
  union wait x;
  int y;
#ifdef WEXITSTATUS
  y = WEXITSTATUS(x);
#endif
],
    AC_DEFINE(BSDWAIT)
    bsdwait=1
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no)
    AC_DEFINE(NEED_WAITPID)))

dnl
dnl checking for select()
dnl

olibs="$LIBS"
AC_CHECK_FUNC(select, ,
  AC_CHECK_LIB(socket, select, LIBS="$LIBS -lsocket",
    AC_CHECK_LIB(nsl, select, LIBS="$LIBS -lnsl",
      AC_CHECK_LIB(inet, select, LIBS="$LIBS -linet",
        AC_CHECK_LIB(cposix, select, LIBS="$LIBS -lcposix",
          AC_CHECK_LIB(net, select, LIBS="$LIBS -lnet",
            AC_MSG_WARN(i can not find select.  you might need to help me)))))))

dnl
dnl termcap or curses
dnl if termcap, check for tputs declaration
dnl
if test x$aix = x1
then
  LIBS="-lcurses $LIBS"
  AC_DEFINE(INCLUDE_CURSES_H)
else
  olibs="$LIBS"
  case "`uname -s`" in
    Linux*)
      if test -d /usr/include/ncurses; then
	CFLAGS="-I/usr/include/ncurses $CFLAGS"
      fi
      ;;
  esac
  AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $olibs",
    AC_CHECK_LIB(tinfo, tgetent, LIBS="-ltinfo $olibs",
      AC_CHECK_LIB(termlib, tgetent, LIBS="-ltermlib $olibs",
        AC_CHECK_LIB(curses, tgetent, LIBS="-lcurses $olibs",
          AC_CHECK_LIB(ncurses, tgetent, LIBS="-lncurses $olibs",
            AC_CHECK_LIB(xtermcap, tgetent, LIBS="-lxtermcap $olibs",
              AC_MSG_ERROR(Can not find curses or termcap library. Installing package libncurses5-dev or ncurses-devel usually fixes this problem.)))))))
  AC_MSG_CHECKING(for tputs in curses.h)
  AC_EGREP_CPP([tputs( |	|\()],[#include <curses.h>
], AC_DEFINE(INCLUDE_CURSES_H) AC_MSG_RESULT(yes), blahhack=1; AC_MSG_RESULT(no))
fi

dnl
dnl libiconv (Sunfreeware gcc)
dnl
dnl
if test "x$enable_utf8" = "xyes" ; then
if test -n "$svr4" -a -n "$GCC"
then
  AC_CHECK_LIB(iconv, iconv_open, LIBS="$LIBS -liconv")
fi
fi

dnl <term.h> is broken on most systems; ignoreit.

dnl if test x$blahhack = x1
dnl then
dnl   AC_MSG_CHECKING(for tputs in term.h)
dnl   AC_EGREP_CPP([tputs( |	|\()],[#include <term.h>
dnl ], AC_DEFINE(INCLUDE_TERM_H) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl fi

dnl
dnl signal handling
dnl

AC_CHECKING(signal implementation)
AC_CHECK_FUNC(sigaction, AC_DEFINE(USE_SIGACTION)
  echo using posix signals
  ,
  AC_CHECK_FUNC(sigset, AC_DEFINE(USE_SIGSET)
  echo using ok system v signals
  ,

echo checking for reliable signals
AC_TRY_RUN([
#include <sys/types.h>
#include <signal.h>

#ifndef SIGCHLD
# define SIGCHLD SIGCLD
#endif
#ifdef USE_SIGSET
# define signal sigset
#endif

int got;

#ifdef SIGVOID
void
#endif
hand()
{
  got++;
}

main()
{
  (void)signal(SIGCHLD, hand);
  kill(getpid(), SIGCHLD);
  kill(getpid(), SIGCHLD);
  if (got < 2)
    exit(1);
  exit(0);
}
], 
echo using bsd signals
, AC_DEFINE(SYSVSIGNALS)
echo using system v signals, you lose.
)))

if test x$bsdwait = x1
then
  AC_MSG_CHECKING(for wait3 declaration)
  AC_EGREP_CPP([wait3( |	|\()],[#include <sys/types.h> dnl )
#include <signal.h>
#include <sys/wait.h>
], AC_DEFINE(WAIT3_DECLARED) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
else
  AC_MSG_CHECKING(for waitpid declaration)
  AC_EGREP_CPP([waitpid( |	|\()],[#include <sys/types.h> dnl )
#include <signal.h>
#include <sys/wait.h>
], AC_DEFINE(WAITPID_DECLARED) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
fi

dnl
dnl check for errno declaration
dnl

AC_MSG_CHECKING(for errno declaration)
AC_TRY_RUN([
#include <sys/types.h>
#include <errno.h>
main()
{
  int i = errno;
  exit(0);
}
],
  AC_MSG_RESULT(yes)
  AC_DEFINE(ERRNO_DECLARED),
  AC_MSG_RESULT(no), :)

dnl
dnl check for sys_errlist declaration
dnl

AC_MSG_CHECKING(for sys_errlist declaration)
AC_TRY_RUN([
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
main()
{
  char *s = sys_errlist[0];
  exit(0);
}
],
  AC_MSG_RESULT(yes)
  AC_DEFINE(SYS_ERRLIST_DECLARED),
  AC_MSG_RESULT(no), :)

dnl
dnl check the type of iconv(3)'s 2nd argument
dnl

if test "x$enable_utf8" = "xyes" ; then
AC_MSG_CHECKING(for const iconv 2nd argument)
AC_EGREP_HEADER([\\<iconv\\>.*\\(.*const], iconv.h,
  AC_MSG_RESULT(yes)
  AC_DEFINE([ICONV_CONST_ARG2]),
  AC_MSG_RESULT(no))
fi

dnl
dnl need this for dcc stuff
dnl

AC_MSG_CHECKING(for a 32 bit integer)
AC_TRY_RUN([
main()
{
  if (4 == sizeof(unsigned long))
    exit(0);
  exit(1);
}
],
  AC_MSG_RESULT(unsigned long)
  AC_DEFINE(UNSIGNED_LONG32),
  AC_TRY_RUN([
main()
{
  if (4 == sizeof(unsigned int))
    exit(0);
  exit(1);
}
],
  AC_MSG_RESULT(unsigned int)
  AC_DEFINE(UNSIGNED_INT32),
  AC_MSG_RESULT(none, using unsigned long)
  AC_DEFINE(UNKNOWN_32INT), :),
:)

dnl
dnl libraries
dnl

dnl i think this was only needed for solaris with -lucb.
dnl AC_HAVE_LIBRARY(elf, LIBS="$LIBS -lelf",)
dnl AC_HAVE_LIBRARY(nls, libnls=1;AC_DEFINE(HAVE_LIB_NLS),)
if test ! -n "$libsocket"; then
	AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket",)
fi
dnl this is for isc.  need the nsl_s library as well.
if test ! -n "$libinet"; then
	AC_CHECK_LIB(inet, socket, libnsl=1; LIBS="$LIBS -linet -lnsl_s",)
fi
AC_CHECK_FUNC(gethostname, ,
        AC_CHECK_LIB(nsl, gethostname, LIBS="$LIBS -lnsl",) )
AC_CHECK_LIB(dgc, inet_addr, LIBS="$LIBS -ldgc",)
AC_CHECK_LIB(resolv, gethostbyname,
  olibs=$LIBS
  LIBS="$LIBS -lresolv"
  AC_TRY_RUN([
#include <netdb.h>
main()
{
  struct hostent *hp;

  hp = gethostbyname("`uname -n`");
  exit(0);
}
],,LIBS=$olibs, :),
  AC_CHECK_LIB(nsl, gethostbyname,
    olibs=$LIBS
    LIBS="$LIBS -lnsl"))
AC_CHECK_LIB(resolv, inet_aton, LIBS="$LIBS -lresolv",)
dnl AC_HAVE_LIBRARY(PW, LIBS="$LIBS -lPW",)

dnl
dnl check for non-blocking fd style available..
dnl
AC_MSG_CHECKING(for non-blocking)
changequote(<<, >>)dnl
<<
precode='#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <signal.h>

alarmed()
{
	exit(1);
}

main()
{
	char b[12], x[32];
	int f, l = sizeof(x);
	f = socket(AF_INET, SOCK_DGRAM, 0);
	if (f >= 0 && (fcntl(f, F_SETFL,'
postcode=') != -1)) {
		signal(SIGALRM, alarmed);
		alarm(3);
		recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
		alarm(0);
		exit(0);
	}
	exit(1);
}'
>>
changequote([, ])dnl

code="$precode O_NONBLOCK $postcode"

AC_TRY_RUN($code,
  AC_DEFINE(NBLOCK_POSIX)
  AC_MSG_RESULT(posix),
  code="$precode O_NDELAY $postcode"
  AC_TRY_RUN($code,
    AC_DEFINE(NBLOCK_BSD)
    AC_MSG_RESULT(bsd),
    code="$precode FIONBIO $postcode"
    AC_TRY_RUN($code,
      AC_DEFINE(NBLOCK_SYSV)
      AC_MSG_RESULT(system v),
      AC_MSG_WARN(i can't find a working non blocking system),
      :),
    :),
  :)

dnl this is all stolen from perl-4.036's Configure.  larry is god.
dnl well, most of it.  couple of tweaks to make it work better.
echo "generating a list of signal names..."
set X `cat /usr/include/signal.h /usr/include/sys/signal.h /usr/include/linux/signal.h 2>&1 | sed 's/^#[ 	]*/#/' | awk '
$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
  [sig[$3] = substr($2,4,20)]
  if (max < $3 && $3 < 60) {
	max = $3
  }
}

END {
  for (i=1; i<=max; i++) {
    [if (sig[i] == "")]
      printf "%d", i
    else
      [printf "%s", sig[i]]
    if (i < max)
      printf " "
  }
  printf "\n"
}
'`
shift
case $# in
0)
  set X `kill -l 2> /dev/null`
  shift
  case $# in
  0)
    if test -f /bin/csh; then
      set X `/bin/csh -cf 'kill -l'`
      shift
      case $# in
      0)
dnl this is a reasonable default; HUP, QUIT, ABRT, KILL, BUS, SEGV, ALRM and 
dnl TERM are all reasonably portable defaults -- i (mrg) haven't ever seen
dnl a system where they are different than these.
        set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
        ;;
      esac
    fi
    ;;
  esac
  ;;
esac

sig_name="ZERO $*"
if test -f source/sig.inc; then
  /bin/rm -f source/sig.inc
fi

[echo $sig_name | sed -e 's/$/"};/' -e 's/ /", "/g' -e 's/^/char *signals[] = { "/' -e 's/};/, NULL};/' >> source/sig.inc]

dnl work out UNIX mail dir..

AC_MSG_CHECKING(for unix mail directory)

for foo in /var/spool/mail /usr/spool/mail /var/mail /usr/mail
do
  if test -d $foo; then
    mdir=$foo
    break
  fi
done

if test -n "$mdir"; then
  UNIX_MAIL=\"$mdir\"
  AC_MSG_RESULT($mdir)
  AC_DEFINE_UNQUOTED(UNIX_MAIL, "$mdir")
else
  AC_MSG_RESULT(none)
  AC_MSG_CHECKING(for AMS mail)
  if test "x$HOME" != "/" -o -z "x$HOME" && test -d "$HOME/Mailbox"; then
    AC_MSG_RESULT(using Mailbox)
    AC_DEFINE_UNQUOTED(AMS_MAIL, "Mailbox")
  else
    AC_MSG_RESULT(no)
  fi
fi


if test -z "$CFLAGS"; then CFLAGS=-O ; fi
if test -z "$LDFLAGS"; then LDFLAGS= ; fi
RM="rm -f"
LN="ln -s"

if test ! -n "$bindir";
then
	bindir=\${exec_prefix}/bin
fi
AC_SUBST(bindir)

if test ! -n "$IRCLIB";
then
	IRCLIB=\${datadir}/scrollz
fi
AC_SUBST(IRCLIB)

if test "x$exec_prefix" = "xNONE"; then
  if test "x$prefix" = "xNONE"; then
    libdir="$ac_default_prefix/lib"
  else
    if test "x$libdir" = "xNONE"; then
      libdir="$prefix/lib"
    fi
  fi
else
  libdir="$exec_prefix/lib"
fi

AC_MSG_CHECKING(for ElectricFence library)
AC_ARG_WITH(efence,
[  --with-efence[=PATH]    Compile with the ElectricFence debugging library.],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;		
  *)
    AC_MSG_RESULT(yes)
    if test "x$withval" = xyes; then
      withval="-lefence"
    else
      if test -d "$withval"; then
        if test -d "$withval/lib"; then
	  withval="-L$withval/lib -lefence"
	else
	  withval="-L$withval -lefence"
	fi
      fi
    fi
    LIBS="$withval $LIBS"
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(paranoia status)
AC_ARG_WITH(paranoid,
[  --with-paranoid         Sets the compile-time paranoid flag.],
[ AC_MSG_RESULT(yes)
  AC_DEFINE_UNQUOTED(PARANOID, 1) ],
  AC_MSG_RESULT(none)
)

AC_MSG_CHECKING(for /dev/urandom)
if test -c /dev/urandom; then
  AC_MSG_RESULT(yes)
  AC_DEFINE_UNQUOTED(HAVE_DEV_RANDOM, 1)
  AC_DEFINE_UNQUOTED(DEV_RANDOM_PATH, "/dev/urandom")
else
  AC_MSG_RESULT(no)
  AC_MSG_CHECKING(for /dev/random)
  if test -c /dev/random; then
    AC_MSG_RESULT(yes)
    AC_DEFINE_UNQUOTED(HAVE_DEV_RANDOM, 1)
    AC_DEFINE_UNQUOTED(DEV_RANDOM_PATH, "/dev/random")
  else
    AC_MSG_RESULT(no)
  fi
fi

AC_MSG_CHECKING(for default server)
AC_ARG_WITH(default-server,
[  --with-default-server=SERVER[:PORT]     Connect to SERVER by default.],
[ if test "$withval"; then
    AC_MSG_RESULT($withval)
    AC_DEFINE_UNQUOTED(DEFAULT_SERVER, "$withval")
  else
    AC_MSG_RESULT(none)
  fi ],
  AC_MSG_RESULT(none)
)

AC_CHECK_LIB(c, crypt,
  [AC_DEFINE(HAVE_CRYPT)
   LIBS="-lc $LIBS"],
  AC_CHECK_LIB(crypt, crypt,
    [AC_DEFINE(HAVE_CRYPT)
     LIBS="-lcrypt $LIBS"],
    AC_CHECK_LIB(des, des,
      [AC_DEFINE(HAVE_CRYPT)
       LIBS="-ldes $LIBS"])))

AC_MSG_CHECKING(whether to support SOCKS)
AC_ARG_WITH(socks,
[  --with-socks            Compile with SOCKS firewall traversal support.],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  yes)
    AC_MSG_RESULT(yes)
    AC_CHECK_LIB(socks5, SOCKSconnect, [
	    socks=5
	    LIBS="-lsocks5 $LIBS"], [
	AC_CHECK_LIB(socks, Rconnect, [
	    socks=4
	    LIBS="-lsocks $LIBS"], [
		AC_MSG_ERROR(Could not find socks library.  You must first install socks.) ] ) ] )
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

if test "x$socks" = "x"; then
	AC_MSG_CHECKING(whether to support SOCKS5)
	AC_ARG_WITH(socks5,
	[  --with-socks5[=PATH]    Compile with SOCKS5 firewall traversal support.],
	[ case "$withval" in
	  no)
	    AC_MSG_RESULT(no)
	    ;;
	  *)
	    AC_MSG_RESULT(yes)
	    socks=5
	    if test "x$withval" = "xyes"; then
	      withval="-lsocks5"
	    else
	      if test -d "$withval"; then
		if test -d "$withval/include"; then
		  CFLAGS="$CFLAGS -I$withval/include"
		else
		  CFLAGS="$CFLAGS -I$withval"
		fi
	        if test -d "$withval/lib"; then
		  withval="-L$withval/lib -lsocks5"
		else
		  withval="-L$withval -lsocks5"
		fi
	      fi
	    fi
	    LIBS="$withval $LIBS"
	    # If Socks was compiled with Kerberos support, we will need
	    # to link against kerberos libraries.  Temporarily append
	    # to LIBS.  This is harmless if there is no kerberos support.
	    TMPLIBS="$LIBS"
	    LIBS="$LIBS $KERBEROS_LIBS"
	    AC_TRY_LINK([],
	                [ SOCKSconnect(); ],
			[],
			[ AC_MSG_ERROR(Could not find the $withval library.  You must first install socks5.) ])
	    LIBS="$TMPLIBS"
	    ;;
	  esac ],
	  AC_MSG_RESULT(no)
	)
fi

if test "x$socks" = "x"; then
	AC_MSG_CHECKING(whether to support SOCKS4)
	AC_ARG_WITH(socks4,
	[  --with-socks4[=PATH]    Compile with SOCKS4 firewall traversal support.],
	[ case "$withval" in
	  no)
	    AC_MSG_RESULT(no)
	    ;;
	  *)
	    AC_MSG_RESULT(yes)
	    socks=4
	    if test "x$withval" = "xyes"; then
	      withval="-lsocks"
	    else
	      if test -d "$withval"; then
	        withval="-L$withval -lsocks"
	      fi
	    fi
	    LIBS="$withval $LIBS"
	    AC_TRY_LINK([],
	                [ Rconnect(); ],
			[],
			[ AC_MSG_ERROR(Could not find the $withval library.  You must first install socks.) ])
	    ;;
	  esac ],
	  AC_MSG_RESULT(no)
	)
fi



if test "x$socks" = "x4"; then
    AC_DEFINE(SOCKS)
    AC_DEFINE(SOCKS4)
    AC_DEFINE(connect, Rconnect)
    AC_DEFINE(getsockname, Rgetsockname)
    AC_DEFINE(bind, Rbind)
    AC_DEFINE(accept, Raccept)
    AC_DEFINE(listen, Rlisten)
    AC_DEFINE(select, Rselect)
fi

if test "x$socks" = "x5"; then
    AC_DEFINE(SOCKS)
    AC_DEFINE(SOCKS5)
    AC_DEFINE(connect,SOCKSconnect)
    AC_DEFINE(getsockname,SOCKSgetsockname)
    AC_DEFINE(getpeername,SOCKSgetpeername)
    AC_DEFINE(bind,SOCKSbind)
    AC_DEFINE(accept,SOCKSaccept)
    AC_DEFINE(listen,SOCKSlisten)
    AC_DEFINE(select,SOCKSselect)
    AC_DEFINE(recvfrom,SOCKSrecvfrom)
    AC_DEFINE(sendto,SOCKSsendto)
    AC_DEFINE(recv,SOCKSrecv)
    AC_DEFINE(send,SOCKSsend)
    AC_DEFINE(read,SOCKSread)
    AC_DEFINE(write,SOCKSwrite)
    AC_DEFINE(rresvport,SOCKSrresvport)
    AC_DEFINE(shutdown,SOCKSshutdown)
    AC_DEFINE(listen,SOCKSlisten)
    AC_DEFINE(close,SOCKSclose)
    AC_DEFINE(dup,SOCKSdup)
    AC_DEFINE(dup2,SOCKSdup2)
    AC_DEFINE(fclose,SOCKSfclose)
    AC_DEFINE(gethostbyname,SOCKSgethostbyname)
fi

AC_MSG_CHECKING([whether to enable ipv6])
if test "x$socks" = "x4" -o "x$socks" = "x5"; then
AC_MSG_RESULT(no, bacause you enabled SOCKS$socks support)
else
AC_ARG_ENABLE(ipv6,
[  --enable-ipv6           Enable ipv6 (with ipv4) support],
[ case "$enableval" in
  yes) AC_MSG_RESULT(yes)
       AC_DEFINE(INET6)
       ipv6=yes
       ;;
  esac ])
if test "x$ipv6" = "xno" -o "x$ipv6" = "x" ; then
       AC_MSG_RESULT(no)
       ipv6=no
fi

ipv6type=unknown
ipv6lib=none
ipv6trylibc=no

if test "x$ipv6" = "xyes"; then
        AC_MSG_CHECKING([ipv6 stack type])
        for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
                case $i in
                inria)
                        dnl http://www.kame.net/
                        AC_EGREP_CPP(yes, [dnl
#include <netinet/in.h>
#ifdef IPV6_INRIA_VERSION
yes
#endif],
                                [ipv6type=$i;
				AC_DEFINE(INET6)])
                        ;;
                kame)
                        dnl http://www.kame.net/
                        AC_EGREP_CPP(yes, [dnl
#include <netinet/in.h>
#ifdef __KAME__
yes
#endif],
                                [ipv6type=$i;
                                ipv6lib=inet6;
                                ipv6libdir=/usr/local/v6/lib;
                                ipv6trylibc=yes;
				AC_DEFINE(INET6)])
                        ;;
                linux-glibc)
                        dnl http://www.v6.linux.or.jp/
                        AC_EGREP_CPP(yes, [dnl
#include <features.h>
#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
yes
#endif],
                                [ipv6type=$i;
				AC_DEFINE(INET6)])
                        ;;
                linux-libinet6)
                        dnl http://www.v6.linux.or.jp/
                        if test -d /usr/inet6 -a -f /usr/include/netinet/ip6.h; then
                                ipv6type=$i
                                ipv6lib=inet6
                                ipv6libdir=/usr/inet6/lib
                                ipv6trylibc=yes;
                                CFLAGS="-I/usr/inet6/include $CFLAGS"
				AC_DEFINE(INET6)
                        fi
                        ;;
                toshiba)
                        AC_EGREP_CPP(yes, [dnl
#include <sys/param.h>
#ifdef _TOSHIBA_INET6
yes
#endif],
                                [ipv6type=$i;
                                ipv6lib=inet6;
                                ipv6libdir=/usr/local/v6/lib;
				AC_DEFINE(INET6)])
                        ;;
                v6d)
                        AC_EGREP_CPP(yes, [dnl
#include </usr/local/v6/include/sys/v6config.h>
#ifdef __V6D__
yes
#endif],
                                [ipv6type=$i;
                                ipv6lib=v6;
                                ipv6libdir=/usr/local/v6/lib;
                                CFLAGS="-I/usr/local/v6/include $CFLAGS"])
                        ;;
                zeta)
                        AC_EGREP_CPP(yes, [dnl
#include <sys/param.h>
#ifdef _ZETA_MINAMI_INET6
yes
#endif],
                                [ipv6type=$i;
                                ipv6lib=inet6;
                                ipv6libdir=/usr/local/v6/lib;
				AC_DEFINE(INET6)])
                        ;;
                esac
                if test "x$ipv6type" != "xunknown"; then
                        break
                fi
        done
        AC_MSG_RESULT($ipv6type)
fi
if test "x$ipv6" = "xyes" -a "x$ipv6lib" != "xnone"; then
        if test -d "$ipv6libdir" -a -f "$ipv6libdir/lib$ipv6lib.a"; then
                LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
                AC_MSG_RESULT(You have $ipv6lib library, using it)
        else
                if test "x$ipv6trylibc" = "xyes"; then
                        AC_MSG_RESULT([You do not have (need) $ipv6lib library, using libc])
                else
                        AC_MSG_ERROR(Fatal: no $ipv6lib library found.  cannot continue.
You need to fetch lib$ipv6lib.a from appropriate
ipv6 kit and compile beforehand.)
                fi
        fi
fi
AC_MSG_CHECKING(getaddrinfo bug)
AC_TRY_RUN([
#include <sys/types.h>
#include <netdb.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>

main()
{
  int passive, gaierr, inet4 = 0, inet6 = 0;
  struct addrinfo hints, *ai, *aitop;
  char straddr[INET6_ADDRSTRLEN], strport[16];

  for (passive = 0; passive <= 1; passive++) {
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_UNSPEC;
    hints.ai_flags = passive ? AI_PASSIVE : 0;
    hints.ai_socktype = SOCK_STREAM;
    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
      (void)gai_strerror(gaierr);
      goto bad;
    }
    for (ai = aitop; ai; ai = ai->ai_next) {
      if (ai->ai_addr == NULL ||
          ai->ai_addrlen == 0 ||
          getnameinfo(ai->ai_addr, ai->ai_addrlen,
                      straddr, sizeof(straddr), strport, sizeof(strport),
                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
        goto bad;
      }
      switch (ai->ai_family) {
      case AF_INET:
        if (strcmp(strport, "54321") != 0) {
          goto bad;
        }
        if (passive) {
          if (strcmp(straddr, "0.0.0.0") != 0) {
            goto bad;
          }
        } else {
          if (strcmp(straddr, "127.0.0.1") != 0) {
            goto bad;
          }
        }
        inet4++;
        break;
      case AF_INET6:
        if (strcmp(strport, "54321") != 0) {
          goto bad;
        }
        if (passive) {
          if (strcmp(straddr, "::") != 0) {
            goto bad;
          }
        } else {
          if (strcmp(straddr, "::1") != 0) {
            goto bad;
          }
        }
        inet6++;
        break;
      case AF_UNSPEC:
        goto bad;
        break;
      default:
        /* another family support? */
        break;
      }
    }
  }

  if (inet4 != 0 && inet4 != 2)
    goto bad;
  if (inet6 != 0 && inet6 != 2)
    goto bad;

  if (aitop)
    freeaddrinfo(aitop);
  exit(0);

 bad:
  if (aitop)
    freeaddrinfo(aitop);
  exit(1);
}
],
AC_MSG_RESULT(good)
buggygetaddrinfo=no,
AC_MSG_RESULT(buggy)
buggygetaddrinfo=yes,
AC_MSG_RESULT(buggy)
buggygetaddrinfo=yes)
fi

if test "x$buggygetaddrinfo" = "xyes"; then
        if test "x$ipv6" = "xyes" -a "x$ipv6type" != "xlinux"; then
                AC_MSG_ERROR(Fatal: You must get working getaddrinfo() function.)
                AC_MSG_ERROR(       or you can specify "--disable-ipv6".)
                exit 1
        elif test "x$ipv6type" = "xlinux"; then
                AC_MSG_ERROR(Warning: getaddrinfo() implementation on your system seems be buggy.)
                AC_MSG_ERROR(         Better upgreade your system library to newest version)
                AC_MSG_ERROR([         of GNU C library (aka glibc).])
        fi
fi

AC_MSG_CHECKING(for struct sockaddr's sa_len)
AC_TRY_LINK([
#include <sys/types.h>
#include <sys/socket.h>
],[
  struct sockaddr sa;
  int i;

  i = sa.sa_len;
  exit(0);
],
  AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
  AC_MSG_RESULT(yes),
  AC_MSG_RESULT(no))

AC_MSG_CHECKING(whether to enable SSL)
AC_ARG_WITH(ssl,
[  --with-ssl[=PATH]       Prefix where GNU TLS is installed (optional)],
[ case "$withval" in
  no)  AC_MSG_RESULT(no)
       ;;		
  *) AC_MSG_RESULT(yes)
     olibs="$LIBS"
     ocflags="$CFLAGS"
     if test "x$withval" = "xyes";
     then
       gnutls_prefix=""
     else
       gnutls_prefix="$withval"
     fi
     AC_MSG_CHECKING(for GNU TLS)
     pkg-config --exists gnutls >/dev/null 2>&1
     if test $? -ne 0;
     then
         AC_MSG_RESULT(no)
         ssl=no
     else
         if test -d "$gnutls_prefix/include" -a -n "$gnutls_prefix"; then
           CFLAGS="-I$gnutls_prefix/include"
         else
           CFLAGS="$ocflags `pkg-config --cflags gnutls`"
         fi
         if test -d "$gnutls_prefix/lib" -a -n "$gnutls_prefix"; then
           LIBS="$olibs -L$gnutls_prefix/lib -lgnutls"
         else
           LIBS="$olibs `pkg-config --libs gnutls`"
         fi
         AC_TRY_LINK([
#include <gnutls/gnutls.h>
    ],   [ gnutls_check_version(NULL); ],
         [ AC_MSG_RESULT(yes)
         AC_DEFINE(HAVE_SSL)
         ssl=yes ],
         [ AC_MSG_RESULT(no)
         LIBS="$olibs"
         CFLAGS="$ocflags"
         ssl=no ])
    fi
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether to enable OpenSSL)
if test "x$ssl" = "xyes"; then
AC_MSG_RESULT(no (you enabled GNU TLS support))
else
AC_ARG_WITH(openssl,
[  --with-openssl[=PATH]   Prefix where OpenSSL is installed (optional)],
[ case "$withval" in
  no)  AC_MSG_RESULT(no)
       ;;		
  *) AC_MSG_RESULT(yes)
     olibs="$LIBS"
     ocflags="$CFLAGS"
     if test "x$withval" = "xyes";
     then
       openssl_prefix=""
     else
       openssl_prefix="$withval"
     fi
     AC_MSG_CHECKING(for OpenSSL)
     if test -d "$openssl_prefix/include" -a -n "$openssl_prefix"; then
       CFLAGS="-I$openssl_prefix/include $CFLAGS"
     fi
     if test -d "$openssl_prefix/lib" -a -n "$openssl_prefix"; then
       LIBS="-L$openssl_prefix/lib $LIBS -lssl -lcrypto"
     else
       LIBS="$LIBS -lssl -lcrypto"
     fi
     AC_TRY_LINK([
#include <openssl/opensslv.h>
],   [ return OPENSSL_VERSION_NUMBER; ],
     [ AC_MSG_RESULT(yes)
     AC_DEFINE(HAVE_OPENSSL)
     openssl=yes ],
     [ AC_MSG_RESULT(no)
     LIBS="$olibs"
     CFLAGS="$ocflags"
     openssl=no ])
     ;;
  esac ],
  AC_MSG_RESULT(no)
)
fi

AC_MSG_CHECKING(whether to enable regexp support)
AC_ARG_ENABLE(regexp,
[  --enable-regexp         Enable POSIX.2 regexp support],
[ case "$enableval" in
  yes) AC_TRY_LINK([
#include <sys/types.h>
#include <regex.h>
],   [ int rc;
       regex_t preg;
       rc = regcomp(&preg, "blah", REG_EXTENDED);
       if (rc != 0) return 1;
       else return 0; ],
     [ AC_MSG_RESULT(yes)
     AC_DEFINE(HAVE_REGCOMP)
     regexp=yes ],
     [ AC_MSG_RESULT(no)
     LIBS="$ac_save_LIBS"
     regexp=no ])
     ;;
  esac ])
if test "x$regexp" = "xno" -o "x$regexp" = "x" ; then
    AC_MSG_RESULT(no)
    regexp=no
fi

AC_MSG_CHECKING(whether to enable FiSH support)
AC_ARG_ENABLE(fish,
[  --enable-fish           Enable FiSH encryption support],
[ case "$enableval" in
  yes) olibs="$LIBS"
       LIBS="$LIBS -lgmp"
       AC_TRY_LINK([
#include <sys/types.h>
#include <gmp.h>
],   [ int rc;
       mpz_t val;
       mpz_init(val);
       return 0; ],
     [ AC_MSG_RESULT(yes)
     AC_DEFINE(HAVE_GMP)
     fish=yes ],
     [ LIBS="$olibs"
       fish=no ])
     ;;
  esac ])
if test "x$fish" = "xno" -o "x$fish" = "x" ; then
    AC_MSG_RESULT(no)
    fish=no
fi

if test -n "$hpux"
then
	# HP-UX's pax is broken
	AC_CHECK_PROGS(COPY_DIRECTORY, tar cpio)
else
	AC_CHECK_PROGS(COPY_DIRECTORY, pax tar cpio)
fi
if test "x$COPY_DIRECTORY" = "xpax";
then
    INSTALL_HELP_CMD='cd help; pax -r -w -s ";.*/\.?CVS$$;;" -s ";.*/\.?CVS/.*;;" . $(DESTDIR)/$(HELP_DIR)'
else
    if test "x$COPY_DIRECTORY" = "xtar";
    then
	INSTALL_HELP_CMD='cd help; tar -cf - . | ( cd $(DESTDIR)/$(HELP_DIR); tar -xf - )'
    else
	if test "x$COPY_DIRECTORY" = "xcpio";
	then
	    INSTALL_HELP_CMD='cd help; find . -print | cpio -pdu $(DESTDIR)/$(HELP_DIR)'
	else
	    INSTALL_HELP_CMD="@echo \"I couldn't figure out a way to install the help files.\""
	fi
    fi
fi
AC_SUBST(INSTALL_HELP_CMD)
if test "x$COPY_DIRECTORY" = "xpax";
then
    INSTALL_TRANSLATION_CMD='cd translation; pax -r -w -s ";.*/\.?CVS$$;;" -s ";.*/\.?CVS/.*;;" . $(DESTDIR)/$(TRANS_PATH)'
else
    if test "x$COPY_DIRECTORY" = "xtar";
    then
	INSTALL_TRANSLATION_CMD='cd translation; tar -cf - . | ( cd $(DESTDIR)/$(TRANS_PATH); tar -xf - )'
    else
	if test "x$COPY_DIRECTORY" = "xcpio";
	then
	    INSTALL_TRANSLATION_CMD='cd translation; find . -print | cpio -pdu $(DESTDIR)/$(TRANS_PATH)'
	else
	    INSTALL_TRANSLATION_CMD="@echo \"I couldn't figure out a way to install the translation files.\""
	fi
    fi
fi
AC_SUBST(INSTALL_TRANSLATION_CMD)

AC_CHECK_PROGS(ZCAT, gzcat zcat gunzip gzip uncompress uncompress)
case "x$ZCAT" in
  xgzcat)
    ZSUFFIX=".gz"
    ZARGS=
    ;;
  xzcat)
    ZSUFFIX=".Z"
    ZARGS=
    ;;
  xgunzip)
    ZSUFFIX=".gz"
    ZARGS="-c"
    ;;
  xgzip)
    ZSUFFIX=".gz"
    ZARGS="-dc"
    ;;
  xuncompress)
    ZSUFFIX=".Z"
    ZARGS="-c"
    ;;
  xcompress)
    ZSUFFIX=".Z"
    ZARGS="-dc"
    ;;
esac
AC_DEFINE_UNQUOTED(ZCAT,"$ZCAT")
AC_DEFINE_UNQUOTED(ZSUFFIX,"$ZSUFFIX")
if test x"$ZARGS" != x; then
  AC_DEFINE_UNQUOTED(ZARGS,"$ZARGS")
fi

AC_FIND_PROGRAM(SENDMAIL,sendmail,/usr/sbin:/usr/lib:/usr/ucblib)

AC_SUBST(RM)
AC_SUBST(LN)
AC_OUTPUT(Makefile source/Makefile ircbug)

#if test ! -f config.h; then
#  cp ${srcdir}/include/config.h.dist config.h
#fi

echo
echo well there we are, you now might want to look in config.h and 
echo see if there is anything you might want to tune, else you can
echo just run a make here..  good luck!
echo