-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
2763 lines (2479 loc) · 74.1 KB
/
configure.ac
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 We want to override the standard _AC_INIT_PARSE_ARGS
dnl
AU_ALIAS([_AC_INIT_PARSE_ARGS], [SH_INIT_PARSE_ARGS])
AU_ALIAS([_AC_INIT_help], [SH_INIT_HELP])
AC_INIT(src/samhain.c)
AC_ARG_VAR([LIBS], [libraries to link against, e.g. -lintl])
dnl
dnl start
dnl
AM_INIT_AUTOMAKE(samhain, 4.1.4)
AC_DEFINE([SAMHAIN], 1, [Application is samhain])
AC_CANONICAL_HOST
dnl
dnl checks for programs
dnl
AC_PROG_CC
if test "$host" != "$build"; then
AC_CHECK_PROGS(BUILD_CC, gcc cc)
else
BUILD_CC=$CC
fi
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_AWK
SH_PROG_LD
AC_PATH_PROG(cmd_hostname,hostname)
AC_SUBST(cmd_hostname)
AC_SUBST(BUILD_CC)
if test "x$GCC" = "xyes"; then
SH_GCC_VERSION
fi
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/ipc.h sys/sem.h sys/msg.h sys/uio.h fcntl.h])
AC_MSG_CHECKING([for OS specific issues])
mydebugflag=no
myneedg3=no
uid_cast="signed long"
selectconfig=linux
mynetbsd=no
sh_use_lcaps="undef"
dnmalloc_ok=yes
sh_use_pie=yes
enable_asm_ok=yes
case "$host_os" in
*linux*)
sh_use_lcaps="yes"
AC_DEFINE(HOST_IS_LINUX)
AC_DEFINE(HAVE_EXT2_IOCTLS)
AC_MSG_RESULT([use ioctl to get e2fs flags])
case "$host_cpu" in
i*86*)
AC_DEFINE(HOST_IS_I86LINUX)
;;
x86_64)
AC_DEFINE([HOST_IS_64LINUX], 1, [Define if host OS is 64bit Linux])
;;
*)
;;
esac
;;
*osf*)
AC_DEFINE([HOST_IS_OSF], 1, [Define if host OS is OSF])
if test "x$GCC" != "xyes"; then
CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
CFLAGS="$CFLAGS -O2 -assume noaligned_objects"
myneedg3=yes
AC_MSG_RESULT([compiler needs assume noaligned_objects])
else
AC_MSG_RESULT([none])
fi
;;
*cygwin*)
AC_DEFINE(HOST_IS_CYGWIN)
AC_DEFINE([USE_REGISTRY_CHECK], 1, [Define for registry check])
dnmalloc_ok=no
enable_asm_ok=no
AC_MSG_RESULT([no trusted paths, no dnmalloc. no asm optimize])
;;
*darwin*|*apple*)
AC_DEFINE(HOST_IS_DARWIN)
dnmalloc_ok=no
AC_MSG_RESULT([check resource forks, no dnmalloc])
;;
*freebsd8*|*freebsd9*)
AC_DEFINE(HOST_IS_FREEBSD)
selectconfig=freebsd
case "$host_cpu" in
amd64|x86_64)
dnmalloc_ok=no
AC_MSG_RESULT([no dnmalloc])
;;
*)
AC_MSG_RESULT([none])
;;
esac
;;
*freebsd7*)
AC_DEFINE(HOST_IS_FREEBSD)
selectconfig=freebsd
case "$host_cpu" in
amd64|x86_64)
sh_use_pie=no
dnmalloc_ok=no
AC_MSG_RESULT([no dnmalloc and broken compiler toolchain])
;;
*)
AC_MSG_RESULT([none])
;;
esac
;;
*freebsd*)
AC_DEFINE(HOST_IS_FREEBSD)
selectconfig=freebsd
AC_MSG_RESULT([none])
;;
*openbsd*)
AC_DEFINE([HOST_IS_OPENBSD], 1, [Define if host OS is OPENBSD])
selectconfig=freebsd
dnmalloc_ok=no
AC_MSG_RESULT([dnmalloc does not work with pthreads])
;;
*netbsd*)
mynetbsd=yes
selectconfig=netbsd
AC_MSG_RESULT([bug with libresolve])
;;
*solaris*)
selectconfig=solaris
AC_DEFINE(HOST_IS_SOLARIS)
case "$host_cpu" in
i*86)
AC_DEFINE(HOST_IS_I86SOLARIS)
AC_MSG_RESULT([vsnprintf prototype])
;;
*)
AC_MSG_RESULT([none])
;;
esac
if test "x$GCC" != "xyes"; then
if test ! -z "`echo "$CFLAGS" | grep "\-g" 2> /dev/null`" ; then
CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
fi
if test -z "`echo "$CFLAGS" | grep "\-xO2" 2> /dev/null`"; then
CFLAGS="$CFLAGS -xO2"
fi
if test -z "`echo "$CFLAGS" | grep "\-Xa" 2> /dev/null`"; then
CFLAGS="$CFLAGS -Xa"
fi
LIBS="-lc $LIBS"
fi
;;
*sun*)
selectconfig=solaris
AC_DEFINE(HOST_IS_SOLARIS)
AC_MSG_RESULT([none])
;;
*aix*)
AC_DEFINE(HOST_IS_AIX)
selectconfig=aix5.2.0
uid_cast="unsigned long"
if test "x$GCC" != "xyes"; then
if test ! -z "`echo "$CFLAGS" | grep "\-g" 2> /dev/null`" ; then
CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
fi
if test -z "`echo "$CFLAGS" | grep "\-O3" 2> /dev/null`"; then
CFLAGS="$CFLAGS -O3"
fi
if test -z "`echo "$CFLAGS" | grep "\-qstrict" 2> /dev/null`"; then
CFLAGS="$CFLAGS -qstrict"
fi
AC_MSG_RESULT([AIX size_t in the accept call and optimize O3 qstrict])
else
AC_MSG_RESULT([AIX size_t in the accept call])
fi
;;
*hpux*)
AC_MSG_RESULT([HPUX need _XOPEN_SOURCE_EXTENDED for h_errno])
AC_DEFINE(HOST_IS_HPUX)
if test "x$GCC" != "xyes"; then
if test ! -z "`echo "$CFLAGS" | grep "\-g" 2> /dev/null`" ; then
CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
fi
if test -z "`echo "$CFLAGS" | grep "\+O2" 2> /dev/null`"; then
CFLAGS="$CFLAGS +O2"
fi
fi
;;
*ultrix*)
AC_MSG_RESULT([ULTRIX getcwd uses popen])
AC_DEFINE(HAVE_BROKEN_GETCWD)
;;
*)
AC_MSG_RESULT([none])
;;
esac
AC_SUBST(selectconfig)
AC_DEFINE_UNQUOTED(UID_CAST, ${uid_cast})
dnl *****************************************
dnl
dnl checks for header files
dnl
dnl *****************************************
AC_HEADER_DIRENT
AC_HEADER_MAJOR
AC_HEADER_TIME
dnl used in minilzo.c
AC_HEADER_STAT
AC_DECL_SYS_SIGLIST
AC_CHECK_HEADERS(stddef.h libgen.h sched.h malloc.h sys/uio.h \
sys/mman.h sys/param.h sys/inotify.h \
sys/vfs.h mntent.h \
sys/select.h sys/socket.h netinet/in.h \
regex.h glob.h fnmatch.h \
linux/ext2_fs.h linux/fs.h ext2fs/ext2_fs.h asm/segment.h \
elf.h linux/elf.h auparse.h \
paths.h arpa/nameser.h arpa/nameser_compat.h \
rpc/rpcent.h rpc/rpc.h sys/statvfs.h,
[],
[],
[#include <sys/types.h>]
)
AC_CHECK_HEADER(utmpx.h, sh_utmpx="yes", sh_utmpx="no")
if test "x$sh_utmpx" = "xyes"; then
AC_DEFINE(HAVE_UTMPX_H)
AC_EGREP_HEADER(ut_host, utmpx.h, AC_DEFINE(HAVE_UTHOST) )
AC_EGREP_HEADER(ut_addr, utmpx.h, AC_DEFINE(HAVE_UTADDR) )
AC_EGREP_HEADER(ut_addr_v6, utmpx.h, AC_DEFINE(HAVE_UTADDR_V6) )
AC_EGREP_HEADER(ut_xtime,utmpx.h, AC_DEFINE(HAVE_UTXTIME) )
AC_EGREP_HEADER(ut_type, utmpx.h, AC_DEFINE(HAVE_UTTYPE) )
else
AC_EGREP_HEADER(ut_addr, utmp.h, AC_DEFINE(HAVE_UTADDR) )
AC_EGREP_HEADER(ut_host, utmp.h, AC_DEFINE(HAVE_UTHOST) )
AC_EGREP_HEADER(ut_type, utmp.h, AC_DEFINE(HAVE_UTTYPE) )
fi
dnl
dnl figure out where acct.h lives
dnl and whether fields are int/comp_t
dnl
dnl GNU Accounting Utilities
dnl Copyright (C) 1993, 1996, 1997, 2003, 2005 Free Software Foundation, Inc.
dnl The GNU Accounting Utilities are free software; you can redistribute
dnl them and/or modify them under the terms of the GNU General Public
dnl License as published by the Free Software Foundation; either version
dnl 2, or (at your option) any later version.
dnl
AC_CHECK_HEADER(sys/acct.h,
AC_DEFINE(HAVE_SYS_ACCT_H, ,
[Define if you have the <sys/acct.h> header file.])
AC_HEADER_EGREP(ac_utime, sys/acct.h,
AC_DEFINE(HAVE_ACUTIME, ,
[Define if <sys/acct.h> has the AC_UTIME field.])
AC_HEADER_EGREP(comp_t.*ac_utime, sys/acct.h,
AC_DEFINE(ACUTIME_COMPT, ,
[Define if <sys/acct.h>'s AC_UTIME field is a COMP_T.]))
)
AC_HEADER_EGREP(ac_stime, sys/acct.h,
AC_DEFINE(HAVE_ACSTIME, ,
[Define if <sys/acct.h> has the AC_STIME field.])
AC_HEADER_EGREP(comp_t.*ac_stime, sys/acct.h,
AC_DEFINE(ACSTIME_COMPT, ,
[Define if <sys/acct.h>'s AC_STIME field is a COMP_T.]))
)
AC_HEADER_EGREP(ac_etime, sys/acct.h,
AC_DEFINE(HAVE_ACETIME, ,
[Define if <sys/acct.h> has the AC_ETIME field.])
AC_HEADER_EGREP(comp_t.*ac_etime, sys/acct.h,
AC_DEFINE(ACETIME_COMPT, ,
[Define if <sys/acct.h>'s AC_ETIME field is a COMP_T.]))
)
AC_HEADER_EGREP(ac_io, sys/acct.h,
AC_DEFINE(HAVE_ACIO, ,
[Define if <sys/acct.h> has the AC_IO field.])
AC_HEADER_EGREP(comp_t.*ac_io, sys/acct.h,
AC_DEFINE(ACIO_COMPT, ,
[Define if <sys/acct.h>'s AC_IO field is a COMP_T.]))
)
AC_HEADER_EGREP(ac_mem, sys/acct.h,
AC_DEFINE(HAVE_ACMEM, ,
[Define if <sys/acct.h> has the AC_MEM field.])
AC_HEADER_EGREP(comp_t.*ac_mem, sys/acct.h,
AC_DEFINE(ACMEM_COMPT, ,
[Define if <sys/acct.h>'s AC_MEM field is a COMP_T.]))
)
AC_HEADER_EGREP(ac_minflt, sys/acct.h,
AC_HEADER_EGREP(ac_majflt, sys/acct.h,
AC_HEADER_EGREP(ac_swaps, sys/acct.h,
AC_DEFINE(HAVE_PAGING, ,
[Define if <sys/acct.h> has the AC_MINFLT, AC_MAJFLT and AC_SWAPS fields.])
AC_HEADER_EGREP(comp_t.*ac_minflt, sys/acct.h,
AC_DEFINE(ACMINFLT_COMPT, ,
[Define if <sys/acct.h>'s AC_MINFLT field is a COMP_T.]))
AC_HEADER_EGREP(comp_t.*ac_mayflt, sys/acct.h,
AC_DEFINE(ACMAJFLT_COMPT, ,
[Define if <sys/acct.h>'s AC_MAJFLT field is a COMP_T.]))
AC_HEADER_EGREP(comp_t.*ac_swaps, sys/acct.h,
AC_DEFINE(ACSWAPS_COMPT, ,
[Define if <sys/acct.h>'s AC_SWAPS field is a COMP_T.]))
)
)
)
AC_HEADER_EGREP(comp_t, sys/acct.h, AC_DEFINE(HAVE_COMP_T, ,
[Define if <sys/acct.h> uses the COMP_T type.]))
AC_HEADER_EGREP([struct acct_v3], sys/acct.h, AC_DEFINE(HAVE_ACCT_V3, ,
[Define if <sys/acct.h> has struct acct_v3.]))
AC_HEADER_EGREP([struct acctv2], sys/acct.h, AC_DEFINE(HAVE_ACCTV2, ,
[Define if <sys/acct.h> has struct acctv2.]))
)
dnl need to check because AIX 4.2 does not have it
dnl
AC_CHECK_MEMBERS([struct statfs.f_flags],[],[],[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
])
AC_SYS_LARGEFILE
dnl
dnl check whether _POSIX_SOURCE is required
dnl
SAMHAIN_POSIX
dnl *****************************************
dnl
dnl Checks for library functions.
dnl
dnl *****************************************
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(memcmp memcpy memmove memset getpwent endpwent fpurge \
gettimeofday strlcat strlcpy strstr strchr strerror strsignal \
seteuid setreuid setresuid lstat getwd getcwd ptrace \
usleep setpriority getpeereid nanosleep \
strptime basename sched_yield hasmntopt \
inet_aton gethostbyname setutent setrlimit gethostname uname \
initgroups getpagesize \
ttyname fchmod writev mmap tzset \
getsid getpriority getpgid statvfs \
strerror_r getgrgid_r getpwnam_r getpwuid_r \
gmtime_r localtime_r rand_r readdir_r strtok_r \
mincore posix_fadvise inotify_init1
)
AC_CHECK_FUNC(statfs, AC_DEFINE(HAVE_STATFS) statfs="yes", statfs="no")
SL_CHECK_VA_COPY
AC_CHECK_FUNCS(vsnprintf, [SL_CHECK_VSNPRINTF])
AC_CHECK_MLOCK
SH_STRFTIME_Z
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) fstype=SVR4)
if test $fstype = no; then
AC_TRY_CPP([#include <sys/statfs.h>
#include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
fi
if test $fstype = no; then
AC_TRY_CPP([#include <sys/statfs.h>
#include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
fi
if test $fstype = no; then
AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
fi
if test $fstype = no; then
AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF)
fi
if test $fstype = no; then
AC_TRY_CPP([#include <sys/mount.h>
#include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
fi
AC_MSG_RESULT($fstype)
sh_libsocket=
dnl Solaris needs -lsocket and -lnsl. Unisys system includes
dnl gethostbyname in libsocket but needs libnsl for socket.
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(socket, socket, ac_need_libsocket=1, ac_try_nsl=1)
if test x$ac_need_libsocket = x1; then
LIBS="$LIBS -lsocket"
sh_libsocket="-lsocket"
fi
if test x$ac_try_nsl = x1; then
AC_CHECK_LIB(nsl, gethostbyname, ac_need_libnsl=1)
if test x$ac_need_libnsl = x1
then
LIBS="$LIBS -lnsl"
fi
fi
AC_SUBST(sh_libsocket)
AC_CHECK_LIB(socket, res_search, [
AC_CHECK_LIB(resolv, dn_skipname)
AC_CHECK_LIB(resolv, __dn_skipname)
if test x$ac_need_libsocket = x1; then
:
else
LIBS="$LIBS -lsocket"
fi
], [
AC_CHECK_LIB(resolv, res_search, [
LIBS="$LIBS -lresolv"
], [
AC_CHECK_LIB(resolv, dn_skipname)
AC_CHECK_LIB(resolv, __dn_skipname)
])
])
AC_CHECK_FUNCS( getnameinfo getaddrinfo )
sh_auparse=no
if test "x$ac_cv_header_auparse_h" = "xyes"
then
AC_CHECK_LIB(auparse, auparse_find_field, [
LIBS="$LIBS -lauparse"
sh_auparse=yes
AC_DEFINE(HAVE_AUPARSE_LIB, 1, [Define if you have the auparse lib])
])
fi
dnl arguments for accept
dnl check for Unix98 socklen_t (found on
dnl xemacs-patches mailing list, written
dnl by Martin Buchholz)
dnl
dnl On Darwin(MacOSX) socklen_t needs to be
dnl an int (see accept man page), on all other
dnl unix systems we need a size_t.
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
socklen_t x;
], [],[
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([ACCEPT_TYPE_ARG3],[socklen_t], [type of arg3 of accept])
AC_DEFINE([HAVE_SOCKLEN_T], 1, [Define if you have socklen_t])
],[
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
int accept (int, struct sockaddr *, size_t *);
],[],[
AC_MSG_RESULT(size_t)
AC_DEFINE_UNQUOTED([ACCEPT_TYPE_ARG3],[size_t], [type of arg3 of accept])
], [
AC_MSG_RESULT(int)
AC_DEFINE_UNQUOTED([ACCEPT_TYPE_ARG3],[int], [type of arg3 of accept])
]
)
])
dnl *****************************************
dnl checks for extended attribute or ACL
dnl support
dnl *****************************************
AC_ARG_ENABLE([selinux],
[AS_HELP_STRING([--enable-selinux], [support checking selinux attributes])],
[],
[enable_selinux=check])
if test "x$enable_selinux" != xno; then
sh_CHECK_XATTR
fi
AC_ARG_ENABLE([posix-acl],
[AS_HELP_STRING([--enable-posix-acl], [support checking posix acls])],
[],
[enable_posix_acl=check])
if test "x$enable_posix_acl" != xno; then
sh_CHECK_POSIX_ACL
fi
dnl *****************************************
dnl checks for typedefs
dnl *****************************************
AC_C_LONG_DOUBLE
SH_CHECK_TYPEDEF(long long, HAVE_LONG_LONG)
SH_CHECK_TYPEDEF(uint16_t, HAVE_UINT16_T)
SH_CHECK_TYPEDEF(uint32_t, HAVE_UINT32_T)
SH_CHECK_TYPEDEF(uint64_t, HAVE_UINT64_T)
if test "$sh_HAVE_LONG_LONG" = "yes"; then
AC_CHECK_SIZEOF(unsigned long long, 4)
sh_sizeof_unsigned_long_long=`echo "$ac_cv_sizeof_unsigned_long_long" | sed 's%[^0-9]%%g'`
if test "$sh_sizeof_unsigned_long_long" = "8"; then
AC_DEFINE(HAVE_LONG_LONG_64, 1, [Define if you have 64bit long long])
fi
fi
AC_CHECK_TYPE(ptrdiff_t, long)
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(char *, 4)
AC_CHECK_SIZEOF(size_t, 4)
AC_CHECK_SIZEOF(unsigned long, 4)
AC_CHECK_SIZEOF(unsigned int, 4)
AC_CHECK_SIZEOF(unsigned short, 2)
sh_sizeof_unsigned_long=`echo "$ac_cv_sizeof_unsigned_long" | sed 's%[^0-9]%%g'`
if test "$sh_sizeof_unsigned_long" = "4"; then
AC_DEFINE(HAVE_LONG_32)
fi
if test "$sh_sizeof_unsigned_long" = "8"; then
AC_DEFINE(HAVE_LONG_64)
fi
sh_sizeof_unsigned_int=`echo "$ac_cv_sizeof_unsigned_int" | sed 's%[^0-9]%%g'`
if test "$sh_sizeof_unsigned_int" = "4"; then
AC_DEFINE(HAVE_INT_32)
fi
sh_sizeof_unsigned_short=`echo "$ac_cv_sizeof_unsigned_short" | sed 's%[^0-9]%%g'`
if test "$sh_sizeof_unsigned_short" = "4"; then
AC_DEFINE(HAVE_SHORT_32)
fi
dnl
dnl check for 64 bit programming environment
dnl
SAMHAIN_64
dnl *****************************************
dnl checks for structures
dnl *****************************************
AC_STRUCT_TM
dnl
dnl from e2fsprogs
dnl
AC_MSG_CHECKING(whether struct stat has a st_flags field)
AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
AC_TRY_COMPILE([#include <sys/stat.h>],
[struct stat stat; stat.st_flags = 0;],
[e2fsprogs_cv_struct_st_flags=yes],
[e2fsprogs_cv_struct_st_flags=no]))
AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
if test "$e2fsprogs_cv_struct_st_flags" = yes; then
AC_MSG_CHECKING(whether st_flags field is useful)
AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
AC_TRY_COMPILE([#include <sys/stat.h>],
[struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
[e2fsprogs_cv_struct_st_flags_immut=yes],
[e2fsprogs_cv_struct_st_flags_immut=no]))
AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
AC_DEFINE(HAVE_STAT_FLAGS)
fi
fi
dnl
dnl from dbus
dnl
AC_MSG_CHECKING(for struct cmsgcred)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
],[
struct cmsgcred cred;
cred.cmcred_pid = 0;
],sh_have_struct_cmsgcred=yes,sh_have_struct_cmsgcred=no)
AC_MSG_RESULT($sh_have_struct_cmsgcred)
if test x$sh_have_struct_cmsgcred = xyes; then
AC_DEFINE(HAVE_STRUCT_CMSGCRED,1,[Have cmsgcred structure])
fi
AC_MSG_CHECKING(for struct fcred)
AC_TRY_COMPILE([
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/ucred.h>
],[
struct fcred sockcred;
],sh_have_struct_fcred=yes,sh_have_struct_fcred=no)
AC_MSG_RESULT($sh_have_struct_fcred)
if test x$sh_have_struct_fcred = xyes; then
AC_DEFINE(HAVE_STRUCT_FCRED,1,[Have fcred structure])
fi
AC_MSG_CHECKING(for struct sockcred)
AC_TRY_COMPILE([
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/ucred.h>
],[
struct sockcred sockcred;
],sh_have_struct_sockcred=yes,sh_have_struct_sockcred=no)
AC_MSG_RESULT($sh_have_struct_sockcred)
if test x$sh_have_struct_sockcred = xyes; then
AC_DEFINE(HAVE_STRUCT_SOCKCRED,1,[Have sockcred structure])
fi
AC_MSG_CHECKING(for SO_PEERCRED)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
],[
int test = SO_PEERCRED;
],sh_have_SO_PEERCRED=yes,sh_have_SO_PEERCRED=no)
AC_MSG_RESULT($sh_have_SO_PEERCRED)
if test x$sh_have_SO_PEERCRED = xyes; then
AC_DEFINE(HAVE_SO_PEERCRED,1,[Have SO_PEERCRED define])
fi
dnl *****************************************
dnl checks for compiler characteristics
dnl *****************************************
AC_C_INLINE
AC_C_CONST
AC_C_BIGENDIAN
AC_C_RESTRICT
AM_SA_SIGACTION_WORKS
AC_ARG_ENABLE(ssp,
[ --disable-ssp disable the GCC stack protector],
[],
[enable_ssp=yes;]
)
if test "x$GCC" = "xyes"; then
if test x"${enable_ssp}" = xno; then
:
else
GCC_STACK_PROTECT_LIB
GCC_STACK_PROTECT_CC
dnl GCC_STACK_CHECK_CC
GCC_PIE_CC
fi
fi
dnl *****************************************
dnl
dnl checks for system services
dnl
dnl *****************************************
dnl
dnl check for /proc filesystem
dnl
if test -d "/proc/$$"
then
AC_DEFINE([HAVE_PROCFS],[1],[Define if you have a proc fs])
fi
dnl
dnl check for GNU gmp
dnl
AC_CHECK_LIB(gmp, __gmpz_init, [sh_have_gmp=yes], [sh_have_gmp=no])
if test "x${sh_have_gmp}" = xno
then
AC_CHECK_LIB(gmp, mpz_init, [sh_have_gmp=yes], [sh_have_gmp=no])
fi
if test "x${sh_have_gmp}" = xyes
then
# LIBS="-lgmp $LIBS"
AC_DEFINE(HAVE_LIBGMP, 1, [Have GNU gmp library])
fi
AC_CHECK_HEADERS(gmp.h)
AC_MSG_CHECKING([for ps])
PS=
for ff in /usr/ucb /bin /usr/bin; do
if test -x "$ff/ps"; then
PS="$ff/ps"
AC_MSG_RESULT([$PS])
break
fi
done
if test x$PS = x
then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Cannot find ps in any of /usr/ucb /bin /usr/bin])
fi
AC_DEFINE_UNQUOTED([PSPATH], _("$PS"), [Path to ps])
AC_MSG_CHECKING([how to use ps])
$PS ax >/dev/null 2>&1
if test $? -eq 0; then
case "$host_os" in
*openbsd*)
one=`$PS akx | wc -l`
;;
*)
one=`$PS ax | wc -l`
;;
esac
else
one=0
fi
$PS -e >/dev/null 2>&1
if test $? -eq 0; then
two=`$PS -e | wc -l`
else
two=0
fi
if test $one -ge $two
then
case "$host_os" in
*openbsd*)
PSARG="akx"
;;
*)
PSARG="ax"
;;
esac
else
PSARG="-e"
fi
AC_DEFINE_UNQUOTED([PSARG], _("$PSARG"), [Argument for ps])
AC_MSG_RESULT([$PS $PSARG])
dnl *****************************************
dnl
dnl enable features
dnl
dnl *****************************************
AC_ARG_ENABLE(db-reload,
[ --enable-db-reload enable database reload on SIGHUP [[no]]],
[
if test "x${enable_db_reload}" = xyes; then
AC_DEFINE(RELOAD_DATABASE)
fi
]
)
AC_ARG_ENABLE(xml-log,
[ --enable-xml-log enable XML logfile format [[no]]],
[
if test "x${enable_xml_log}" = xyes; then
AC_DEFINE(SH_USE_XML)
fi
]
)
AC_ARG_ENABLE(mail,
[ --disable-mail disable the internal SMTP mailer],
[
if test "x${enable_mail}" = xno; then
:
else
AC_DEFINE(SH_WITH_MAIL)
fi
],
[AC_DEFINE(SH_WITH_MAIL)]
)
AC_ARG_ENABLE(suid,
[ --enable-suid allow suid],
[
if test "x${enable_suid}" = xyes; then
AC_DEFINE(SH_ALLOW_SUID, [1], [Define if you want to allow suid execution for samhain])
fi
]
)
AC_ARG_ENABLE(shellexpand,
[ --disable-shellexpand disable shell expansion in config file],
[
if test "x${enable_shellexpand}" = xno; then
:
else
AC_DEFINE(SH_EVAL_SHELL, [1], [Define if you want shell expansion in configuration file])
fi
],
[AC_DEFINE(SH_EVAL_SHELL, [1], [Define if you want shell expansion in configuration file])]
)
AC_ARG_ENABLE(external-scripts,
[ --disable-external-scripts disable interface to external scripts],
[
if test "x${enableval}" = xno; then
:
else
AC_DEFINE(WITH_EXTERNAL)
fi
],
[AC_DEFINE(WITH_EXTERNAL)]
)
AC_ARG_ENABLE(message-queue,
[ --enable-message-queue[[=MODE]] enable SysV message queue [[MODE=0700]]],
[
if test "x${ac_cv_header_sys_msg_h}" = "xyes"; then
if test "x${enable_message_queue}" = xyes; then
AC_DEFINE(WITH_MESSAGE_QUEUE)
AC_DEFINE_UNQUOTED(MESSAGE_QUEUE_MODE, 0700)
elif test "x${enable_message_queue}" != xno; then
echo "${enableval}" | grep ['[^0123456789]'] >/dev/null 2>&1 &&
AC_MSG_ERROR([With --enable-message-queue=MODE, MODE must be numeric])
echo "${enableval}" | \
grep ['0[0123456789][0123456789][0123456789]'] >/dev/null 2>&1 ||
AC_MSG_ERROR([With --enable-message-queue=MODE, MODE must be an octal (0nnn) number])
AC_DEFINE(WITH_MESSAGE_QUEUE)
AC_DEFINE_UNQUOTED(MESSAGE_QUEUE_MODE, ${enable_message_queue})
fi
else
echo
echo "**********************************************"
echo
AC_MSG_WARN([sys/msg.h missing, --enable-message-queue disabled])
echo
echo "**********************************************"
echo
fi
]
)
AC_ARG_WITH(cflags,
[ --with-cflags additional flags to pass to compiler],
[
if test "x$withval" != "xno" ; then
CFLAGS="$CFLAGS $withval"
fi
]
)
AC_ARG_WITH(libs,
[ --with-libs additional libraries to link with],
[
if test "x$withval" != "xno" ; then
LIBS="$LIBS $withval"
fi
]
)
#
# this is from ssh
#
AC_MSG_CHECKING(whether to use libwrap)
LIBWRAP_LIB=""
LIBWRAP_INC=""
AC_ARG_WITH(libwrap,
[ --with-libwrap[=PATH] Compile in libwrap (TCP Wrappers) support],
[ AC_MSG_RESULT($withval)
case "$withval" in
no)
;;
""|yes)
LIBWRAP_LIB="-lwrap"
;;
*)
if test -d "$withval"; then
LIBWRAP_LIB="-L$withval -lwrap"
changequote(<<, >>)dnl
sh_libwrap_inc=`echo ${withval} | sed 's%/[^/][^/]*$%%'`
LIBWRAP_INC="-I${sh_libwrap_inc}/include"
changequote([, ])dnl
else
LIBWRAP_LIB="-lwrap"
changequote(<<, >>)dnl
sh_libwrap_inc=`echo ${withval} | sed 's%/[^/][^/]*$%%'`
LIBWRAP_INC="-I${sh_libwrap_inc}"
changequote([, ])dnl
fi
;;
esac
if test -n "$LIBWRAP_LIB"; then
# OLDLIBS="$LIBS"
LIBS="$LIBWRAP_LIB $LIBS"
# OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $LIBWRAP_INC"
AC_CHECK_HEADER(tcpd.h,
[],
[ AC_MSG_ERROR([Could not find tcpd.h for libwrap. You need to install tcp_wrappers.]) ])
AC_TRY_LINK([ #include <tcpd.h>
int allow_severity; int deny_severity; ],
[ hosts_access((struct request_info *) 0); ],
[ AC_DEFINE(SH_USE_LIBWRAP,1,[Build with tcp wrapper support]) ],
[ AC_MSG_ERROR([Could not find the libwrap library.]) ])
fi ],
AC_MSG_RESULT(no)
)
dnl
dnl NETWORK OPTIONS
dnl
AC_ARG_ENABLE(network,
[ --enable-network=[[client|server]] compile client or server [[no]]],
[
if test "x$enable_network" = xclient; then
mytclient="-DSH_WITH_CLIENT"
yulectl_prg=
samhainadmin_prg=
setpwd_prg="samhain_setpwd"
sh_main_prg="samhain"
if test "x${sh_have_gmp}" = xyes
then
LIBS="-lgmp $LIBS"
fi
dnl AC_CHECK_HEADER(sys/capability.h,
dnl [AC_CHECK_LIB(cap, cap_get_proc,,sh_use_lcaps="no")],
dnl [sh_use_lcaps="no"])
elif test "x$enable_network" = xserver; then
mytclient="-DSH_WITH_SERVER"
yulectl_prg="yulectl"
samhainadmin_prg="scripts/samhainadmin.pl"
setpwd_prg="samhain_setpwd"
sh_main_prg="yule"
if test "x${sh_have_gmp}" = xyes
then
LIBS="-lgmp $LIBS"
fi
sh_use_lcaps="undef"
elif test "x$enable_network" = xno; then
mytclient="-DSH_STANDALONE"
yulectl_prg=
samhainadmin_prg=
setpwd_prg=
sh_main_prg="samhain"
dnl AC_CHECK_HEADER(sys/capability.h,
dnl [AC_CHECK_LIB(cap, cap_get_proc,,sh_use_lcaps="no")],
dnl [sh_use_lcaps="no"])
else
AC_MSG_ERROR([With --enable-network=WHAT, WHAT must be client, server, or no])
fi
],
[
mytclient="-DSH_STANDALONE"
setpwd_prg=
yulectl_prg=
samhainadmin_prg=
sh_main_prg="samhain"
dnl AC_CHECK_HEADER(sys/capability.h,
dnl [AC_CHECK_LIB(cap, cap_get_proc,,sh_use_lcaps="no")],