source: trunk/configure.ac@ 524

Last change on this file since 524 was 522, checked in by katerina, 8 years ago

Fix for ticket #417 (bus error on Solaris/SPARC).

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