source: trunk/configure.ac@ 386

Last change on this file since 386 was 384, checked in by katerina, 13 years ago

Fix for ticket #282 (compile issues on FreeBSD).

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