source: trunk/configure.ac@ 226

Last change on this file since 226 was 226, checked in by katerina, 16 years ago

Fix for ticket #151 (incorrect hostname insertion into db when relaying).

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