source: trunk/configure.ac@ 543

Last change on this file since 543 was 539, checked in by katerina, 6 years ago

Fixes for tickets #431 (OpenBSD compatibility) and #432 (compiler warnings).

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