source: trunk/configure.ac@ 274

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

Fixes tickets #190, #191, #192, #193, and #194.

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