source: trunk/configure.ac@ 494

Last change on this file since 494 was 491, checked in by katerina, 9 years ago

Fix for ticket #389 (libwrap) and #390 (update on FreeBSD).

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