aboutsummaryrefslogtreecommitdiff
path: root/support/configure.in
blob: 3d425e5097e2df1c0717002fa44e9ee276042edf (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
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
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
dnl configure.in for irc-2.10.1
dnl Matthew Green (mrg@mame.mu.oz.au), Alain Nissen (Alain.Nissen@ulg.ac.be)
dnl using portions of Avalon's Config and GNU Autoconf 1.12.

dnl ---------
dnl new tests
dnl ---------

AC_DEFUN(IRC_PATH_ZLIB,
[AC_MSG_CHECKING(for zlib package)
AC_ARG_WITH(zlib, [  --with-zlib             checks for zlib; if found, enables compressed links])
AC_ARG_WITH(zlib, [  --without-zlib          does not check for zlib; disables compressed links])
if test "x$with_zlib" = xno; then
  no_zlib=yes
else
AC_CACHE_VAL(irc_cv_path_zlib,
[no_zlib=yes
no_zlib_include=yes
no_zlib_library=yes
AC_TRY_CPP([#include <zlib.h>],
[no_zlib_include=
irc_zlib_include=],
[for irc_dir in "$irc_zlib_include" \
                     `test -z "$irc_zlib_prefix" || echo "$irc_zlib_prefix/include"` \
                     `echo "$irc_zlib_library" | sed s/lib/include/` \
                     /usr/include /usr/local/include /usr/unsupported/include \
                     /usr/share/include /usr/local/share/include /include \
                     /usr/zlib/include /usr/local/zlib/include \
                     /usr/include/zlib /usr/local/include/zlib \
                     /usr/unsupported/include/zlib /usr/share/include/zlib \
                     /usr/local/share/include/zlib /include/zlib \
                     /usr/zlib/include/zlib /usr/local/zlib/include/zlib; \
  do
    if test -r "$irc_dir/zlib.h"; then
      no_zlib_include=
      irc_zlib_include=$irc_dir
      break
    fi
  done
])
irc_save_LIBS="$LIBS"
LIBS="-lz $LIBS"
AC_TRY_LINK(,
[inflate()],
[no_zlib_library=
irc_zlib_library=
LIBS="$irc_save_LIBS"],
[LIBS="$irc_save_LIBS"
for irc_dir in "$irc_zlib_library" \
                    `test -z "$irc_zlib_prefix" || echo "$irc_zlib_prefix/lib"` \
                    `echo "$irc_zlib_include" | sed s/include/lib/` \
                    /usr/lib /usr/local/lib /usr/unsupported/lib \
                    /usr/share/lib /usr/local/share/lib /lib /usr/zlib/lib \
                    /usr/local/zlib/lib /usr/lib/zlib /usr/local/lib/zlib \
                    /usr/unsupported/lib/zlib /usr/share/lib/zlib \
                    /usr/local/share/lib/zlib /lib/zlib \
                    /usr/zlib/lib/zlib /usr/local/zlib/lib/zlib; \
do
  for irc_extension in a so sl; do
    if test -r $irc_dir/libz.$irc_extension; then
      no_zlib_library=
      irc_zlib_library=$irc_dir
      break 2
    fi
  done
done
])
if test "x$no_zlib_include" = x && test "x$no_zlib_library" = x; then
  no_zlib=
fi
if test "$no_zlib" = yes; then
  irc_cv_path_zlib="no_zlib=yes"
else
  irc_cv_path_zlib="no_zlib= irc_zlib_include=$irc_zlib_include irc_zlib_library=$irc_zlib_library"
fi])
  eval "$irc_cv_path_zlib"
fi
if test "$no_zlib" = yes; then
  IRC_ZLIB_LIBRARY=
  IRC_ZLIB_INCLUDE=
  AC_MSG_RESULT(no)
else
  AC_DEFINE(USE_ZLIB)
  if test "x$irc_zlib_library" = x; then
    irc_zlib_library_message="found by the linker"
    IRC_ZLIB_LIBRARY=-lz
  else
    irc_zlib_library_message="in $irc_zlib_library"
    IRC_ZLIB_LIBRARY=-L$irc_zlib_library
    if test ! "$irc_cv_solaris_2" = no; then
      IRC_ZLIB_LIBRARY="$IRC_ZLIB_LIBRARY -R$irc_zlib_library"
    fi
    IRC_ZLIB_LIBRARY="$IRC_ZLIB_LIBRARY -lz"
  fi
  if test "x$irc_zlib_include" = x; then
    irc_zlib_include_message="found by the compiler"
    IRC_ZLIB_INCLUDE=
  else
    irc_zlib_include_message="in $irc_zlib_include"
    IRC_ZLIB_INCLUDE=-I$irc_zlib_include
  fi
  AC_MSG_RESULT([])
  AC_MSG_RESULT([  library $irc_zlib_library_message])
  AC_MSG_RESULT([  header $irc_zlib_include_message])
fi
AC_SUBST(IRC_ZLIB_INCLUDE)
AC_SUBST(IRC_ZLIB_LIBRARY)
])


AC_DEFUN(IRC_CURSES_TERMCAP,
[AC_MSG_CHECKING([which curses or termcap library will be used])
AC_ARG_WITH(ncurses, [  --without-ncurses       does not look for ncurses library, will not use it])
AC_ARG_WITH(cursesX, [  --without-cursesX       does not look for cursesX library, will not use it])
AC_ARG_WITH(curses, [  --without-curses        does not look for curses library, will not use it])
AC_ARG_WITH(termcap, [  --without-termcap       does not look for termcap library, will not use it])
AC_CACHE_VAL(irc_cv_curses_termcap,
[irc_save_LIBS="$LIBS"
LIBS="-lncurses $irc_save_LIBS"
AC_TRY_LINK(,
[initscr()],
irc_ncurses=yes,
irc_ncurses=no)
LIBS="-lcursesX $irc_save_LIBS"
AC_TRY_LINK(,
[initscr()],
irc_cursesX=yes,
irc_cursesX=no)
LIBS="-lcurses $irc_save_LIBS"
AC_TRY_LINK(,
[initscr()],
irc_curses=yes,
irc_curses=no)
LIBS="-lcurses -ltermcap $irc_save_LIBS"
AC_TRY_LINK(,
[initscr()],
irc_curses_termcap=yes,
irc_curses_termcap=no)
LIBS="-ltermcap $irc_save_LIBS"
AC_TRY_LINK(,
[tgetent()],
irc_termcap=yes,
irc_termcap=no)
LIBS="$irc_save_LIBS"
irc_cv_curses_termcap="irc_ncurses=$irc_ncurses irc_curses=$irc_curses irc_cursesX=$irc_cursesX irc_curses_termcap=$irc_curses_termcap irc_termcap=$irc_termcap"
])
eval $irc_cv_curses_termcap
if test "x$with_ncurses" = xno; then
  irc_ncurses=no
fi
if test "x$with_cursesX" = xno; then
  irc_cursesX=no
fi
if test "x$with_curses" = xno; then
  irc_curses=no
  irc_curses_termcap=no
fi
if test "x$with_termcap" = xno; then
  irc_termcap=no
fi
if test $irc_ncurses = yes; then
  AC_MSG_RESULT(ncurses)
  AC_DEFINE(USE_NCURSES)
  IRC_CURSES_TERMCAP_LIBRARY="-lncurses"
elif test $irc_cursesX = yes; then
  AC_MSG_RESULT(cursesX)
  AC_DEFINE(USE_CURSESX)
  IRC_CURSES_TERMCAP_LIBRARY="-lcursesX"
elif test $irc_curses = yes; then
  AC_MSG_RESULT(curses)
  AC_DEFINE(USE_CURSES)
  IRC_CURSES_TERMCAP_LIBRARY="-lcurses"
elif test $irc_curses_termcap = yes; then
  AC_MSG_RESULT(curses over termcap)
  AC_DEFINE(USE_CURSES)
  IRC_CURSES_TERMCAP_LIBRARY="-lcurses -ltermcap"
elif test $irc_termcap = yes; then
  AC_MSG_RESULT(termcap)
  AC_DEFINE(USE_TERMCAP)
  IRC_CURSES_TERMCAP_LIBRARY="-ltermcap"
else
  AC_MSG_RESULT(none)
  AC_MSG_WARN([I can't find either ncurses, cursesX, curses or termcap library.])
  IRC_CURSES_TERMCAP_LIBRARY=
fi
AC_SUBST(IRC_CURSES_TERMCAP_LIBRARY)
])


AC_DEFUN(IRC_UNION_WAIT,
[AC_MSG_CHECKING(whether an union wait * is mandatory in waitpid)
AC_CACHE_VAL(irc_cv_type_union_wait,
AC_TRY_COMPILE([
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif],
[
int status;
waitpid(-1, &status, 0);
],
irc_cv_type_union_wait=no,
AC_TRY_COMPILE([
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif],
[
union wait status;
waitpid(-1, &status, 0);
],
irc_cv_type_union_wait=yes,
irc_cv_type_union_wait=no)))
if test $irc_cv_type_union_wait = yes; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(USE_UNION_WAIT)
else
  AC_MSG_RESULT(no)
fi
])


AC_DEFUN(IRC_SUN,
[AC_MSG_CHECKING([for SunOS])
AC_CACHE_VAL(irc_cv_sun,
[if test "x`(uname) 2>/dev/null`" = "xSunOS"; then
  irc_cv_sun="`uname -r`"
else
  irc_cv_sun=no
fi
])
irc_cv_solaris_2=no
if test "$irc_sun" = no; then
  AC_MSG_RESULT(no)
else
  if uname -r 2>/dev/null | grep "^5" >/dev/null; then
    irc_cv_solaris_2="`uname -r | sed -e \"s/^5/2/g\"`"
    AC_MSG_RESULT([yes, Solaris $irc_cv_solaris_2])
    AC_DEFINE(SOLARIS_2)
    if echo "$irc_cv_solaris_2" | egrep "^2\.(0|1|2)" >/dev/null; then
      AC_DEFINE(SOLARIS_2_0_2_1_2_2)
    elif echo "$irc_cv_solaris_2" | grep "^2\.3" >/dev/null; then
      AC_DEFINE(SOLARIS_2_3)
    fi
  else
    AC_MSG_RESULT([yes, SunOS $irc_cv_sun])
  fi
fi
])


AC_DEFUN(IRC_DECL_SYS_ERRLIST,
[AC_CACHE_CHECK([for sys_errlist declaration in stdio.h, errno.h or sys/errno.h],
  irc_cv_decl_sys_errlist,
[AC_TRY_COMPILE([
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_SYS_ERRNO_H
#include <sys/errno.h>
#endif],
[char *msg = sys_errlist[0];],
  irc_cv_decl_sys_errlist=yes, irc_cv_decl_sys_errlist=no)])
if test $irc_cv_decl_sys_errlist = yes; then
  AC_DEFINE(SYS_ERRLIST_DECLARED)
fi
])


AC_DEFUN(IRC_DECL_SYS_NERR,
[AC_CACHE_CHECK([for sys_nerr declaration in stdio.h, errno.h or sys/errno.h],
  irc_cv_decl_sys_nerr,
[AC_TRY_COMPILE([
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_SYS_ERRNO_H
#include <sys/errno.h>
#endif],
[int num = sys_nerr;],
  irc_cv_decl_sys_nerr=yes, irc_cv_decl_sys_nerr=no)])
if test $irc_cv_decl_sys_nerr = yes; then
  AC_DEFINE(SYS_NERR_DECLARED)
fi
])


AC_DEFUN(IRC_DECL_ERRNO,
[AC_CACHE_CHECK([for errno declaration in errno.h or sys/errno.h],
  irc_cv_decl_errno,
[AC_TRY_COMPILE([
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_SYS_ERRNO_H
#include <sys/errno.h>
#endif],
[int num = errno;],
  irc_cv_decl_errno=yes, irc_cv_decl_errno=no)])
if test $irc_cv_decl_errno = yes; then
  AC_DEFINE(ERRNO_DECLARED)
fi
])


AC_DEFUN(IRC_DECL_H_ERRNO,
[AC_CACHE_CHECK([for h_errno declaration in errno.h, sys/errno.h or netdb.h],
  irc_cv_decl_h_errno,
[AC_TRY_COMPILE([
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_SYS_ERRNO_H
#include <sys/errno.h>
#endif
#if HAVE_NETDB_H
#include <netdb.h>
#endif],
[int num = h_errno;],
  irc_cv_decl_h_errno=yes, irc_cv_decl_h_errno=no)])
if test $irc_cv_decl_h_errno = yes; then
  AC_DEFINE(H_ERRNO_DECLARED)
fi
])


AC_DEFUN(IRC_SGI_CC,
[AC_MSG_CHECKING([for SGI's cc])
AC_EGREP_CPP(yes,
[#ifdef sgi
yes
#endif],
if test x$CC = xcc; then
  AC_MSG_RESULT(yes)
  CC="$CC -cckr"
else
  AC_MSG_RESULT(no)
fi,
AC_MSG_RESULT(no))
])


AC_DEFUN(IRC_HPUX_CC,
[AC_MSG_CHECKING([for HPUX's cc])
AC_EGREP_CPP(yes,
[#ifdef hpux
yes
#endif],
if test x$CC = xcc; then
  AC_MSG_RESULT(yes)
  CC="$CC -Ae"
else
  AC_MSG_RESULT(no)
fi,
AC_MSG_RESULT(no))
])


AC_DEFUN(IRC_ALPHA_BETA,
[AC_MSG_CHECKING(whether this is an alpha/beta release)
AC_CACHE_VAL(irc_cv_alpha_beta,
[AC_EGREP_CPP(^\"......00,
[#include "../common/patchlevel.h"
#ifdef PATCHLEVEL
PATCHLEVEL
#else
"0000000000"
#endif
],irc_cv_alpha_beta=,
irc_cv_alpha_beta=yes)
])
if test x$irc_cv_alpha_beta = xyes; then
  AC_MSG_RESULT(yes)
  AC_MSG_WARN([

This is a development version of the package,
it is not intended to be used in a production environment.
])
#  if test ! "$ac_test_CFLAGS" = set; then
#    if test x$ac_cv_prog_cc_g = xyes -o x$GCC = x; then
#      CFLAGS="$CFLAGS -g"
#    fi
#  fi
else
  AC_MSG_RESULT(no)
#  if test ! "${LDFLAGS+set}" = set; then
#    LDFLAGS="-s"
#  fi
fi

if test ! "$ac_test_CFLAGS" = set; then
  if test x$ac_cv_prog_cc_g = xyes -o x$GCC = x; then
    CFLAGS="$CFLAGS -g"
  fi
fi
])


AC_DEFUN(IRC_SELECT_POLL,
[AC_MSG_CHECKING([whether select or poll system call will be used])
AC_CACHE_VAL(irc_cv_select_poll,
[if test "$irc_cv_sun" != "no" && test "x$irc_cv_solaris_2" = "xno"; then
  # we don't like SunOS' poll() function
  irc_cv_select_poll=select
else  
  if test "$ac_cv_func_poll" = "yes"; then
    irc_cv_select_poll=poll
  else
    irc_cv_select_poll=select
  fi
fi])

if test "$irc_cv_select_poll" = "poll"; then
  AC_MSG_RESULT(poll)
  AC_DEFINE(USE_POLL)
  if test ! "$irc_cv_linux" = "no"; then
    AC_MSG_WARN([Aiiie.. This is linux.  poll() is known to be broken for some releases (2.0.x with libc6?).  You may want to edit setup.h to undefine USE_POLL])
  fi
else
  AC_MSG_RESULT(select)
fi
])


AC_DEFUN(IRC_SIGNAL_IMPLEMENTATION,
[AC_MSG_CHECKING([for signal implementation])
AC_CACHE_VAL(irc_cv_signal_implementation,
[if test x$ac_cv_func_sigaction = xyes; then
  irc_cv_signal_implementation=posix_sigaction
elif test x$ac_cv_func_sigset = xyes; then
  irc_cv_signal_implementation=bsd_sigset
else
  AC_TRY_RUN([
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#ifndef SIGCHLD
#define SIGCHLD SIGCLD
#endif

int got = 0;

RETSIGTYPE hand()
{
  got++;
}

main()
{
  (void)signal(SIGCHLD, hand);
  kill(getpid(), SIGCHLD);
  kill(getpid(), SIGCHLD);
  if (got < 2)
    exit(1);
  exit(0);
}
],
    irc_cv_signal_implementation=bsd_signal,
    irc_cv_signal_implementation=sysv_signal)
fi
])
if test $irc_cv_signal_implementation = posix_sigaction; then
  AC_MSG_RESULT([using POSIX sigaction])
  AC_DEFINE(POSIX_SIGNALS)
elif test $irc_cv_signal_implementation = bsd_sigset; then
  AC_MSG_RESULT([using BSD sigset])
  AC_DEFINE(BSD_RELIABLE_SIGNALS)
  AC_DEFINE(signal, sigset)
elif test $irc_cv_signal_implementation = bsd_signal; then
  AC_MSG_RESULT([using reliable BSD signal])
  AC_DEFINE(BSD_RELIABLE_SIGNALS)
else
  AC_MSG_RESULT([using unreliable SystemV signal])
  AC_DEFINE(SYSV_UNRELIABLE_SIGNALS)
fi
])


AC_DEFUN(IRC_NON_BLOCKING_SYSTEM,
[AC_MSG_CHECKING([for a working non-blocking system])
AC_CACHE_VAL(irc_cv_non_blocking_system,
[
changequote(<<, >>)dnl
irc_precode='#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#if HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

RETSIGTYPE alarmed()
{
  exit(1);
}

main()
{
  char b[12];
  struct sockaddr_in x;
  int f, l = sizeof(x);
  f = socket(AF_INET, SOCK_DGRAM, 0);
  if (f >= 0 && !(fcntl(f, F_SETFL, '
irc_postcode=')))
    {
      signal(SIGALRM, alarmed);
      alarm(3);
      recvfrom(f, b, 12, 0, &x, &l);
      alarm(0);
      exit(0);
    }
   exit(1);
}'
changequote([, ])dnl
irc_code_posix="${irc_precode}O_NONBLOCK${irc_postcode}"
irc_code_bsd="${irc_precode}O_NDELAY${irc_postcode}"
irc_code_sysv="${irc_precode}FIONBIO${irc_postcode}"
AC_TRY_RUN($irc_code_posix,
  irc_cv_non_blocking_system=posix,
  AC_TRY_RUN($irc_code_bsd,
    irc_cv_non_blocking_system=bsd,
    AC_TRY_RUN($irc_code_sysv,
      irc_cv_non_blocking_system=sysv,
      irc_cv_non_blocking_system=none)))
])
if test $irc_cv_non_blocking_system = posix; then
  AC_MSG_RESULT([using POSIX O_NONBLOCK])
  AC_DEFINE(NBLOCK_POSIX)
elif test $irc_cv_non_blocking_system = bsd; then
  AC_MSG_RESULT([using BSD O_NDELAY])
  AC_DEFINE(NBLOCK_BSD)
elif test $irc_cv_non_blocking_system = sysv; then
  AC_MSG_RESULT([using SystemV FIONBIO])
  AC_DEFINE(NBLOCK_SYSV)
else
  AC_MSG_RESULT([using none])
  AC_MSG_WARN([I can't find a working non-blocking system.])
fi
])


AC_DEFUN(IRC_STDARG,
[AC_MSG_CHECKING([for working stdarg])
AC_CACHE_VAL(irc_cv_stdarg,
AC_TRY_RUN(
[
changequote(<<, >>)dnl
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#if HAVE_STDARG_H
#include <stdarg.h>
#endif
#if HAVE_STRING_H
#include <string.h>
#endif

char buf1[256];

int level1(char *data, char *format, va_list ap)
{
  return vsprintf(data, format, ap);
}

int level2(char *data, int rounds, char *format, va_list ap)
{
  if(!--rounds)
    return level1(data, format, ap);
  else {
    if(rounds == 2) {
      va_list ap2 = ap;
      char *arg = va_arg(ap2, char *);
      strcpy(buf1, arg);
    }
    return level2(data, rounds, format, ap);
  }
}

int level3(char *data, char *format, va_list ap)
{
  return level2(data, 5, format, ap);
}

int dotest(int size, char *val, char *data)
{
  if(size != strlen(val))
    return 0;
  if(strcmp(data, val))
    return 0;
  if(strcmp(buf1, "was"))
    return 0;
  return 1;
}

int base(char *val, char *format, ...)
{
  int res = 1;
  char data[256];

  {
    va_list ap;
    data[0]=0;
    va_start(ap, format);
    res = dotest(level3(data, format, ap), val, data);
    va_end(ap);
  }

  {
    va_list ap;
    data[0]=0;
    va_start(ap, format);
    res = res && dotest(level3(data, format, ap), val, data);
    va_end(ap);
  }

  return res;
}

int main(void)
{
  int res = base("toto was here ! 42", "toto %s here ! %d", "was", 42);

  exit(res ? 0 : 1);
}
changequote([, ])dnl
],
irc_cv_stdarg=yes,
irc_cv_stdarg=no)
)
if test $irc_cv_stdarg = yes; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(USE_STDARG)
else
  AC_MSG_RESULT(no)
fi
])


AC_DEFUN(IRC_PATH_RESCONF,
[AC_MSG_CHECKING([for resolver configuration file])
AC_CACHE_VAL(irc_cv_path_resconf,
[if test -z "$irc_resconf"; then
   irc_cv_path_resconf="/etc/resolv.conf";
 else
   irc_cv_path_resconf="$irc_resconf";
 fi
])
AC_MSG_RESULT($irc_cv_path_resconf)
AC_DEFINE_UNQUOTED(IRC_RESCONF, "$irc_cv_path_resconf")
if test ! -r "$irc_cv_path_resconf"; then
  AC_MSG_WARN([Unable to read \"$irc_cv_path_resconf\"! Without resolver configuration file, the server won't work.])
fi
])


AC_DEFUN(IRC_EGREP_RMLF_CPP,
[cat > conftest.$ac_ext <<EOF
[#]line __oline__ "configure"
#include "confdefs.h"
[$2]
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
  $AWK "{if (NR > 1) printf(\" \"); printf(\[$]0)}" |
changequote(, )dnl
  egrep "$1" >/dev/null 2>&1; then
changequote([, ])dnl
  ifelse([$3], , :, [rm -rf conftest*
  $3])
ifelse([$4], , , [else
  rm -rf conftest*
  $4
])dnl
fi
rm -f conftest*
])


AC_DEFUN(IRC_LINUX,
[AC_MSG_CHECKING(for Linux)
AC_CACHE_VAL(irc_cv_linux,
[if test "x`(uname) 2>/dev/null`" = "xLinux"; then
  IRC_EGREP_RMLF_CPP(
    [struct( |	)+hostent( |	)+\{.*const.*h_name],
    [#include <netdb.h>],
    irc_cv_linux=bad,
    irc_cv_linux=good)
else
  irc_cv_linux=no
fi
])
if test "$irc_cv_linux" = no; then
  AC_MSG_RESULT(no)
elif test "$irc_cv_linux" = good; then
  AC_MSG_RESULT([yes, with a good <netdb.h> file])
else
  AC_MSG_RESULT([yes, with a bad <netdb.h> file])
  AC_DEFINE(BAD___CONST_NETDB_H)
fi
])


AC_DEFUN(IRC_IP6,
[AC_ARG_ENABLE(ip6, [  --enable-ip6            enables IPv6])
if test "x$enable_ip6" != x; then
  AC_DEFINE(INET6)
  dnl be smart about it
  AC_MSG_CHECKING([IPv6 system type])
  AC_CACHE_VAL(irc_cv_v6type, [
    if test -d /usr/inet6; then
      irc_cv_v6type=linux
    else
      AC_EGREP_CPP(yes, [dnl
#include <netinet/in.h>
#ifdef IPV6_INRIA_VERSION
yes
#endif], irc_cv_v6type=inria,
        AC_EGREP_CPP(yes, [dnl
#include <netinet/in.h>
#ifdef __KAME__
yes
#endif], irc_cv_v6type=kame,
          AC_EGREP_CPP(yes, [dnl
#include <sys/param.h>
#ifdef _TOSHIBA_INET6
yes
#endif], irc_cv_v6type=toshiba,
            AC_EGREP_CPP(yes, [dnl
#include </usr/local/v6/include/sys/types.h>
#ifdef __V6D__
yes
#endif], irc_cv_v6type=v6d,
              AC_EGREP_CPP(yes, [dnl
#include <sys/param.h>
#ifdef _ZETA_MINAMI_INET6
yes
#endif], irc_cv_v6type=zeta)))))
    fi])
  AC_MSG_RESULT($irc_cv_v6type)

  dnl eventually update LIBS
  case $irc_cv_v6type in
	kame)
		LIBS="-L/usr/local/v6/lib -linet6 $LIBS"
		CFLAGS="$CFLAGS -I/usr/local/v6/include"
		;;
	linux)
		LIBS="-L/usr/inet6/lib -linet6 $LIBS"
		CFLAGS="$CFLAGS -I/usr/inet6/include"
		;;
	toshiba)
		LIBS="-L/usr/local/v6/lib -linet6 $LIBS"
		CFLAGS="$CFLAGS -I/usr/local/v6/include"
		;;
	v6d)
		LIBS="-L/usr/local/v6/lib -lv6 $LIBS"
		CFLAGS="$CFLAGS -I/usr/local/v6/include"
		;;
	zeta)
		LIBS="-L/usr/local/v6/lib -linet6 $LIBS"
		CFLAGS="$CFLAGS -I/usr/local/v6/include"
		;;
	esac

  dnl /etc/resolv.conf check
  AC_MSG_CHECKING(for IPv6 name server addresses in resolv.conf ($irc_cv_path_resconf))
  if grep nameserver $irc_cv_path_resconf | grep ':' >/dev/null 2>&1; then
    AC_MSG_RESULT(yes)
    AC_MSG_WARN([$irc_cv_path_resconf is not setup correctly.])
  else
    AC_MSG_RESULT(no)
  fi
fi
])


AC_DEFUN(IRC_SHAREDMODULES,
[AC_ARG_ENABLE(dsm, [  --enable-dsm            enables dynamically shared modules for iauth])
if test "x$enable_dsm" != x; then
  AC_DEFINE(USE_DSM)
dnl  AC_CONFIG_HEADER(dl.h)
  AC_CHECK_HEADERS(dlfcn.h)
  AC_CHECK_LIB(dl, dlclose, IRC_DLIB="-ldl")
  AC_SUBST(IRC_DLIB)
fi
])


dnl -------------------------------------------------------------------
dnl modified Autoconf tests; their names begin with IRC_ instead of AC_
dnl -------------------------------------------------------------------

AC_DEFUN(IRC_INIT_PARSE_ARGS,
[
# Initialize some variables set by options.
# The variables have the same names as the options, with
# dashes changed to underlines.
build=NONE
cache_file=./config.cache
exec_prefix=NONE
host=NONE
no_create=
nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
target=NONE
verbose=
zlib_include=NONE
zlib_library=NONE
dnl Installation directory options.
dnl These are left unexpanded so users can "make install exec_prefix=/foo"
dnl and all the variables that are supposed to be based on exec_prefix
dnl by default will actually change.
dnl Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
logdir='${prefix}/var/log/ircd'

# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12

ac_prev=
for ac_option
do

  # If the previous option needs an argument, assign it.
  if test -n "$ac_prev"; then
    eval "$ac_prev=\$ac_option"
    ac_prev=
    continue
  fi

  case "$ac_option" in
changequote(, )dnl
  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
changequote([, ])dnl
  *) ac_optarg= ;;
  esac

  # Accept the important Cygnus configure options, so we can diagnose typos.

  case "$ac_option" in

  -bindir | --bindir | --bindi | --bind | --bin | --bi)
    ac_prev=bindir ;;
  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
    bindir="$ac_optarg" ;;

  -build | --build | --buil | --bui | --bu)
    ac_prev=build ;;
  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
    build="$ac_optarg" ;;

  -cache-file | --cache-file | --cache-fil | --cache-fi \
  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
    ac_prev=cache_file ;;
  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
    cache_file="$ac_optarg" ;;

  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
    ac_prev=datadir ;;
  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
  | --da=*)
    datadir="$ac_optarg" ;;

  -disable-* | --disable-*)
    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
    # Reject names that are not valid shell variable names.
changequote(, )dnl
    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
changequote([, ])dnl
      AC_MSG_ERROR($ac_feature: invalid feature name)
    fi
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
    eval "enable_${ac_feature}=no" ;;

  -enable-* | --enable-*)
    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
    # Reject names that are not valid shell variable names.
changequote(, )dnl
    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
changequote([, ])dnl
      AC_MSG_ERROR($ac_feature: invalid feature name)
    fi
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
    case "$ac_option" in
      *=*) ;;
      *) ac_optarg=yes ;;
    esac
    eval "enable_${ac_feature}='$ac_optarg'" ;;

  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
  | --exec | --exe | --ex)
    ac_prev=exec_prefix ;;
  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
  | --exec=* | --exe=* | --ex=*)
    exec_prefix="$ac_optarg" ;;

  -gas | --gas | --ga | --g)
    # Obsolete; use --with-gas.
    with_gas=yes ;;

  -help | --help | --hel | --he)
    # Omit some internal or obsolete options to make the list less imposing.
    # This message is too long to be a string in the A/UX 3.1 sh.
    cat << EOF
changequote(, )dnl
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
  --cache-file=FILE       cache test results in FILE
  --help                  print this message
  --no-create             do not create output files
  --quiet, --silent       do not print \`checking...' messages
  --version               print the version of autoconf that created configure
Directory and file names:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [$ac_default_prefix]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [same as prefix]
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
  --datadir=DIR           read-only architecture-independent data in DIR
                          [PREFIX/share]
  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
                          [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data in DIR[PREFIX/var/run]
  --includedir=DIR        C header files in DIR [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
  --logdir=DIR            log files in DIR [PREFIX/var/log/ircd]
  --infodir=DIR           info documentation in DIR [PREFIX/info]
  --mandir=DIR            man documentation in DIR [PREFIX/man]
  --srcdir=DIR            find the sources in DIR [configure dir or ..]
  --program-prefix=PREFIX prepend PREFIX to installed program names
  --program-suffix=SUFFIX append SUFFIX to installed program names
  --program-transform-name=PROGRAM
                          run sed PROGRAM on installed program names
EOF
    cat << EOF
Host type:
  --build=BUILD           configure for building on BUILD [BUILD=HOST]
  --host=HOST             configure for HOST [guessed]
  --target=TARGET         configure for TARGET [TARGET=HOST]
Features and packages:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --resconf=FILE          use FILE as resolver config file [/etc/resolv.conf]
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --zlib-prefix=ZDIR      zlib installation prefix is ZDIR
  --zlib-include=ZIDIR    zlib include files are in ZIDIR [ZDIR/include]
  --zlib-library=ZLDIR    zlib library files are in ZLDIR [ZDIR/lib]
changequote([, ])dnl
EOF
    if test -n "$ac_help"; then
      echo "--enable and --with options recognized:$ac_help"
    fi
    exit 0 ;;

  -host | --host | --hos | --ho)
    ac_prev=host ;;
  -host=* | --host=* | --hos=* | --ho=*)
    host="$ac_optarg" ;;

  -includedir | --includedir | --includedi | --included | --include \
  | --includ | --inclu | --incl | --inc)
    ac_prev=includedir ;;
  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
  | --includ=* | --inclu=* | --incl=* | --inc=*)
    includedir="$ac_optarg" ;;

  -infodir | --infodir | --infodi | --infod | --info | --inf)
    ac_prev=infodir ;;
  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
    infodir="$ac_optarg" ;;

  -libdir | --libdir | --libdi | --libd)
    ac_prev=libdir ;;
  -libdir=* | --libdir=* | --libdi=* | --libd=*)
    libdir="$ac_optarg" ;;

  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
  | --libexe | --libex | --libe)
    ac_prev=libexecdir ;;
  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
  | --libexe=* | --libex=* | --libe=*)
    libexecdir="$ac_optarg" ;;

  -localstatedir | --localstatedir | --localstatedi | --localstated \
  | --localstate | --localstat | --localsta | --localst \
  | --locals | --local | --loca | --loc | --lo)
    ac_prev=localstatedir ;;
  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
    localstatedir="$ac_optarg" ;;

  -logdir | --logdir | --logdi | --logd)
    ac_prev=logdir ;;
  -logdir=* | --logdir=* | --logdi=* | --logd=*)
    logdir="$ac_optarg/" ;;

  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
    ac_prev=mandir ;;
  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
    mandir="$ac_optarg" ;;

  -nfp | --nfp | --nf)
    # Obsolete; use --without-fp.
    with_fp=no ;;

  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  | --no-cr | --no-c)
    no_create=yes ;;

  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
    no_recursion=yes ;;

  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
  | --oldin | --oldi | --old | --ol | --o)
    ac_prev=oldincludedir ;;
  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
    oldincludedir="$ac_optarg" ;;

  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
    ac_prev=prefix ;;
  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
    prefix="$ac_optarg" ;;

  -program-prefix | --program-prefix | --program-prefi | --program-pref \
  | --program-pre | --program-pr | --program-p)
    ac_prev=program_prefix ;;
  -program-prefix=* | --program-prefix=* | --program-prefi=* \
  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
    program_prefix="$ac_optarg" ;;

  -program-suffix | --program-suffix | --program-suffi | --program-suff \
  | --program-suf | --program-su | --program-s)
    ac_prev=program_suffix ;;
  -program-suffix=* | --program-suffix=* | --program-suffi=* \
  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
    program_suffix="$ac_optarg" ;;

  -program-transform-name | --program-transform-name \
  | --program-transform-nam | --program-transform-na \
  | --program-transform-n | --program-transform- \
  | --program-transform | --program-transfor \
  | --program-transfo | --program-transf \
  | --program-trans | --program-tran \
  | --progr-tra | --program-tr | --program-t)
    ac_prev=program_transform_name ;;
  -program-transform-name=* | --program-transform-name=* \
  | --program-transform-nam=* | --program-transform-na=* \
  | --program-transform-n=* | --program-transform-=* \
  | --program-transform=* | --program-transfor=* \
  | --program-transfo=* | --program-transf=* \
  | --program-trans=* | --program-tran=* \
  | --progr-tra=* | --program-tr=* | --program-t=*)
    program_transform_name="$ac_optarg" ;;

  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  | -silent | --silent | --silen | --sile | --sil)
    silent=yes ;;

  -resconf | --resconf | --rescon | --resco | --resc | --res \
  | --re | --r)
    ac_prev=irc_resconf ;;
  -resconf=* | --resconf=* | --rescon=* | --resco=* | --resc=* \
  | --res=* | --re=* | --r=*)
    irc_resconf="$ac_optarg" ;;

  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
    ac_prev=sbindir ;;
  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
  | --sbi=* | --sb=*)
    sbindir="$ac_optarg" ;;

  -sharedstatedir | --sharedstatedir | --sharedstatedi \
  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
  | --sharedst | --shareds | --shared | --share | --shar \
  | --sha | --sh)
    ac_prev=sharedstatedir ;;
  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
  | --sha=* | --sh=*)
    sharedstatedir="$ac_optarg" ;;

  -site | --site | --sit)
    ac_prev=site ;;
  -site=* | --site=* | --sit=*)
    site="$ac_optarg" ;;

  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
    ac_prev=srcdir ;;
  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
    srcdir="$ac_optarg" ;;

  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
  | --syscon | --sysco | --sysc | --sys | --sy)
    ac_prev=sysconfdir ;;
  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
    sysconfdir="$ac_optarg" ;;

  -target | --target | --targe | --targ | --tar | --ta | --t)
    ac_prev=target ;;
  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
    target="$ac_optarg" ;;

  -v | -verbose | --verbose | --verbos | --verbo | --verb)
    verbose=yes ;;

  -version | --version | --versio | --versi | --vers)
    echo "configure generated by autoconf version AC_ACVERSION"
    exit 0 ;;

  -with-* | --with-*)
    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
    # Reject names that are not valid shell variable names.
changequote(, )dnl
    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
changequote([, ])dnl
      AC_MSG_ERROR($ac_package: invalid package name)
    fi
    ac_package=`echo $ac_package| sed 's/-/_/g'`
    case "$ac_option" in
      *=*) ;;
      *) ac_optarg=yes ;;
    esac
    eval "with_${ac_package}='$ac_optarg'" ;;

  -without-* | --without-*)
    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
    # Reject names that are not valid shell variable names.
changequote(, )dnl
    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
changequote([, ])dnl
      AC_MSG_ERROR($ac_package: invalid package name)
    fi
    ac_package=`echo $ac_package| sed 's/-/_/g'`
    eval "with_${ac_package}=no" ;;

  -zlib-prefix | --zlib-prefix | --zlib-prefi | --zlib-pref \
  | --zlib-pre | --zlib-pr | --zlib-p)
    ac_prev=irc_zlib_prefix ;;
  -zlib-prefix=* | --zlib-prefix=* | --zlib-prefi=* | --zlib-pref=* \
  | --zlib-pre=* | --zlib-pr=* | --zlib-p=*)
    irc_zlib_prefix="$ac_optarg" ;;

  -zlib-include | --zlib-include | --zlib-includ | --zlib-inclu \
  | --zlib-incl | --zlib-inc | --zlib-in | --zlib-i)
    ac_prev=irc_zlib_include ;;
  -zlib-include=* | --zlib-include=* | --zlib-includ=* | --zlib-inclu=* \
  | --zlib-incl=* | --zlib-inc=* | --zlib-in=* | --zlib-i=*)
    irc_zlib_include="$ac_optarg" ;;

  -zlib-library | --zlib-library | --zlib-librar | --zlib-libra | --zlib-libr \
  | --zlib-lib | --zlib-li | --zlib-l)
    ac_prev=irc_zlib_library ;;
  -zlib-library=* | --zlib-library=* | --zlib-librar=* | --zlib-libra=* \
  | --zlib-libr=* | --zlib-lib=* | --zlib-li=* | --zlib-l=*)
    irc_zlib_library="$ac_optarg" ;;

  -*) AC_MSG_ERROR([$ac_option: invalid option; use --help to show usage])
    ;;

  *)
changequote(, )dnl
    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
changequote([, ])dnl
      AC_MSG_WARN($ac_option: invalid host type)
    fi
    if test "x$nonopt" != xNONE; then
      AC_MSG_ERROR(can only configure for one host and one target at a time)
    fi
    nonopt="$ac_option"
    ;;

  esac
done

if test -n "$ac_prev"; then
  AC_MSG_ERROR(missing argument to --`echo $ac_prev | sed 's/_/-/g'`)
fi

AC_SUBST(logdir)
])


AC_DEFUN(IRC_INIT,
[sinclude(acsite.m4)dnl
sinclude(./aclocal.m4)dnl
AC_REQUIRE([AC_INIT_BINSH])dnl
AC_INIT_NOTICE
AC_DIVERT_POP()dnl to NORMAL
AC_DIVERT_PUSH(AC_DIVERSION_INIT)dnl
IRC_INIT_PARSE_ARGS
AC_INIT_PREPARE($1)dnl
AC_DIVERT_POP()dnl to NORMAL
])


AC_DEFUN(IRC_PROG_INSTALL,
[define(AC_PROVIDE_AC_PROG_INSTALL)
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Find a good install program.  We prefer a C program (faster),
# so one script is as good as another.  But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AIX v4 /usr/bin/installbsd, which does not work if the user is not root
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
AC_MSG_CHECKING(for a BSD compatible install)
if test -z "$INSTALL"; then
AC_CACHE_VAL(ac_cv_path_install,
[  IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
  for ac_dir in $PATH; do
    # Account for people who put trailing slashes in PATH elements.
    case "$ac_dir/" in
    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
    *)
      # OSF1 and SCO ODT 3.0 have their own names for install.
      for ac_prog in ginstall installbsd scoinst install; do
        if test -f $ac_dir/$ac_prog; then
	  if test $ac_prog = install &&
            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
	    # AIX install.  It has an incompatible calling convention.
	    # OSF/1 installbsd also uses dspmsg, but is usable.
	    :
	  elif test $ac_prog = installbsd -a "x`(uname -sv) 2>/dev/null`" = "xAIX 4"; then
            # AIX v4 installbsd. Does not work if the user is not root.
            :
          else
	    ac_cv_path_install="$ac_dir/$ac_prog -c"
	    break 2
	  fi
	fi
      done
      ;;
    esac
  done
  IFS="$ac_save_IFS"
])dnl
  if test "${ac_cv_path_install+set}" = set; then
    INSTALL="$ac_cv_path_install"
  else
    # As a last resort, use the slow shell script.  We don't cache a
    # path for INSTALL within a source directory, because that will
    # break other packages using the cache if that directory is
    # removed, or if the path is relative.
    INSTALL="$ac_install_sh"
  fi
fi
dnl We do special magic for INSTALL instead of AC_SUBST, to get
dnl relative paths right.
AC_MSG_RESULT($INSTALL)

# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
AC_SUBST(INSTALL_PROGRAM)dnl

test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
AC_SUBST(INSTALL_DATA)dnl
])

AC_DEFUN(IRC_CYGWIN,
[AC_CYGWIN
if test ! -z "$CYGWIN"; then
  if test ! -x /bin/mv || test ! -x /bin/rm || test ! -x /bin/sh; then
    AC_MSG_ERROR([mv, rm and/or sh is missing from /bin])
  fi
  AC_MSG_WARN([The IRC client and the iauth program do not work under the CYGWIN environment.])
fi
])

AC_DEFUN(IRC_PROG_CC,
[define(AC_PROVIDE_AC_PROG_CC)
AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_WORKS
AC_PROG_CC_GNU
ac_test_CFLAGS="${CFLAGS+set}"
if test $ac_cv_prog_gcc = yes; then
  GCC=yes
  ac_save_CFLAGS="$CFLAGS"
  CFLAGS=
  AC_PROG_CC_G
  if test "$ac_test_CFLAGS" = set; then
    CFLAGS="$ac_save_CFLAGS"
  else
    CFLAGS="-O2"
  fi
else
  GCC=
fi
])


AC_DEFUN(IRC_AIX,
[AC_MSG_CHECKING(for AIX)
AC_CACHE_VAL(irc_cv_aix,
[if test "x`(uname) 2>/dev/null`" = "xAIX"; then
  irc_cv_aix="`uname -rv`"
else
  irc_cv_aix=no
fi
])
if test "$irc_cv_aix" = no; then
  AC_MSG_RESULT(no)
else
  AC_MSG_RESULT(yes)
  AC_DEFINE(_ALL_SOURCE)
  if test "x$irc_cv_aix" = "x2 3"; then
    AC_DEFINE(AIX_3_2)
  fi
  if test x$CC = xcc; then
    CFLAGS="$CFLAGS -O3 -qstrict"
  fi
fi
])


AC_DEFUN(IRC_CHECK_TYPE,
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_type_$1,
[AC_EGREP_CPP(dnl
changequote(<<,>>)dnl
<<$1[^a-zA-Z_0-9]>>dnl
changequote([,]), [
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
#if HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
AC_MSG_RESULT($ac_cv_type_$1)
if test $ac_cv_type_$1 = no; then
  AC_DEFINE($1, $2)
fi
])


AC_DEFUN(IRC_FUNC_MEMCMP,
[AC_CACHE_CHECK(for 8-bit clean memcmp, irc_cv_func_memcmp_clean,
[AC_TRY_RUN([
main()
{
  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
}
], irc_cv_func_memcmp_clean=yes, irc_cv_func_memcmp_clean=no,
irc_cv_func_memcmp_clean=no)])
if test $irc_cv_func_memcmp_clean = no; then
  AC_DEFINE(MEMCMP_BROKEN)
fi
])


dnl ----
dnl main
dnl ----

AC_REVISION([$Id: configure.in,v 1.46 1999/08/13 17:18:23 kalt Exp $])
AC_PREREQ(2.13)
IRC_INIT(../ircd/ircd.c)
AC_CONFIG_HEADER(setup.h:../support/setup.h.in)
AC_CONFIG_AUX_DIR(../support)
AC_VALIDATE_CACHED_SYSTEM_TUPLE()

IRC_PROG_CC
AC_PROG_CPP
AC_PROG_AWK
IRC_PROG_INSTALL
AC_PATH_PROGS(SUM, md5sum sum cksum, true)
AC_PROG_GCC_TRADITIONAL

IRC_AIX
AC_ISC_POSIX
AC_MINIX
IRC_SGI_CC
IRC_HPUX_CC
IRC_SUN
IRC_LINUX
IRC_CYGWIN

AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(stdio.h stdlib.h sys/types.h sys/bitypes.h stddef.h stdarg.h unistd.h ctype.h memory.h ncurses.h curses.h cursesX.h term.h sgtty.h errno.h sys/errno.h sys/syscall.h pwd.h math.h utmp.h fcntl.h signal.h sys/ioctl.h sys/file.h sys/filio.h sys/socket.h sys/stat.h sys/resource.h sys/select.h sys/poll.h stropts.h netdb.h netinet/in.h sys/un.h arpa/inet.h sys/param.h syslog.h sys/syslog.h string.h strings.h sys/time.h time.h sys/times.h netinet/in_systm.h netinfo/ni.h resolv.h arpa/nameser.h)
IRC_DECL_SYS_ERRLIST
IRC_DECL_SYS_NERR
IRC_DECL_ERRNO
IRC_DECL_H_ERRNO
AC_HEADER_STAT
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_UID_T
IRC_UNION_WAIT
IRC_CHECK_TYPE(int8_t, char)
IRC_CHECK_TYPE(u_int8_t, unsigned char)
IRC_CHECK_TYPE(int16_t, short)
IRC_CHECK_TYPE(u_int16_t, unsigned short)
IRC_CHECK_TYPE(int32_t, int)
IRC_CHECK_TYPE(u_int32_t, unsigned int)
IRC_CHECK_TYPE(u_char, unsigned char)
IRC_CHECK_TYPE(u_short, unsigned short)
IRC_CHECK_TYPE(u_int, unsigned int)
IRC_CHECK_TYPE(u_long, unsigned long)

AC_C_BIGENDIAN
AC_C_CONST

AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, socket)

IRC_PATH_ZLIB
IRC_CURSES_TERMCAP

AC_FUNC_SETPGRP
AC_FUNC_SETVBUF_REVERSED
AC_FUNC_VFORK
AC_CHECK_FUNCS(setpgrp strchr strrchr memcmp memset memmove memcpy index rindex bcmp bcopy bzero select inet_ntoa inet_aton inet_addr inet_netof getrusage times strerror strtoken strtok sigaction sigset truncate poll vsyslog)
dnl ---
dnl Note: additional tests should be performed and used inside the source code
dnl       for the following functions:
dnl       gethostname gettimeofday lrand48 mkdir socket
dnl ---
IRC_FUNC_MEMCMP
IRC_SELECT_POLL

IRC_SIGNAL_IMPLEMENTATION
IRC_NON_BLOCKING_SYSTEM
IRC_STDARG
IRC_PATH_RESCONF
IRC_IP6
IRC_SHAREDMODULES
IRC_ALPHA_BETA

AC_OUTPUT(Makefile:../support/Makefile.in version.c.SH:../ircd/version.c.SH.in sums:../support/sums.in tkconf.h:../support/tkconf.h.dist)
AC_OUTPUT_COMMANDS(chmod a+x version.c.SH)