source: trunk/configure.ac@ 254

Last change on this file since 254 was 252, checked in by katerina, 15 years ago

Add code to check for stale file records on close() and fclose(), fix sl_close() to handle open stream (ticket #163).

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