-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
1645 lines (1487 loc) · 43.3 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
dnl Process this file with autoconf to produce a configure script.
dnl
dnl require a recent autoconf
AC_PREREQ(2.61)
AC_INIT(src/version.h)
BUILD_DIR=`pwd`
cd ..
TOP_DIR=`pwd`
cd ${BUILD_DIR}
AC_SUBST(BUILD_DIR)
AC_SUBST(TOP_DIR)
AC_USE_SYSTEM_EXTENSIONS
AC_CONFIG_AUX_DIR(autoconf)
AC_CONFIG_HEADERS(src/config.h:config.h.in)
AC_CONFIG_MACRO_DIR([autoconf/m4])
dnl minimal Win32 stuff for "make clean"
WIN32BUILDDIR=${BUILD_DIR}/src/win32
WIN32MAINDIR=${BUILD_DIR}
WIN32TOPDIR=${TOP_DIR}
AC_SUBST(WIN32BUILDDIR)
AC_SUBST(WIN32MAINDIR)
AC_SUBST(WIN32TOPDIR)
dnl search for true and false programs.
AC_PATH_PROGS(TRUEPRG, true, :)
AC_PATH_PROGS(FALSEPRG, false, :)
dnl burp version
post_host=
if test "x$BURP" != x; then
post_host=`echo -${BURP} | tr 'A-Z ' 'a-z-'`
fi
BURP=${BURP:-Burp}
VERSION=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
DATE=`sed -n -e 's/^.*[ \t]*BDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
LSMDATE=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
AC_SUBST(VERSION)dnl
AC_SUBST(DATE)dnl
AC_SUBST(LSMDATE)dnl
AC_SUBST(BURP)dnl
AC_SUBST(post_host)dnl
AC_SUBST(BDB_VERSION)dnl
dnl -------------------------------------------------------
dnl Check for compiler.
dnl ------------------------------------------------------
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CC_C_O dnl Determine if C compiler support -c -o.
AC_PROG_GCC_TRADITIONAL dnl Determine if ioctl() need -traditional.
BASECC=`basename $CC`
have_gcc=no
if test "x$BASECC" = xgcc; then
AC_DEFINE(HAVE_GCC, 1, [Define if you have GCC])
have_gcc=yes
fi
# This stuff interferes with ccache, so do not do it.
#AC_PATH_PROG(CXX, $CXX, $CXX)
#if test ! -e $CXX; then
# AC_MSG_ERROR(Unable to find C++ compiler)
#fi
dnl -------------------------------------------------------
dnl Check for programs.
dnl ------------------------------------------------------
AC_PROG_INSTALL
AC_PATH_PROG(MV, mv, mv)
dnl Alert !!!
dnl If we name the variable RM it will shadow the RM variable in the configure script and we overwrite the
dnl value with the name of the rm command and not rm -f which is its normal content. This gives all kind
dnl of strange output of the configure script (like things don't exist etc.).
dnl So we name it REMOVE (more software has run into this problem)
AC_PATH_PROG(REMOVE, rm, rm)
AC_PATH_PROG(CP, cp, cp)
AC_PATH_PROG(SED, sed, sed)
AC_PATH_PROG(ECHO, echo, echo)
AC_PATH_PROG(CMP, cmp, cmp)
AC_PATH_PROG(TBL, tbl, tbl)
AC_PATH_PROG(AR, ar, ar)
AC_PATH_PROG(OPENSSL, openssl, none)
AC_PATH_PROG(PKGCONFIG, pkg-config, pkg-config)
AC_PATH_PROG(PIDOF, pidof, pidof)
AC_PROG_AWK
# Some AWK programs fail, so test it and warn the user
if echo xfoo | $AWK 'BEGIN { prog=ARGV[1]; ARGC=1 }
{ if ((prog == $2) || (("(" prog ")") == $2) ||
(("[" prog "]") == $2) ||
((prog ":") == $2)) { print $1 ; exit 0 } }' xfoo>/dev/null; then :;
else
AC_MSG_ERROR([!!!!!!!!! WARNING !!!!!!!!!!!!!!
The regex engine of $AWK is too broken to be used you
might want to install GNU AWK.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!])
fi
THE_AWK=$AWK
AC_PATH_PROG(AWK, $THE_AWK, $THE_AWK)
test -n "$ARFLAG" || ARFLAGS="cr"
AC_SUBST(ARFLAGS)
MAKE_SHELL=/bin/sh
AC_SUBST(MAKE_SHELL)
AC_SUBST(LOCAL_LIBS)
AC_SUBST(LOCAL_CFLAGS)
AC_SUBST(LOCAL_LDFLAGS)
AC_SUBST(LOCAL_DEFS)
dnl -------------------------------------------
dnl static (default off)
dnl -------------------------------------------
AC_ARG_ENABLE(static,
AC_HELP_STRING([--enable-static], [enable static burp @<:@default=no@:>@]),
[
if test x$enableval = xyes; then
if test x$use_libtool = xyes; then
AC_MSG_ERROR([Libtool is enabled, not compatible with static tools,
please rerun configure with --disable-libtool])
fi
support_static=yes
fi
]
)
STATIC=
STATIC_DEDUP=
STATIC_STRIP_VSS=
if test x$support_static = xyes; then
STATIC="static-burp"
STATIC_DEDUP="static-bedup"
STATIC_STRIP_VSS="static-vss_strip"
fi
AC_SUBST(STATIC)
AC_SUBST(STATIC_DEDUP)
AC_SUBST(STATIC_STRIP_VSS)
dnl --------------------------------------------------
dnl Libtool config
dnl --------------------------------------------------
use_libtool=yes
AC_ARG_ENABLE(libtool,
AC_HELP_STRING([--enable-libtool], [enable building using GNU libtool @<:@default=yes@:>@]),
[
if test x$enableval = xno; then
use_libtool=no
fi
]
)
LT_INIT([shared disable-static])
LT_LANG([C++])
if test x$use_libtool != xno; then
DEFAULT_OBJECT_TYPE=".lo"
DEFAULT_ARCHIVE_TYPE=".la"
DEFAULT_SHARED_OBJECT_TYPE=".la"
LIBTOOL="\$(LIBTOOL)"
LIBTOOL_INSTALL_TARGET="libtool-install"
LIBTOOL_UNINSTALL_TARGET="libtool-uninstall"
LIBTOOL_CLEAN_TARGET="libtool-clean"
have_plugins=yes
else
DEFAULT_OBJECT_TYPE=".o"
DEFAULT_ARCHIVE_TYPE=".a"
DEFAULT_SHARED_OBJECT_TYPE=".so"
LIBTOOL="# \$(LIBTOOL)"
LIBTOOL_INSTALL_TARGET=""
LIBTOOL_UNINSTALL_TARGET=""
LIBTOOL_CLEAN_TARGET=""
have_plugins=no
fi
AC_SUBST(DEFAULT_OBJECT_TYPE)
AC_SUBST(DEFAULT_ARCHIVE_TYPE)
AC_SUBST(DEFAULT_SHARED_OBJECT_TYPE)
AC_SUBST(LIBTOOL)
AC_SUBST(LIBTOOL_INSTALL_TARGET)
AC_SUBST(LIBTOOL_UNINSTALL_TARGET)
AC_SUBST(LIBTOOL_CLEAN_TARGET)
dnl --------------------------------------------------
dnl Include file handling
dnl --------------------------------------------------
AC_ARG_ENABLE(includes,
AC_HELP_STRING([--enable-includes], [enable installing of include files @<:@default=no@:>@]),
[
if test x$enableval = xyes; then
install_includes=yes
fi
]
)
dnl It only makes sense to install include files when you install libraries which only happens when
dnl libtool is enabled
if test x$use_libtool != xno -a x$install_includes = xyes; then
INCLUDE_INSTALL_TARGET="install-includes"
INCLUDE_UNINSTALL_TARGET="uninstall-includes"
else
INCLUDE_INSTALL_TARGET=""
INCLUDE_UNINSTALL_TARGET=""
fi
AC_SUBST(INCLUDE_INSTALL_TARGET)
AC_SUBST(INCLUDE_UNINSTALL_TARGET)
dnl --------------------------------------------------
dnl Burp OP Sys determination (see aclocal.m4)
dnl --------------------------------------------------
BA_CHECK_OPSYS
dnl -----------------------------------------------------------
dnl Burp OPSys Distribution determination (see aclocal.m4)
dnl ----------------------------------------------------------
BA_CHECK_OPSYS_DISTNAME
dnl --------------------------------------------------
dnl Suppport for gettext (translations)
dnl By default, $datarootdir is ${prefix}/share
dnl --------------------------------------------------
AM_GNU_GETTEXT([external])
dnl ------------------------------------------------------------------
dnl If the user has not set --prefix, we set our default to nothing.
dnl In this case, if the user has not set --sysconfdir, we set it
dnl to the package default of /etc/burp. If either --prefix or
dnl --sysconfdir is set, we leave sysconfdir alone except to eval it.
dnl If the user has not set --libdir, we set it to the package
dnl default of /usr/lib. If either --prefix or --libdir is set,
dnl we leave libdir alone except to eval it. If the user has not set
dnl --includedir, we set it to the package default of /usr/include.
dnl If either --prefix or --includedir is set, we leave includedir
dnl alone except to eval it
dnl ------------------------------------------------------------------
os_name=`uname -s 2>/dev/null`
if test x${prefix} = xNONE ; then
if test `eval echo ${sysconfdir}` = NONE/etc ; then
sysconfdir=/etc/burp
fi
if test `eval echo ${libdir}` = NONE/lib ; then
case ${os_name} in
Linux)
os_processor=`uname -p 2>/dev/null`
case ${os_processor} in
x86_64)
libdir=/usr/lib64
;;
*)
libdir=/usr/lib
;;
esac
;;
*)
libdir=/usr/lib
;;
esac
fi
if test `eval echo ${includedir}` = NONE/include ; then
includedir=/usr/include
fi
if test `eval echo ${datarootdir}` = NONE/share ; then
datarootdir=/usr/share
fi
prefix=
fi
dnl -------------------------------------------------------------------------
dnl If the user has not set --exec-prefix, we default to ${prefix}
dnl -------------------------------------------------------------------------
if test x${exec_prefix} = xNONE ; then
exec_prefix=${prefix}
fi
sysconfdir=`eval echo ${sysconfdir}`
datarootdir=`eval echo ${datarootdir}`
docdir=`eval echo ${docdir}`
htmldir=`eval echo ${htmldir}`
libdir=`eval echo ${libdir}`
includedir=`eval echo ${includedir}`
localedir=`eval echo ${datarootdir}/locale`
AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir", [Define to system config directory])
AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir", [LOCALEDIR])
dnl ------------------------------------------------------------------
dnl If the user has not set --sbindir, we set our default as /usr/sbin
dnl ------------------------------------------------------------------
if test x$sbindir = x'${exec_prefix}/sbin' ; then
sbindir=${exec_prefix}/usr/sbin
fi
sbindir=`eval echo ${sbindir}`
dnl -------------------------------------------------------------------------
dnl If the user has not set --mandir, we default to /usr/share/man
dnl -------------------------------------------------------------------------
if test x$mandir = x'${prefix}/man' ; then
mandir=/usr/share/man
fi
dnl -------------------------------------------------------------------------
dnl If the user has not set --htmldir, we default to /usr/share/doc/burp/html
dnl -------------------------------------------------------------------------
if test x$htmldir = x${docdir} ; then
htmldir=`eval echo ${docdir}burp/html`
fi
dnl -------------------------------------------------------------------------
dnl If the user has not set --docdir, we default to /usr/share/doc/
dnl -------------------------------------------------------------------------
if test x$docdir = x'/usr/share/doc/' ; then
docdir=`eval echo ${docdir}burp`
fi
support_readline=yes
support_conio=yes
support_tls=no
support_crypto=no
dnl
dnl allow setting default executable permissions
dnl
SBINPERM=0755
AC_ARG_WITH(sbin-perm,
AC_HELP_STRING([--with-sbin-perm=MODE], [specify permissions for sbin binaries @<:@default=0755@:>@]),
[
if test "x$withval" != "x" ; then
SBINPERM=$withval
fi
]
)
AC_SUBST(SBINPERM)
dnl --------------------------------------------------------------------------
dnl CHECKING COMMAND LINE OPTIONS
dnl --------------------------------------------------------------------------
dnl
dnl Find where sockets are (especially for Solaris)
dnl Do this before the TCP Wrappers test since tcp wrappers
dnl uses the socket library and some linkers are stupid.
dnl
AC_CHECK_FUNC(socket,
AC_MSG_RESULT(using libc's socket),
AC_CHECK_LIB(xnet,socket)
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(inet,socket))
dnl -----------------------------------------------------------
dnl Check whether user wants TCP wrappers support (default off)
dnl -----------------------------------------------------------
TCPW_MSG="no"
WRAPLIBS=""
AC_ARG_WITH(tcp-wrappers,
AC_HELP_STRING([--with-tcp-wrappers@<:@=DIR@:>@], [enable tcpwrappers support]),
[
if test "x$withval" != "xno" ; then
saved_LIBS="$LIBS"
LIBS="$saved_LIBS -lwrap"
AC_SEARCH_LIBS(nanosleep, [rt])
AC_MSG_CHECKING(for libwrap)
AC_TRY_LINK(
[
#include <sys/types.h>
#include <tcpd.h>
int deny_severity = 0;
int allow_severity = 0;
struct request_info *req;
], [
hosts_access(req);
], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
TCPW_MSG="yes"
LIBS="$saved_LIBS"
WRAPLIBS="-lwrap"
], [
LIBS="$saved_LIBS -lwrap -lnsl"
WRAPLIBS="$saved_LIBS -lwrap -lnsl"
AC_TRY_LINK(
[
#include <sys/types.h>
#include <tcpd.h>
int deny_severity = 0;
int allow_severity = 0;
struct request_info *req;
], [
hosts_access(req);
], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBWRAP, 1, [Set to enable libwraper support])
TCPW_MSG="yes"
LIBS="$saved_LIBS"
WRAPLIBS="-lwrap"
], [
AC_MSG_ERROR([*** libwrap missing])
]
)
]
)
fi
]
)
AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),[want_v6=$enableval],[want_v6=yes])
if test "x$want_v6" = "xno"; then
have_ipv6="no"
else
AC_MSG_CHECKING(for IPv6 support)
have_ipv6="no"
AC_RUN_IFELSE([
AC_LANG_PROGRAM(
[[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
]],
[[
int fd;
struct sockaddr_in6 foo;
fd = socket(AF_INET6, SOCK_STREAM, 0);
return(fd >= 0 ? 0 : 1);
]]
)
],
have_ipv6=yes,
have_ipv6=no,
have_ipv6=no)
AC_MSG_RESULT($have_ipv6)
if test $have_ipv6 = yes ; then
AC_DEFINE(HAVE_IPV6,,"check if system supports IPV6")
fi
fi
dnl -----------------------------------------------------------
dnl Check whether OpenSSL is available
dnl -----------------------------------------------------------
AC_MSG_CHECKING([for OpenSSL])
dnl The following uses quadrigraphs:
dnl '@<:@' = '['
dnl '@:>@' = ']'
AC_ARG_WITH(openssl,
AC_HELP_STRING([--with-openssl@<:@=DIR@:>@], [Include OpenSSL support. DIR is the OpenSSL base]),
[
with_openssl_directory=${withval}
]
)
if test "x$with_openssl_directory" != "xno"; then
OPENSSL_LIBS="-lssl -lcrypto"
OPENSSL_INC=""
if test "x$with_openssl_directory" != "xyes" && test x"${with_openssl_directory}" != "x"; then
#
# Make sure the $with_openssl_directory also makes sense
#
if test -d "$with_openssl_directory/lib" -a -d "$with_openssl_directory/include"; then
OPENSSL_LIBS="-L$with_openssl_directory/lib $OPENSSL_LIBS"
OPENSSL_INC="-I$with_openssl_directory/include $OPENSSL_INC"
fi
fi
saved_LIBS="${LIBS}"
saved_CFLAGS="${CFLAGS}"
LIBS="${saved_LIBS} ${OPENSSL_LIBS}"
CFLAGS="${saved_CFLAGS} ${OPENSSL_INC}"
AC_TRY_LINK(
[
#include <openssl/ssl.h>
], [
CRYPTO_set_id_callback(NULL);
], [
support_tls="yes"
support_crypto="yes"
], [
support_tls="no"
support_crypto="no"
]
)
AC_TRY_LINK(
[
#include <openssl/evp.h>
], [
EVP_sha512();
], [
ac_cv_openssl_sha2="yes"
], [
ac_cv_openssl_sha2="no"
]
)
dnl Solaris disables greater than 128+ bit encryption in their OpenSSL
dnl implementation, presumably for export reasons. If 192bit AES
dnl is available, we assume that we're running with a 'non-export'
dnl openssl library.
AC_TRY_LINK(
[
#include <openssl/evp.h>
], [
EVP_aes_192_cbc();
], [
ac_cv_openssl_export="no"
], [
ac_cv_openssl_export="yes"
]
)
if test "$support_tls" = "yes"; then
AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL library is available])
AC_DEFINE(HAVE_TLS, 1, [Define if TLS support should be enabled])
AC_DEFINE(HAVE_CRYPTO, 1, [Define if encryption support should be enabled])
fi
if test "$ac_cv_openssl_sha2" = "yes"; then
AC_DEFINE(HAVE_SHA2, 1, [Define if the SHA-2 family of digest algorithms is available])
fi
if test "$ac_cv_openssl_export" = "yes"; then
AC_DEFINE(HAVE_OPENSSL_EXPORT_LIBRARY, 1, [Define if the OpenSSL library is export-contrained to 128bit ciphers])
fi
if test "$support_crypto" = "yes"; then
AC_CHECK_LIB(ssl, EVP_PKEY_encrypt_old, AC_DEFINE(HAVE_OPENSSLv1, 1, [Set if have OpenSSL version 1.x]))
fi
LIBS="${saved_LIBS}"
CFLAGS="${saved_CFLAGS}"
else
support_tls="no"
support_crypto="no"
OPENSSL_LIBS=""
OPENSSL_INC=""
fi
AC_MSG_RESULT([$support_tls])
if test "$support_tls" = "no"; then
OPENSSL_LIBS=""
OPENSSL_INC=""
echo "Please install openssl"
exit 1
fi
if test "$support_crypto" = "no"; then
OPENSSL_LIBS=""
OPENSSL_INC=""
echo "Please install openssl"
exit 1
fi
AC_SUBST(OPENSSL_LIBS)
AC_SUBST(OPENSSL_INC)
#dnl -----------------------------------------------------------
#dnl dlopen is needed for plugins
#dnl -----------------------------------------------------------
#AC_SEARCH_LIBS(dlopen, [dl])
AC_DEFINE(PROTOTYPES, 1, [Define if you need function prototypes])
dnl --------------------------------------------------------------------------
dnl Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
dnl
if test -z "$CFLAGS" -o "$CFLAGS" = "-g -O0"; then
if test -z "$CCOPTS"; then
CCOPTS='-g -O0 -Wall'
fi
CFLAGS="$CCOPTS"
fi
dnl A few others
AC_EXEEXT
dnl See if we can use 64 bit file addresses
AC_SYS_LARGEFILE
AC_PATH_XTRA
dnl --------------------------------------------------------------------------
dnl CHECKING FOR HEADER FILES
dnl --------------------------------------------------------------------------
AC_CHECK_HEADERS( \
assert.h \
fcntl.h \
grp.h \
pwd.h \
libc.h \
limits.h \
stdarg.h \
stdlib.h \
stdint.h \
string.h \
strings.h \
termios.h \
termcap.h \
term.h \
unistd.h \
sys/bitypes.h \
sys/byteorder.h \
sys/ioctl.h \
sys/select.h \
sys/socket.h \
sys/sockio.h \
sys/stat.h \
sys/time.h \
sys/types.h \
arpa/nameser.h \
mtio.h \
sys/mtio.h \
sys/tape.h \
regex.h \
)
AC_HEADER_STDC
AC_HEADER_MAJOR
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_TIMEZONE
dnl --------------------------------------------------------------------------
dnl Check for utime.h structure
dnl --------------------------------------------------------------------------
AC_CACHE_CHECK(for utime.h, ba_cv_header_utime_h,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <utime.h>
], [
struct utimbuf foo
], [
ba_cv_header_utime_h=yes
], [
ba_cv_header_utime_h=no
]
)
]
)
test $ba_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H, 1, [Set if utime.h exists])
dnl --------------------------------------------------------------------------
dnl Check for socklen_t
dnl --------------------------------------------------------------------------
AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
], [
socklen_t x
], [
ba_cv_header_socklen_t=yes
], [
ba_cv_header_socklen_t=no
]
)
]
)
test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T, 1, [Set if socklen_t exists])
dnl --------------------------------------------------------------------------
dnl Check for ioctl request type
dnl --------------------------------------------------------------------------
AC_LANG(C++)
AC_CACHE_CHECK(for ioctl_req_t, ba_cv_header_ioctl_req_t,
[
AC_TRY_COMPILE(
[
#include <unistd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
], [
int (*d_ioctl)(int fd, unsigned long int request, ...);
d_ioctl = ::ioctl;
], [
ba_cv_header_ioctl_req_t=yes
], [
ba_cv_header_ioctl_req_t=no
]
)
]
)
test $ba_cv_header_ioctl_req_t = yes && AC_DEFINE(HAVE_IOCTL_ULINT_REQUEST, 1, [Set if ioctl request is unsigned long int])
dnl Note: it is more correct to use AC_LANG(C++) but some of the older
dnl *BSD systems still use old style C prototypes, which are wrong with
dnl compiled with a C++ compiler.
AC_LANG(C)
dnl --------------------------------------------------------------------------
dnl Check for typeof()
dnl --------------------------------------------------------------------------
AC_LANG_PUSH(C++)
AC_CACHE_CHECK(for typeof, ba_cv_have_typeof,
[
AC_TRY_RUN(
[
main(){char *a = 0; a = (typeof a)a;}
], [
ba_cv_have_typeof=yes
], [
ba_cv_have_typeof=no
], [
ba_cv_have_typeof=no
]
)
]
)
test $ba_cv_have_typeof = yes && AC_DEFINE([HAVE_TYPEOF], 1, [Defind to 1 if compiler has typeof])
AC_LANG_POP(C++)
AC_C_CONST
dnl --------------------------------------------------------------------------
dnl CHECKING FOR FILESYSTEM TYPE
dnl --------------------------------------------------------------------------
AC_MSG_CHECKING(how to get filesystem type)
fstype=no
# The order of these tests is important.
AC_TRY_CPP(
[
#include <sys/statvfs.h>
#include <sys/fstyp.h>
],
AC_DEFINE(FSTYPE_STATVFS, 1, [Define to use SVR4 statvfs to get filesystem type]) fstype=SVR4
)
if test $fstype = no; then
AC_TRY_CPP(
[
#include <sys/statfs.h>
#include <sys/fstyp.h>
],
AC_DEFINE(FSTYPE_USG_STATFS, 1, [Define to use SVR3.2 statfs to get filesystem type]) fstype=SVR3
)
fi
if test $fstype = no; then
AC_TRY_CPP(
[
#include <sys/statfs.h>
#include <sys/vmount.h>
],
AC_DEFINE(FSTYPE_AIX_STATFS, 1, [Define to use AIX3 statfs to get filesystem type]) fstype=AIX
)
fi
if test $fstype = no; then
AC_TRY_CPP(
[
#include <mntent.h>
],
AC_DEFINE(FSTYPE_MNTENT, 1, [Define to use 4.3BSD getmntent to get filesystem type]) fstype=4.3BSD
)
fi
if test $fstype = no; then
AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS, 1, [Define to use 4.4BSD and OSF1 statfs to get filesystem type]) fstype=4.4BSD/OSF1)
fi
if test $fstype = no; then
AC_TRY_CPP(
[
#include <sys/mount.h>
#include <sys/fs_types.h>
],
AC_DEFINE(FSTYPE_GETMNT, 1, [Define to use Ultrix getmnt to get filesystem type]) fstype=Ultrix
)
fi
AC_MSG_RESULT($fstype)
AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
dnl --------------------------------------------------------------------------
dnl CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
dnl --------------------------------------------------------------------------
AC_TYPE_SIGNAL
SIGNAL_CHECK
AC_TYPE_MODE_T
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_OFF_T
AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
AC_CHECK_TYPE(ino_t, unsigned long)
AC_CHECK_TYPE(dev_t, unsigned long)
AC_CHECK_TYPE(daddr_t, long)
AC_CHECK_TYPE(major_t, int)
AC_CHECK_TYPE(minor_t, int)
AC_CHECK_TYPE(ssize_t, int)
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
AC_STRUCT_TM
AC_C_CONST
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short int, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long int, 4)
AC_CHECK_SIZEOF(long long int, 8)
AC_CHECK_SIZEOF(int *, 4)
dnl Check for sys/types.h types
AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
], [
u_int a; a = 1;
], [
ac_cv_have_u_int="yes"
], [
ac_cv_have_u_int="no"
]
)
]
)
if test "x$ac_cv_have_u_int" = "xyes" ; then
AC_DEFINE(HAVE_U_INT, 1, [type is defined: u_int])
have_u_int=1
fi
AC_CACHE_CHECK([for intmax_t type], ac_cv_have_intmax_t,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
], [
intmax_t a; a = 1;
], [
ac_cv_have_intmax_t="yes"
], [
AC_TRY_COMPILE(
[
#include <stdint.h>
], [
intmax_t a; a = 1;
], [
ac_cv_have_intmax_t="yes"
], [
ac_cv_have_intmax_t="no"
]
)
]
)
]
)
if test "x$ac_cv_have_intmax_t" = "xyes" ; then
AC_DEFINE(HAVE_INTMAX_T, 1, [type is defined: intmax_t])
have_intmax_t=1
fi
AC_CACHE_CHECK([for u_intmax_t type], ac_cv_have_u_intmax_t,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
], [
u_intmax_t a; a = 1;
], [
ac_cv_have_u_intmax_t="yes"
], [
AC_TRY_COMPILE(
[
#include <stdint.h>
], [
u_intmax_t a; a = 1;
], [
ac_cv_have_u_intmax_t="yes"
], [
ac_cv_have_u_intmax_t="no"
]
)
]
)
]
)
if test "x$ac_cv_have_u_intmax_t" = "xyes" ; then
AC_DEFINE(HAVE_U_INTMAX_T, 1, [type is defined: u_intmax_t])
have_u_intmax_t=1
fi
AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
], [
int8_t a; int16_t b; int32_t c; a = b = c = 1;
], [
ac_cv_have_intxx_t="yes"
], [
ac_cv_have_intxx_t="no"
]
)
]
)
if test "x$ac_cv_have_intxx_t" = "xyes" ; then
AC_DEFINE(HAVE_INTXX_T, 1, [type is defined: intXX_t])
have_intxx_t=1
fi
AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
], [
int64_t a; a = 1;
], [
ac_cv_have_int64_t="yes"
], [
ac_cv_have_int64_t="no"
]
)
]
)
if test "x$ac_cv_have_int64_t" = "xyes" ; then
AC_DEFINE(HAVE_INT64_T, 1, [type is defined: int64_t])
have_int64_t=1
fi
AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
], [
u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;
], [
ac_cv_have_u_intxx_t="yes"
], [
ac_cv_have_u_intxx_t="no"
]
)
]
)
if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
AC_DEFINE(HAVE_U_INTXX_T, 1, [types are defined: u_intXX_t])
have_u_intxx_t=1
fi
AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t,
[
AC_TRY_COMPILE(
[
#include <sys/types.h>
], [
u_int64_t a; a = 1;
], [
ac_cv_have_u_int64_t="yes"
], [
ac_cv_have_u_int64_t="no"
]
)
]
)
if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
AC_DEFINE(HAVE_U_INT64_T, 1, [type is defined: u_int64_t])
have_u_int64_t=1
fi
if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
test "x$ac_cv_header_sys_bitypes_h" = "xyes")
then
AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
AC_TRY_COMPILE(
[
#include <sys/bitypes.h>
], [
int8_t a; int16_t b; int32_t c;
u_int8_t e; u_int16_t f; u_int32_t g;
a = b = c = e = f = g = 1;
], [
AC_DEFINE(HAVE_U_INTXX_T)
AC_DEFINE(HAVE_INTXX_T)
AC_DEFINE(HAVE_SYS_BITYPES_H)
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
]
)
fi