source: trunk/configure.ac@ 507

Last change on this file since 507 was 507, checked in by katerina, 8 years ago

Release 4.1.4

File size: 74.1 KB
Line 
1dnl We want to override the standard _AC_INIT_PARSE_ARGS
2dnl
3AU_ALIAS([_AC_INIT_PARSE_ARGS], [SH_INIT_PARSE_ARGS])
4AU_ALIAS([_AC_INIT_help], [SH_INIT_HELP])
5
6AC_INIT(src/samhain.c)
7
8
9AC_ARG_VAR([LIBS], [libraries to link against, e.g. -lintl])
10
11dnl
12dnl start
13dnl
14AM_INIT_AUTOMAKE(samhain, 4.1.4)
15AC_DEFINE([SAMHAIN], 1, [Application is samhain])
16AC_CANONICAL_HOST
17
18dnl
19dnl checks for programs
20dnl
21
22AC_PROG_CC
23if test "$host" != "$build"; then
24 AC_CHECK_PROGS(BUILD_CC, gcc cc)
25else
26 BUILD_CC=$CC
27fi
28AC_PROG_CPP
29AC_PROG_INSTALL
30AC_PROG_LN_S
31AC_PROG_AWK
32SH_PROG_LD
33AC_PATH_PROG(cmd_hostname,hostname)
34AC_SUBST(cmd_hostname)
35AC_SUBST(BUILD_CC)
36
37if test "x$GCC" = "xyes"; then
38 SH_GCC_VERSION
39fi
40
41AC_HEADER_STDC
42
43AC_CHECK_HEADERS([sys/ipc.h sys/sem.h sys/msg.h sys/uio.h fcntl.h])
44
45
46AC_MSG_CHECKING([for OS specific issues])
47mydebugflag=no
48myneedg3=no
49uid_cast="signed long"
50selectconfig=linux
51mynetbsd=no
52sh_use_lcaps="undef"
53dnmalloc_ok=yes
54sh_use_pie=yes
55enable_asm_ok=yes
56
57case "$host_os" in
58
59 *linux*)
60 sh_use_lcaps="yes"
61 AC_DEFINE(HOST_IS_LINUX)
62 AC_DEFINE(HAVE_EXT2_IOCTLS)
63 AC_MSG_RESULT([use ioctl to get e2fs flags])
64 case "$host_cpu" in
65 i*86*)
66 AC_DEFINE(HOST_IS_I86LINUX)
67 ;;
68 x86_64)
69 AC_DEFINE([HOST_IS_64LINUX], 1, [Define if host OS is 64bit Linux])
70 ;;
71 *)
72 ;;
73 esac
74 ;;
75
76 *osf*)
77 AC_DEFINE([HOST_IS_OSF], 1, [Define if host OS is OSF])
78 if test "x$GCC" != "xyes"; then
79 CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
80 CFLAGS="$CFLAGS -O2 -assume noaligned_objects"
81 myneedg3=yes
82 AC_MSG_RESULT([compiler needs assume noaligned_objects])
83 else
84 AC_MSG_RESULT([none])
85 fi
86 ;;
87
88 *cygwin*)
89 AC_DEFINE(HOST_IS_CYGWIN)
90 AC_DEFINE([USE_REGISTRY_CHECK], 1, [Define for registry check])
91 dnmalloc_ok=no
92 enable_asm_ok=no
93 AC_MSG_RESULT([no trusted paths, no dnmalloc. no asm optimize])
94 ;;
95
96 *darwin*|*apple*)
97 AC_DEFINE(HOST_IS_DARWIN)
98 dnmalloc_ok=no
99 AC_MSG_RESULT([check resource forks, no dnmalloc])
100 ;;
101
102 *freebsd8*|*freebsd9*)
103 AC_DEFINE(HOST_IS_FREEBSD)
104 selectconfig=freebsd
105 case "$host_cpu" in
106 amd64|x86_64)
107 dnmalloc_ok=no
108 AC_MSG_RESULT([no dnmalloc])
109 ;;
110 *)
111 AC_MSG_RESULT([none])
112 ;;
113 esac
114 ;;
115
116 *freebsd7*)
117 AC_DEFINE(HOST_IS_FREEBSD)
118 selectconfig=freebsd
119 case "$host_cpu" in
120 amd64|x86_64)
121 sh_use_pie=no
122 dnmalloc_ok=no
123 AC_MSG_RESULT([no dnmalloc and broken compiler toolchain])
124 ;;
125 *)
126 AC_MSG_RESULT([none])
127 ;;
128 esac
129 ;;
130
131 *freebsd*)
132 AC_DEFINE(HOST_IS_FREEBSD)
133 selectconfig=freebsd
134 AC_MSG_RESULT([none])
135 ;;
136
137 *openbsd*)
138 AC_DEFINE([HOST_IS_OPENBSD], 1, [Define if host OS is OPENBSD])
139 selectconfig=freebsd
140 dnmalloc_ok=no
141 AC_MSG_RESULT([dnmalloc does not work with pthreads])
142 ;;
143
144 *netbsd*)
145 mynetbsd=yes
146 selectconfig=netbsd
147 AC_MSG_RESULT([bug with libresolve])
148 ;;
149
150 *solaris*)
151 selectconfig=solaris
152 AC_DEFINE(HOST_IS_SOLARIS)
153 case "$host_cpu" in
154 i*86)
155 AC_DEFINE(HOST_IS_I86SOLARIS)
156 AC_MSG_RESULT([vsnprintf prototype])
157 ;;
158 *)
159 AC_MSG_RESULT([none])
160 ;;
161 esac
162 if test "x$GCC" != "xyes"; then
163 if test ! -z "`echo "$CFLAGS" | grep "\-g" 2> /dev/null`" ; then
164 CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
165 fi
166 if test -z "`echo "$CFLAGS" | grep "\-xO2" 2> /dev/null`"; then
167 CFLAGS="$CFLAGS -xO2"
168 fi
169 if test -z "`echo "$CFLAGS" | grep "\-Xa" 2> /dev/null`"; then
170 CFLAGS="$CFLAGS -Xa"
171 fi
172 LIBS="-lc $LIBS"
173 fi
174 ;;
175
176
177 *sun*)
178 selectconfig=solaris
179 AC_DEFINE(HOST_IS_SOLARIS)
180 AC_MSG_RESULT([none])
181 ;;
182
183 *aix*)
184 AC_DEFINE(HOST_IS_AIX)
185 selectconfig=aix5.2.0
186 uid_cast="unsigned long"
187 if test "x$GCC" != "xyes"; then
188 if test ! -z "`echo "$CFLAGS" | grep "\-g" 2> /dev/null`" ; then
189 CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
190 fi
191 if test -z "`echo "$CFLAGS" | grep "\-O3" 2> /dev/null`"; then
192 CFLAGS="$CFLAGS -O3"
193 fi
194 if test -z "`echo "$CFLAGS" | grep "\-qstrict" 2> /dev/null`"; then
195 CFLAGS="$CFLAGS -qstrict"
196 fi
197 AC_MSG_RESULT([AIX size_t in the accept call and optimize O3 qstrict])
198 else
199 AC_MSG_RESULT([AIX size_t in the accept call])
200 fi
201 ;;
202
203 *hpux*)
204 AC_MSG_RESULT([HPUX need _XOPEN_SOURCE_EXTENDED for h_errno])
205 AC_DEFINE(HOST_IS_HPUX)
206 if test "x$GCC" != "xyes"; then
207 if test ! -z "`echo "$CFLAGS" | grep "\-g" 2> /dev/null`" ; then
208 CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
209 fi
210 if test -z "`echo "$CFLAGS" | grep "\+O2" 2> /dev/null`"; then
211 CFLAGS="$CFLAGS +O2"
212 fi
213 fi
214 ;;
215
216 *ultrix*)
217 AC_MSG_RESULT([ULTRIX getcwd uses popen])
218 AC_DEFINE(HAVE_BROKEN_GETCWD)
219 ;;
220
221 *)
222 AC_MSG_RESULT([none])
223 ;;
224esac
225
226AC_SUBST(selectconfig)
227AC_DEFINE_UNQUOTED(UID_CAST, ${uid_cast})
228
229
230
231dnl *****************************************
232dnl
233dnl checks for header files
234dnl
235dnl *****************************************
236
237AC_HEADER_DIRENT
238AC_HEADER_MAJOR
239AC_HEADER_TIME
240dnl used in minilzo.c
241AC_HEADER_STAT
242AC_DECL_SYS_SIGLIST
243
244AC_CHECK_HEADERS(stddef.h libgen.h sched.h malloc.h sys/uio.h \
245 sys/mman.h sys/param.h sys/inotify.h \
246 sys/vfs.h mntent.h \
247 sys/select.h sys/socket.h netinet/in.h \
248 regex.h glob.h fnmatch.h \
249 linux/ext2_fs.h linux/fs.h ext2fs/ext2_fs.h asm/segment.h \
250 elf.h linux/elf.h auparse.h \
251 paths.h arpa/nameser.h arpa/nameser_compat.h \
252 rpc/rpcent.h rpc/rpc.h sys/statvfs.h,
253 [],
254 [],
255 [#include <sys/types.h>]
256)
257
258
259AC_CHECK_HEADER(utmpx.h, sh_utmpx="yes", sh_utmpx="no")
260if test "x$sh_utmpx" = "xyes"; then
261 AC_DEFINE(HAVE_UTMPX_H)
262 AC_EGREP_HEADER(ut_host, utmpx.h, AC_DEFINE(HAVE_UTHOST) )
263 AC_EGREP_HEADER(ut_addr, utmpx.h, AC_DEFINE(HAVE_UTADDR) )
264 AC_EGREP_HEADER(ut_addr_v6, utmpx.h, AC_DEFINE(HAVE_UTADDR_V6) )
265 AC_EGREP_HEADER(ut_xtime,utmpx.h, AC_DEFINE(HAVE_UTXTIME) )
266 AC_EGREP_HEADER(ut_type, utmpx.h, AC_DEFINE(HAVE_UTTYPE) )
267else
268 AC_EGREP_HEADER(ut_addr, utmp.h, AC_DEFINE(HAVE_UTADDR) )
269 AC_EGREP_HEADER(ut_host, utmp.h, AC_DEFINE(HAVE_UTHOST) )
270 AC_EGREP_HEADER(ut_type, utmp.h, AC_DEFINE(HAVE_UTTYPE) )
271fi
272
273dnl
274dnl figure out where acct.h lives
275dnl and whether fields are int/comp_t
276dnl
277dnl GNU Accounting Utilities
278dnl Copyright (C) 1993, 1996, 1997, 2003, 2005 Free Software Foundation, Inc.
279dnl The GNU Accounting Utilities are free software; you can redistribute
280dnl them and/or modify them under the terms of the GNU General Public
281dnl License as published by the Free Software Foundation; either version
282dnl 2, or (at your option) any later version.
283dnl
284AC_CHECK_HEADER(sys/acct.h,
285 AC_DEFINE(HAVE_SYS_ACCT_H, ,
286 [Define if you have the <sys/acct.h> header file.])
287 AC_HEADER_EGREP(ac_utime, sys/acct.h,
288 AC_DEFINE(HAVE_ACUTIME, ,
289 [Define if <sys/acct.h> has the AC_UTIME field.])
290 AC_HEADER_EGREP(comp_t.*ac_utime, sys/acct.h,
291 AC_DEFINE(ACUTIME_COMPT, ,
292 [Define if <sys/acct.h>'s AC_UTIME field is a COMP_T.]))
293 )
294 AC_HEADER_EGREP(ac_stime, sys/acct.h,
295 AC_DEFINE(HAVE_ACSTIME, ,
296 [Define if <sys/acct.h> has the AC_STIME field.])
297 AC_HEADER_EGREP(comp_t.*ac_stime, sys/acct.h,
298 AC_DEFINE(ACSTIME_COMPT, ,
299 [Define if <sys/acct.h>'s AC_STIME field is a COMP_T.]))
300 )
301 AC_HEADER_EGREP(ac_etime, sys/acct.h,
302 AC_DEFINE(HAVE_ACETIME, ,
303 [Define if <sys/acct.h> has the AC_ETIME field.])
304 AC_HEADER_EGREP(comp_t.*ac_etime, sys/acct.h,
305 AC_DEFINE(ACETIME_COMPT, ,
306 [Define if <sys/acct.h>'s AC_ETIME field is a COMP_T.]))
307 )
308 AC_HEADER_EGREP(ac_io, sys/acct.h,
309 AC_DEFINE(HAVE_ACIO, ,
310 [Define if <sys/acct.h> has the AC_IO field.])
311 AC_HEADER_EGREP(comp_t.*ac_io, sys/acct.h,
312 AC_DEFINE(ACIO_COMPT, ,
313 [Define if <sys/acct.h>'s AC_IO field is a COMP_T.]))
314 )
315 AC_HEADER_EGREP(ac_mem, sys/acct.h,
316 AC_DEFINE(HAVE_ACMEM, ,
317 [Define if <sys/acct.h> has the AC_MEM field.])
318 AC_HEADER_EGREP(comp_t.*ac_mem, sys/acct.h,
319 AC_DEFINE(ACMEM_COMPT, ,
320 [Define if <sys/acct.h>'s AC_MEM field is a COMP_T.]))
321 )
322 AC_HEADER_EGREP(ac_minflt, sys/acct.h,
323 AC_HEADER_EGREP(ac_majflt, sys/acct.h,
324 AC_HEADER_EGREP(ac_swaps, sys/acct.h,
325 AC_DEFINE(HAVE_PAGING, ,
326 [Define if <sys/acct.h> has the AC_MINFLT, AC_MAJFLT and AC_SWAPS fields.])
327 AC_HEADER_EGREP(comp_t.*ac_minflt, sys/acct.h,
328 AC_DEFINE(ACMINFLT_COMPT, ,
329 [Define if <sys/acct.h>'s AC_MINFLT field is a COMP_T.]))
330 AC_HEADER_EGREP(comp_t.*ac_mayflt, sys/acct.h,
331 AC_DEFINE(ACMAJFLT_COMPT, ,
332 [Define if <sys/acct.h>'s AC_MAJFLT field is a COMP_T.]))
333 AC_HEADER_EGREP(comp_t.*ac_swaps, sys/acct.h,
334 AC_DEFINE(ACSWAPS_COMPT, ,
335 [Define if <sys/acct.h>'s AC_SWAPS field is a COMP_T.]))
336 )
337 )
338 )
339 AC_HEADER_EGREP(comp_t, sys/acct.h, AC_DEFINE(HAVE_COMP_T, ,
340 [Define if <sys/acct.h> uses the COMP_T type.]))
341 AC_HEADER_EGREP([struct acct_v3], sys/acct.h, AC_DEFINE(HAVE_ACCT_V3, ,
342 [Define if <sys/acct.h> has struct acct_v3.]))
343 AC_HEADER_EGREP([struct acctv2], sys/acct.h, AC_DEFINE(HAVE_ACCTV2, ,
344 [Define if <sys/acct.h> has struct acctv2.]))
345
346 )
347
348
349dnl need to check because AIX 4.2 does not have it
350dnl
351AC_CHECK_MEMBERS([struct statfs.f_flags],[],[],[
352#ifdef HAVE_SYS_TYPES_H
353#include <sys/types.h>
354#endif
355#ifdef HAVE_SYS_STAT_H
356#include <sys/stat.h>
357#endif
358#ifdef HAVE_SYS_VFS_H
359#include <sys/vfs.h>
360#endif
361#ifdef HAVE_UNISTD_H
362#include <unistd.h>
363#endif
364])
365
366AC_SYS_LARGEFILE
367
368dnl
369dnl check whether _POSIX_SOURCE is required
370dnl
371SAMHAIN_POSIX
372
373
374dnl *****************************************
375dnl
376dnl Checks for library functions.
377dnl
378dnl *****************************************
379AC_FUNC_STRFTIME
380AC_CHECK_FUNCS(memcmp memcpy memmove memset getpwent endpwent fpurge \
381 gettimeofday strlcat strlcpy strstr strchr strerror strsignal \
382 seteuid setreuid setresuid lstat getwd getcwd ptrace \
383 usleep setpriority getpeereid nanosleep \
384 strptime basename sched_yield hasmntopt \
385 inet_aton gethostbyname setutent setrlimit gethostname uname \
386 initgroups getpagesize \
387 ttyname fchmod writev mmap tzset \
388 getsid getpriority getpgid statvfs \
389 strerror_r getgrgid_r getpwnam_r getpwuid_r \
390 gmtime_r localtime_r rand_r readdir_r strtok_r \
391 mincore posix_fadvise inotify_init1
392)
393AC_CHECK_FUNC(statfs, AC_DEFINE(HAVE_STATFS) statfs="yes", statfs="no")
394SL_CHECK_VA_COPY
395AC_CHECK_FUNCS(vsnprintf, [SL_CHECK_VSNPRINTF])
396AC_CHECK_MLOCK
397SH_STRFTIME_Z
398
399AC_MSG_CHECKING(how to get filesystem type)
400fstype=no
401# The order of these tests is important.
402AC_TRY_CPP([#include <sys/statvfs.h>
403#include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
404if test $fstype = no; then
405AC_TRY_CPP([#include <sys/statfs.h>
406#include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
407fi
408if test $fstype = no; then
409AC_TRY_CPP([#include <sys/statfs.h>
410#include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
411fi
412if test $fstype = no; then
413AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT) fstype=4.3BSD)
414fi
415if test $fstype = no; then
416AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS) fstype=4.4BSD/OSF)
417fi
418if test $fstype = no; then
419AC_TRY_CPP([#include <sys/mount.h>
420#include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT) fstype=Ultrix)
421fi
422AC_MSG_RESULT($fstype)
423
424sh_libsocket=
425
426dnl Solaris needs -lsocket and -lnsl. Unisys system includes
427dnl gethostbyname in libsocket but needs libnsl for socket.
428AC_CHECK_LIB(nsl, gethostbyname)
429AC_CHECK_LIB(socket, socket, ac_need_libsocket=1, ac_try_nsl=1)
430if test x$ac_need_libsocket = x1; then
431 LIBS="$LIBS -lsocket"
432 sh_libsocket="-lsocket"
433fi
434if test x$ac_try_nsl = x1; then
435 AC_CHECK_LIB(nsl, gethostbyname, ac_need_libnsl=1)
436 if test x$ac_need_libnsl = x1
437 then
438 LIBS="$LIBS -lnsl"
439 fi
440fi
441AC_SUBST(sh_libsocket)
442
443AC_CHECK_LIB(socket, res_search, [
444 AC_CHECK_LIB(resolv, dn_skipname)
445 AC_CHECK_LIB(resolv, __dn_skipname)
446 if test x$ac_need_libsocket = x1; then
447 :
448 else
449 LIBS="$LIBS -lsocket"
450 fi
451 ], [
452 AC_CHECK_LIB(resolv, res_search, [
453 LIBS="$LIBS -lresolv"
454 ], [
455 AC_CHECK_LIB(resolv, dn_skipname)
456 AC_CHECK_LIB(resolv, __dn_skipname)
457 ])
458 ])
459
460AC_CHECK_FUNCS( getnameinfo getaddrinfo )
461
462
463sh_auparse=no
464
465if test "x$ac_cv_header_auparse_h" = "xyes"
466then
467 AC_CHECK_LIB(auparse, auparse_find_field, [
468 LIBS="$LIBS -lauparse"
469 sh_auparse=yes
470 AC_DEFINE(HAVE_AUPARSE_LIB, 1, [Define if you have the auparse lib])
471 ])
472fi
473
474dnl arguments for accept
475
476dnl check for Unix98 socklen_t (found on
477dnl xemacs-patches mailing list, written
478dnl by Martin Buchholz)
479dnl
480dnl On Darwin(MacOSX) socklen_t needs to be
481dnl an int (see accept man page), on all other
482dnl unix systems we need a size_t.
483
484AC_MSG_CHECKING(for socklen_t)
485AC_TRY_COMPILE([
486#ifdef HAVE_SYS_TYPES_H
487#include <sys/types.h>
488#endif
489#ifdef HAVE_SYS_SOCKET_H
490#include <sys/socket.h>
491#endif
492 socklen_t x;
493], [],[
494 AC_MSG_RESULT(yes)
495 AC_DEFINE_UNQUOTED([ACCEPT_TYPE_ARG3],[socklen_t], [type of arg3 of accept])
496 AC_DEFINE([HAVE_SOCKLEN_T], 1, [Define if you have socklen_t])
497],[
498 AC_TRY_COMPILE([
499#ifdef HAVE_SYS_TYPES_H
500#include <sys/types.h>
501#endif
502#ifdef HAVE_SYS_SOCKET_H
503#include <sys/socket.h>
504#endif
505 int accept (int, struct sockaddr *, size_t *);
506 ],[],[
507 AC_MSG_RESULT(size_t)
508 AC_DEFINE_UNQUOTED([ACCEPT_TYPE_ARG3],[size_t], [type of arg3 of accept])
509 ], [
510 AC_MSG_RESULT(int)
511 AC_DEFINE_UNQUOTED([ACCEPT_TYPE_ARG3],[int], [type of arg3 of accept])
512 ]
513 )
514])
515
516dnl *****************************************
517dnl checks for extended attribute or ACL
518dnl support
519dnl *****************************************
520
521AC_ARG_ENABLE([selinux],
522 [AS_HELP_STRING([--enable-selinux], [support checking selinux attributes])],
523 [],
524 [enable_selinux=check])
525if test "x$enable_selinux" != xno; then
526 sh_CHECK_XATTR
527fi
528
529AC_ARG_ENABLE([posix-acl],
530 [AS_HELP_STRING([--enable-posix-acl], [support checking posix acls])],
531 [],
532 [enable_posix_acl=check])
533if test "x$enable_posix_acl" != xno; then
534 sh_CHECK_POSIX_ACL
535fi
536
537dnl *****************************************
538dnl checks for typedefs
539dnl *****************************************
540
541AC_C_LONG_DOUBLE
542SH_CHECK_TYPEDEF(long long, HAVE_LONG_LONG)
543SH_CHECK_TYPEDEF(uint16_t, HAVE_UINT16_T)
544SH_CHECK_TYPEDEF(uint32_t, HAVE_UINT32_T)
545SH_CHECK_TYPEDEF(uint64_t, HAVE_UINT64_T)
546if test "$sh_HAVE_LONG_LONG" = "yes"; then
547 AC_CHECK_SIZEOF(unsigned long long, 4)
548 sh_sizeof_unsigned_long_long=`echo "$ac_cv_sizeof_unsigned_long_long" | sed 's%[^0-9]%%g'`
549 if test "$sh_sizeof_unsigned_long_long" = "8"; then
550 AC_DEFINE(HAVE_LONG_LONG_64, 1, [Define if you have 64bit long long])
551 fi
552fi
553
554AC_CHECK_TYPE(ptrdiff_t, long)
555AC_TYPE_SIZE_T
556AC_CHECK_SIZEOF(char *, 4)
557AC_CHECK_SIZEOF(size_t, 4)
558
559AC_CHECK_SIZEOF(unsigned long, 4)
560AC_CHECK_SIZEOF(unsigned int, 4)
561AC_CHECK_SIZEOF(unsigned short, 2)
562
563
564sh_sizeof_unsigned_long=`echo "$ac_cv_sizeof_unsigned_long" | sed 's%[^0-9]%%g'`
565if test "$sh_sizeof_unsigned_long" = "4"; then
566 AC_DEFINE(HAVE_LONG_32)
567fi
568if test "$sh_sizeof_unsigned_long" = "8"; then
569 AC_DEFINE(HAVE_LONG_64)
570fi
571sh_sizeof_unsigned_int=`echo "$ac_cv_sizeof_unsigned_int" | sed 's%[^0-9]%%g'`
572if test "$sh_sizeof_unsigned_int" = "4"; then
573 AC_DEFINE(HAVE_INT_32)
574fi
575sh_sizeof_unsigned_short=`echo "$ac_cv_sizeof_unsigned_short" | sed 's%[^0-9]%%g'`
576if test "$sh_sizeof_unsigned_short" = "4"; then
577 AC_DEFINE(HAVE_SHORT_32)
578fi
579
580dnl
581dnl check for 64 bit programming environment
582dnl
583SAMHAIN_64
584
585
586dnl *****************************************
587dnl checks for structures
588dnl *****************************************
589
590AC_STRUCT_TM
591
592dnl
593dnl from e2fsprogs
594dnl
595AC_MSG_CHECKING(whether struct stat has a st_flags field)
596AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
597 AC_TRY_COMPILE([#include <sys/stat.h>],
598 [struct stat stat; stat.st_flags = 0;],
599 [e2fsprogs_cv_struct_st_flags=yes],
600 [e2fsprogs_cv_struct_st_flags=no]))
601AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
602if test "$e2fsprogs_cv_struct_st_flags" = yes; then
603 AC_MSG_CHECKING(whether st_flags field is useful)
604 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
605 AC_TRY_COMPILE([#include <sys/stat.h>],
606 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
607 [e2fsprogs_cv_struct_st_flags_immut=yes],
608 [e2fsprogs_cv_struct_st_flags_immut=no]))
609 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
610 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
611 AC_DEFINE(HAVE_STAT_FLAGS)
612 fi
613fi
614
615dnl
616dnl from dbus
617dnl
618AC_MSG_CHECKING(for struct cmsgcred)
619AC_TRY_COMPILE([
620#include <sys/types.h>
621#include <sys/socket.h>
622],[
623struct cmsgcred cred;
624
625cred.cmcred_pid = 0;
626],sh_have_struct_cmsgcred=yes,sh_have_struct_cmsgcred=no)
627AC_MSG_RESULT($sh_have_struct_cmsgcred)
628
629if test x$sh_have_struct_cmsgcred = xyes; then
630 AC_DEFINE(HAVE_STRUCT_CMSGCRED,1,[Have cmsgcred structure])
631fi
632
633AC_MSG_CHECKING(for struct fcred)
634AC_TRY_COMPILE([
635#include <sys/param.h>
636#include <sys/socket.h>
637#include <sys/ucred.h>
638],[
639struct fcred sockcred;
640],sh_have_struct_fcred=yes,sh_have_struct_fcred=no)
641AC_MSG_RESULT($sh_have_struct_fcred)
642
643if test x$sh_have_struct_fcred = xyes; then
644 AC_DEFINE(HAVE_STRUCT_FCRED,1,[Have fcred structure])
645fi
646
647AC_MSG_CHECKING(for struct sockcred)
648AC_TRY_COMPILE([
649#include <sys/param.h>
650#include <sys/socket.h>
651#include <sys/ucred.h>
652],[
653struct sockcred sockcred;
654],sh_have_struct_sockcred=yes,sh_have_struct_sockcred=no)
655AC_MSG_RESULT($sh_have_struct_sockcred)
656
657if test x$sh_have_struct_sockcred = xyes; then
658 AC_DEFINE(HAVE_STRUCT_SOCKCRED,1,[Have sockcred structure])
659fi
660
661AC_MSG_CHECKING(for SO_PEERCRED)
662AC_TRY_COMPILE([
663#include <sys/types.h>
664#include <sys/socket.h>
665],[
666int test = SO_PEERCRED;
667],sh_have_SO_PEERCRED=yes,sh_have_SO_PEERCRED=no)
668AC_MSG_RESULT($sh_have_SO_PEERCRED)
669
670if test x$sh_have_SO_PEERCRED = xyes; then
671 AC_DEFINE(HAVE_SO_PEERCRED,1,[Have SO_PEERCRED define])
672fi
673
674
675dnl *****************************************
676dnl checks for compiler characteristics
677dnl *****************************************
678AC_C_INLINE
679AC_C_CONST
680AC_C_BIGENDIAN
681AC_C_RESTRICT
682
683AM_SA_SIGACTION_WORKS
684
685AC_ARG_ENABLE(ssp,
686 [ --disable-ssp disable the GCC stack protector],
687 [],
688 [enable_ssp=yes;]
689)
690
691if test "x$GCC" = "xyes"; then
692
693 if test x"${enable_ssp}" = xno; then
694 :
695 else
696 GCC_STACK_PROTECT_LIB
697 GCC_STACK_PROTECT_CC
698dnl GCC_STACK_CHECK_CC
699 GCC_PIE_CC
700 fi
701
702fi
703
704dnl *****************************************
705dnl
706dnl checks for system services
707dnl
708dnl *****************************************
709
710dnl
711dnl check for /proc filesystem
712dnl
713if test -d "/proc/$$"
714then
715 AC_DEFINE([HAVE_PROCFS],[1],[Define if you have a proc fs])
716fi
717
718dnl
719dnl check for GNU gmp
720dnl
721AC_CHECK_LIB(gmp, __gmpz_init, [sh_have_gmp=yes], [sh_have_gmp=no])
722if test "x${sh_have_gmp}" = xno
723then
724 AC_CHECK_LIB(gmp, mpz_init, [sh_have_gmp=yes], [sh_have_gmp=no])
725fi
726if test "x${sh_have_gmp}" = xyes
727then
728 # LIBS="-lgmp $LIBS"
729 AC_DEFINE(HAVE_LIBGMP, 1, [Have GNU gmp library])
730fi
731AC_CHECK_HEADERS(gmp.h)
732
733AC_MSG_CHECKING([for ps])
734PS=
735for ff in /usr/ucb /bin /usr/bin; do
736 if test -x "$ff/ps"; then
737 PS="$ff/ps"
738 AC_MSG_RESULT([$PS])
739 break
740 fi
741done
742if test x$PS = x
743then
744 AC_MSG_RESULT([no])
745 AC_MSG_ERROR([Cannot find ps in any of /usr/ucb /bin /usr/bin])
746fi
747AC_DEFINE_UNQUOTED([PSPATH], _("$PS"), [Path to ps])
748
749AC_MSG_CHECKING([how to use ps])
750$PS ax >/dev/null 2>&1
751if test $? -eq 0; then
752 case "$host_os" in
753 *openbsd*)
754 one=`$PS akx | wc -l`
755 ;;
756 *)
757 one=`$PS ax | wc -l`
758 ;;
759 esac
760else
761 one=0
762fi
763$PS -e >/dev/null 2>&1
764if test $? -eq 0; then
765 two=`$PS -e | wc -l`
766else
767 two=0
768fi
769if test $one -ge $two
770then
771 case "$host_os" in
772 *openbsd*)
773 PSARG="akx"
774 ;;
775 *)
776 PSARG="ax"
777 ;;
778 esac
779else
780 PSARG="-e"
781fi
782AC_DEFINE_UNQUOTED([PSARG], _("$PSARG"), [Argument for ps])
783AC_MSG_RESULT([$PS $PSARG])
784
785dnl *****************************************
786dnl
787dnl enable features
788dnl
789dnl *****************************************
790
791AC_ARG_ENABLE(db-reload,
792 [ --enable-db-reload enable database reload on SIGHUP [[no]]],
793 [
794 if test "x${enable_db_reload}" = xyes; then
795 AC_DEFINE(RELOAD_DATABASE)
796 fi
797 ]
798)
799
800AC_ARG_ENABLE(xml-log,
801 [ --enable-xml-log enable XML logfile format [[no]]],
802 [
803 if test "x${enable_xml_log}" = xyes; then
804 AC_DEFINE(SH_USE_XML)
805 fi
806 ]
807)
808
809
810AC_ARG_ENABLE(mail,
811 [ --disable-mail disable the internal SMTP mailer],
812 [
813 if test "x${enable_mail}" = xno; then
814 :
815 else
816 AC_DEFINE(SH_WITH_MAIL)
817 fi
818 ],
819 [AC_DEFINE(SH_WITH_MAIL)]
820)
821
822AC_ARG_ENABLE(suid,
823 [ --enable-suid allow suid],
824 [
825 if test "x${enable_suid}" = xyes; then
826 AC_DEFINE(SH_ALLOW_SUID, [1], [Define if you want to allow suid execution for samhain])
827 fi
828 ]
829)
830
831AC_ARG_ENABLE(shellexpand,
832 [ --disable-shellexpand disable shell expansion in config file],
833 [
834 if test "x${enable_shellexpand}" = xno; then
835 :
836 else
837 AC_DEFINE(SH_EVAL_SHELL, [1], [Define if you want shell expansion in configuration file])
838 fi
839 ],
840 [AC_DEFINE(SH_EVAL_SHELL, [1], [Define if you want shell expansion in configuration file])]
841)
842
843AC_ARG_ENABLE(external-scripts,
844 [ --disable-external-scripts disable interface to external scripts],
845 [
846 if test "x${enableval}" = xno; then
847 :
848 else
849 AC_DEFINE(WITH_EXTERNAL)
850 fi
851 ],
852 [AC_DEFINE(WITH_EXTERNAL)]
853)
854
855AC_ARG_ENABLE(message-queue,
856 [ --enable-message-queue[[=MODE]] enable SysV message queue [[MODE=0700]]],
857 [
858 if test "x${ac_cv_header_sys_msg_h}" = "xyes"; then
859 if test "x${enable_message_queue}" = xyes; then
860 AC_DEFINE(WITH_MESSAGE_QUEUE)
861 AC_DEFINE_UNQUOTED(MESSAGE_QUEUE_MODE, 0700)
862 elif test "x${enable_message_queue}" != xno; then
863 echo "${enableval}" | grep ['[^0123456789]'] >/dev/null 2>&1 &&
864 AC_MSG_ERROR([With --enable-message-queue=MODE, MODE must be numeric])
865 echo "${enableval}" | \
866 grep ['0[0123456789][0123456789][0123456789]'] >/dev/null 2>&1 ||
867 AC_MSG_ERROR([With --enable-message-queue=MODE, MODE must be an octal (0nnn) number])
868 AC_DEFINE(WITH_MESSAGE_QUEUE)
869 AC_DEFINE_UNQUOTED(MESSAGE_QUEUE_MODE, ${enable_message_queue})
870 fi
871 else
872 echo
873 echo "**********************************************"
874 echo
875 AC_MSG_WARN([sys/msg.h missing, --enable-message-queue disabled])
876 echo
877 echo "**********************************************"
878 echo
879 fi
880 ]
881)
882
883AC_ARG_WITH(cflags,
884 [ --with-cflags additional flags to pass to compiler],
885 [
886 if test "x$withval" != "xno" ; then
887 CFLAGS="$CFLAGS $withval"
888 fi
889 ]
890)
891AC_ARG_WITH(libs,
892 [ --with-libs additional libraries to link with],
893 [
894 if test "x$withval" != "xno" ; then
895 LIBS="$LIBS $withval"
896 fi
897 ]
898)
899
900
901#
902# this is from ssh
903#
904AC_MSG_CHECKING(whether to use libwrap)
905LIBWRAP_LIB=""
906LIBWRAP_INC=""
907AC_ARG_WITH(libwrap,
908[ --with-libwrap[=PATH] Compile in libwrap (TCP Wrappers) support],
909[ AC_MSG_RESULT($withval)
910 case "$withval" in
911 no)
912 ;;
913 ""|yes)
914 LIBWRAP_LIB="-lwrap"
915 ;;
916 *)
917 if test -d "$withval"; then
918 LIBWRAP_LIB="-L$withval -lwrap"
919 changequote(<<, >>)dnl
920 sh_libwrap_inc=`echo ${withval} | sed 's%/[^/][^/]*$%%'`
921 LIBWRAP_INC="-I${sh_libwrap_inc}/include"
922 changequote([, ])dnl
923 else
924 LIBWRAP_LIB="-lwrap"
925 changequote(<<, >>)dnl
926 sh_libwrap_inc=`echo ${withval} | sed 's%/[^/][^/]*$%%'`
927 LIBWRAP_INC="-I${sh_libwrap_inc}"
928 changequote([, ])dnl
929 fi
930 ;;
931 esac
932 if test -n "$LIBWRAP_LIB"; then
933 # OLDLIBS="$LIBS"
934 LIBS="$LIBWRAP_LIB $LIBS"
935 # OLDCFLAGS="$CFLAGS"
936 CFLAGS="$CFLAGS $LIBWRAP_INC"
937 AC_CHECK_HEADER(tcpd.h,
938 [],
939 [ AC_MSG_ERROR([Could not find tcpd.h for libwrap. You need to install tcp_wrappers.]) ])
940 AC_TRY_LINK([ #include <tcpd.h>
941 int allow_severity; int deny_severity; ],
942 [ hosts_access((struct request_info *) 0); ],
943 [ AC_DEFINE(SH_USE_LIBWRAP,1,[Build with tcp wrapper support]) ],
944 [ AC_MSG_ERROR([Could not find the libwrap library.]) ])
945 fi ],
946 AC_MSG_RESULT(no)
947)
948
949
950dnl
951dnl NETWORK OPTIONS
952dnl
953AC_ARG_ENABLE(network,
954 [ --enable-network=[[client|server]] compile client or server [[no]]],
955 [
956 if test "x$enable_network" = xclient; then
957 mytclient="-DSH_WITH_CLIENT"
958 yulectl_prg=
959 samhainadmin_prg=
960 setpwd_prg="samhain_setpwd"
961 sh_main_prg="samhain"
962 if test "x${sh_have_gmp}" = xyes
963 then
964 LIBS="-lgmp $LIBS"
965 fi
966dnl AC_CHECK_HEADER(sys/capability.h,
967dnl [AC_CHECK_LIB(cap, cap_get_proc,,sh_use_lcaps="no")],
968dnl [sh_use_lcaps="no"])
969 elif test "x$enable_network" = xserver; then
970 mytclient="-DSH_WITH_SERVER"
971 yulectl_prg="yulectl"
972 samhainadmin_prg="scripts/samhainadmin.pl"
973 setpwd_prg="samhain_setpwd"
974 sh_main_prg="yule"
975 if test "x${sh_have_gmp}" = xyes
976 then
977 LIBS="-lgmp $LIBS"
978 fi
979 sh_use_lcaps="undef"
980 elif test "x$enable_network" = xno; then
981 mytclient="-DSH_STANDALONE"
982 yulectl_prg=
983 samhainadmin_prg=
984 setpwd_prg=
985 sh_main_prg="samhain"
986dnl AC_CHECK_HEADER(sys/capability.h,
987dnl [AC_CHECK_LIB(cap, cap_get_proc,,sh_use_lcaps="no")],
988dnl [sh_use_lcaps="no"])
989 else
990 AC_MSG_ERROR([With --enable-network=WHAT, WHAT must be client, server, or no])
991 fi
992 ],
993 [
994 mytclient="-DSH_STANDALONE"
995 setpwd_prg=
996 yulectl_prg=
997 samhainadmin_prg=
998 sh_main_prg="samhain"
999dnl AC_CHECK_HEADER(sys/capability.h,
1000dnl [AC_CHECK_LIB(cap, cap_get_proc,,sh_use_lcaps="no")],
1001dnl [sh_use_lcaps="no"])
1002 ],
1003)
1004
1005AC_SUBST(setpwd_prg)
1006AC_SUBST(yulectl_prg)
1007AC_SUBST(samhainadmin_prg)
1008AC_SUBST(sh_main_prg)
1009AC_SUBST(mytclient)
1010
1011# needed for the rpm spec
1012clmytclient=`echo ${mytclient} | sed s%\-%%`
1013AC_SUBST(clmytclient)
1014
1015sh_no_gcc_static=no
1016
1017AC_ARG_ENABLE(static,
1018 [ --enable-static enable static linking [[no]]],
1019 [
1020 if test x$enable_static = xyes; then
1021 if test x"$mynetbsd" = xyes
1022 then
1023 tmp_LIBS=`echo $LIBS | sed 's%\-lresolv%%' `
1024 LIBS="${tmp_LIBS}"
1025 fi
1026 if test x"${sh_auparse}" = xyes
1027 then
1028 tmp_LIBS=`echo $LIBS | sed 's%\-lauparse%%' `
1029 LIBS="${tmp_LIBS}"
1030 fi
1031
1032 if test "x$GCC" = "xyes";
1033 then
1034 case "$host_os" in
1035
1036 *solaris*)
1037 AC_MSG_WARN([option --enable-static ignored on Solaris])
1038 ;;
1039
1040 *)
1041 AC_DEFINE(SH_COMPILE_STATIC, 1, [Define if compiling static])
1042 sh_no_gcc_static=no
1043 LDFLAGS="$LDFLAGS -static"
1044 ;;
1045 esac
1046 else
1047 AC_DEFINE(SH_COMPILE_STATIC, 1, [Define if compiling static])
1048 sh_no_gcc_static=yes
1049 case "$host_os" in
1050
1051 *aix*)
1052 LDFLAGS="$LDFLAGS -bnso -bI:/lib/syscalls.exp"
1053 ;;
1054
1055 *hpux*)
1056 LDFLAGS="$LDFLAGS -Wl,-a,archive"
1057 ;;
1058
1059 *osf*)
1060 LDFLAGS="$LDFLAGS -non_shared"
1061 ;;
1062
1063 *irix*)
1064 LDFLAGS="$LDFLAGS -non_shared"
1065 ;;
1066
1067 *sco*)
1068 LDFLAGS="$LDFLAGS -dn"
1069 ;;
1070
1071 *sun*)
1072 LDFLAGS="$LDFLAGS -Bstatic"
1073 ;;
1074
1075 *solaris*)
1076 LDFLAGS="$LDFLAGS -Bstatic"
1077 ;;
1078
1079 *)
1080 echo "***********************************************"
1081 echo "*"
1082 echo "* Don't know how to enable static linking"
1083 echo "* with your compiler. Please set the environment"
1084 echo "* variable LDFLAGS to:"
1085 echo "* ${LDFLAGS} + the static linking flag"
1086 echo "* and run configure again"
1087 echo "*"
1088 echo "***********************************************"
1089 ;;
1090
1091 esac
1092 fi
1093 fi
1094 ]
1095)
1096
1097if test x"${mytclient}" = x-DSH_STANDALONE -o x"${mytclient}" = x-DSH_WITH_CLIENT;
1098then
1099dnl For threaded modules
1100 ACX_PTHREAD
1101 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1102 LIBS="$PTHREAD_LIBS $LIBS"
1103 LDFLAGS="$PTHREAD_CFLAGS $LDFLAGS"
1104 CC="$PTHREAD_CC"
1105dnl For MODI_TXT
1106 CHECK_ZLIB()
1107fi
1108
1109if test x$enable_static = xyes; then
1110 :
1111else
1112 if test x$sh_use_pie = xyes; then
1113 LDFLAGS="$LDFLAGS $PIE_LDFLAGS"
1114 CFLAGS="$CFLAGS $PIE_CFLAGS"
1115 fi
1116fi
1117AC_CHECK_FUNC(pmap_getmaps,
1118 AC_DEFINE([HAVE_PMAP_GETMAPS], [], [Define if pmap_getmaps available]), [],[])
1119
1120
1121#
1122# this is from the snort configure.in
1123#
1124AC_DEFUN(FAIL_MESSAGE,[
1125 echo
1126 echo
1127 echo "**********************************************"
1128 echo " ERROR: unable to find" $1
1129 echo " checked in the following places"
1130 for i in `echo $2`; do
1131 echo " $i"
1132 done
1133 echo "**********************************************"
1134 echo
1135 exit
1136])
1137
1138AC_ARG_WITH(libprelude-prefix,
1139 [ --with-libprelude-prefix=PFX Prefix where libprelude is installed (optional)],
1140 libprelude_config_prefix="$withval", libprelude_config_prefix="")
1141
1142AC_MSG_CHECKING(whether to use prelude)
1143AC_ARG_WITH(prelude,
1144 [ --with-prelude Prelude IDS support [[no]]],
1145 [
1146 if test "x${withval}" = "xno"; then
1147 AC_MSG_RESULT(no)
1148 else
1149 AC_MSG_RESULT(yes)
1150 if test x$libprelude_config_prefix != x ; then
1151 if test x${LIBPRELUDE_CONFIG+set} != xset ; then
1152 LIBPRELUDE_CONFIG=$libprelude_config_prefix/bin/libprelude-config
1153 fi
1154 fi
1155
1156 AC_PATH_PROG(LIBPRELUDE_CONFIG, libprelude-config, no)
1157 if test x"$LIBPRELUDE_CONFIG" = "xno" ; then
1158 HAVE_PRELUDE_CONFIG=no
1159 else
1160 HAVE_PRELUDE_CONFIG=yes
1161 fi
1162dnl AC_CHECK_PROG(HAVE_PRELUDE_CONFIG, libprelude-config, yes, no)
1163 if test "$HAVE_PRELUDE_CONFIG" = "yes"; then
1164 sh_libprelude_version=`$LIBPRELUDE_CONFIG --version`
1165 case "$sh_libprelude_version" in
1166 0.8*)
1167 AC_MSG_ERROR([You have Libprelude 0.8, which is too old. Version 0.9.6 or higher is required.])
1168 ;;
1169 *)
1170 AM_PATH_LIBPRELUDE([0.9.6],
1171 [
1172 AC_DEFINE(HAVE_LIBPRELUDE,1,[Have libprelude])
1173 CFLAGS="$CFLAGS $LIBPRELUDE_PTHREAD_CFLAGS"
1174 LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
1175 LIBS="$LIBS $LIBPRELUDE_LIBS"
1176 ],
1177 [
1178 AC_MSG_ERROR([Could not find libprelude (if you are using --enable-static, the static library libprelude.a might be missing).])
1179 ])
1180 ;;
1181 esac
1182 else
1183 AC_MSG_ERROR([Could not find libprelude-config.])
1184 fi
1185 fi
1186 ],
1187 [
1188 AC_MSG_RESULT(no)
1189 ]
1190)
1191
1192#
1193# partly based on the snort configure.in
1194#
1195AC_ARG_WITH(database,
1196 [ --with-database=[[mysql|postgresql|oracle|odbc]] database support [[no]]],
1197 [
1198 if test x"$enable_xml_log" != xyes; then
1199 AC_MSG_ERROR([With --with-database, --enable-xml-log is required as well.])
1200 fi
1201 if test "x${withval}" = "xmysql"; then
1202 if test "x$zlib_found" = "x"
1203 then
1204 CHECK_ZLIB()
1205 fi
1206 AC_CHECK_PROG(HAVE_MYSQL_CONFIG, mysql_config, yes, no)
1207 if test "$HAVE_MYSQL_CONFIG" = "yes"; then
1208 sh_mysql_libs="`mysql_config --libs`"
1209 sh_mysql_libs="`eval echo ${sh_mysql_libs}`"
1210 LIBS="$LIBS ${sh_mysql_libs}"
1211 sh_mysql_cflags="`mysql_config --cflags`"
1212 sh_mysql_cflags="`eval echo ${sh_mysql_cflags}`"
1213 CPPFLAGS="$CPPFLAGS ${sh_mysql_cflags}"
1214 else
1215 AC_MSG_CHECKING([for MySQL in /usr /usr/local /usr/local/mysql MYSQL_HOME])
1216 mysql_directory="/usr /usr/local /usr/local/mysql ${MYSQL_HOME}"
1217
1218 for i in $mysql_directory; do
1219 if test -r $i/include/mysql/mysql.h; then
1220 MYSQL_DIR=$i
1221 MYSQL_INC_DIR=$i/include
1222 # we use AC_CHECK_HEADERS to check for mysql/mysql.h
1223 fi
1224 done
1225 if test -z "$MYSQL_DIR"; then
1226 for i in $mysql_directory; do
1227 if test -r $i/include/mysql.h; then
1228 MYSQL_DIR=$i
1229 MYSQL_INC_DIR=$i/include
1230 fi
1231 done
1232 fi
1233
1234 if test -z "$MYSQL_DIR"; then
1235 tmp=""
1236 for i in $mysql_directory; do
1237 tmp="$tmp $i/include $i/include/mysql"
1238 done
1239 FAIL_MESSAGE("mysql headers (mysql.h)", $tmp)
1240 fi
1241
1242 for i in lib lib/mysql; do
1243 str="$MYSQL_DIR/$i/libmysqlclient.*"
1244 for j in `echo $str`; do
1245 if test -r $j; then
1246 MYSQL_LIB_DIR="$MYSQL_DIR/$i"
1247 break 2
1248 fi
1249 done
1250 done
1251
1252 if test -z "$MYSQL_LIB_DIR"; then
1253 for ff in $mysql_directory; do
1254 for i in lib lib/mysql; do
1255 str="$ff/$i/libmysqlclient.*"
1256 for j in `echo $str`; do
1257 if test -r $j; then
1258 MYSQL_LIB_DIR="$ff/$i"
1259 break 3
1260 fi
1261 done
1262 done
1263 done
1264 fi
1265
1266 if test -z "$MYSQL_LIB_DIR"; then
1267 tmp=""
1268 for i in $mysql_directory; do
1269 tmp="$i/lib $i/lib/mysql"
1270 done
1271 FAIL_MESSAGE("mysql library libmysqlclient", $tmp)
1272 fi
1273
1274 AC_MSG_RESULT(yes)
1275 LIBS="$LIBS -L${MYSQL_LIB_DIR} -lmysqlclient"
1276 # CFLAGS="$CFLAGS -I${MYSQL_INC_DIR}"
1277 CPPFLAGS="$CPPFLAGS -I${MYSQL_INC_DIR}"
1278 fi
1279 AC_DEFINE(WITH_MYSQL)
1280 AC_DEFINE(WITH_DATABASE)
1281 if test "x$zlib_found" = "xyes"
1282 then
1283 LIBS="$LIBS -lz -lm"
1284 else
1285 echo
1286
1287 echo " Mysql library was not found or not useable."
1288 echo " Possible reasons include:"
1289 echo " - an old, incompatible version compiled from source"
1290 echo " - on Solaris, libmysql is compiled with the Solaris"
1291 echo " compiler, thus the mysql_config script provides"
1292 echo " compiler options unsuitable for gcc (move"
1293 echo " mysql_config out of your PATH)"
1294 echo " For other problems, check config.log for the error"
1295 echo " message from the compiler."
1296 echo
1297 echo " If your mysql libraries are installed in an"
1298 echo " unusual place, use --with-libs=-L/path/to/libdirectory"
1299 echo " where libdirectory is the directory holding libmysql."
1300 if test x"$enable_static" = xyes; then
1301 echo " Note that for compiling a static binary, you need"
1302 echo " the static libraries, rather than the shared ones."
1303 fi
1304 echo
1305 AC_MSG_ERROR([Could not find libmysql, or it is not useable.])
1306 fi
1307 AC_CHECK_HEADERS(mysql/mysql.h)
1308 elif test "x${withval}" = "xpostgresql"; then
1309 AC_DEFINE(WITH_POSTGRES)
1310 AC_DEFINE(WITH_DATABASE)
1311 #
1312 PGCONF="no"
1313 MY_PATH="${PATH}:/usr/local/bin:/usr/local/pgsql/bin"
1314 OLD_IFS="$IFS"
1315 IFS=":"
1316 for ff in ${MY_PATH}
1317 do
1318 if test -f "$ff/pg_config"
1319 then
1320 PGCONF="$ff/pg_config"
1321 fi
1322 done
1323 IFS="${OLD_IFS}"
1324 #
1325 #
1326 if test "x${PGCONF}" = "xno"
1327 then
1328 AC_MSG_CHECKING(for PostgreSQL in /usr/local/pgsql /usr/pgsql /usr/local /usr PGSQL_HOME)
1329 pgsql_directory="/usr/local/pgsql /usr/pgsql /usr/local /usr ${PGSQL_HOME}"
1330 for i in $pgsql_directory; do
1331 if test -r $i/include/pgsql/libpq-fe.h; then
1332 PGSQL_INC_DIR=$i/include
1333 PGSQL_DIR=$i
1334 # use AC_CHECK_HEADERS to check for pgsql/libpq-fe.h
1335 fi
1336 done
1337 if test -z "$PGSQL_DIR"; then
1338 for i in $pgsql_directory; do
1339 if test -r $i/include/postgresql/libpq-fe.h; then
1340 PGSQL_INC_DIR=$i/include
1341 PGSQL_DIR=$i
1342 fi
1343 done
1344 fi
1345 if test -z "$PGSQL_DIR"; then
1346 for i in $pgsql_directory; do
1347 if test -r $i/include/libpq-fe.h; then
1348 PGSQL_INC_DIR=$i/include
1349 PGSQL_DIR=$i
1350 fi
1351 done
1352 fi
1353
1354 if test -z "$PGSQL_DIR"; then
1355 tmp=""
1356 for i in $pgsql_directory; do
1357 tmp="$tmp $i/include $i/include/pgsql $i/include/postgresql"
1358 done
1359 FAIL_MESSAGE("PostgreSQL header file (libpq-fe.h)", $tmp)
1360 fi
1361
1362 for i in lib lib/pgsql lib/postgresql; do
1363 str="$PGSQL_DIR/$i/libpq.*"
1364 for j in `echo $str`; do
1365 if test -r $j; then
1366 PGSQL_LIB_DIR="$PGSQL_DIR/$i"
1367 break 2
1368 fi
1369 done
1370 done
1371
1372 if test -z "$PGSQL_LIB_DIR"; then
1373 for ff in $pgsql_directory; do
1374 for i in lib lib/pgsql lib/postgresql; do
1375 str="$ff/$i/libpq.*"
1376 for j in `echo $str`; do
1377 if test -r $j; then
1378 PGSQL_LIB_DIR="$ff/$i"
1379 break 3
1380 fi
1381 done
1382 done
1383 done
1384 fi
1385
1386 if test -z "$PGSQL_LIB_DIR"; then
1387 tmp=""
1388 for i in $pgsql_directory; do
1389 tmp="$i/lib $i/lib/pgsql $i/lib/postgresql"
1390 done
1391 FAIL_MESSAGE("postgresql library libpq", $tmp)
1392 fi
1393
1394 AC_MSG_RESULT(yes)
1395
1396 LIBS="$LIBS -L${PGSQL_LIB_DIR} -lpq -lm"
1397 if test x"$enable_static" = xyes; then
1398 LIBS="$LIBS -L${PGSQL_LIB_DIR} -lpq -lcrypt -lm"
1399 else
1400 LIBS="$LIBS -L${PGSQL_LIB_DIR} -lpq -lm"
1401 fi
1402 # CFLAGS="$CFLAGS -I${PGSQL_INC_DIR}"
1403 CPPFLAGS="$CPPFLAGS -I${PGSQL_INC_DIR}"
1404 AC_CHECK_HEADERS(pgsql/libpq-fe.h)
1405 AC_CHECK_HEADERS(postgresql/libpq-fe.h)
1406 else
1407 pg_lib_dir=`${PGCONF} --libdir`
1408 if test x"$enable_static" = xyes; then
1409 LIBS="$LIBS -L${pg_lib_dir} -lpq -lcrypt -lm"
1410 else
1411 LIBS="$LIBS -L${pg_lib_dir} -lpq -lm"
1412 fi
1413 pg_inc_dir=`${PGCONF} --includedir`
1414 # CFLAGS="$CFLAGS -I${pg_inc_dir}"
1415 CPPFLAGS="$CPPFLAGS -I${pg_inc_dir}"
1416 fi
1417 elif test "x${withval}" = "xodbc"; then
1418 AC_MSG_CHECKING(for odbc in /usr /usr/local ODBC_HOME)
1419 odbc_directory="/usr /usr/local"
1420
1421 for i in $odbc_directory; do
1422 if test -r $i/include/sql.h; then
1423 if test -r $i/include/sqlext.h; then
1424 if test -r $i/include/sqltypes.h; then
1425 ODBC_DIR=$i
1426 ODBC_INC_DIR=$i/include
1427 fi
1428 fi
1429 fi
1430 done
1431
1432 if test -z "$ODBC_DIR"; then
1433 tmp=""
1434 for i in $odbc_directory; do
1435 tmp="$tmp $i/include"
1436 done
1437 FAIL_MESSAGE("odbc headers (sql.h sqlext.h sqltypes.h)", $tmp)
1438 fi
1439
1440 str="$ODBC_DIR/lib/libodbc.*"
1441 for j in `echo $str`; do
1442 if test -r $j; then
1443 ODBC_LIB_DIR="$ODBC_DIR/lib"
1444 ODBC_LIB="odbc"
1445 fi
1446 done
1447
1448 if test -z "$ODBC_LIB_DIR"; then
1449 FAIL_MESSAGE("odbc library (libodbc)", "$ODBC_DIR/lib")
1450 fi
1451
1452 AC_MSG_RESULT(yes)
1453 CPPFLAGS="${CPPFLAGS} -I${ODBC_INC_DIR}"
1454 LIBS="${LIBS} -L${ODBC_LIB_DIR} -l$ODBC_LIB"
1455 AC_DEFINE(WITH_ODBC)
1456 AC_DEFINE(WITH_DATABASE)
1457
1458 elif test "x${withval}" = "xoracle"; then
1459
1460 AC_MSG_CHECKING(for oracle in ORACLE_HOME /usr/local /usr)
1461
1462 oracle_directory="/usr /usr/local ${ORACLE_HOME}"
1463 for i in $oracle_directory; do
1464
1465 ff=`find $i -name oci.h 2>/dev/null | tail -1`
1466 if test "x$ff" = "x"; then
1467 :
1468 else
1469 ORACLE_INC=`dirname $ff`
1470 fi
1471
1472 fg=`find $i -name libclntsh.so 2>/dev/null | tail -1`
1473 if test "x$fg" = "x"; then
1474 :
1475 else
1476 ORACLE_LIB=`dirname $fg`
1477 fi
1478
1479 done
1480
1481 if test -z "$ORACLE_INC"; then
1482
1483 tmp=""
1484 for i in $oracle_directory; do
1485 tmp="$tmp $i"
1486 done
1487 FAIL_MESSAGE("OCI header file (oci.h) please define ORACLE_INC directory where oci.h resides", $tmp)
1488
1489 elif test -z "$ORACLE_LIB"; then
1490
1491 tmp=""
1492 for i in $oracle_directory; do
1493 tmp="$tmp $i"
1494 done
1495 FAIL_MESSAGE("OCI library file (libclntsh.so) please define ORACLE_LIB directory where libclntsh.so resides", $tmp)
1496
1497 else
1498
1499 ORACLE_CPP_FLAGS="-I$ORACLE_INC"
1500 ORACLE_LIB_DIR="$ORACLE_LIB"
1501
1502 AC_MSG_RESULT([$ORACLE_INC $ORACLE_LIB])
1503
1504 CPPFLAGS="${CPPFLAGS} ${ORACLE_CPP_FLAGS}"
1505
1506 ORACLE_LIBS="-lclntsh"
1507
1508 if test -r $ORACLE_LIB_DIR/libnnz11.so; then
1509 ORACLE_LIBS="${ORACLE_LIBS} -lnnz11"
1510 fi
1511 if test -r $ORACLE_LIB_DIR/libwtc9.so; then
1512 ORACLE_LIBS="${ORACLE_LIBS} -lwtc9"
1513 elif test -r $ORACLE_LIB_DIR/libwtc8.so; then
1514 ORACLE_LIBS="${ORACLE_LIBS} -lwtc8"
1515 fi
1516 LIBS="${LIBS} -L${ORACLE_LIB_DIR} ${ORACLE_LIBS}"
1517 if test "x$GCC" != "xyes"; then
1518 CFLAGS="${CFLAGS} -fno-strict-aliasing"
1519 fi
1520 fi
1521 AC_DEFINE(WITH_ORACLE)
1522 AC_DEFINE(WITH_DATABASE)
1523
1524 else
1525 AC_MSG_ERROR([Option --with-database=database used with unsupported database ${withval}])
1526 fi
1527 ]
1528)
1529
1530AC_ARG_WITH(console,
1531 [ --with-console=PATH set path to console device [[/dev/console]]],
1532 [
1533 if test "x${withval}" != xno; then
1534 mycons="$withval"
1535 AC_DEFINE_UNQUOTED(DEFAULT_CONSOLE, _("${mycons}") )
1536 fi
1537 ])
1538
1539AC_ARG_WITH(altconsole,
1540 [ --with-altconsole=PATH set path to second console device [[none]]],
1541 [
1542 if test "x${withval}" != xno; then
1543 myaltcons="$withval"
1544 else
1545 myaltcons="NULL"
1546 fi
1547 ],
1548 [myaltcons="NULL"])
1549AC_DEFINE_UNQUOTED(ALT_CONSOLE, _("${myaltcons}") )
1550
1551AC_ARG_WITH(timeserver,
1552 [ --with-timeserver=HOST set host address for time server [[none]]],
1553 [
1554 if test "x${withval}" != xno; then
1555 mytimeserv="$withval"
1556 AC_DEFINE(HAVE_NTIME)
1557 else
1558 mytimeserv="NULL"
1559 fi
1560 ],
1561 mytimeserv="NULL")
1562AC_DEFINE_UNQUOTED(DEFAULT_TIMESERVER, _("${mytimeserv}") )
1563
1564AC_ARG_WITH(alttimeserver,
1565 [ --with-alttimeserver=HOST set address for backup time server [[none]]],
1566 [
1567 if test "x${withval}" != xno; then
1568 myalttimeserv="$withval"
1569 AC_DEFINE(HAVE_NTIME)
1570 else
1571 myalttimeserv="NULL"
1572 fi
1573 ],
1574 myalttimeserv="NULL")
1575AC_DEFINE_UNQUOTED(ALT_TIMESERVER, _("${myalttimeserv}") )
1576
1577AC_ARG_ENABLE(login-watch,
1578 [ --enable-login-watch watch for login/logout [[no]]],
1579 [
1580 if test "x${enable_login_watch}" = xyes; then
1581 AC_DEFINE(SH_USE_UTMP)
1582 fi
1583 ]
1584)
1585
1586AC_ARG_ENABLE(mounts-check,
1587 [ --enable-mounts-check check mount options on filesystems [[no]]],
1588 [
1589 if test "x${enable_mounts_check}" = xyes; then
1590 AC_DEFINE(SH_USE_MOUNTS)
1591 fi
1592 ]
1593)
1594
1595AC_ARG_ENABLE(logfile-monitor,
1596 [ --enable-logfile-monitor monitor logfiles [[no]]],
1597 [
1598 if test "x${enable_logfile_monitor}" = xyes; then
1599 AC_CHECK_HEADER(pcre.h,
1600 [
1601 AC_DEFINE(USE_LOGFILE_MONITOR, 1, [Define if you want the logfile monitor module.])
1602 LIBS="-lpcre $LIBS"
1603 ],
1604 [
1605 AC_CHECK_HEADER(pcre/pcre.h,
1606 [
1607 AC_DEFINE(USE_LOGFILE_MONITOR, 1, [Define if you want the logfile monitor module.])
1608 AC_DEFINE(HAVE_PCRE_PCRE_H, 1, [Define if you have pcre/pcre.h.])
1609 LIBS="-lpcre $LIBS"
1610 ],
1611 AC_MSG_ERROR([The --enable-logfile-monitor option requires libpcre. For compiling the pcre development package is needed.])
1612 )
1613 ]
1614 )
1615 AC_CHECK_LIB(pcre, pcre_dfa_exec, [
1616 AC_DEFINE([HAVE_PCRE_DFA_EXEC], 1, [Define if you have pcre_dfa_exec])
1617 ], [
1618 AC_MSG_WARN([pcre_dfa_exec not available])
1619 ])
1620 fi
1621 ]
1622)
1623
1624
1625AC_ARG_ENABLE(process-check,
1626 [ --enable-process-check check processes [[no]]],
1627 [
1628 if test "x${enable_process_check}" = xyes; then
1629 AC_CHECK_LIB([rt], [sched_getparam], sh_lrt=yes, sh_lrt=no)
1630 if test x"$sh_lrt" = xyes; then
1631 LIBRT=-lrt
1632 else
1633 LIBRT=
1634 fi
1635 LIBS="$LIBS $LIBRT"
1636 AC_DEFINE(SH_USE_PROCESSCHECK, [1], [Define if you want to check processes])
1637 fi
1638 ]
1639)
1640
1641AC_ARG_ENABLE(port-check,
1642 [ --enable-port-check check ports [[no]]],
1643 [
1644 if test "x${enable_port_check}" = xyes; then
1645 AC_DEFINE(SH_USE_PORTCHECK, [1], [Define if you want to check ports])
1646 fi
1647 ]
1648)
1649
1650AC_ARG_ENABLE(userfiles,
1651 [ --enable-userfiles check for users' config files [[no]]],
1652 [
1653 if test "x${enableval}" = "xyes"; then
1654 AC_DEFINE(SH_USE_USERFILES)
1655 fi
1656 ]
1657)
1658
1659AC_ARG_ENABLE(debug,
1660 [ --enable-debug enable debug options [[no]]],
1661 [
1662 if test "x${enable_debug}" = "xyes"; then
1663 if test "x${mydebugflag}" != "xyes"; then
1664 AC_DEFINE(MEM_DEBUG)
1665 fi
1666 AC_DEFINE(WITH_TPT)
1667 AC_DEFINE(SL_DEBUG)
1668 AC_DEFINE(DNMALLOC_CHECKS, 1, [Debug dnmalloc])
1669 AC_DEFINE(PARANOIA, 0, [Paranoia level for dnmalloc])
1670 AC_DEFINE(SL_FAIL_ON_ERROR)
1671 if test "x${myneedg3}" = "xyes"; then
1672 mydebugdef="-g3"
1673 else
1674 mydebugdef="-g"
1675 fi
1676 mydebugit="yes"
1677 elif test "x${enable_debug}" = "xgdb"; then
1678 AC_DEFINE(SH_ABORT_ON_ERROR, 1, [Use abort])
1679 if test "x${myneedg3}" = "xyes"; then
1680 mydebugdef="-g3"
1681 else
1682 mydebugdef="-g"
1683 fi
1684 mydebugit="yes"
1685 fi
1686 ]
1687)
1688AC_SUBST(mydebugdef)
1689
1690if test "x${enable_asm_ok}" = "xyes"; then
1691 sh_enable_asm=yes
1692else
1693 sh_enable_asm=no
1694fi
1695AC_ARG_ENABLE(asm,
1696 [ --disable-asm disable asm inline code],
1697 [
1698 if test "x${enable_asm}" = xno; then
1699 sh_enable_asm=no
1700 fi
1701 ]
1702)
1703
1704if test "x${samhain_64_asm}" = xyes; then
1705 if test "x${sh_enable_asm}" = xyes; then
1706 AC_DEFINE([TIGER_OPT_ASM],1,[Define to use tiger x86_64 optimized assembly])
1707 fi
1708fi
1709
1710AC_ARG_ENABLE(ipv6,
1711 [ --disable-ipv6 disable ipv6 support],
1712 [
1713 if test "x${enable_ipv6}" = xno; then
1714 AC_DEFINE(USE_IPV4,1,[Define if you do not want IPv6])
1715 fi
1716 ]
1717)
1718
1719if test "x${dnmalloc_ok}" = "xyes"; then
1720 sh_dnmalloc_enabled=yes
1721else
1722 sh_dnmalloc_enabled=no
1723fi
1724
1725AC_ARG_ENABLE(dnmalloc,
1726 [ --disable-dnmalloc disable dnmalloc],
1727 [
1728 if test "x${enable_dnmalloc}" = xno; then
1729 sh_dnmalloc_enabled=no
1730 else
1731 sh_dnmalloc_enabled=yes
1732 fi
1733 ]
1734)
1735
1736dnl Handle the problem that static linking against libc.a on Linux
1737dnl produces the error "multiple definitions of malloc"
1738dnl
1739if test "x$sh_dnmalloc_enabled" = "xyes"; then
1740 if test x$enable_static = xyes; then
1741 if test "x$sh_no_gcc_static" = "xyes"; then
1742 sh_dnmalloc_enabled=no
1743 else
1744 if test "x$with_gnu_ld" = "xyes"; then
1745 LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"
1746 else
1747 sh_dnmalloc_enabled=no
1748 fi
1749 fi
1750 fi
1751fi
1752
1753if test "x${sh_dnmalloc_enabled}" = xno; then
1754 AC_DEFINE(USE_SYSTEM_MALLOC,1,[Define if you want to use the system malloc])
1755fi
1756
1757AC_ARG_ENABLE(ptrace,
1758 [ --enable-ptrace use anti-debugger options [[no]]],
1759 [
1760 if test "x${enable_ptrace}" = xyes; then
1761 if test "x$mydebugit" != "xyes"; then
1762 AC_DEFINE(SCREW_IT_UP)
1763 fi
1764 fi
1765 ]
1766)
1767
1768dnl
1769if test "x$GCC" = "xyes"; then
1770 if test ! -z "`echo "$CFLAGS" | grep "\-g\ " 2> /dev/null`" ; then
1771 CFLAGS=`echo $CFLAGS | sed 's%\-g%%' `
1772 fi
1773
1774dnl -W is the older name for -Wextra
1775
1776
1777 if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
1778 case "$host_os" in
1779 *solaris*)
1780 CFLAGS="$CFLAGS -Wall -W -Wno-missing-braces "
1781 ;;
1782 *)
1783 CFLAGS="$CFLAGS -Wall -W "
1784 ;;
1785 esac
1786 fi
1787
1788 if test -z "`echo "$CFLAGS" | grep "\-fstrength\-reduce" 2> /dev/null`"
1789 then
1790 if test -z "`echo "$CFLAGS" | grep "\-fno\-strength\-reduce" 2> /dev/null`"
1791 then
1792 GCC_FLAG_CHECK([-fno-strength-reduce])
1793 fi
1794 fi
1795
1796 if test -z "`echo "$CFLAGS" | grep "\-fomit\-frame\-pointer" 2> /dev/null`"
1797 then
1798 if test -z "`echo "$CFLAGS" | grep "\-fno\-omit\-frame\-pointer" 2> /dev/null`"
1799 then
1800 GCC_FLAG_CHECK([-fno-omit-frame-pointer])
1801 fi
1802 fi
1803
1804fi
1805
1806dnl Test whether gcc supports -Wno-empty-body
1807dnl Suppresses warnings from glibc pthread_cleanup_pop
1808dnl
1809GCC_FLAG_CHECK([-Wno-empty-body])
1810
1811dnl This one is for clang
1812dnl
1813GCC_FLAG_CHECK([-Wno-invalid-source-encoding])
1814
1815
1816AC_MSG_CHECKING([which random module to use])
1817AC_ARG_WITH(rnd,
1818 [ --with-rnd=[[egd|unix|dev|default]] random number generator [[default]]],
1819[use_static_rnd=$withval], [use_static_rnd=default] )
1820
1821if test "$use_static_rnd" = no; then
1822 use_static_rnd=default
1823fi
1824
1825case "$use_static_rnd" in
1826 egd | dev | unix | default )
1827 AC_MSG_RESULT($use_static_rnd)
1828 ;;
1829 * )
1830 AC_MSG_RESULT([invalid argument])
1831 AC_MSG_ERROR([Option --with-rnd=module used with unsupported module ${use_static_rnd}])
1832 ;;
1833esac
1834
1835AC_ARG_WITH(egd-socket,
1836 [ --with-egd-socket=NAME EGD socket name],
1837 egd_socket_name="$withval", egd_socket_name="" )
1838AC_DEFINE_UNQUOTED(EGD_SOCKET_NAME, _("$egd_socket_name") )
1839
1840dnl
1841dnl See whether the user wants to disable checking for /dev/random
1842
1843try_dev_random=yes
1844
1845case "$use_static_rnd" in
1846dev | default )
1847 try_dev_random=yes
1848 ;;
1849egd)
1850 AC_DEFINE(HAVE_EGD_RANDOM)
1851 try_dev_random=no
1852 ;;
1853unix)
1854 AC_DEFINE(HAVE_UNIX_RANDOM)
1855 try_dev_random=no
1856 ;;
1857esac
1858
1859
1860if test "x$try_dev_random" = "xyes"; then
1861 AC_MSG_CHECKING(whether /dev/random exists)
1862 if test -r "/dev/srandom" && test -c "/dev/srandom"; then
1863 AC_DEFINE(HAVE_URANDOM)
1864 AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, _("/dev/srandom") )
1865 AC_MSG_RESULT(yes)
1866 if test -r "/dev/urandom" && test -c "/dev/urandom"; then
1867 AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, _("/dev/urandom") )
1868 fi
1869 else
1870 if test -r "/dev/random" && test -c "/dev/random"; then
1871 AC_DEFINE(HAVE_URANDOM)
1872 AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, _("/dev/random") )
1873 AC_MSG_RESULT(yes)
1874 if test -r "/dev/urandom" && test -c "/dev/urandom"; then
1875 AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, _("/dev/urandom") )
1876 fi
1877 else
1878 AC_MSG_RESULT(no)
1879 AC_DEFINE(HAVE_UNIX_RANDOM)
1880 fi
1881 fi
1882fi
1883
1884
1885AC_ARG_ENABLE(udp,
1886 [ --enable-udp server can listen on port 514/udp [[no]]],
1887 [
1888 if test "x${enable_udp}" = xyes; then
1889 AC_DEFINE(INET_SYSLOG)
1890 fi
1891 ]
1892)
1893
1894myencrypt=yes
1895AC_ARG_ENABLE(encrypt,
1896 [ --disable-encrypt disable client/server encryption],
1897 [
1898 if test "x${enable_encrypt}" = xno; then
1899 myencrypt=no
1900 fi
1901 ]
1902)
1903if test "x${myencrypt}" = "xyes"; then
1904 AC_DEFINE(SH_ENCRYPT)
1905 AC_DEFINE(SH_ENCRYPT_2)
1906fi
1907
1908sh_use_srp_proto=yes
1909AC_ARG_ENABLE(srp,
1910 [ --disable-srp disable SRP for authentication],
1911 [
1912 if test "x${enable_srp}" = xno; then
1913 sh_use_srp_proto=no
1914 fi
1915 ]
1916)
1917if test "x${sh_use_srp_proto}" = xyes; then
1918 AC_DEFINE(USE_SRP_PROTOCOL)
1919fi
1920
1921AC_ARG_WITH(port,
1922 [ --with-port=PORT set port to use for TCP/IP connection [[49777]]],
1923 [
1924 echo "${withval}" | grep ['[^0123456789]'] >/dev/null 2>&1 &&
1925 AC_MSG_ERROR([For --with-port=PORT, PORT must be numeric.])
1926 myport=${withval}
1927 ],
1928 [myport="49777"])
1929AC_DEFINE_UNQUOTED(SH_DEFAULT_PORT, ${myport})
1930AC_SUBST(myport)
1931
1932AC_ARG_WITH(logserver,
1933 [ --with-logserver=HOST set host address for log server [[none]]],
1934 [
1935 case "$withval" in
1936 *.* | localhost)
1937 mylogsrv="$withval"
1938 ;;
1939 *)
1940 mylogsrv="$withval"
1941 ;;
1942 esac
1943 ],
1944 [mylogsrv="NULL"])
1945AC_DEFINE_UNQUOTED(DEFAULT_LOGSERVER, _("${mylogsrv}") )
1946AC_SUBST(mylogsrv)
1947
1948AC_ARG_WITH(altlogserver,
1949 [ --with-altlogserver=HOST set address for backup log server [[none]]],
1950 [
1951 case "$withval" in
1952 *.* | localhost)
1953 myaltlogsrv="$withval"
1954 ;;
1955 *)
1956 myaltlogsrv="$withval"
1957 ;;
1958 esac
1959 ],
1960 [myaltlogsrv="NULL"])
1961AC_DEFINE_UNQUOTED(ALT_LOGSERVER, _("${myaltlogsrv}"))
1962
1963
1964
1965dnl
1966dnl STEALTH OPTIONS
1967dnl
1968nocl_code=
1969xor_code=0
1970AC_ARG_ENABLE(nocl,
1971 [ --enable-nocl=PW no CL parsing unless first CL argument is PW],
1972 [
1973 if test "x${enableval}" != "x"; then
1974 AC_DEFINE(SH_STEALTH_NOCL)
1975 fi
1976 if test "x${enableval}" = "xstop" || test "x${enableval}" = "xstart"; then
1977 AC_MSG_ERROR([For --enable-nocl=PW start/stop/reload/restart/status are reserved words.])
1978 fi
1979 if test "x${enableval}" = "xreload" || test "x${enableval}" = "xrestart"; then
1980 AC_MSG_ERROR([For --enable-nocl=PW start/stop/reload/restart/status are reserved words.])
1981 fi
1982 if test "x${enableval}" = "xstatus"; then
1983 AC_MSG_ERROR([For --enable-nocl=PW start/stop/reload/restart/status are reserved words.])
1984 fi
1985 if test "x${enableval}" = "xno"; then
1986 AC_MSG_ERROR([With --enable-nocl=PW, the use of --enable-nocl=no is ambiguous.])
1987 fi
1988 nocl_code="${enable_nocl}"
1989 ]
1990)
1991AC_DEFINE_UNQUOTED(NOCL_CODE, _("${nocl_code}") )
1992AC_SUBST(nocl_code)
1993AC_ARG_ENABLE(stealth,
1994 [ --enable-stealth=XOR_VAL enable stealth mode [[no]]],
1995 [AC_DEFINE(SH_STEALTH)
1996 if test "x${enableval}" != "xyes"; then
1997 echo "${enableval}" | grep ['[^0123456789]'] >/dev/null 2>&1 &&
1998 AC_MSG_ERROR([For --enable-stealth=XOR_VAL, XOR_VAL must be numeric.])
1999 if test "${enableval}" -lt 127 || test "${enableval}" -gt 255; then
2000 if test x"${enableval}" = x0
2001 then
2002 :
2003 else
2004 AC_MSG_ERROR([For --enable-stealth=XOR_VAL, XOR_VAL must be in the range 127 to 255.])
2005 fi
2006 fi
2007 xor_code="${enable_stealth}"
2008 else
2009 xor_code=0
2010 fi
2011 stegin_prg="samhain_stealth"
2012 ],
2013 [
2014 stegin_prg=
2015 ]
2016)
2017AC_ARG_ENABLE(micro-stealth,
2018 [ --enable-micro-stealth=XOR_VAL enable micro stealth mode [[no]]],
2019 [
2020 AC_DEFINE(SH_STEALTH)
2021 AC_DEFINE(SH_STEALTH_MICRO)
2022 if test "x${enableval}" != "xyes"; then
2023 echo "${enableval}" | grep ['[^0123456789]'] >/dev/null 2>&1 &&
2024 AC_MSG_ERROR([For --enable-micro-stealth=XOR_VAL, XOR_VAL must be numeric.])
2025 if test "${enableval}" -lt 127 || test "${enableval}" -gt 255; then
2026 if test x"${enableval}" = x0
2027 then
2028 :
2029 else
2030 AC_MSG_ERROR([For --enable-micro-stealth=XOR_VAL, XOR_VAL must be in the range 127 to 255.])
2031 fi
2032 fi
2033 xor_code="${enable_micro_stealth}"
2034 else
2035 xor_code=0
2036 fi
2037 ]
2038)
2039install_name="samhain"
2040INSTALL_NAME="SAMHAIN"
2041AC_ARG_ENABLE(install-name,
2042 [ --enable-install-name=NAME name under which to install [[samhain|yule]]],
2043 [
2044 if test "x${enableval}" != "xyes"; then
2045 install_name="${enableval}"
2046 INSTALL_NAME=`echo "${enableval}" | tr [a-z] [A-Z]`
2047 else
2048 install_name="${sh_main_prg}"
2049 INSTALL_NAME=`echo "${sh_main_prg}" | tr [a-z] [A-Z]`
2050 fi
2051 ],
2052 [
2053 install_name="${sh_main_prg}"
2054 INSTALL_NAME=`echo "${sh_main_prg}" | tr [a-z] [A-Z]`
2055 ]
2056)
2057
2058
2059need_user_install=0
2060
2061AC_ARG_ENABLE(identity,
2062 [ --enable-identity=USER user if dropping root [[daemon]]],
2063 [
2064 if test x"$enableval" = xno; then
2065 myident="daemon"
2066 else
2067 myident="$enableval"
2068 fi
2069 echo "${myident}" | grep ['[^0123456789]'] >/dev/null 2>&1 || \
2070 AC_MSG_ERROR([With --enable-identity=USER, please supply a username, not a UID.])
2071 myident_uid=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
2072 grep "^${myident}:" | awk -F: '{ print $3; }'`
2073 if test x"${myident_uid}" = x; then
2074 AC_MSG_WARN([Option --enable-identity used, user ${myident} will be added upon install.])
2075 need_user_install=1
2076 fi
2077 ],
2078 [
2079 for myident in ${install_name} daemon nobody; do
2080 AC_MSG_CHECKING(for user ${myident})
2081 myident_uid=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
2082 grep "^${myident}:" | awk -F: '{ print $3; }'`
2083 if test x"${myident_uid}" != x; then
2084 AC_MSG_RESULT(yes)
2085 break;
2086 else
2087 AC_MSG_RESULT(no)
2088 fi
2089 done
2090 if test x"${myident_uid}" = x; then
2091 myident=${install_name}
2092 AC_MSG_WARN([--enable-identity: user ${myident} will be added upon install])
2093 need_user_install=1
2094 fi
2095 ])
2096AC_DEFINE_UNQUOTED(DEFAULT_IDENT, _("${myident}") )
2097AC_SUBST(myident)
2098AC_SUBST(need_user_install)
2099
2100AC_SUBST(install_name)
2101AC_SUBST(INSTALL_NAME)
2102AC_SUBST(stegin_prg)
2103AC_SUBST(xor_code)
2104
2105AC_DEFINE_UNQUOTED(XOR_CODE, ${xor_code})
2106AC_DEFINE_UNQUOTED(SH_SYSCALLTABLE, ${sh_syscalltable})
2107
2108
2109exepack_state0=`${srcdir}/c_random.sh 2>/dev/null`
2110exepack_state1=`${srcdir}/c_random.sh 2>/dev/null`
2111exepack_state2=`${srcdir}/c_random.sh 2>/dev/null`
2112
2113AC_DEFINE_UNQUOTED(EXEPACK_STATE_0, ${exepack_state0})
2114AC_DEFINE_UNQUOTED(EXEPACK_STATE_1, ${exepack_state1})
2115AC_DEFINE_UNQUOTED(EXEPACK_STATE_2, ${exepack_state2})
2116
2117
2118AC_ARG_ENABLE(suidcheck,
2119 [ --enable-suidcheck check for suid/sgid files [[no]]],
2120 [
2121 if test "x${enableval}" = "xyes"; then
2122 AC_DEFINE(SH_USE_SUIDCHK)
2123 fi
2124 ]
2125)
2126
2127
2128AC_ARG_ENABLE(base,
2129 [ --enable-base=B1,B2 base key (0...2147483647)],
2130 [
2131 AC_MSG_CHECKING(base key setting)
2132 my_key_A=`echo ${enableval} | awk 'BEGIN{FS=","}{print $1}'`
2133 my_key_B=`echo ${enableval} | awk 'BEGIN{FS=","}{print $2}'`
2134 AC_MSG_RESULT(${my_key_A} ${my_key_B})
2135 if test "x${my_key_A}" = x; then
2136 AC_MSG_ERROR([Option --enable-base=B1,B2 used with invalid first base key (zero length).])
2137 fi
2138 if test "x${my_key_B}" = x; then
2139 AC_MSG_ERROR([Option --enable-base=B1,B2 used with invalid second base key (zero length).])
2140 fi
2141 echo "${my_key_A}" | grep ['[^0123456789]'] >/dev/null 2>&1 &&
2142 AC_MSG_ERROR([For --enable-base=B1,B2, B1 and B2 must be numeric in the range 0 to 2147483647.])
2143 echo "${my_key_B}" | grep ['[^0123456789]'] >/dev/null 2>&1 &&
2144 AC_MSG_ERROR([For --enable-base=B1,B2, B1 and B2 must be numeric in the range 0 to 2147483647.])
2145 ],
2146 [
2147 AC_MSG_CHECKING(base key setting .. collecting entropy)
2148 my_key_1=`${srcdir}/c_random.sh 2>/dev/null`
2149 my_key_2=`${srcdir}/c_random.sh 2>/dev/null`
2150 my_key_3=`${srcdir}/c_random.sh 2>/dev/null`
2151 my_key_4=`${srcdir}/c_random.sh 2>/dev/null`
2152 my_key_A=`expr $my_key_1 \* 32767`
2153 my_key_A=`echo ${my_key_A} | sed 's%^0*%%g' 2>/dev/null`
2154 my_key_A=`expr $my_key_A \+ $my_key_2`
2155 my_key_B=`expr $my_key_3 \* 32767`
2156 my_key_B=`echo ${my_key_B} | sed 's%^0*%%g' 2>/dev/null`
2157 my_key_B=`expr $my_key_B \+ $my_key_4`
2158 AC_MSG_RESULT(${my_key_A} ${my_key_B})
2159 ]
2160 )
2161AC_SUBST(my_key_A)
2162AC_SUBST(my_key_B)
2163
2164dnl low bytes
2165my_key_1=`expr $my_key_A \% 65536`
2166dnl high bytes
2167my_key_2=`expr $my_key_A \/ 65536`
2168dnl low bytes
2169my_key_3=`expr $my_key_B \% 65536`
2170dnl high bytes
2171my_key_4=`expr $my_key_B \/ 65536`
2172
2173dnl echo ${my_key_1} ${my_key_2} ${my_key_3} ${my_key_4}
2174
2175dnl touch ./sh_MK.h
2176dnl echo "#ifndef SH_MK_H" >> ./sh_MK.h
2177dnl echo "#define SH_MK_H" >> ./sh_MK.h
2178dnl ${srcdir}/c_bits.sh ${my_key_1} MKB >> ./sh_MK.h
2179dnl ${srcdir}/c_bits.sh ${my_key_2} MKA >> ./sh_MK.h
2180dnl ${srcdir}/c_bits.sh ${my_key_3} MKC >> ./sh_MK.h
2181dnl ${srcdir}/c_bits.sh ${my_key_4} MKD >> ./sh_MK.h
2182dnl echo "#endif" >> ./sh_MK.h
2183AC_SUBST(my_key_1)
2184AC_SUBST(my_key_2)
2185AC_SUBST(my_key_3)
2186AC_SUBST(my_key_4)
2187
2188AC_MSG_CHECKING(key position)
2189pos_tf_1=`${srcdir}/c_random.sh 2>/dev/null`
2190pos_tf_2=`expr $pos_tf_1 \% 8`
2191pos_tf=`expr $pos_tf_2 + 1`
2192AC_MSG_RESULT(${pos_tf})
2193AC_DEFINE_UNQUOTED(POS_TF, ${pos_tf} )
2194
2195mykeybase=`echo ${my_key_A},${my_key_B}`
2196AC_DEFINE_UNQUOTED(DEFKEY, ${mykeybase} )
2197AC_SUBST(mykeybase)
2198
2199
2200dnl
2201dnl GPG/PGP options
2202dnl
2203
2204AC_ARG_WITH(gpg,
2205 [ --with-gpg=PATH use GnuPG to verify database/config [[no]]],
2206 [
2207 if test "x${withval}" != "xno"; then
2208 if test "x${cross_compiling}" = xyes; then
2209 mygpg="${withval}"
2210 else
2211 if test -f "${withval}"; then
2212 mygpg="${withval}"
2213 mychk0=`${withval} --load-extension tiger --print-md TIGER192 ${withval} 2>/dev/null`
2214 if test "x$?" != "x0"; then
2215 mychktest=no
2216 for sampre in ./samhain ./yule /usr/local/sbin/samhain /usr/local/bin/samhain /usr/bin/samhain /usr/sbin/samhain /usr/local/sbin/yule /usr/local/bin/yule /usr/bin/yule /usr/sbin/yule; do
2217 if test x"${mychktest}" = xyes
2218 then
2219 :
2220 else
2221 if test -f ${sampre}
2222 then
2223 echo "use existing ${sampre} for gpg checksum"
2224 mychk0=`${sampre} -H ${withval} 2>/dev/null`
2225 if test "x$?" != "x0"; then
2226 if test "x${nocl_code}" != "x"; then
2227 mychk0=`echo -H ${withval} | ${sampre} ${nocl_code} 2>/dev/null`
2228 if test "x$?" != "x0"; then
2229 :
2230 else
2231 mychk="${mychk0}"
2232 mychktest=yes
2233 fi
2234 fi
2235 else
2236 mychk="${mychk0}"
2237 mychktest=yes
2238 fi
2239 fi
2240 fi
2241 done
2242 if test x${mychktest} = xno; then
2243 AC_MSG_WARN([--with-gpg: cannot determine TIGER192 checksum of ${withval}])
2244 echo "-------------------------------------------------------------"
2245 echo " Your gpg binary does not support the TIGER192 checksum, "
2246 echo " and I cannot find an existing samhain binary to use instead."
2247 echo " You can:"
2248 echo " (a) run make to compile a samhain binary, then repeat"
2249 echo " ./configure and make"
2250 echo " (b) ignore the failure. The checksum of the gpg binary"
2251 echo " will not get compiled in, thus allowing an attacker"
2252 echo " to replace gpg with a trojan and subverting the gpg"
2253 echo " signature verification of configure and database files."
2254 echo
2255 echo " PLEASE IGNORE THIS MESSAGE IF YOU ALSO USE --with-checksum"
2256 echo "-------------------------------------------------------------"
2257 fi
2258 else
2259 mychk="${mychk0}"
2260 fi
2261 else
2262 AC_MSG_ERROR([--with-gpg: cannot find GnuPG PATH=${withval}])
2263 fi
2264 fi
2265 AC_DEFINE(WITH_GPG)
2266 AC_DEFINE_UNQUOTED(DEFAULT_GPG_PATH, _("${mygpg}") )
2267 AC_SUBST(mygpg)
2268 fi
2269 ]
2270)
2271
2272
2273
2274AC_ARG_WITH(keyid,
2275 [ --with-keyid=KEYID specify KeyID (0x...) for GPG/PGP functions [[none]]],
2276 [
2277 if test "x${withval}" != "x"; then
2278 echo "${withval}" | awk '{if((length($0)==10)||(length($0)==18)){exit 2}else{exit 0}}' &&
2279 AC_MSG_ERROR([--with-keyid:${withval} must be "0x" + 8|16 hex digits])
2280 echo "${withval}" | grep ['[^0][^x][^0123456789ABCDEFabcdef]'] >/dev/null 2>&1 &&
2281 AC_MSG_ERROR([--with-keyid:${withval} must be "0x" + 8|16 hex digits])
2282 mykeyid="$withval"
2283 mykeytag="--default-key"
2284 else
2285 mykeyid=""
2286 mykeytag=""
2287 fi
2288 AC_SUBST(mykeyid)
2289 AC_SUBST(mykeytag)
2290 ]
2291)
2292
2293dnl AC_ARG_WITH(pgp,
2294dnl [ --with-pgp=PATH Use PGP to verify database/config (no).],
2295dnl [myppg="$withval"
2296dnl AC_DEFINE(WITH_PGP)
2297dnl AC_DEFINE_UNQUOTED(DEFAULT_PGP_PATH, _("${myppg}") )
2298dnl ])
2299
2300AC_ARG_WITH(checksum,
2301 [ --with-checksum=CHKSUM compile in gpg/pgp checksum [[yes]]],
2302 [
2303 if test "x${withval}" != "xno"; then
2304 if test "x${withval}" != "xyes"; then
2305 if test "x${mychk}" != "x"; then
2306 if test "x${mychk}" != "x${withval}"; then
2307 AC_MSG_WARN([--with-checksum: possible gpg CHKSUM problem])
2308 AC_MSG_WARN([--with-checksum: CHKSUM=${withval}])
2309 AC_MSG_WARN([--with-checksum: autodetected=${mychk}])
2310 fi
2311 fi
2312 mychk="${withval}"
2313 else
2314 if test "x${mychk}" = "x"; then
2315 AC_MSG_ERROR([Option --with-checksum=CHKSUM: checksum CHKSUM of the gpg binary not specified.])
2316 fi
2317 fi
2318 AC_DEFINE(HAVE_GPG_CHECKSUM)
2319 AC_DEFINE_UNQUOTED(GPG_HASH, _("${mychk}") )
2320 echo "${mychk}" | sed 's,.*:,,g' | sed 's, ,,g' | sed 's,\(.\),\1:,g' | awk '{ split($0, arr, ":"); m = length($1)/2; print "#ifndef CHKSUM_H"; print "#define CHKSUM_H"; print "char gpgchk[50];"; for (i=1; i <= m; i++) printf "gpgchk[%d] = %c%s%c;\n", i-1, 39, arr[i], 39; printf "gpgchk[48] = %c%c0%c;\n", 39, 92, 39; print "#endif"; }' > sh_gpg_chksum.h
2321 fi
2322 ],
2323 [
2324 if test "x${mygpg}" != "x"; then
2325 if test "x${mychk}" != "x"; then
2326 AC_DEFINE(HAVE_GPG_CHECKSUM)
2327 AC_DEFINE_UNQUOTED(GPG_HASH, _("${mychk}") )
2328 echo "${mychk}" | sed 's,.*:,,g' | sed 's, ,,g' | sed 's,\(.\),\1:,g' | awk '{ split($0, arr, ":"); m = length($1)/2; print "#ifndef CHKSUM_H"; print "#define CHKSUM_H"; print "char gpgchk[50];"; for (i=1; i <= m; i++) printf "gpgchk[%d] = %c%s%c;\n", i-1, 39, arr[i], 39; printf "gpgchk[48] = %c%c0%c;\n", 39, 92, 39; print "#endif"; }' > sh_gpg_chksum.h
2329 fi
2330 fi
2331 ]
2332)
2333
2334AC_ARG_WITH(fp,
2335 [ --with-fp=FINGERPRINT compile in public key fingerprint [[no]]],
2336 [
2337 if test "x${withval}" != "xno"; then
2338 if test "x${withval}" != "xyes"; then
2339 withval0=`echo ${withval} | sed 's% %%g'`
2340 echo "${withval0}" | \
2341 grep ['[^0123456789abcdefABCDEF]'] >/dev/null 2>&1 &&
2342 AC_MSG_ERROR([In option --with-fp=FINGERPRINT, there is an invalid character(s) in FINGERPRINT=${withval0}.])
2343 sh_len=`echo ${withval0} | wc -c | sed 's% %%g'`
2344 sh_len0=`expr ${sh_len} \- 1`
2345 if test "x${sh_len0}" = "x40" || test "x${sh_len0}" = "x32"
2346 then
2347 myfp="${withval0}"
2348 AC_DEFINE(USE_FINGERPRINT)
2349 AC_DEFINE_UNQUOTED(SH_GPG_FP, _("${myfp}") )
2350 echo "${myfp}" | sed 's,.*:,,g' | sed 's, ,,g' | sed 's,\(.\),\1:,g' | awk '{ split($0, arr, ":"); m = length($1)/2; print "#ifndef FINGERPRINT_H"; print "#define FINGERPRINT_H"; printf "char gpgfp[%d];\n", m+1; for (i=1; i <= m; i++) printf "gpgfp[%d] = %c%s%c;\n", i-1, 39, arr[i], 39; printf "gpgfp[%d] = %c%c0%c;\n", m, 39, 92, 39; print "#endif"; }' > sh_gpg_fp.h
2351 else
2352 AC_MSG_ERROR([In option --with-fp=FINGERPRINT, the length (${sh_len0}) of FINGERPRINT ${withval0} is incorrect.])
2353 fi
2354 else
2355 AC_MSG_ERROR([For option --with-fp=FINGERPRINT, FINGERPRINT=yes is invalid, please specify a valid key fingerprint.])
2356 fi
2357 fi
2358 ])
2359
2360
2361dnl
2362dnl MAIL OPTIONS
2363dnl
2364
2365AC_ARG_WITH(recipient,
2366 [ --with-recipient=ADDR set recipient(s) for e-mail [[none]]],
2367 [
2368 withval0=`echo ${withval} | sed 's%,% %g'`
2369 for sh_item in ${withval0}
2370 do
2371 case ${sh_item} in
2372 *@localhost)
2373 ;;
2374 *@*.*)
2375 sh_tmp=`echo ${sh_item} | awk '{ if ($1 ~ [/^[a-zA-Z0-9][a-zA-Z0-9\-_\.]*@[a-zA-Z0-9\-\.]+\.([a-zA-Z]+|[0-9]+)$/]) {print 1; } else { print 0}}'`
2376 if test "x${sh_tmp}" != "x1"
2377 then
2378 AC_MSG_ERROR([Option --with-recipient=ADDR used with invalid mail address ${sh_item}.])
2379 fi
2380 ;;
2381 *)
2382 AC_MSG_ERROR([Option --with-recipient=ADDR used with invalid mail address ${sh_item}.])
2383 ;;
2384 esac
2385 done
2386 myrcp="$withval0"
2387 ],
2388 [myrcp="NULL"])
2389AC_DEFINE_UNQUOTED(DEFAULT_MAILADDRESS, _("${myrcp}") )
2390
2391
2392AC_ARG_WITH(sender,
2393 [ --with-sender=SENDER set sender for e-mail [[daemon]]],
2394 [
2395 mysender="${withval}"
2396 ],
2397 [
2398 mysender="daemon"
2399 ])
2400AC_DEFINE_UNQUOTED(DEFAULT_SENDER, _("${mysender}") )
2401
2402
2403dnl
2404dnl PATHS
2405dnl
2406
2407AC_ARG_WITH(trusted,
2408 [ --with-trusted=UID Set uid(s) of trusted users [[0]]],
2409 [
2410 sh_tmp_test=no
2411 sh_tmp=`echo ${withval} | sed 's%,% %g'`
2412 for sh_tmp1 in ${sh_tmp}
2413 do
2414 echo "${sh_tmp1}" | grep ['[^0123456789]'] >/dev/null 2>&1 &&
2415 AC_MSG_ERROR([Option --with-trusted=UID used with non-numeric UID in ${withval}.])
2416 if test "x${sh_tmp1}" = "x0"
2417 then
2418 sh_tmp_test=yes
2419 fi
2420 done
2421 if test "x${sh_tmp_test}" = "xno"
2422 then
2423 withval="0,${withval}"
2424 fi
2425 mytrust="${withval}"
2426 ],
2427 [mytrust="0"] )
2428AC_DEFINE_UNQUOTED(SL_ALWAYS_TRUSTED, ${mytrust} )
2429AC_SUBST(mytrust)
2430
2431mytmpdir=
2432
2433AC_ARG_WITH(tmp-dir,
2434 [ --with-tmp-dir=PFX set directory for temporary files [[HOME]]],
2435 [
2436 if test "x${cross_compiling}" = xyes; then
2437 mytmpdir="$withval"
2438 AC_DEFINE_UNQUOTED(SH_TMPDIR, _("${mytmpdir}") )
2439 else
2440 if test -d "${withval}"; then
2441 mytmpdir="$withval"
2442 AC_DEFINE_UNQUOTED(SH_TMPDIR, _("${mytmpdir}") )
2443 else
2444 mytmpdir="$withval"
2445 AC_DEFINE_UNQUOTED(SH_TMPDIR, _("${mytmpdir}") )
2446 AC_MSG_WARN([--with-tmp-dir: tmp directory ${withval} does not exist])
2447 fi
2448 fi
2449 ]
2450)
2451
2452AC_SUBST(mytmpdir)
2453
2454
2455dnl
2456dnl PATH DEFAULTS
2457dnl
2458
2459if test "x${ac_prefix_set}" = xyes
2460then
2461 if test "x${exec_prefix}" = xNONE
2462 then
2463 exec_prefix="${prefix}"
2464 fi
2465
2466 if test "x${prefix}" = xOPT
2467 then
2468 tmp_sbindir="/opt/${install_name}/bin"
2469 tmp_sysconfdir="/etc/opt"
2470 tmp_mandir="/opt/${install_name}/man"
2471 tmp_localstatedir="/var/opt/${install_name}"
2472 elif test "x${prefix}" = xUSR
2473 then
2474 tmp_sbindir="/usr/sbin"
2475 tmp_sysconfdir="/etc"
2476 tmp_mandir="/usr/share/man"
2477 tmp_localstatedir="/var"
2478 else
2479 tmp_sbindir=`eval echo ${sbindir}`
2480 tmp_sysconfdir=`eval echo ${sysconfdir}`
2481 tmp_mandir=`eval echo ${mandir}`
2482 tmp_localstatedir=`eval echo ${localstatedir}`
2483 fi
2484else
2485 prefix=""
2486 if test "x${ac_exec_prefix_set}" = xyes
2487 then
2488 tmp_sbindir=`eval echo ${sbindir}`
2489 else
2490 tmp_sbindir="/usr/local/sbin"
2491 fi
2492 tmp_sysconfdir="/etc"
2493 # share/man -> man (FHS) 11.10.2002
2494 tmp_mandir="/usr/local/man"
2495 tmp_localstatedir="/var"
2496fi
2497
2498
2499if test "x${ac_sbindir_set}" = xyes
2500then
2501 :
2502else
2503 sbindir=`eval echo ${tmp_sbindir}`
2504fi
2505
2506
2507if test "x${ac_sysconfdir_set}" = xyes
2508then
2509 :
2510else
2511 sysconfdir=`eval echo ${tmp_sysconfdir}`
2512fi
2513
2514if test "x${ac_mandir_set}" = xyes
2515then
2516 :
2517else
2518 mandir=`eval echo ${tmp_mandir}`
2519fi
2520
2521if test "x${ac_localstatedir_set}" = xyes
2522then
2523 :
2524else
2525 localstatedir=`eval echo ${tmp_localstatedir}`
2526fi
2527
2528
2529
2530AC_ARG_WITH(config-file,
2531 [ --with-config-file=FILE configuration file [[/etc/{install_name}rc]]],
2532 [
2533 myconffile="${withval}"
2534 changequote(<<, >>)dnl
2535 tmp=`echo ${withval} | sed 's%^REQ_FROM_SERVER%%'`
2536 sysconfdir=`echo ${tmp} | sed 's%/[^/][^/]*$%%'`
2537 myrpmconffile="${tmp}"
2538 changequote([, ])dnl
2539 ],
2540 [
2541 myconffile="${sysconfdir}/${install_name}rc"
2542 myrpmconffile="${myconffile}"
2543 ]
2544)
2545AC_DEFINE_UNQUOTED(DEFAULT_CONFIGFILE, _("${myconffile}") )
2546AC_SUBST(myconffile)
2547AC_SUBST(myrpmconffile)
2548
2549AC_ARG_WITH(log-file,
2550 [ --with-log-file=FILE path of log file [[/var/log/{install_name}_log]]],
2551 [
2552 mylogfile="$withval"
2553 changequote(<<, >>)dnl
2554 mylogdir=`echo ${withval} | sed 's%/[^/][^/]*$%%'`
2555 changequote([, ])dnl
2556 ],
2557 [
2558 if test "x${mytclient}" = "x-DSH_WITH_SERVER"; then
2559 mylogfile="${localstatedir}/log/${install_name}/${install_name}_log"
2560 mylogdir="${localstatedir}/log/${install_name}"
2561 else
2562 mylogfile="${localstatedir}/log/${install_name}_log"
2563 mylogdir="${localstatedir}/log"
2564 fi
2565 ]
2566)
2567AC_DEFINE_UNQUOTED(DEFAULT_ERRFILE, _("${mylogfile}") )
2568AC_DEFINE_UNQUOTED(DEFAULT_LOGDIR, _("${mylogdir}") )
2569AC_SUBST(mylogfile)
2570AC_SUBST(mylogdir)
2571
2572AC_ARG_WITH(pid-file,
2573 [ --with-pid-file=FILE set path of pid file [[/var/run/{install_name}.pid]]],
2574 [
2575 mylockfile="$withval"
2576 changequote(<<, >>)dnl
2577 mylockdir=`echo ${withval} | sed 's%/[^/][^/]*$%%'`
2578 changequote([, ])dnl
2579 ],
2580 [
2581 if test -h /var/run && test -d /run; then
2582 mylockfile="/run/${install_name}.pid"
2583 mylockdir="/run"
2584 else
2585 mylockfile="${localstatedir}/run/${install_name}.pid"
2586 mylockdir="${localstatedir}/run"
2587 fi
2588 ]
2589)
2590AC_DEFINE_UNQUOTED(DEFAULT_ERRLOCK, _("${mylockfile}") )
2591AC_DEFINE_UNQUOTED(DEFAULT_PIDDIR, _("${mylockdir}") )
2592AC_SUBST(mylockfile)
2593AC_SUBST(mylockdir)
2594
2595AC_ARG_WITH(state-dir,
2596 [ --with-state-dir=PFX set state data directory [[/var/lib/{install_name}]]],
2597 [
2598 mydataroot="$withval"
2599 ],
2600 [
2601 mydataroot="${localstatedir}/lib/${install_name}"
2602 ]
2603 )
2604AC_ARG_WITH(data-file,
2605 [ --with-data-file=FILE set path of data file],
2606 [
2607 mydatafile="$withval"
2608 changequote(<<, >>)dnl
2609 tmp=`echo ${withval} | sed 's%^REQ_FROM_SERVER%%'`
2610 mydataroot=`echo ${tmp} | sed 's%/[^/][^/]*$%%'`
2611 myrpmdatafile="${tmp}"
2612 changequote([, ])dnl
2613 if test x"${tmp}" = x
2614 then
2615 echo "No local path in data file ${withval}"
2616 echo "This will not work for initializing the database."
2617 if test x"${withval}" = xREQ_FROM_SERVER
2618 then
2619 echo "It should be REQ_FROM_SERVER/some/local/path"
2620 fi
2621 AC_MSG_ERROR([Option --with-data-file=FILE used with invalid path ${withval}.])
2622 fi
2623 ],
2624 [
2625 mydatafile="${mydataroot}/${install_name}_file"
2626 myrpmdatafile="${mydatafile}"
2627 ])
2628AC_DEFINE_UNQUOTED(DEFAULT_DATA_FILE, _("${mydatafile}") )
2629AC_SUBST(mydatafile)
2630AC_SUBST(myrpmdatafile)
2631
2632AC_DEFINE_UNQUOTED(DEFAULT_DATAROOT, _("${mydataroot}") )
2633AC_SUBST(mydataroot)
2634
2635AC_DEFINE_UNQUOTED(DEFAULT_QDIR, _("${mydataroot}/.quarantine") )
2636AC_SUBST(myqdir)
2637
2638
2639AC_ARG_WITH(html-file,
2640 [ --with-html-file=FILE set path of html file,],
2641 [
2642 myhtmlfile="$withval"
2643 ],
2644 [
2645 myhtmlfile="${mylogdir}/${install_name}.html"
2646 ])
2647AC_DEFINE_UNQUOTED(DEFAULT_HTML_FILE, _("${myhtmlfile}") )
2648AC_SUBST(myhtmlfile)
2649
2650
2651mydefargs=$ac_configure_args
2652# if test -z "`echo "$mydefargs" | grep "\-\-enable\-static" 2> /dev/null`"
2653# then
2654# mydefargs="--enable-static $mydefargs"
2655# fi
2656if test -z "`echo "$mydefargs" | grep "\-\-enable\-base" 2> /dev/null`"
2657then
2658 mydefargs="--enable-base=${mykeybase} $mydefargs"
2659fi
2660AC_SUBST(mydefargs)
2661
2662
2663AC_DEFINE_UNQUOTED(SH_INSTALL_DIR, _("${sbindir}"))
2664AC_DEFINE_UNQUOTED(SH_INSTALL_PATH, _("${sbindir}/${install_name}"))
2665AC_DEFINE_UNQUOTED(SH_INSTALL_NAME, _("${install_name}"))
2666
2667AC_CONFIG_HEADER(config.h)
2668
2669AC_OUTPUT(
2670[
2671Makefile
2672samhain-install.sh
2673init/samhain.startLSB
2674init/samhain.startLinux
2675init/samhain.startGentoo
2676init/samhain.startFreeBSD
2677init/samhain.startSolaris
2678init/samhain.startHPUX
2679init/samhain.startIRIX
2680init/samhain.startMACOSX
2681samhain.spec
2682rules.deb
2683rules.deb-light
2684hp_ux.psf
2685scripts/logrotate
2686scripts/samhain.spec
2687scripts/redhat_i386.client.spec
2688scripts/samhain.ebuild
2689scripts/samhain.ebuild-light
2690scripts/samhainadmin.pl
2691scripts/yuleadmin.pl
2692scripts/check_samhain.pl
2693deploy.sh
2694],
2695[
2696echo timestamp > stamp-h
2697chmod +x samhain-install.sh
2698chmod +x scripts/samhainadmin.pl
2699chmod +x scripts/yuleadmin.pl
2700chmod +x scripts/check_samhain.pl
2701]
2702)
2703
2704chmod +x deploy.sh
2705
2706if test "x${cross_compiling}" = xyes
2707then
2708
2709echo "--------------------------------------------------------------"
2710echo
2711echo "You are using a cross-compiler. The following system dependent"
2712echo "values may have been set to default values that may be"
2713echo "incorrect for your target system: "
2714echo
2715echo "ac_cv_c_bigendian bigendian byte order ${ac_cv_c_bigendian}"
2716echo "ac_cv_c_long_double long double exists ${ac_cv_c_long_double}"
2717echo "ac_cv_sizeof_char_p size of pointer to char ${ac_cv_sizeof_char_p}"
2718echo "ac_cv_sizeof_char_p size of size_t ${ac_cv_sizeof_size_t}"
2719echo "ac_cv_sizeof_unsigned_int size of unsigned int ${ac_cv_sizeof_unsigned_int}"
2720echo "ac_cv_sizeof_unsigned_long size of unsigned long ${ac_cv_sizeof_unsigned_long}"
2721echo "ac_cv_sizeof_unsigned_short size of unsigned short ${ac_cv_sizeof_unsigned_short}"
2722echo
2723echo "If these values are incorrect, change them in the file "
2724echo "config.cache and run configure again."
2725echo
2726echo "--------------------------------------------------------------"
2727
2728fi
2729
2730if test x${silent} != xyes
2731then
2732
2733 # A=`eval echo ${sbindir}` ; A=`eval echo ${A}`
2734 # B=`eval echo ${myconffile}` ; B=`eval echo ${B}`
2735 # C=`eval echo ${mandir}` ; C=`eval echo ${C}`
2736 # D=`eval echo ${mylockfile}` ; D=`eval echo ${D}`
2737 # E=`eval echo ${mylogfile}` ; E=`eval echo ${E}`
2738 # F=`eval echo ${mydataroot}` ; F=`eval echo ${F}`
2739
2740 echo
2741 echo " samhain has been configured as follows:"
2742 echo " System binaries: ${sbindir}"
2743 echo " Configuration file: ${myconffile}"
2744 echo " Manual pages: ${mandir}"
2745 echo " Data directory: ${mydataroot}"
2746 echo " Database file: ${mydatafile}"
2747 echo " PID file: ${mylockfile}"
2748 echo " Log file: ${mylogfile}"
2749 echo " Base key: ${mykeybase}"
2750 if test x"$mykeyid" != x
2751 then
2752 echo " target GPG/PGP key: ${mykeyid}"
2753 fi
2754 echo
2755 if test x"$mytclient" = x"-DSH_WITH_SERVER"
2756 then
2757 echo " Selected rc file: yulerc"
2758 else
2759 echo " Selected rc file: samhainrc.${selectconfig}"
2760 fi
2761
2762fi
2763
Note: See TracBrowser for help on using the repository browser.