1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4
5AC_PREREQ(2.59)
6AC_INIT(atslog, 2.1.1, samm@os2.kiev.ua)
7
8
9AC_CONFIG_SRCDIR([atslogd/atslogd.h])
10#AC_CONFIG_HEADER([config.h])
11
12# Checks for programs.
13AC_PROG_CC
14AC_PROG_MAKE_SET
15AC_PATH_PROGS(RM,rm,rm)
16AC_PATH_PROGS(CP,cp,cp)
17AC_PATH_PROGS(MKDIR,mkdir,mkdir)
18AC_PATH_PROGS(ECHO,echo,echo)
19
20AC_PROG_PERL_VERSION(5,,AC_MSG_ERROR(atslog require perl>=5.0.0))
21AC_PROG_PERL_MODULES(Sys::Syslog,,AC_MSG_ERROR(atslog requires SYS:Syslog))
22AC_PROG_PERL_MODULES(DBI,,AC_MSG_ERROR(atslog requires DBI))
23AC_PROG_PERL_MODULES(POSIX,,AC_MSG_ERROR(atslog requires POSIX))
24
25
26AC_ARG_VAR(ATSLOG_DB_HOST,[Hostname where ATSlog database located])
27AC_ARG_VAR(ATSLOG_DB_NAME,[Name of ATSlog database])
28AC_ARG_VAR(ATSLOG_DB_USER,[Name of ATSlog database user])
29AC_ARG_VAR(ATSLOG_DB_PASS,[Password of ATSlog database user])
30
31
32if test "$ATSLOG_DB_HOST" == ""; then
33    AC_SUBST(ATSLOG_DB_HOST,[localhost])
34fi
35if test "$ATSLOG_DB_NAME" == ""; then
36    AC_SUBST(ATSLOG_DB_NAME,[atslog])
37fi
38
39if test "$ATSLOG_DB_USER" == ""; then
40    AC_SUBST(ATSLOG_DB_USER,[atslog])
41fi
42
43
44dnl
45dnl WWW root directory
46dnl
47AC_ARG_WITH(wwwroot, AC_HELP_STRING([--with-wwwroot=DIR], [Set the WWW root directory]),
48	  WWW_ROOT="$withval", WWW_ROOT="$localstatedir/www")
49
50AC_SUBST(WWW_ROOT)
51
52#if test "$WWW_ROOT" == ""; then
53#    AC_SUBST(WWW_ROOT,[$(prefix)/www])
54#fi
55
56# Checks for header files.
57AC_HEADER_STDC
58AC_HEADER_SYS_WAIT
59AC_CHECK_HEADERS([arpa/inet.h arpa/telnet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h termios.h unistd.h])
60AC_CHECK_HEADERS(tcpd.h)
61
62# Checks for typedefs, structures, and compiler characteristics.
63AC_TYPE_PID_T
64AC_STRUCT_TM
65
66# Checks for library functions.
67AC_FUNC_FORK
68AC_FUNC_MALLOC
69AC_FUNC_STRFTIME
70AC_FUNC_VPRINTF
71AC_CHECK_FUNCS([bzero gethostbyname inet_ntoa memset socket strcasecmp strchr strerror strncasecmp strspn])
72
73# Disable use of libwrap (TCP wrappers)
74# it should be the last check!
75AC_MSG_CHECKING([whether to disable TCP wrappers library support])
76AC_ARG_ENABLE(libwrap,
77[  --disable-libwrap       Disable TCP wrappers library support],
78    [AC_MSG_RESULT([yes])],
79    [
80        AC_MSG_RESULT([no (autodetecting)])
81        AC_MSG_CHECKING([for hosts_access in -lwrap])
82        saved_LIBS="$LIBS"
83        LIBS="$saved_LIBS -lwrap"
84        AC_LINK_IFELSE(
85            [AC_LANG_PROGRAM(
86                [[int hosts_access(); int allow_severity, deny_severity;]],
87                [[hosts_access()]]
88            )],
89            [AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_LIBWRAP)],
90            [AC_MSG_RESULT([no]); LIBS="$saved_LIBS"]
91        )
92    ]
93)
94
95
96AC_CONFIG_FILES(
97[Makefile atslogd/Makefile
98include/atslogcleardb.pl include/atslogdb.pl include/atslogmaster
99]
100)
101
102AC_OUTPUT
103AC_CONFIG_COMMANDS_POST[chmod +x include/atslogcleardb.pl include/atslogdb.pl include/atslogmaster]
104