-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfigure.in
1017 lines (871 loc) · 32 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 Prefered emacs editing mode: -*- shell-script -*-
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (c) 1997, by Carlo Wood <[email protected]>
dnl Copyright (C) 2001 Kevin L. Mitchell <[email protected]>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 3, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl $Id$
dnl Make sure we are in the correct directory (someone could have run
dnl 'configure' with a wrong '--srcdir').
AC_INIT(Nefarious IRCu, 1.3.0, [email protected])
AC_CONFIG_SRCDIR([ircd/ircd.c])
dnl Set the default prefix
AC_PREFIX_DEFAULT([$HOME])
AC_MSG_CHECKING([for installation prefix])
AC_CACHE_VAL(unet_cv_prefix, [unet_cv_prefix=$HOME])
if test x"$prefix" != xNONE; then
unet_cv_prefix=$prefix
fi
AC_MSG_RESULT([$unet_cv_prefix])
dnl HACK WARNING: We are referencing an autoconf internal variable. This is
dnl the only way to force the prefix to be retrieved from the config.cache
dnl file!
ac_default_prefix=$unet_cv_prefix
dnl Define the input and output configuration header file.
AC_CONFIG_HEADER([config.h])
dnl Demand at least version 2.57 of autoconf
AC_PREREQ(2.57)
dnl Find out what type of system we are
AC_CANONICAL_HOST
dnl This should be done early.
AC_PROG_CC
dnl ANSIfy the C compiler whenever possible.
AM_PROG_CC_STDC
dnl Allow specification of optimization level.
AC_ARG_WITH([optimization],
AS_HELP_STRING([--with-optimization=[-O2]], [Explicitly set the compiler optimization flags (default: -O3)]),
[unet_cv_optimization=$withval],
[unet_cv_optimization="-O3"])
AC_CACHE_CHECK([optimization level], [unet_cv_optimization], [unet_cv_optimization="-O3"])
if test "x$unet_cv_optimization" = "xno" ; then
unet_cv_optimization=""
fi
if test x"$CFLAGS" != x; then
CFLAGS=`echo "$CFLAGS" | sed -e s/-O2/$unet_cv_optimization/`
fi
dnl Remove -pipe during configure
if test x"$CFLAGS" != x; then
CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
fi
dnl Notice the -g flag and deal accordingly
if test x"$CFLAGS" != x; then
unet_old_cflags=$CFLAGS
CFLAGS=`echo "$CFLAGS" | sed -e 's/-g//g'`
fi
if test x"$CFLAGS" != x"$unet_old_cflags"; then
# If -g was already there, force symbols to be enabled
unet_cv_enable_symbols=yes
fi
dnl Notice the -pg flag and deal accordingly
if test x"$CFLAGS" != x; then
unet_old_cflags=$CFLAGS
CFLAGS=`echo "$CFLAGS" | sed -e 's/-pg//g'`
fi
if test x"$CFLAGS" != x"$unet_old_cflags"; then
# If -pg was already there, force profiling to be enabled
unet_cv_enable_profile=yes
fi
dnl Notice the -Wall flag and deal accordingly
if test x"$CFLAGS" != x; then
unet_old_cflags=$CFLAGS
CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wall//g'`
fi
if test x"$CFLAGS" != x"$unet_old_cflags"; then
# If -Wall was already there, force warnings to be enabled
unet_cv_enable_warnings=yes
fi
dnl Notice the -pedantic flag and deal accordingly
if test x"$CFLAGS" != x; then
unet_old_cflags=$CFLAGS
CFLAGS=`echo "$CFLAGS" | sed -e 's/-pedantic//g'`
fi
if test x"$CFLAGS" != x"$unet_old_cflags"; then
# If -pedantic was already there, force pedatic to be enabled
unet_cv_enable_pedantic=yes
fi
dnl Checks for libraries.
dnl Locate the library containing crypt
AC_SEARCH_LIBS(crypt, descrypt crypt, ,
[AC_MSG_ERROR([Unable to find library containing crypt()])])
dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff
AC_LIBRARY_NET
dnl Look for res_mkquery. Done after AC_LIBRARY_NET in case res_mkquery
dnl is in one of those libraries somewhere.
dnl if no res_mkquery, try __res_mkquery as this is all there is on ia64 (ubuntu linux anyway)
AC_SEARCH_LIBS(res_mkquery, resolv,
,
[ AC_SEARCH_LIBS(__res_mkquery, resolv,
AC_DEFINE_UNQUOTED(RES_PREFIX, "TRUE", [__res_mkquery instead of res_mkquery]),
[AC_MSG_ERROR([Unable to find library containing res_mkquery() or __res_mkquery(). Please install resolv library. (comes with libc6)])]
)
]
)
dnl Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_RESOLV
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h crypt.h fcntl.h getopt.h inttypes.h limits.h netdb.h netinet/in.h poll.h stddef.h stdlib.h string.h sys/devpoll.h sys/event.h sys/epoll.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h libintl.h malloc.h])
dnl Checks for typedefs, structures, and compiler characteristics
AC_C_CONST
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_C_BIGENDIAN
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UID_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
unet_CHECK_TYPE_SIZES
AC_CHECK_TYPES([ptrdiff_t])
dnl Checks for library functions.
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm dup2 getpass gettimeofday memmove memset regcomp select socket strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul strspn kqueue setrlimit getrusage times])
dnl Do we have restarting syscalls ?
AC_SYS_RESTARTABLE_SYSCALLS
dnl Check for required features for admins?
AC_MSG_CHECKING([for donuts])
AC_MSG_RESULT([yes])
dnl Test for programs
AC_PROG_AWK
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PATH_PROGS(RMPROG, rm, /bin/rm)
AC_PATH_PROGS(SHPROG, sh, /bin/sh)
AC_PATH_PROGS(BASH, bash, /bin/bash, [/bin/bash:/usr/bin/bash:/usr/local/bin/bash:$PATH])
AC_CACHE_CHECK(if we can set the core size to unlimited, ac_cv_force_core,[
AC_TRY_RUN([
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
int main() {
struct rlimit corelim;
corelim.rlim_cur = corelim.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_CORE, &corelim))
exit(1);
exit(0);
}
],ac_cv_force_core=yes,ac_cv_force_core=no)
])
if test "$ac_cv_force_core" = "yes"; then
AC_DEFINE([FORCE_CORE], [], [Specify whether we can enable core files or not])
fi
dnl (F)LEX - needed for the new conf file parser
AC_PROG_LEX
dnl The autoconf docs say $LEX defaults to 'lex'. They lie.
if test "$LEX" = ":" ; then
AC_MSG_ERROR([Cannot find flex.])
elif echo "" | $LEX -V -v --version > /dev/null 2>&1 ; then
:
else
AC_MSG_ERROR([Cannot use $LEX as flex.])
fi
dnl YACC - ditto
AC_PROG_YACC
dnl The autoconf docs say $YACC defaults to 'yacc'. This seems to be true,
dnl but judging from AC_PROG_LEX, it may not stay true.
if test "$YACC" = ":" ; then
AC_MSG_ERROR([Cannot find yacc.])
elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then
:
else
dnl byacc does not seem to have any way to test for workingness, so only warn.
AC_MSG_WARN([$YACC may not work as yacc.])
fi
unet_NONBLOCKING
unet_SIGNALS
dnl Add -pipe when possible
unet_PIPE_CFLAGS
dnl Check OS for os_dep files.
AC_MSG_CHECKING(for OS-dependent information)
case "$host" in
*-linux*)
AC_MSG_RESULT([Linux ($host) found.])
unet_poll_syscall=yes
OSDEP_C=os_linux.c
;;
*-solaris*)
AC_MSG_RESULT([Solaris ($host) found.])
if test x"$ac_cv_header_poll_h" = xyes; then
unet_poll_syscall=yes
else
unet_poll_syscall=no
fi
OSDEP_C=os_solaris.c
;;
*-sunos*)
AC_MSG_RESULT([Solaris ($host) found.])
unet_poll_syscall=no
OSDEP_C=os_solaris.c
;;
*-openbsd*)
AC_MSG_RESULT([OpenBSD ($host) found.])
if test x"$ac_cv_header_poll_h" = xyes; then
unet_poll_syscall=yes
else
unet_poll_syscall=no
fi
OSDEP_C=os_openbsd.c
;;
*-*bsd*)
AC_MSG_RESULT([Generic BSD ($host) found.])
CFLAGS="-Wno-long-long $CFLAGS"
if test x"$ac_cv_header_poll_h" = xyes; then
unet_poll_syscall=yes
else
unet_poll_syscall=no
fi
OSDEP_C=os_bsd.c
;;
*-darwin*)
AC_MSG_RESULT([Darwin (Mac OS X) ($host) found.])
unet_poll_syscall=no
OSDEP_C=os_bsd.c
;;
*)
AC_MSG_RESULT([Unknown system type $host found.])
AC_MSG_WARN([Unknown OS type; using generic routines.])
unet_poll_syscall=no
OSDEP_C=os_generic.c
;;
esac
AC_SUBST(OSDEP_C)
dnl Check user configuration options
dnl Start with --enable-poll
AC_MSG_CHECKING([whether to enable use of poll()])
AC_ARG_ENABLE([poll],
[ --enable-poll Force poll to be used regardless of whether or not
it is a system call],
[unet_cv_enable_poll=$enable_poll],
[AC_CACHE_VAL(unet_cv_enable_poll,
[unet_cv_enable_poll=$unet_poll_syscall])])
# Force poll to be disabled if there is no poll.h
if test x"$ac_cv_header_poll_h" != xyes; then
unet_cv_enable_poll=no
fi
AC_MSG_RESULT([$unet_cv_enable_poll])
if test x"$unet_cv_enable_poll" = xyes; then
AC_DEFINE([USE_POLL], , [Specify whether or not to use poll()])
ENGINE_C=engine_poll.c
else
ENGINE_C=engine_select.c
fi
AC_SUBST(ENGINE_C)
dnl Now look for --enable-debug
AC_MSG_CHECKING([whether to enable debug mode])
AC_ARG_ENABLE([debug],
[ --enable-debug Turn on debugging mode],
[unet_cv_enable_debug=$enable_debug],
[AC_CACHE_VAL(unet_cv_enable_debug,
[unet_cv_enable_debug=no])])
AC_MSG_RESULT([$unet_cv_enable_debug])
if test x"$unet_cv_enable_debug" = xyes; then
AC_DEFINE([DEBUGMODE], , [Enable debugging code])
fi
dnl And now for --disable-asserts
AC_MSG_CHECKING([whether to enable asserts])
AC_ARG_ENABLE([asserts],
[ --disable-asserts Disable assertion checking],
[unet_cv_enable_asserts=$enable_asserts],
[AC_CACHE_VAL(unet_cv_enable_asserts,
[unet_cv_enable_asserts=yes])])
AC_MSG_RESULT([$unet_cv_enable_asserts])
if test x"$unet_cv_enable_asserts" = xno; then
AC_DEFINE([NDEBUG], , [Disable assertions])
fi
dnl Check for --enable-symbols
AC_MSG_CHECKING([whether to enable debugging symbols])
AC_ARG_ENABLE([symbols],
[ --disable-symbols Disable debugging symbols (remove -g from CFLAGS)],
[unet_cv_enable_symbols=$enable_symbols],
[AC_CACHE_VAL(unet_cv_enable_symbols,
[unet_cv_enable_symbols=yes])])
AC_MSG_RESULT([$unet_cv_enable_symbols])
if test x"$unet_cv_enable_symbols" = xyes; then
CFLAGS="-g $CFLAGS"
fi
dnl Now check for --enable-profile
AC_MSG_CHECKING([whether to enable profiling support (gprof)])
AC_ARG_ENABLE([profile],
[ --enable-profile Enable profiling support (add -pg to CFLAGS)],
[unet_cv_enable_profile=$enable_profile],
[AC_CACHE_VAL(unet_cv_enable_profile,
[unet_cv_enable_profile=no])])
AC_MSG_RESULT([$unet_cv_enable_profile])
if test x"$unet_cv_enable_profile" = xyes; then
CFLAGS="-pg $CFLAGS"
fi
dnl Now check for --enable-pedantic
AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
AC_ARG_ENABLE([pedantic],
[ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)],
[unet_cv_enable_pedantic=$enable_pedantic],
[AC_CACHE_VAL(unet_cv_enable_pedantic,
[unet_cv_enable_pedantic=no])])
AC_MSG_RESULT([$unet_cv_enable_pedantic])
if test x"$unet_cv_enable_pedantic" = xyes; then
CFLAGS="-pedantic $CFLAGS"
fi
dnl Now check for --enable-warnings
AC_MSG_CHECKING([whether to enable compiler warnings])
AC_ARG_ENABLE([warnings],
[ --enable-warnings Enable warnings (add -Wall to CFLAGS)],
[unet_cv_enable_warnings=$enable_warnings],
[AC_CACHE_VAL(unet_cv_enable_warnings,
[unet_cv_enable_warnings=no])])
AC_MSG_RESULT([$unet_cv_enable_warnings])
AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
ac_save_cc="$CC"
CC="$CC -fno-strict-aliasing"
AC_TRY_RUN([int main() { return 0; }],
ac_cv_no_strict_aliasing_ok=yes,
ac_cv_no_strict_aliasing_ok=no,
ac_cv_no_strict_aliasing_ok=no)
CC="$ac_save_cc"
AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
if test $ac_cv_no_strict_aliasing_ok = yes
then
CFLAGS="-fno-strict-aliasing $CFLAGS"
fi
dnl --disable-inlines check...
AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
AC_ARG_ENABLE([inlines],
[ --disable-inlines Disable inlining for a few critical functions],
[unet_cv_enable_inlines=$enable_inlines],
[AC_CACHE_VAL(unet_cv_enable_inlines,
[unet_cv_enable_inlines=yes])])
AC_MSG_RESULT([$unet_cv_enable_inlines])
if test x"$unet_cv_enable_inlines" = xyes; then
AC_DEFINE([FORCEINLINE], , [Force inlining for a few critical functions])
fi
dnl check for /dev/null so we can use it to hold evil fd's
AC_MSG_CHECKING([for /dev/null])
if test -c /dev/null ; then
AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
AC_MSG_RESULT(yes)
else
AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
AC_MSG_RESULT(no - using devnull.log)
fi
dnl **
dnl ** SSL Library checks (OpenSSL)
dnl **
AC_MSG_CHECKING([whether to enable OpenSSL support])
AC_ARG_ENABLE([ssl],
[ --disable-ssl Disable Secure Sockets Layer support],
[unet_cv_enable_ssl=$enable_ssl],
[AC_CACHE_VAL(unet_cv_enable_ssl,
[unet_cv_enable_ssl=yes])])
AC_MSG_RESULT([$unet_cv_enable_ssl])
if test x"$unet_cv_enable_ssl" = xyes; then
AC_MSG_CHECKING([for OpenSSL includes])
AC_ARG_WITH([openssl-includes],
AS_HELP_STRING([--with-openssl-includes=dir], [Specify location of OpenSSL header files (default: /usr/include)]),
[base_ssl_inc=$withval],
[base_ssl_inc=/usr/include])
[unet_cv_with_openssl_inc_prefix=$base_ssl_inc]
AC_MSG_RESULT([$unet_cv_with_openssl_inc_prefix])
AC_DEFINE_UNQUOTED(SSL_INCLUDES_PATH, "$base_ssl_inc",
[Path name used as a base for the ssl include files.])
AC_MSG_CHECKING([for OpenSSL libraries])
AC_ARG_WITH([openssl-libs],
AS_HELP_STRING([--with-openssl-libs=dir], [Specify location of OpenSSL libs (default: /usr/lib)]),
[unet_cv_with_openssl_prefix=$withval],
[unet_cv_with_openssl_prefix=/usr/lib])
AC_MSG_RESULT([$unet_cv_with_openssl_prefix])
AC_DEFINE_UNQUOTED(SSL_LIBS_PATH, "$unet_cv_with_openssl_prefix",
[Path name used as a base for the ssl lib files.])
AC_MSG_CHECKING([for Kerberos includes])
AC_ARG_WITH([kerberos-includes],
AS_HELP_STRING([--with-kerb-includes=dir], [Specify location of Kerberos includes (default: /usr/kerberos/include)]),
[unet_cv_with_kerberos_prefix=$withval],
[unet_cv_with_kerberos_prefix=/usr/kerberos/include])
AC_MSG_RESULT([$unet_cv_with_kerberos_prefix])
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="-I$unet_cv_with_openssl_inc_prefix -lcrypto"
LIBS="-L$unet_cv_with_openssl_prefix -lssl -lcrypto"
unet_cv_enable_ssl="no";
OPENSSL_LDFLAGS="";
AC_CHECK_LIB(ssl, SSL_read, [
AC_CHECK_LIB(crypto, EVP_sha256, [
AC_CHECK_HEADERS($base_ssl_inc/openssl/ssl.h $base_ssl_inc/openssl/err.h, [
unet_cv_enable_ssl="yes";
OPENSSL_LDFLAGS="-lssl -lcrypto"
SSL_C=ssl.c
AC_SUBST(SSL_C)
])
])
])
LIBS=$save_LIBS
CFLAGS=$save_CFLAGS
if test "x$unet_cv_enable_ssl" = xyes; then
AC_DEFINE([USE_SSL], , [Define if you are using OpenSSL])
LIBS="$LIBS -L$unet_cv_with_openssl_prefix $OPENSSL_LDFLAGS"
CFLAGS="$CFLAGS -I$unet_cv_with_openssl_inc_prefix -I$unet_cv_with_kerberos_prefix"
else
AC_MSG_ERROR([Unable to find OpenSSL with sha256 support, Maybe you need to install the openssl and libssl-dev package, or use --with-openssl-includes and --with-openssl-libs if you have openssl installed in an odd location])
fi
fi
dnl dnl SSL/TLS Library checks (GNU TLS)
dnl if test x"$unet_cv_enable_ssl" = xyes; then
dnl unet_cv_enable_ssl="no";
dnl AC_CHECK_HEADER(gnutls/gnutls.h,
dnl dnl Save the current libraries so the crypto stuff isn't always
dnl dnl included...
dnl save_LIBS="$LIBS"
dnl TEST_GNUTLS_LIBS=`libgnutls-config --libs`
dnl AC_CHECK_LIB(gnutls, gnutls_init,
dnl [SSLLIBS=$TEST_GNUTLS_LIBS
dnl unet_cv_enable_ssl="yes"],,
dnl $TEST_GNUTLS_LIBS)
dnl
dnl LIBS=$save_LIBS)
dnl fi
dnl if test "x$unet_cv_enable_ssl" = xyes; then
dnl AC_DEFINE([USE_SSL], , [Define if you are using SSL/TLS])
dnl SSL_C=ssl.c
dnl AC_SUBST(SSL_C)
dnl LIBS="$LIBS $SSLLIBS"
dnl fi
AC_CHECK_HEADERS(pcreposix.h, [ ac_cv_header_pcreposix_h="yes" ] , [ ac_cv_header_pcreposix_h="no" ])
if test x"$ac_cv_header_pcreposix_h" = xyes; then
TRELIBS="-lpcreposix -lpcre"
AC_SUBST(TRELIBS)
AC_DEFINE([PCRE_SYSTEM], , [Define if PCRE is installed in /usr])
else
ac_cv_header_pcreposix_h=no
AC_CHECK_HEADERS(/usr/local/include/pcreposix.h, [ ac_cv_header_pcreposix_h="yes" ] , [ ac_cv_header_pcreposix_h="no" ])
if test x"$ac_cv_header_pcreposix_h" = xyes; then
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
TRELIBS="-L/usr/local/lib -lpcreposix -lpcre"
AC_DEFINE([PCRE_SYSTEM], , [Define if PCRE is installed in /usr])
else
ac_cv_header_pcreposix_h=no
AC_CHECK_HEADERS(/usr/include/pcre/pcreposix.h, [ ac_cv_header_pcreposix_h="yes" ] , [ ac_cv_header_pcreposix_h="no" ])
if test x"$ac_cv_header_pcreposix_h" = xyes; then
CPPFLAGS="$CPPFLAGS -I/usr/include/pcre"
TRELIBS="-L/usr/lib/pcre -lpcreposix -lpcre"
AC_SUBST(TRELIBS)
else
ac_cv_header_pcreposix_h=no
AC_CHECK_HEADERS($HOME/include/pcreposix.h, [ ac_cv_header_pcreposix_h="yes" ] , [ ac_cv_header_pcreposix_h="no" ])
if test x"$ac_cv_header_pcreposix_h" = xyes; then
CPPFLAGS="$CPPFLAGS -I$HOME/include"
TRELIBS="-L$HOME/lib -lpcreposix -lpcre"
AC_SUBST(TRELIBS)
else
AC_MSG_ERROR([PCRE regex library not found. To install PCRE just type 'tools/pcre_install.sh' now, to install PCRE in your home directory.])
fi
fi
fi
fi
AC_MSG_CHECKING([weather to enable subversion updating support])
AC_ARG_ENABLE([subversion],
[ --enable-subversion Enable subversion will check /usr/bin and /usr/local/bin for subversion],
[unet_cv_enable_svn=$enable_svn],
[AC_CACHE_VAL(unet_cv_enable_svn,
[unet_cv_enable_svn=yes])])
found_svn=disabled
if test "x$unet_cv_enable_svn" = "xyes" ; then
found_svn=no
for dir in $enableval /usr/bin /usr/local/bin; do
svndir="$dir"
if test -f "$svndir/svn"; then
found_svn=yes
SVNDIR=$svndir
SVNUPDATE="svnupdate"
AC_SUBST(SVNDIR)
AC_SUBST(SVNUPDATE)
break;
fi
done
fi
AC_MSG_RESULT([$found_svn])
if test "x$found_svn" = "xno" ; then
SVNUPDATE=" "
AC_SUBST(SVNUPDATE)
echo ""
echo "Apparently you do not have subversion installed. If you want the"
echo "latest updates to Nefarious IRCu then you should install this and"
echo "run configure again."
echo ""
fi
dnl --disable-devpoll check...
AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
AC_ARG_ENABLE([devpoll],
[ --disable-devpoll Disable the /dev/poll-based engine],
[unet_cv_enable_devpoll=$enable_devpoll],
[AC_CACHE_VAL(unet_cv_enable_devpoll,
[unet_cv_enable_devpoll=yes])])
if test x"$ac_cv_header_sys_devpoll_h" = xno; then
unet_cv_enable_devpoll=no
fi
AC_MSG_RESULT([$unet_cv_enable_devpoll])
if test x"$unet_cv_enable_devpoll" != xno; then
AC_DEFINE([USE_DEVPOLL], , [Define to enable the /dev/poll engine])
ENGINE_C="engine_devpoll.c $ENGINE_C"
fi
dnl --disable-kqueue check...
AC_MSG_CHECKING([whether to enable the kqueue event engine])
AC_ARG_ENABLE([kqueue],
[ --disable-kqueue Disable the kqueue-based engine],
[unet_cv_enable_kqueue=$enable_kqueue],
[AC_CACHE_VAL(unet_cv_enable_kqueue,
[unet_cv_enable_kqueue=yes])])
if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then
unet_cv_enable_kqueue=no
fi
dnl **
dnl ** FIXME: KQUEUE + OpenSSL does not work with *BSD at present
dnl **
if test x"$unet_cv_enable_ssl" = xyes -a x"$OSDEP_C" = xos_bsd.c; then
unet_cv_enable_kqueue=no
fi
AC_MSG_RESULT([$unet_cv_enable_kqueue])
if test x"$unet_cv_enable_kqueue" != xno; then
AC_DEFINE([USE_KQUEUE], , [Define to enable the kqueue engine])
ENGINE_C="engine_kqueue.c $ENGINE_C"
fi
dnl --disable-epoll check
AC_CHECK_LIB(epoll, epoll_create,
[have_epoll_lib=yes],
have_epoll_lib=no)
AC_MSG_CHECKING([whether to enable the epoll event engine])
AC_ARG_ENABLE([epoll],
[ --disable-epoll Disable the epoll-based engine],
[unet_cv_enable_epoll=$enable_epoll],
[AC_CACHE_VAL(unet_cv_enable_epoll,
[unet_cv_enable_epoll=yes])])
if test x"$ac_cv_header_sys_epoll_h" = xno -o x"$ac_cv_func_epoll" = xno -o x"$have_epoll_lib" = xno; then
unet_cv_enable_epoll=no
fi
AC_MSG_RESULT([$unet_cv_enable_epoll])
dnl If we have the header and user has not refused epoll, we still need
dnl to check whether the functions are properly defined.
if test x"$unet_cv_enable_epoll" != xno; then
AC_MSG_CHECKING([whether epoll functions are properly defined])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [epoll_create(10);])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_DEFINE([EPOLL_NEED_BODY],,[Define to implement epoll system calls])])
AC_DEFINE([USE_EPOLL], , [Define to enable the epoll engine])
ENGINE_C="engine_epoll.c $ENGINE_C"
fi
dnl How to copy one va_list to another?
AC_CACHE_CHECK([for va_copy], unet_cv_c_va_copy, [AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
[unet_cv_c_va_copy="yes"],
[unet_cv_c_va_copy="no"]
)])
if test "$unet_cv_c_va_copy" = "yes" ; then
AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
fi
AC_CACHE_CHECK([for __va_copy], unet_cv_c___va_copy, [AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
[unet_cv_c___va_copy="yes"],
[unet_cv_c___va_copy="no"]
)])
if test "$unet_cv_c___va_copy" = "yes" ; then
AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
fi
dnl --with-symlink lets us set the name of the symlink; defaults to "ircd"
AC_MSG_CHECKING([what name to give the symlink])
AC_ARG_WITH([symlink],
[ --with-symlink=name Name to give the symlink; if name is "no," no
symlink will be created.],
[unet_cv_with_symlink=$with_symlink],
[AC_CACHE_VAL(unet_cv_with_symlink,
[unet_cv_with_symlink="ircd"])])
if test x"$unet_cv_with_symlink" = xyes; then
unet_cv_with_symlink="ircd"
fi
AC_MSG_RESULT([$unet_cv_with_symlink])
if test x"$unet_cv_with_symlink" = xno; then
INSTALL_RULE=install-no-symlink
SYMLINK=
else
INSTALL_RULE=install-with-symlink
SYMLINK=$unet_cv_with_symlink
fi
AC_SUBST(INSTALL_RULE)
AC_SUBST(SYMLINK)
dnl --with-mode lets us set the permissions on the binary
AC_MSG_CHECKING([what permissions to set on the installed binary])
AC_ARG_WITH([mode],
[ --with-mode=mode Permissions (in octal) to give the binary],
[unet_cv_with_mode=$with_mode],
[AC_CACHE_VAL(unet_cv_with_mode,
[unet_cv_with_mode=711])])
if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then
unet_cv_with_mode=711
fi
AC_MSG_RESULT([$unet_cv_with_mode])
IRCDMODE=$unet_cv_with_mode
AC_SUBST(IRCDMODE)
dnl --with-owner lets us set the owner of the binary
changequote(,)dnl
unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
changequote([,])dnl
AC_MSG_CHECKING([which user should own the installed binary])
AC_ARG_WITH([owner],
[ --with-owner=owner Specify owner of the installed binary],
[unet_cv_with_owner=$with_owner],
[AC_CACHE_VAL(unet_cv_with_owner,
[unet_cv_with_owner=$unet_uid])])
if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then
unet_cv_with_owner=$unet_uid
fi
AC_MSG_RESULT([$unet_cv_with_owner])
IRCDOWN=$unet_cv_with_owner
AC_SUBST(IRCDOWN)
dnl --with-group lets us set the group owner of the binary
changequote(,)dnl
unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
changequote([,])dnl
AC_MSG_CHECKING([which group should own the installed binary])
AC_ARG_WITH([group],
[ --with-group=group Specify group owner of the installed binary],
[unet_cv_with_group=$with_group],
[AC_CACHE_VAL(unet_cv_with_group,
[unet_cv_with_group=$unet_gid])])
if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then
unet_cv_with_group=$unet_gid
fi
AC_MSG_RESULT([$unet_cv_with_group])
IRCDGRP=$unet_cv_with_group
AC_SUBST(IRCDGRP)
dnl --with-domain lets us set the domain name for some statistics-gathering
unet_domain=
if test -f /etc/resolv.conf; then
unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`
if test x"$unet_domain" = x; then
unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf`
fi
fi
AC_MSG_CHECKING([for site domain name])
AC_ARG_WITH([domain],
[ --with-domain=domain Domain name to use in local statistics gathering],
[unet_cv_with_domain=$with_domain],
[AC_CACHE_VAL(unet_cv_with_domain,
[unet_cv_with_domain=$unet_domain])])
if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then
unet_cv_with_domain=$unet_domain
fi
if test x"$unet_cv_with_domain" = xno; then
AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it])
fi
AC_MSG_RESULT([$unet_cv_with_domain])
AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain",
[Domain name to be used for some statistics gathering])
dnl --with-chroot lets us define a directory that we are going to be using
dnl as the root of our filesystem
AC_MSG_CHECKING([if chroot operation is desired])
AC_ARG_WITH([chroot],
[ --with-chroot=dir Specify that the server will be operated under
a different root directory given by dir. See
doc/readme.chroot for more information.],
[unet_cv_with_chroot=$with_chroot],
[AC_CACHE_VAL(unet_cv_with_chroot,
[unet_cv_with_chroot=no])])
if test x"$unet_cv_with_chroot" = xyes; then
AC_MSG_ERROR([--with-chroot given with no directory. See doc/readme.chroot.])
fi
# Ensure there are no trailing /'s to mess us up
unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'`
AC_MSG_RESULT([$unet_cv_with_chroot])
dnl Determine some default directory names
dnl
dnl HACK WARNING: We are referencing an autoconf internal variable. This is
dnl the only way to figure out what value $prefix will have when we go to do
dnl the install--and the only way we can stick that value in our definitions
dnl of SPATH, etc.
# Deal with the annoying value "NONE" here
unet_save_prefix=$prefix
if test x"$prefix" = xNONE; then
prefix=$ac_default_prefix
else
prefix=$prefix
fi
unet_save_exec_prefix=$exec_prefix
if test x"$exec_prefix" = xNONE; then
exec_prefix=$prefix
else
exec_prefix=$exec_prefix
fi
# Obtain the actual interesting directories
unet_bindir=`eval echo "$bindir"`
unet_libdir=`eval echo "$libdir"`
# Restore the original settings of $prefix and $exec_prefix
prefix=$unet_save_prefix
exec_prefix=$unet_save_exec_prefix
dnl Now compute the name of the binary and verify that it will work under
dnl chroot operation
AC_MSG_CHECKING([where the binary will be for /restart])
if test x"$unet_cv_with_symlink" = xno; then
unet_spath="$unet_bindir/ircd"
else
unet_spath="$unet_bindir/$unet_cv_with_symlink"
fi
AC_MSG_RESULT([$unet_spath])
if test x"$unet_cv_with_chroot" != xno; then
if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"`
else
AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail])
fi
fi
AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts])
dnl --with-dpath sets the all-important DPATH
AC_MSG_CHECKING([what the data directory should be])
AC_ARG_WITH([dpath],
[ --with-dpath=dir Directory for all server data files],
[unet_cv_with_dpath=$with_dpath],
[AC_CACHE_VAL(unet_cv_with_dpath,
[unet_cv_with_dpath=$unet_libdir])])
if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then
unet_cv_with_dpath=$unet_libdir
fi
# Ensure there are no trailing /'s to mess us up
unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'`
AC_MSG_RESULT([$unet_cv_with_dpath])
if test x"$unet_cv_with_chroot" != xno; then
if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"`
else
AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot])
fi
else
unet_dpath=$unet_cv_with_dpath
fi
AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory])
DPATH=$unet_cv_with_dpath
AC_SUBST(DPATH)
dnl --with-cpath allows us to specify the configuration file
AC_MSG_CHECKING([where the default configuration file resides])
AC_ARG_WITH([cpath],
[ --with-cpath=file Set server configuration file],
[unet_cv_with_cpath=$with_cpath],
[AC_CACHE_VAL(unet_cv_with_cpath,
[unet_cv_with_cpath="ircd.conf"])])
if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then
unet_cv_with_cpath="ircd.conf"
fi
AC_MSG_RESULT([$unet_cv_with_cpath])
if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then
# Absolute path; check against chroot stuff
if test x"$unet_cv_with_chroot" != xno; then
if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"`
else
AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot])
fi
else
unet_cpath=$unet_cv_with_cpath
fi
else
unet_cpath=$unet_cv_with_cpath
fi
AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name])
dnl --with-lpath allows us to specify the default debugging log file
AC_MSG_CHECKING([where to put the debugging log if debugging enabled])
AC_ARG_WITH([lpath],
[ --with-lpath=file Set the debugging log file],
[unet_cv_with_lpath=$with_lpath],
[AC_CACHE_VAL(unet_cv_with_lpath,
[unet_cv_with_lpath="ircd.log"])])
if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then
unet_cv_with_lpath="ircd.log"
fi
AC_MSG_RESULT([$unet_cv_with_lpath])
if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then
# Absolute path; check against chroot stuff
if test x"$unet_cv_with_chroot" != xno; then
if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"`
else
AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead])
unet_cv_with_lpath="ircd.log"
unet_lpath="ircd.log"
fi
else
unet_lpath=$unet_cv_with_lpath
fi
else
unet_lpath=$unet_cv_with_lpath
fi
AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file])
dnl --with-maxcon allows us to set the maximum connections
unet_maxcon=`ulimit -Hn`
if test x"$unet_maxcon" = xunlimited; then
unet_maxcon=`ulimit -Sn`
fi
unet_maxcon=`expr $unet_maxcon - 4`
AC_MSG_CHECKING([max connections])
AC_ARG_WITH([maxcon],
[ --with-maxcon=maxcon Maximum number of connections server will accept],
[unet_cv_with_maxcon=$with_maxcon],
[AC_CACHE_VAL(unet_cv_with_maxcon,
[unet_cv_with_maxcon=$unet_maxcon])])
if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then
unet_cv_with_maxcon=$unet_maxcon
fi
AC_MSG_RESULT([$unet_cv_with_maxcon])
AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
[Maximum number of network connections])
dnl Enable humor
AC_MSG_CHECKING([sense of humor])
AC_ARG_WITH([sense-of-humor],
[ --with-sense-of-humor Specify this if you have a sense of humor],
[unet_cv_with_sense_of_humor=$with_sense_of_humor],
[AC_CACHE_VAL(unet_cv_with_sense_of_humor,
[unet_cv_with_sense_of_humor=no])])
AC_MSG_RESULT([$unet_cv_with_sense_of_humor])
if test x"$unet_cv_with_sense_of_humor" = xyes; then
AC_CHECK_LIB(Fridge,mass_quantities_of_beer)
AC_CHECK_LIB(Fridge,mass_quantities_of_any_alcohol, , [
echo "Warning: No alcohol was found in your refrigerator."