source: trunk/configure.ac@ 575

Last change on this file since 575 was 572, checked in by katerina, 3 years ago

Fix for ticket #460 (gcc11 vs dnmalloc).

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