source: branches/samhain_3_1/configure.ac@ 583

Last change on this file since 583 was 477, checked in by katerina, 9 years ago

Update version number. Final 3.1.6 version.

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