source: trunk/configure.ac@ 199

Last change on this file since 199 was 196, checked in by katerina, 16 years ago

New option SetDropCache ([false]/true) to drop checksummed files from file cache.

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