dnl $CoreSDI: configure.in,v 1.158 2002/03/04 22:17:57 alejo Exp $ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/syslogd.c) AC_CONFIG_HEADER(src/config.h) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET dnl Do some AIX stuff before AC_AIX dnl Checks for libraries. dnl Checks for header files. AC_HEADER_DIRENT dnl This will be needed by later ports dnl AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h paths.h strings.h inttypes.h sys/ioctl.h \ sys/types.h sys/time.h machine/endian.h syslog.h unistd.h sysctl.h \ err.h sys/context.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM dnl Checks for library functions. AC_CHECK_LIB(dl, dlopen, SYSLOGD_LIBS="$SYSLOGD_LIBS -ldl") AC_CHECK_LIB(socket, connect, SYSLOGD_LIBS="$SYSLOGD_LIBS -lsocket") AC_CHECK_LIB(nsl, gethostbyname, SYSLOGD_LIBS="$SYSLOGD_LIBS -lnsl") AC_DEFINE(SYSLOGD_LIBS, $SYSLOGD_LIBS) AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL dnl It should have strftime! dnl AC_FUNC_STRFTIME AC_FUNC_VPRINTF LIBS_SAVE="$LIBS" LIBS="$LIBS $SYSLOGD_LIBS" AC_CHECK_FUNCS(gethostname inet_ntop getaddrinfo regcomp poll select\ socket strdup strerror strstr strtoul inet_aton inet_addr ) LIBS="$LIBS_SAVE" dnl Check endianness AC_C_BIGENDIAN dnl dnl Here are our checks... dnl if test "x$GCC" = "xyes" then CFLAGS="$CFLAGS -Wall" fi MSYSLOG_VERSION="1.08g" AC_DEFINE_UNQUOTED(MSYSLOG_VERSION_STR, "$MSYSLOG_VERSION") echo msyslog version... $MSYSLOG_VERSION MLIBNAME="libmsyslog.so.$MSYSLOG_VERSION" ; AC_DEFINE_UNQUOTED(MLIBNAME_STR, "$MLIBNAME") MANPAGES="syslog.conf.5 syslogd.8" if test "x$prefix" = "xNONE" then prefix=$ac_default_prefix fi AC_DEFINE_UNQUOTED(INSTALL_LIBDIR, "$prefix/lib/alat") AC_MSG_CHECKING(wheter optreset is needed) AC_TRY_LINK([#include ], [extern int optreset; optreset = 1;], [AC_DEFINE(HAVE_OPTRESET) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) AC_MSG_CHECKING(pidfile directory) for dir in "/var/run" "/etc" do if test -d $dir ; then break fi done AC_MSG_RESULT(root-mode pid file will go in $dir) AC_DEFINE_UNQUOTED(PID_DIR, "$dir") dnl search mandir for non bsd systems for MANDIR in "/usr/share/man" "/usr/man" do if test -d $MANDIR ; then mandir=$MANDIR; break; fi done dnl Check underscore requirement for dlsym() AC_MSG_CHECKING(wether netdb.h requires _USE_IRS) if grep _USE_IRS /usr/include/netdb.h >/dev/null ;then AC_DEFINE(_USE_IRS) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(if sigaltstack uses stack_t structure) AC_EGREP_HEADER(stack_t, [signal.h],[ AC_DEFINE(SIGALTSTACK_WITH_STACK_T) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING(for daemon name) MSYSLOG_DAEMON_NAME="syslogd"; AC_ARG_WITH(daemon-name, [ --with-daemon-name Set a different daemon name, instead of syslogd ],[ if test "X$withval" = "Xyes" ; then error_tmp="You have to specify a value, --with-daemon-name"; AC_MSG_ERROR("$error_tmp") else MSYSLOG_DAEMON_NAME="$withval"; fi ]) AC_MSG_RESULT("$MSYSLOG_DAEMON_NAME") AC_ARG_WITH(maximum-optimization, [ --without-maximum-optimization Activate maximum possible compile and link optimization ],[ maxopt="yes"; ],[ maxopt="no"; ]) MAIN_CPPFLAGS=""; UNAME=`uname` if test "$UNAME" = "OpenBSD" ; then AC_DEFINE(DLOPEN_FLAGS, RTLD_LAZY) AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "_") SHARED_PARAMS="-Bshareable" DCCFLAGS="-fPIC" elif test "$UNAME" = "Linux" ; then AC_DEFINE(DLOPEN_FLAGS, RTLD_LAZY | RTLD_GLOBAL) AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "") MAIN_CPPFLAGS="-Xlinker -E"; SHARED_PARAMS="-Bshareable" DCCFLAGS="" AC_DEFINE(_GNU_SOURCE, 1) elif test "$UNAME" = "SunOS" ; then AC_DEFINE(DLOPEN_FLAGS, RTLD_LAZY) AC_DEFINE(_REENTRANT) AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "") SHARED_PARAMS="-G" DCCFLAGS="-fPIC" elif test "$UNAME" = "IRIX" -o "$UNAME" = "IRIX64" ; then AC_DEFINE(DLOPEN_FLAGS, RTLD_LAZY) AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "") AC_DEFINE(INET6) CFLAGS="-D_BSD_SIGNALS" if test "x$GCC" == "xyes" then DCCFLAGS="-Bshared" else if test "x$maxopt" = "xyes" then CFLAGS="$CFLAGS -g3 -Ofast" fi fi SHARED_PARAMS="-shared -soname $MLIBNAME -all" elif test "$UNAME" = "AIX" ; then AC_DEFINE(DLOPEN_FLAGS, RTLD_LAZY | RTLD_GLOBAL) AC_DEFINE(NEEDS_DLOPEN_NULL) AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "") DCCFLAGS="-shared" SHARED_PARAMS="-lc -bI:libmsyslog.imp -bexpall -bnoentry -brtl" cat > src/modules/libmsyslog.imp <<-EOF #! . dprintf logerror add_fd_input place_signal remove_fd_input printline EOF SYSLOGD_LIBS="$SYSLOGD_LIBS -Wl,-bexpall" else AC_MSG_WARN(cannot determine system type falling to defaults) AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "") AC_DEFINE(DLOPEN_FLAGS, RTLD_LAZY) SHARED_PARAMS="-Bshareable" fi # Name of pidfile if test "$UNAME" = "Linux" ; then AC_DEFINE(PID_FILE, "syslogd.pid") else AC_DEFINE(PID_FILE, "syslog.pid") fi dnl dnl Here we check module support dnl temp_res="no"; AC_ARG_WITH(bsd, [ --without-bsd Use bsd input module. Automatically detected. ],[ temp_res="$with_bsd"; ],[ if test "$UNAME" = "OpenBSD" -o "$UNAME" = "NetBSD" \ -o "$UNAME" = "FreeBSD" -o "$UNAME" = "BSDi" \ -o "$UNAME" = "386BSD" -o "$UNAME" = "ArchBSD" \ -o "$UNAME" = "TrustedBSD" ; then temp_res="yes"; fi ]) if test "X$temp_res" = "Xyes" ; then MSRCS="$MSRCS im_bsd.c"; MANPAGES="$MANPAGES im_bsd.8"; AC_DEFINE(HAVE_BSD_IMODULE) fi AC_ARG_WITH(linux, [ --without-linux Use linux kernel input module. Automatically detected. ],[ if test "$with_linux" = "yes" ; then MSRCS="$MSRCS im_linux.c" MANPAGES="$MANPAGES im_linux.8" AC_DEFINE(HAVE_LINUX_IMODULE) fi ],[ AC_CHECK_HEADER(sys/klog.h, [ MSRCS="$MSRCS im_linux.c" MANPAGES="$MANPAGES im_linux.8" AC_DEFINE(HAVE_LINUX_IMODULE) ]) ]) temp_res="no"; AC_ARG_WITH(udp, [ --without-udp Use udp socket input module. Activated by default. ],[ temp_res="$with_udp"; ],[ AC_CHECK_HEADER(sys/socket.h, [ temp_res="yes"; ]) ]) if test "X$temp_res" = "Xyes" ; then MSRCS="$MSRCS im_udp.c om_udp.c" MANPAGES="$MANPAGES im_udp.8 om_udp.8"; fi temp_res="yes"; AC_ARG_WITH(unix, [ --without-unix Use unix socket domain input module. Activated by default. ],[ temp_res="$with_unix"; ],[ AC_CHECK_HEADER(sys/un.h, [ temp_res="yes"; ]) ]) if test "X$temp_res" = "Xyes" ; then MSRCS="$MSRCS im_unix.c" AC_DEFINE(HAVE_UNIX_IMODULE) MANPAGES="$MANPAGES im_unix.8" fi temp_res="yes"; AC_ARG_WITH(file, [ --without-file Use file/pip input module. Activated by default. ],[ temp_res="$with_file"; ]) if test "X$temp_res" = "Xyes" ; then MSRCS="$MSRCS im_file.c" AC_DEFINE(HAVE_FILE_IMODULE) MANPAGES="$MANPAGES im_file.8" fi dnl Doors should only be used with streams temp_res=no AC_ARG_WITH(streams, [ --without-streams Use streams input module. Activated by default. ],[ if test "$with_streams" = "yes" ; then temp_res="yes" fi ],[ AC_CHECK_HEADER(sys/strlog.h, strlog_h="yes", strlog_h="no") AC_CHECK_HEADER(door.h, door_h="yes", door_h="no") if test "$strlog_h" = "yes" -a "$door_h" = "yes" ; then temp_res="yes" fi ]) if test "$temp_res" = "yes" ; then MSRCS="$MSRCS im_streams.c" MLIBS="$MLIBS -lpthread" MANPAGES="$MANPAGES im_streams.8" SYSLOGD_LIBS="$SYSLOGD_LIBS -lthread -ldoor" AC_DEFINE(HAVE_STREAMS_IMODULE) fi AC_MSG_CHECKING(for streams module) AC_MSG_RESULT($temp_res) temp_res=no AC_ARG_WITH(classic, [ --without-classic Use classic output module. Activated by default. ],[ temp_res="$with_classic"; ],[ temp_res="yes"; ],[ ]) if test "X$temp_res" = "Xyes" ; then MSRCS="$MSRCS om_classic.c ttymsg.c" MANPAGES="$MANPAGES om_classic.8" fi AC_ARG_WITH(tcp, [ --without-tcp Use tcp input and output modules. Activated by default. ],[ if test $with_tcp = "yes" ; then MSRCS="$MSRCS om_tcp.c im_tcp.c ip_misc.c" MANPAGES="$MANPAGES om_tcp.8 im_tcp.8" temp_res="yes" else temp_res="no" fi ],[ MSRCS="$MSRCS om_tcp.c im_tcp.c ip_misc.c" MANPAGES="$MANPAGES om_tcp.8 im_tcp.8" temp_res="yes" ]) if test "$temp_res" = "yes" ; then AC_EGREP_HEADER(sa_len, [#include ], AC_DEFINE(HAVE_SOCKADDR_SA_LEN)) fi AC_ARG_WITH(mysql, [ --without-mysql Use mysql MySQL output module. Activated by default. ],[ if test $with_mysql = "yes" ; then MSRCS="$MSRCS om_mysql.c" MANPAGES="$MANPAGES om_mysql.8" fi ],[ MSRCS="$MSRCS om_mysql.c" MANPAGES="$MANPAGES om_mysql.8" USESQL="yes" ]) AC_ARG_WITH(pgsql, [ --without-pgsql Use pgsql PostgreSQL output module. Activated by default. ],[ if test $with_pgsql = "yes" ; then MSRCS="$MSRCS om_pgsql.c" MANPAGES="$MANPAGES om_pgsql.8" fi ],[ MSRCS="$MSRCS om_pgsql.c" MANPAGES="$MANPAGES om_pgsql.8" USESQL="yes" ]) if test "$USESQL" = "yes" ; then MSRCS="$MSRCS sql_misc.c" fi AC_ARG_WITH(peo, [ --without-peo Use peo log integrity verification module. Activated by default. ],[ if test $with_peo = "yes" ; then PEO=yes else PEO=no fi ],[ PEO=yes ]) HASH_SRCS=""; if test $PEO = "yes" ; then MSRCS="$MSRCS om_peo.c" MANPAGES="$MANPAGES om_peo.8 peochk.8" HASH_SRCS="hash.c"; HASH_SRCS_MODULES="../peo/hash.c"; HASH_OBJS_MODULES="hash.o"; AC_CHECK_FUNC(MD5Init, AC_DEFINE(HAVE_MD5), HASH_SRCS="$HASH_SRCS md5c.c"; HASH_SRCS_MODULES="$HASH_SRCS_MODULES ../peo/md5c.c"; HASH_OBJS_MODULES="$HASH_OBJS_MODULES md5c.o"; ) AC_CHECK_FUNC(SHA1Init, AC_DEFINE(HAVE_SHA1), HASH_SRCS="$HASH_SRCS sha1.c"; HASH_SRCS_MODULES="$HASH_SRCS_MODULES ../peo/sha1.c"; HASH_OBJS_MODULES="$HASH_OBJS_MODULES sha1.o"; ) AC_CHECK_FUNC(RMD160Init, AC_DEFINE(HAVE_RMD160), HASH_SRCS="$HASH_SRCS rmd160.c"; HASH_SRCS_MODULES="$HASH_SRCS_MODULES ../peo/rmd160.c"; HASH_OBJS_MODULES="$HASH_OBJS_MODULES rmd160.o"; ) if test -r /dev/srandom ; then AC_DEFINE(HAVE_SRANDOM) fi fi AC_ARG_WITH(regex, [ --without-regex Use regex pattern matching output module. Activated by default. ],[ if test $with_regex = "yes" ; then MSRCS="$MSRCS om_regex.c" MANPAGES="$MANPAGES om_regex.8" fi ],[ AC_CHECK_HEADER(regex.h, [ MSRCS="$MSRCS om_regex.c" MANPAGES="$MANPAGES om_regex.8" ]) ]) AC_CACHE_SAVE AC_CHECK_TYPES(socklen_t,,,[#include #include #include ]) AC_CHECK_TYPES(uint32_t) AC_CHECK_TYPES(uint64_t) AC_CHECK_TYPES(u_int32_t) AC_CHECK_TYPES(u_int64_t) AC_CHECK_TYPES(__uint32_t) AC_CHECK_TYPES(__uint64_t) AC_CHECK_TYPES(CODE,,,[#include #define SYSLOG_NAMES #include ]) AC_SUBST(SYSLOGD_LIBS) AC_SUBST(SHARED_PARAMS) AC_SUBST(DCCFLAGS) AC_SUBST(MSRCS) AC_SUBST(MLIBS) AC_SUBST(MLIBNAME) AC_SUBST(MANPAGES) AC_SUBST(HASH_SRCS) AC_SUBST(HASH_SRCS_MODULES) AC_SUBST(HASH_OBJS_MODULES) AC_SUBST(HAVE_SOCKLEN_T) AC_SUBST(MAIN_CPPFLAGS) AC_SUBST(MSYSLOG_DAEMON_NAME) AC_SUBST(MSYSLOG_VERSION) dnl AC_SUBST(SYMBOL_PREFIX) AC_OUTPUT([Makefile src/Makefile src/modules/Makefile src/peo/Makefile src/man/Makefile src/man/BSDmakefile src/man/GNUmakefile packaging/Makefile packaging/OpenBSD/Makefile packaging/OpenBSD/pkg/PLIST packaging/OpenBSD-devel/Makefile])