source: trunk/configure.ac@ 204

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

Fix compile failures on RHEL3 (ticket #130) and FreeBSD7 amd64 (ticket #131).

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