source: trunk/configure.ac@ 234

Last change on this file since 234 was 233, checked in by katerina, 15 years ago

Documentation update

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