source: trunk/configure.ac@ 190

Last change on this file since 190 was 188, checked in by katerina, 16 years ago

Release 2.5.0

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