source: trunk/configure.ac@ 255

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

Add --disable-ssp configure option (ticket #172).

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