-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1225 lines (1104 loc) · 31.2 KB
/
configure.in
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
dnl ----------------------------------------------------------
dnl configure.in for ircii, 2.3. copyright (c) matthew green, 1993,
dnl except those bits attributed otherwise.
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.1 2009/01/27 11:01:30 fb Exp $
AC_REVISION($Revision: 1.1 $)dnl
AC_INIT(source/irc.c)
AC_CONFIG_HEADER(include/defs.h)
unset GREP_OPTIONS
dnl ----------------------------------------------------------
dnl
dnl grok the version number - from source/irc.c
dnl
VERSION=`sed -n -e 's/";$//' -e '/const char irc_version.. = .EPIC.-/s///p' -e '/const char irc_version/q' < $srcdir/source/irc.c`
echo this is EPIC5 version $VERSION
echo
AC_SUBST(VERSION)
dnl ----------------------------------------------------------
dnl
dnl initial stuff
dnl
AC_PROG_CC
AC_PROG_CPP
AC_ISC_POSIX
AC_AIX
dnl ----------------------------------------------------------
AC_MSG_CHECKING(for an extra library directory)
AC_ARG_WITH(localdir,
[ --with-localdir=/usr/local An extra directory to look for stuff.],[
if test "x$withval" = "x" ; then
with_extra_libdir="no"
elif test -d "$withval" ; then
with_extra_libdir="yes"
LIBS="-L$withval/lib $LIBS"
CFLAGS="-I$withval/include/ $CFLAGS"
else
with_extra_libdir="no"
fi
],[
with_extra_libdir="no"
])
AC_MSG_RESULT($with_extra_libdir)
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl
dnl System specific checks
dnl
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl
dnl Checking for solaris cc
dnl
AC_MSG_CHECKING(for solaris cc)
( $CC -V 2>&1 | grep 'Sun C' > /dev/null ) && \
sun_compiler="yes" \
CFLAGS="$CFLAGS -erroff=E_ARG_INCOMPATIBLE_WITH_ARG,E_ASSIGNMENT_TYPE_MISMATCH"
AC_MSG_RESULT(ok)
dnl
dnl checking for svr4's /usr/ccs/lib
dnl
if test -d /usr/ccs/lib; then
LIBS="-L/usr/ccs/lib $LIBS"
fi
dnl ----------------------------------------------------------
AC_MSG_CHECKING(if you want threaded stdout)
AC_ARG_WITH(threaded-stdout,
[ --with-threaded-stdout[=yes] Threaded stdout so the client doesn't block when gnu screen malfunctions.],[
if test "x$withval" = "x" ; then
with_threaded_stdout="no"
elif test "x$withval" = "xy" ; then
with_threaded_stdout="yes"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
elif test "x$withval" = "xY" ; then
with_threaded_stdout="yes"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
elif test "x$withval" = "xyes" ; then
with_threaded_stdout="yes"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
elif test "x$withval" = "xYES" ; then
with_threaded_stdout="yes"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
else
with_threaded_stdout="no"
fi
],[
with_threaded_stdout="no"
])
AC_MSG_RESULT($with_threaded_stdout)
if test "x$with_threaded_stdout" = "xyes" ; then
AC_DEFINE(WITH_THREADED_STDOUT)
threading=1
fi
dnl ----------------------------------------------------------
dnl Where does this belong?
AC_MSG_CHECKING(which multiplexer function to use)
AC_ARG_WITH(multiplex,
[ --with-multiplex[=TYPE] Multiplexer type (select,poll,freebsd-kqueue,pthread,solaris-ports)],[
if test "x$withval" = "x"; then
with_multiplex="select"
elif test "x$withval" = "xselect"; then
with_multiplex="select"
elif test "x$withval" = "xpoll"; then
with_multiplex="poll"
elif test "x$withval" = "xfreebsd-kqueue"; then
with_multiplex="kqueue"
elif test "x$withval" = "xsolaris-ports"; then
with_multiplex="port_create"
elif test "x$withval" = "xpthread"; then
with_multiplex="pthread_create"
if [ "x$sun_compiler" = "xyes" ] ; then
CFLAGS="CFLAGS -mt"
else
CFLAGS="$CFLAGS -pthread"
fi
else
with_multiplex="select"
fi
],[
with_multiplex="select"
])
AC_MSG_RESULT($with_multiplex)
AC_CHECK_FUNC($with_multiplex, [
if test "x$with_multiplex" = "xselect" ; then
AC_DEFINE(USE_SELECT)
threading=0
elif test "x$with_multiplex" = "xpoll" ; then
AC_DEFINE(USE_POLL)
threading=0
elif test "x$with_multiplex" = "xkqueue" ; then
AC_DEFINE(USE_FREEBSD_KQUEUE)
threading=0
elif test "x$with_multiplex" = "xport_create" ; then
AC_DEFINE(USE_SOLARIS_PORTS)
threading=0
elif test "x$with_multiplex" = "xpthread_create" ; then
AC_DEFINE(USE_PTHREAD)
threading=1
fi
],[
AC_DEFINE(USE_SELECT)
threading=0
])
dnl ----------------------------------------------------------
dnl
dnl Check for libraries before we check for functions!
dnl
if test -z "$libsocket"; then
AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket",)
fi
AC_CHECK_LIB(archive, archive_read_new,
[LIBS="$LIBS -larchive"
AC_DEFINE(HAVE_LIBARCHIVE)],)
AC_ARG_WITH(ssl,
[ --with-ssl[=PATH] Include SSL support (DIR is OpenSSL's install dir).],[
if test -z "$withval"; then
with_ssl="yes"
fi
])
AC_MSG_CHECKING(whether to include SSL support)
if test "x$with_ssl" = "xno"; then
AC_MSG_RESULT(no)
else
saved_LIBS="$LIBS"
saved_CFLAGS="$CFLAGS"
# First just try to see if it exists in the default location
LIBS="$saved_LIBS -lssl -lcrypto"
CFLAGS="$saved_CFLAGS"
AC_TRY_LINK([#include <openssl/ssl.h>],
[SSL_accept(0);], have_ssl="yes")
# Otherwise, go hunting for it.
if test -z "$have_ssl" ; then
for ssldir in "$with_ssl" /usr/local/ssl /usr/local/openssl; do
if test -n "$have_ssl"; then
break;
fi
if test -z "$ssldir"; then
continue;
fi
if test -f "$ssldir/include/openssl/ssl.h" &&
test -f "$ssldir/lib/libssl.a"; then
CFLAGS="$saved_CFLAGS -I$ssldir/include"
LIBS="$saved_LIBS -L$ssldir/lib -lssl -lcrypto"
AC_TRY_LINK([#include <openssl/ssl.h>],
[SSL_accept(0);], have_ssl="yes")
fi
done
fi
# If we found it somewhere, great! Otherwise, revert.
if test ! -n "$have_ssl"; then
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT(no)
if test "x$with_ssl" != "x"; then
AC_MSG_ERROR([You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL])
fi
else
if test "x$threading" = "x1" ; then
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(whether your SSL is threading compatable)
AC_TRY_RUN([
#define OPENSSL_THREAD_DEFINES
#include <openssl/opensslconf.h>
main ()
{
#if defined(THREADS)
exit(0);
#else
exit(1);
#endif
}
],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SSL),
AC_MSG_RESULT(no. Your system can not do SSL with pthreads), :)
else
AC_DEFINE(HAVE_SSL)
AC_MSG_RESULT(yes)
fi
fi
fi
dnl this is for isc. need the nsl_s library as well.
if test -z "$libinet"; then
AC_CHECK_LIB(inet, socket, libnsl=1; LIBS="$LIBS -linet -lnsl_s",)
fi
if test -z "$libnsl"; then
AC_CHECK_LIB(nsl, gethostname, LIBS="$LIBS -lnsl",)
fi
AC_CHECK_LIB(sun, getpwnam, LIBS="$LIBS -lsun",)
AC_CHECK_LIB(dgc, inet_addr, LIBS="$LIBS -ldgc",)
AC_CHECK_LIB(resolv, gethostbyname, LIBS="$LIBS -lresolv",)
AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt",)
AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm",)
AC_CHECK_LIB(rt, clock_gettime, LIBS="$LIBS -lrt",)
termcap=0;
warn_again=0;
AC_MSG_CHECKING(whether you want to use termcap)
AC_ARG_WITH(termcap,
[ --with-termcap Forcibly refuse to use terminfo/ncurses ],
[ AC_MSG_RESULT(yes)
AC_CHECK_LIB(termcap, tgetent, termcap=1;LIBS="-ltermcap $LIBS",
AC_CHECK_LIB(termlib, tgetent, termcap=1;LIBS="-ltermlib $LIBS",
AC_CHECK_LIB(curses, tgetent, termcap=1;LIBS="-lcurses $LIBS",
AC_MSG_WARN(I cant find tgetent. Youll have to help me.))))],
[ AC_MSG_RESULT(no)
AC_CHECK_LIB(ncurses, setupterm, LIBS="-lncurses $LIBS",
AC_CHECK_LIB(tinfo, setupterm, LIBS="-ltinfo $LIBS",
AC_CHECK_LIB(curses, setupterm, LIBS="-lcurses $LIBS",
AC_CHECK_LIB(curses, tgetent, termcap=1;LIBS="-lcurses $LIBS",
AC_CHECK_LIB(termlib, tgetent, termcap=1;LIBS="-ltermlib $LIBS",
AC_CHECK_LIB(termcap, tgetent, termcap=1;LIBS="-ltermcap $LIBS",
AC_MSG_WARN(I cant find tgetent. Youll have to help me.)
warn_again=1))))))])
dnl ----------------------------------------------------------
dnl
dnl Checking for headers, functions, and a type declarations
dnl
AC_CHECK_HEADERS(fcntl.h inttypes.h math.h ndbm.h netdb.h regex.h stddef.h stdint.h sys/fcntl.h sys/file.h sys/filio.h sys/select.h sys/sysctl.h sys/syslimits.h sys/time.h sys/un.h sys/param.h,)
if test $termcap -eq 0 ; then
AC_CHECK_HEADERS(term.h,)
else
AC_CHECK_HEADERS(termcap.h,)
fi
AC_CHECK_FUNC(arc4random, AC_DEFINE(HAVE_ARC4RANDOM),)
AC_CHECK_FUNC(clock_gettime, AC_DEFINE(HAVE_CLOCK_GETTIME),)
AC_CHECK_FUNC(fchdir, AC_DEFINE(HAVE_FCHDIR),)
AC_CHECK_FUNC(fpathconf, AC_DEFINE(HAVE_FPATHCONF),)
AC_CHECK_FUNC(getlogin, AC_DEFINE(HAVE_GETLOGIN),)
AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO),)
AC_CHECK_FUNC(getnameinfo, AC_DEFINE(HAVE_GETNAMEINFO),)
AC_CHECK_FUNC(getpass, AC_DEFINE(HAVE_GETPASS),)
AC_CHECK_FUNC(getpgid, AC_DEFINE(HAVE_GETPGID),)
AC_CHECK_FUNC(getpgrp, AC_FUNC_GETPGRP,)
AC_CHECK_FUNC(getservbyport, AC_DEFINE(HAVE_GETSERVBYPORT),)
AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY),)
AC_CHECK_FUNC(killpg, AC_DEFINE(HAVE_KILLPG),)
AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE),)
AC_CHECK_FUNC(nanosleep, AC_DEFINE(HAVE_NANOSLEEP),)
AC_CHECK_FUNC(uname, AC_DEFINE(HAVE_UNAME),)
AC_CHECK_FUNC(realpath, AC_DEFINE(HAVE_REALPATH),)
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),)
AC_CHECK_FUNC(setsid, AC_DEFINE(HAVE_SETSID),)
AC_CHECK_FUNC(tcsetpgrp, AC_DEFINE(HAVE_TCSETPGRP),)
if test $termcap -eq 0 ; then
AC_CHECK_FUNC(setupterm, AC_DEFINE(HAVE_TERMINFO),)
fi
AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF),)
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR),)
AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT),)
AC_CHECK_FUNC(strlcpy, AC_DEFINE(HAVE_STRLCPY),)
AC_CHECK_FUNC(strptime, AC_DEFINE(HAVE_STRPTIME),)
AC_CHECK_FUNC(strtoul, AC_DEFINE(HAVE_STRTOUL),)
AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
AC_CHECK_FUNC(sysctlbyname, AC_DEFINE(HAVE_SYSCTLBYNAME),)
AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV),)
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF),)
AC_CHECK_FUNC(finite, AC_DEFINE(HAVE_FINITE),)
AC_MSG_CHECKING(for isfinite macro in math.h)
AC_EGREP_HEADER(isfinite, math.h,
AC_DEFINE(HAVE_ISFINITE) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_CHECK_FUNC(tparm, AC_DEFINE(HAVE_TPARM),)
dnl -- Oh why does this have to be so painful? --
AC_MSG_CHECKING(whether term.h works by itself)
AC_TRY_RUN([
#include <term.h>
main ()
{
exit(0);
}
],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether term.h requires termio.h and curses.h)
AC_TRY_RUN([
#include <termio.h>
#include <curses.h>
#include <term.h>
main ()
{
exit(0);
}
],
AC_MSG_RESULT(yes)
AC_DEFINE(TERM_H_REQUIRES_CURSES_H),
AC_MSG_RESULT(no, ugh)
AC_DEFINE(DONT_USE_TERM_H), :), :)
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_FUNC_ALLOCA
dnl ----------------------------------------------------------
dnl Check to see if we can find intptr_t.
dnl
have_intptr_t=""
AC_MSG_CHECKING(for intptr_t in inttypes.h or stdint.h)
AC_EGREP_HEADER(intptr_t, inttypes.h, AC_DEFINE(HAVE_INTPTR_T)
have_intptr_t=yes)
AC_EGREP_HEADER(intptr_t, stdint.h, AC_DEFINE(HAVE_INTPTR_T)
have_intptr_t=yes)
if test "x$have_intptr_t" = "x"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
dnl ----------------------------------------------------------
dnl Check to see if we have socklen_t
dnl
AC_MSG_CHECKING(for socklen_t)
AC_EGREP_HEADER(socklen_t, sys/socket.h,
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SOCKLEN_T),
AC_MSG_RESULT(no))
dnl ----------------------------------------------------------
dnl
dnl Check to see if we have to include <sys/select.h>
dnl
dnl
AC_MSG_CHECKING(whether sys/types.h defines fd_set)
AC_EGREP_HEADER(fd_set, sys/types.h,
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether sys/select.h defines fd_set)
AC_EGREP_HEADER(fd_set, sys/select.h,
AC_MSG_RESULT(yes)
AC_DEFINE(NEED_SYS_SELECT_H),
AC_MSG_RESULT(no. ugh.)))
dnl ----------------------------------------------------------
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
dnl Check for a useful SO_SNDLOWAT.
dnl Some systems (eg, linux) can be bothered to #define SO_SNDLOWAT
dnl but can't be bothered to implement it, instead returning an error.
dnl How completely bogus. Don't #define it if you don't support it!
dnl
AC_MSG_CHECKING(for useful SO_SNDLOWAT)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
main ()
{
#ifndef SO_SNDLOWAT
exit(1);
#else
int d = socket(AF_INET, SOCK_STREAM, 0);
int size = 256;
if (setsockopt(d, SOL_SOCKET, SO_SNDLOWAT, &size, sizeof(size)) < 0)
exit(1);
exit (0);
#endif
}
],
AC_MSG_RESULT(yes, your SO_SNDLOWAT is useful)
AC_DEFINE(HAVE_SO_SNDLOWAT),
AC_MSG_RESULT(no, your SO_SNDLOWAT is broken and/or worthless), :)
dnl ----------------------------------------------------------
dnl
dnl Check for a realpath() that works.
dnl
AC_MSG_CHECKING(for useful realpath)
AC_TRY_RUN([
#include <sys/param.h>
#include <stdlib.h>
main ()
{
char resolved_path[MAXPATHLEN];
if (realpath("/etc/filethatdoesnotexist", resolved_path) == 0)
exit(1);
exit(0);
}
],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no, your realpath is broken and/or worthless)
AC_DEFINE(HAVE_BROKEN_REALPATH), :)
dnl ----------------------------------------------------------
dnl
dnl Check for sys_siglist declaration
dnl
AC_MSG_CHECKING(for sys_siglist declaration)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/signal.h>
#include <signal.h>
#include <unistd.h>
main()
{
char *s = sys_siglist[0];
exit(0);
}
],
AC_MSG_RESULT(yes)
sys_siglist="1"
AC_DEFINE(SYS_SIGLIST_DECLARED),
AC_MSG_RESULT(no), :)
dnl ----------------------------------------------------------
dnl
dnl Generate signal list, from perl4
dnl
if test x$sys_siglist != x1
then
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)
if test -f /bin/csh; then
set X `/bin/csh -cf 'kill -l'`
shift
case $* in
0)
set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
;;
esac
fi
;;
esac
sig_name="ZERO $*"
if test -f sig.inc; then
/bin/rm -f sig.inc
fi
[echo $sig_name | sed -e 's/$/"};/' -e 's/ /", "/g' -e 's/^/static char *sys_siglist[] = { "/' >> sig.inc]
fi
dnl ----------------------------------------------------------
dnl
dnl Check for 'intmax_t'
dnl
have_intmax_t=""
AC_MSG_CHECKING(for intmax_t in inttypes.h or stdint.h)
AC_EGREP_HEADER(intmax_t, inttypes.h, have_intmax_t=yes)
AC_EGREP_HEADER(intmax_t, stdint.h, have_intmax_t=yes)
if test "x$have_intmax_t" != "x"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INTMAX_NATIVE)
AC_CHECK_FUNC(strtoimax, AC_DEFINE(HAVE_STRTOIMAX),)
else
AC_MSG_RESULT(no)
AC_CHECK_SIZEOF(long long, 0)
if test "$ac_cv_sizeof_long_long" != 0; then
AC_DEFINE(HAVE_INTMAX_LONG_LONG)
AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL),)
else
AC_CHECK_SIZEOF(quad_t, 0)
if test "$ac_cv_sizeof_quad_t" != 0; then
AC_DEFINE(HAVE_INTMAX_QUADT)
AC_CHECK_FUNC(strtoq, AC_DEFINE(HAVE_STRTOQ),)
else
AC_DEFINE(HAVE_INTMAX_LONG)
fi
fi
fi
dnl ----------------------------------------------------------
dnl
dnl need this for dcc stuff
dnl
AC_CHECK_SIZEOF(unsigned int, 4)
if test "$ac_cv_sizeof_unsigned_int" = 4; then
AC_DEFINE(UNSIGNED_INT32)
else
AC_CHECK_SIZEOF(unsigned long, 4)
if test "$ac_cv_sizeof_unsigned_long" = 4; then
AC_DEFINE(UNSIGNED_LONG32)
else
AC_DEFINE(UNKNOWN_32INT)
fi
fi
dnl ----------------------------------------------------------
dnl
dnl It makes a big difference if your system's (struct sockaddr)
dnl structures look like this:
dnl
dnl struct sockaddr {
dnl u_char sa_len;
dnl u_char sa_family;
dnl char sa_data[14];
dnl };
dnl
dnl or this
dnl
dnl struct sockaddr {
dnl u_short sa_family;
dnl char sa_data[14];
dnl };
dnl
dnl so check for that here.
dnl
dnl -----------------------------------------------------------
AC_MSG_CHECKING(to see if your struct sockaddr includes a length field)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
main()
{
struct sockaddr sa;
sa.sa_len = 0;
exit(0);
}
],
AC_DEFINE(HAVE_SA_LEN)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no), :)
dnl ----------------------------------------------------------
dnl
dnl checks for ipv6-related things
dnl
AC_MSG_CHECKING(whether to support ipv6)
AC_ARG_WITH(ipv6,
[ --with-ipv6 Include IPv6 support],[
if test "x$withval" = "xno" ; then
AC_MSG_RESULT(no)
AC_DEFINE(DO_NOT_USE_IPV6)
else
AC_MSG_RESULT(yes)
fi
],[AC_MSG_RESULT(yes)])
AC_MSG_CHECKING(for struct sockaddr_storage)
AC_EGREP_HEADER([struct( | )*sockaddr_storage], sys/socket.h,
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for struct sockaddr_in6)
AC_EGREP_HEADER([struct( | )*sockaddr_in6], netinet/in.h,
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for struct addrinfo)
AC_EGREP_HEADER([struct( | )*addrinfo], netdb.h,
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_ADDRINFO),
AC_MSG_RESULT(no))
dnl ----------------------------------------------------------
dnl
dnl Some implementations of getaddrinfo (*cough*KAME*cough*) don't
dnl support the AF_UNIX protocol family. For these partially incomplete
dnl implementations, we must add our own support in a wrapper.
dnl
AC_MSG_CHECKING(to see if your getaddrinfo supports AF_UNIX)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/un.h>
#include <stdlib.h>
main()
{
struct addrinfo hints;
struct addrinfo *results;
int retval;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0;
hints.ai_family = AF_UNIX;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
retval = getaddrinfo(0, "/tmp/.ircd/6667", &hints, &results);
if (retval != 0)
exit(1);
else
exit(0);
}
],
AC_MSG_RESULT(yes),
AC_DEFINE(GETADDRINFO_DOES_NOT_DO_AF_UNIX)
AC_MSG_RESULT(no. ugh), :)
dnl ----------------------------------------------------------
dnl
dnl Socks4 or Socks5 or neither?
dnl
AC_MSG_CHECKING(whether to support SOCKS)
AC_ARG_WITH(socks,
[ --with-socks[=PATH] Compile with SOCKS firewall traversal support.],
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
if test "x$withval" != "xyes"; then
LIBS="$LIBS -L$withval"
fi
AC_MSG_RESULT(yes)
LIBS="$LIBS -lsocks"
AC_DEFINE(SOCKS)
AC_DEFINE(connect, Rconnect)
AC_DEFINE(getsockname, Rgetsockname)
AC_DEFINE(bind, Rbind)
AC_DEFINE(accept, Raccept)
AC_DEFINE(listen, Rlisten)
AC_DEFINE(select, Rselect)
;;
esac ],
AC_MSG_RESULT(no)
)
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)
;;
*)
if test "x$withval" != "xyes"; then
LIBS="$LIBS -L$withval"
CFLAGS="$CFLAGS -I$withval/../include/"
fi
AC_MSG_RESULT(yes)
LIBS="$LIBS -lsocks5"
AC_DEFINE(SOCKS)
AC_DEFINE(USE_SOCKS5)
;;
esac ],
AC_MSG_RESULT(no)
)
dnl ----------------------------------------------------------
dnl
dnl Iconv support?
dnl
AC_ARG_WITH(iconv,
[ --with-iconv[=PATH] Include iconv support (DIR is eg /usr/local).],[
if test -z "$withval"; then
with_iconv="yes"
fi
])
AC_MSG_CHECKING(whether to include iconv support)
if test "x$with_iconv" = "xno"; then
AC_MSG_RESULT(no)
else
saved_LIBS="$LIBS"
saved_CFLAGS="$CFLAGS"
# First try to see if it's in libc
AC_TRY_LINK([#include <iconv.h>],
[iconv_open(0, 0);], have_iconv="yes")
# If it's not in libc, look in -liconv
if test -z "$have_iconv" ; then
LIBS="$saved_LIBS -liconv"
CFLAGS="$saved_CFLAGS"
AC_TRY_LINK([#include <iconv.h>],
[iconv_open(0, 0);], have_iconv="yes")
fi
# Otherwise, go hunting for it.
if test -z "$have_iconv" ; then
for iconvdir in "$with_iconv" "$prefix" /usr/local /opt /usr/opt; do
if test -n "$have_iconv"; then
break;
fi
if test -z "$iconvdir"; then
continue;
fi
if test -f "$iconvdir/include/iconv.h" &&
test -f "$iconvdir/lib/libiconv.a"; then
CFLAGS="$saved_CFLAGS -I$iconvdir/include"
LIBS="$saved_LIBS -L$iconvdir/lib -liconv"
AC_TRY_LINK([#include <iconv.h>],
[iconv_open(0, 0);], have_iconv="yes")
fi
done
fi
# If we found it somewhere, great! Otherwise, revert.
if test ! -n "$have_iconv"; then
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT(looked but did not find it)
if test "x$with_iconv" != "x"; then
AC_MSG_ERROR([You requested iconv support, but iconv was not found. Please supply a pathname to iconv])
fi
else
AC_MSG_RESULT(yes)
fi
AC_CHECK_FUNC(iconv_open, AC_DEFINE(HAVE_ICONV),)
fi
dnl ----------------------------------------------------------
dnl
dnl Job Control / Wserv support?
dnl
AC_MSG_CHECKING(whether you have posix-like job control)
if test "x$ac_cv_func_tcsetpgrp" = "xyes" -a "x$ac_cv_func_setsid" = "xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_DEFINE(NO_JOB_CONTROL)
no_job_control=1
fi
AC_MSG_CHECKING(whether to include wserv support)
include_wserv="yes"
AC_ARG_WITH(wserv,
[ --with-wserv Include Wserv support for multiple screens],[
if test -z "$withval"; then
include_wserv="yes"
else
include_wserv="$withval"
fi
])
if test "x$no_job_control" = "x1" ; then
include_wserv="no"
fi
AC_MSG_RESULT($include_wserv)
if test "x$include_wserv" = "xyes" ; then
WSERV_BIN="wserv4"
WSERV_INSTALL="installwserv4"
fi
dnl ----------------------------------------------------------
dnl
dnl Perl support?
dnl
AC_ARG_WITH(perl,
[ --with-perl[=PATH_TO_PERL_EXE] Compile with perl support.],
[
perlexe=$withval
],
perlexe=yes
)
if test "x$perlexe" = "xyes"; then
perlexe=perl
fi
if test "x$perlexe" = "xno"; then
AC_MSG_CHECKING(whether to support Perl)
AC_MSG_RESULT(no)
else
AC_CHECK_PROG(PERLPROG, $perlexe, "yes", "no")
AC_MSG_CHECKING(whether to support Perl)
if test $PERLPROG != "yes" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
PERLCFLAGS=`$perlexe -MExtUtils::Embed -e ccopts`
PERLLDFLAGS=`$perlexe -MExtUtils::Embed -e ldopts`
PERLDOTOH="perl.o"
AC_MSG_CHECKING(whether embedded perl works the way I expect)
have_embedded_perl="no"
old_CFLAGS="$CFLAGS"
old_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS $PERLCFLAGS"
LDFLAGS="$LDFLAGS $PERLLDFLAGS"
AC_TRY_LINK([
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
], [
/* I "borrowed" this from the perlembed(1) man page */
PerlInterpreter *my_perl;
int main(int argc, char **argv, char **env)
{
PERL_SYS_INIT3(&argc,&argv,&env);
my_perl = perl_alloc();
perl_construct(my_perl);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
perl_run(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
PERL_SYS_TERM();
}
], have_embedded_perl="yes")
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
if test $have_embedded_perl = "yes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PERL)
AC_DEFINE(PERLCFLAGS)
AC_DEFINE(PERLLDFLAGS)
else
AC_MSG_RESULT(no, sorry)
fi
fi
fi
dnl ----------------------------------------------------------
dnl
dnl Tcl support?
dnl
AC_ARG_WITH(tcl,
[ --with-tcl[=PATH_TO_tclConfig.sh] Compile with tcl support.],
[
tclconfig=$withval
],
tclconfig="yes"
)
if test "x$tclconfig" = "xyes" ; then
for i in /usr/lib /usr/local/lib /usr/local/lib/tcl8.4 ; do
if test -r $i/tclConfig.sh ; then
tclconfig=$i/tclConfig.sh
break;
fi
done
fi
AC_MSG_CHECKING(whether to support TCL)
if test "x$tclconfig" = "xno"; then
AC_MSG_RESULT(no)
else
if test ! -r $tclconfig ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
TCLCFLAGS=`(. $tclconfig && echo $TCL_INCLUDE_SPEC)`
TCLLDFLAGS1=`(. $tclconfig && echo $TCL_LIB_SPEC)`
TCLLDFLAGS2=`(. $tclconfig && echo $TCL_LIBS)`
TCLLDFLAGS=$(eval echo "$TCLLDFLAGS1 $TCLLDFLAGS2")
TCLDOTOH="tcl.o"
AC_MSG_CHECKING(whether embedded tcl works the way I expect)
have_embedded_tcl="no"
old_CFLAGS="$CFLAGS"
old_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS $TCLCFLAGS"
LDFLAGS="$LDFLAGS $TCLLDFLAGS"
AC_TRY_LINK([
#include <tcl.h>
], [
Tcl_Interp *my_tcl;
int Tcl_echoCmd (ClientData clientData, Tcl_Interp *interp, int objc, const char **objv)
{
return TCL_OK;
}
int main(int argc, char **argv, char **env)
{
my_tcl = Tcl_CreateInterp();
Tcl_Init(my_tcl);
Tcl_CreateCommand(my_tcl, "echo", Tcl_echoCmd,
(ClientData)NULL, (void (*)()) NULL);
Tcl_DeleteInterp(my_tcl);
}
], have_embedded_tcl="yes")