source: trunk/configure.ac@ 191

Last change on this file since 191 was 191, checked in by katerina, 17 years ago

Patch for GnuPG key ID by Jim Dutton

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