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