source: trunk/configure.ac@ 171

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

Include dnmalloc (ticket #108) and fix bugs #106 (EINPROGRESS) and #107 (compressBound).

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