piler/configure.in

558 lines
13 KiB
Plaintext
Raw Normal View History

2011-11-14 15:57:52 +01:00
AC_INIT
AC_CONFIG_SRCDIR([src/piler.c])
AC_CONFIG_HEADER(piler-config.h)
CONFIGURE_PARAMS_FILE=params.h
2012-08-10 14:07:50 +02:00
PARAMS=$@
2011-11-14 15:57:52 +01:00
dnl Checks for programs.
AC_PROG_CC
dnl AM_PROG_CC_STDC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/socket.h sys/time.h syslog.h signal.h ctype.h unistd.h)
AC_SUBST(defs)
AC_SUBST(INCDIR)
AC_SUBST(LIBDIR)
AC_SUBST(OBJS)
AC_SUBST(RUNNING_USER)
AC_SUBST(SUBDIRS)
AC_SUBST(MAKE)
2013-05-16 22:13:46 +02:00
AC_SUBST(sql_includes)
AC_SUBST(sql_libs)
AC_SUBST(sql_obj)
2011-11-14 15:57:52 +01:00
AC_SUBST(libclamav_extra_libs)
AC_SUBST(id_bin)
2012-02-11 23:12:30 +01:00
AC_SUBST(iv)
2011-11-14 15:57:52 +01:00
have_libclamav="no"
have_libtool="no"
have_clamd="no"
have_antivirus="no"
have_mysql="no"
2013-05-16 22:13:46 +02:00
have_psql="no"
2012-01-07 00:00:36 +01:00
have_tre="no"
have_zip="no"
2011-11-14 15:57:52 +01:00
have_zlib="no"
have_tcpwrappers="no"
have_tweak_sent_time="no"
2011-11-14 15:57:52 +01:00
2012-09-07 15:08:50 +02:00
pdftotext="no"
catdoc="no"
catppt="no"
ppthtml="no"
xls2csv="no"
2012-09-14 15:03:00 +02:00
unrtf="no"
2013-09-11 09:19:29 +02:00
tnef="no"
2012-09-07 15:08:50 +02:00
timeout_binary=""
2011-11-14 15:57:52 +01:00
have_static_build="no"
2015-02-01 10:40:18 +01:00
have_compat_storage_layout="no"
2011-11-14 15:57:52 +01:00
2012-10-27 14:40:25 +02:00
antispam_libs="-lz -lm -ldl -lcrypto -lssl"
2011-11-14 15:57:52 +01:00
defs=""
objs=""
user_obj=""
2013-05-16 22:13:46 +02:00
sql_obj=""
2011-11-14 15:57:52 +01:00
os=`uname -s`
id_bin="id"
MAKE="make"
if test "$os" = "SunOS"; then MAKE="gmake"; fi
rm -f $CONFIGURE_PARAMS_FILE
LDD_VERSION=`ldd --version | head -1`
GCC_VERSION=''
if test -f `which gcc`; then gcc -v 2> aa; GCC_VERSION=`tail -1 aa`; rm -f aa; fi
if test "$os" = "SunOS"; then
echo "#define CONFIGURE_PARAMS \"Build Date: "`date`'\\n" \\' > $CONFIGURE_PARAMS_FILE
else
echo "#define CONFIGURE_PARAMS \"Build Date: "`date`"\\nldd version: $LDD_VERSION\\ngcc version: $GCC_VERSION\\nOS: "`uname -a`"\n"\" \\ > $CONFIGURE_PARAMS_FILE
fi
echo "\"Configure command: ./configure $PARAMS\"" >> $CONFIGURE_PARAMS_FILE
2015-11-27 12:17:19 +01:00
SUBDIRS="src etc util init.d unit_tests"
2011-11-14 15:57:52 +01:00
dnl static build
AC_ARG_ENABLE(static-build,
[ --enable-static-build build statically linked executables (default: dynamically linked)], have_static_build=$enableval, have_static_build="no")
2015-02-01 10:40:18 +01:00
dnl
AC_ARG_ENABLE(compat-layout,
[ --enable-compat-layout support for older storage layout (default: no)], have_compat_storage_layout=$enableval, have_compat_storage_layout="no")
2011-11-14 15:57:52 +01:00
dnl clamd
AC_ARG_ENABLE(clamd,
[ --enable-clamd build clamd antivirus support], want_clamd=$enableval, want_clamd="no")
if test "$want_clamd" = "yes"; then
have_clamd="yes"
have_antivirus="yes"
fi
2012-01-07 00:00:36 +01:00
AC_ARG_ENABLE(memcached,
[ --enable-memcached build memcached support], want_memcached=$enableval, want_memcached="no")
2011-11-14 15:57:52 +01:00
AC_ARG_ENABLE(tcpwrappers,
2012-11-02 12:12:58 +01:00
[ --enable-tcpwrappers build tcpwrappers support], want_tcpwrappers=$enableval, want_tcpwrappers="no")
if test "$want_tcpwrappers" = "yes"; then
AC_CHECK_HEADERS(tcpd.h, have_tcpwrappers=yes, have_tcpwrappers=no)
AC_CHECK_LIB([wrap],[hosts_access],[AC_CHECK_LIB(wrap, hosts_access, have_tcpwrappers=yes, echo "libwrap is not found"; have_tcpwrappers=no)],[],[])ac_cv_lib_wrap=ac_cv_lib_wrap_main
if test "$have_tcpwrappers" = "no"; then
echo "can't find either tcpd.h or libwrap";
exit 1;
fi
fi
2012-10-28 20:36:46 +01:00
AC_ARG_ENABLE(tweak-sent-time,
[ --tweak-sent-time tweak sent time], have_tweak_sent_time=$enableval, have_tweak_sent_time="no")
2011-11-14 15:57:52 +01:00
dnl math library
AC_CHECK_HEADERS(math.h, have_math=yes, have_math=no)
AC_CHECK_LIB([m],[fabs],[AC_CHECK_LIB(m, fabs)],[have_math=yes],[""; exit])ac_cv_lib_m=ac_cv_lib_m_main
dnl openssl library
AC_CHECK_HEADERS(openssl/sha.h, have_crypto=yes, have_crypto=no)
AC_CHECK_LIB([crypto],[SHA256_Init],[AC_CHECK_LIB(crypto, SHA256_Init, have_crypto=yes, echo "libcrypto is not found"; have_crypto=no)],[],[])ac_cv_lib_crypto=ac_cv_lib_crypto_main
2012-10-27 14:40:25 +02:00
AC_CHECK_HEADERS(openssl/ssl.h, have_ssl=yes, have_ssl=no)
AC_CHECK_LIB([ssl],[SSL_write],[AC_CHECK_LIB(ssl, SSL_write, have_ssl=yes, echo "libssl is not found"; have_ssl=no)],[],[])ac_cv_lib_ssl=ac_cv_lib_ssl_main
if test "$have_crypto" = "no" || test "$have_ssl" = "no"; then
2011-11-14 15:57:52 +01:00
echo "please install openssl developer package"
exit 1
fi
dnl TRE library
AC_CHECK_HEADERS(tre/tre.h, have_tre=yes, echo "tre.h is not found")
AC_CHECK_LIB([tre],[main],[AC_CHECK_LIB(tre, regcomp, have_tre=yes, echo "libtre.so is not found"; have_tre=no)],[],[])ac_cv_lib_tre=ac_cv_lib_tre_main
2012-01-07 00:00:36 +01:00
if test "$have_tre" = "no"; then
echo "please install the tre development packages"
exit 1;
fi
2011-11-14 15:57:52 +01:00
dnl libzip
AC_CHECK_HEADERS(zip.h, have_zip=yes, echo "zip.h is not found")
AC_CHECK_LIB([zip],[main],[AC_CHECK_LIB(zip, zip_open, have_zip=yes, echo "libzip.so is not found"; have_zip=no)],[],[])ac_cv_lib_zip=ac_cv_lib_zip_main
2011-11-14 15:57:52 +01:00
dnl zlib
AC_CHECK_HEADERS(zlib.h, have_zlib=yes, echo "zlib.h is not found")
AC_CHECK_LIB([z],[main],[AC_CHECK_LIB(z, compress, have_zlib=yes, echo "libz.so is not found"; have_zlib=no)],[],[])ac_cv_lib_z=ac_cv_lib_z_main
if test "$have_zlib" = "no"; then
echo "please install the zlib development packages"
exit 1;
fi
2013-05-16 22:13:46 +02:00
AC_ARG_WITH(database,
2013-08-03 12:57:35 +02:00
[ --with-database[[=mysql]] select the used database, currently mysql only (default: none)],[
2013-05-16 22:13:46 +02:00
if test "$withval" != "no" -a "$withval" != "yes"; then
DATABASE=$withval
fi
2011-11-14 15:57:52 +01:00
2013-05-16 22:13:46 +02:00
if test "$withval" = "mysql"; then
2011-11-14 15:57:52 +01:00
2013-05-16 22:13:46 +02:00
AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, yes)
2011-11-14 15:57:52 +01:00
2013-05-16 22:13:46 +02:00
if test x$MYSQL_CONFIG = xyes; then
have_mysql="yes"
fi
2011-11-14 15:57:52 +01:00
2013-05-16 22:13:46 +02:00
if test "$have_mysql" = "yes"; then
sql_includes=`mysql_config --cflags`
sql_libs=`mysql_config --libs_r`
sql_obj="mysql.o"
AC_CHECK_LIB([guide],[main],[AC_CHECK_LIB(guide, _intel_fast_memset, have_icc_guide=yes, have_icc_guide=no)],[],[])ac_cv_lib_guide=ac_cv_lib_guide_main
else
echo "MySQL support is not found"
exit 1;
fi
fi
if test "$withval" = "mariadb"; then
AC_CHECK_PROG(MYSQL_CONFIG, mariadb_config, yes)
if test x$MYSQL_CONFIG = xyes; then
have_mysql="yes"
fi
if test "$have_mysql" = "yes"; then
sql_includes=`mariadb_config --cflags`
sql_libs=`mariadb_config --libs_r`
sql_obj="mysql.o"
else
echo "mariadb_config is not found, please install \"MariaDB Client Library for C 1.0.0 Stable\", see https://downloads.mariadb.org/client-native/1.0.0/"
exit 1;
fi
fi
2013-05-16 22:13:46 +02:00
if test "$withval" = "psql"; then
AC_CHECK_PROG(PSQL_CONFIG, pg_config, yes)
if test x$PSQL_CONFIG = xyes; then
have_psql="yes"
fi
if test "$have_psql" = "yes"; then
sql_includes="-I`pg_config --includedir`"
sql_libs="-L`pg_config --libdir`"
sql_obj="psql.o"
else
echo "PSQL support is not found"
exit 1;
fi
fi
])
2011-11-14 15:57:52 +01:00
2014-11-04 12:01:39 +01:00
dnl timeout binary
2011-11-14 15:57:52 +01:00
2014-11-04 12:01:39 +01:00
if test z`which timeout 2>/dev/null` != "z"; then
timeout_binary=`which timeout`
AC_DEFINE_UNQUOTED(TIMEOUT_BINARY, "$timeout_binary", [timeout binary])
fi
2011-11-14 15:57:52 +01:00
dnl user running piler
AC_ARG_WITH(piler-user,
[ --with-piler-user=username what user the piler daemon shall be run as],
[ RUNNING_USER=$withval ],
[ RUNNING_USER=piler ]
)
dnl configure config directory
cfg_dir=`echo $sysconfdir | grep prefix`
if test -n "$cfg_dir"; then
if test "$prefix" = "NONE"
then
cfg_dir="$ac_default_prefix/etc"
my_prefix=$ac_default_prefix
else
cfg_dir="$prefix/etc"
my_prefix=$prefix
fi
else
cfg_dir="$sysconfdir"
fi
CFGDIR=$cfg_dir
AC_SUBST(CFGDIR)
AC_DEFINE_UNQUOTED(CONFDIR,"$cfg_dir",[where to look for the config file])
dnl configure data directory
data_dir=`echo $localstatedir | grep prefix`
if test -n "$data_dir"; then
if test "$prefix" = "NONE"
then
data_dir="$ac_default_prefix/var"
else
data_dir="$prefix/var"
fi
else
data_dir="$localstatedir"
fi
DATADIR=$data_dir
AC_SUBST(DATADIR)
AC_DEFINE_UNQUOTED(DATADIR,"$data_dir",[where to look for the data files])
2013-09-28 21:47:34 +02:00
dnl configure libexec directory
libexec_dir=`echo $libexecdir | grep prefix`
if test -n "$libexec_dir"; then
if test "$prefix" = "NONE"
then
libexec_dir="$ac_default_prefix/libexec"
else
libexec_dir="$prefix/libexec"
fi
else
libexec_dir="$libexecdir"
fi
LIBEXECDIR=$libexec_dir
AC_SUBST(LIBEXECDIR)
AC_DEFINE_UNQUOTED(LIBEXECDIR,"$libexec_dir",[where to look for the piler helpers])
dnl configure dataroot directory
dataroot_dir=`echo $datarootdir | grep prefix`
if test -n "$dataroot_dir"; then
if test "$prefix" = "NONE"
then
dataroot_dir="$ac_default_prefix/share"
else
dataroot_dir="$prefix/share"
fi
else
dataroot_dir="$datarootdir"
fi
DATAROOTDIR=$dataroot_dir
AC_SUBST(DATAROOTDIR)
AC_DEFINE_UNQUOTED(DATAROOTDIR,"$dataroot_dir",[where to look for the share data files])
2011-11-14 15:57:52 +01:00
AC_DEFINE_UNQUOTED(VIRUS_TEMPLATE, "$my_prefix/share/clapf/template.virus", [where the virus template is])
AC_DEFINE_UNQUOTED(ZOMBIE_NET_REGEX, "$my_prefix/share/clapf/zombienets.regex", [where the virus template is])
2013-05-16 22:13:46 +02:00
if test "$have_mysql" = "no" && test "$have_psql" = "no"; then
echo
echo "please specify the used database with --with-database=..."
echo
exit 1
fi
2011-11-14 15:57:52 +01:00
dnl let us know if we are building on FreeBSD
if test "$os" = "FreeBSD"; then
defs="$defs -DFREEBSD"
antispam_libs="-lz -lm -lcrypto -lssl -liconv"
2014-07-22 21:10:58 +02:00
MAKE="gmake"
2011-11-14 15:57:52 +01:00
fi
if test "$os" = "Linux"; then
defs="$defs -D_GNU_SOURCE"
fi
if test "$os" = "SunOS"; then
AC_DEFINE(HAVE_DAEMON, 0, [daemon() support])
sunos_libs="-lnsl -lsocket"
if test -x /usr/xpg4/bin/id; then id_bin="/usr/xpg4/bin/id"; fi
fi
if test `echo $os | grep -c CYGWIN` -eq 1; then
defs="$defs -DCYGWIN"
AC_DEFINE_UNQUOTED(ZOMBIE_NET_REGEX, "zombienets.regex", [where the virus template is])
fi
dnl whether we have antivirus support
if test "$have_clamd" = "yes" ; then
defs="$defs -DHAVE_ANTIVIRUS"
objs="$objs avir.o"
fi
echo; echo
echo "run as user: $RUNNING_USER"
2012-09-11 14:27:29 +02:00
echo "piler data directory: $data_dir/piler"
2011-11-14 15:57:52 +01:00
if test "$have_static_build" = "yes"; then
echo "link mode: static"
static="-static"
else
echo "link mode: dynamic"
fi
2012-09-11 14:27:29 +02:00
echo
2015-02-01 10:40:18 +01:00
if test "$have_compat_storage_layout" = "yes"; then
echo "support for older storage layout: yes"
AC_DEFINE_UNQUOTED(HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT, 1, [compat storage layout support])
fi
2013-05-16 22:13:46 +02:00
if test "$have_mysql" = "yes"; then
echo "database: mysql"
fi
if test "$have_psql" = "yes"; then
echo "database: psql"
fi
2011-11-14 15:57:52 +01:00
if test "$have_tre" = "yes"; then
echo "tre library: yes"
defs="$defs -DHAVE_TRE"
antispam_libs="$antispam_libs -ltre"
fi
if test "$have_zip" = "yes"; then
echo "zip library: yes"
AC_DEFINE_UNQUOTED(HAVE_ZIP, 1, [libzip support])
antispam_libs="$antispam_libs -lzip"
fi
if test "$have_tcpwrappers" = "yes"; then
echo "tcpwrappers support: yes"
AC_DEFINE_UNQUOTED(HAVE_LIBWRAP, 1, [tcpwrappers support])
2014-07-22 21:10:58 +02:00
if test "$os" = "FreeBSD"; then
antispam_libs="$antispam_libs -lwrap"
else
antispam_libs="$antispam_libs -lwrap -lnsl"
fi
else
echo "tcpwrappers support: no"
fi
2012-09-11 14:27:29 +02:00
echo
if test "$have_clamd" = "yes"; then
echo "clamd support: yes"
objs="$objs clamd.o"
defs="$defs -DHAVE_CLAMD"
fi
if test "$want_memcached" = "yes"; then
echo "memcached support: yes"
objs="$objs memc.o"
defs="$defs -DHAVE_MEMCACHED"
fi
2011-11-14 15:57:52 +01:00
if test "$have_mysql" = "yes"; then
defs="$defs -DNEED_MYSQL"
fi
if test "$have_icc_guide" = "yes" && test "$have_mysql" = "yes"; then
2013-05-16 22:13:46 +02:00
sql_libs="$sql_libs -lguide"
2011-11-14 15:57:52 +01:00
fi
2013-05-21 11:03:03 +02:00
if test "$have_psql" = "yes"; then
defs="$defs -DNEED_PSQL"
fi
2012-09-07 15:08:50 +02:00
if test z`which pdftotext 2>/dev/null` != "z"; then
pdftotext=`which pdftotext`
2014-11-04 12:01:39 +01:00
AC_DEFINE_UNQUOTED(HAVE_PDFTOTEXT, "$pdftotext", [path to pdftotext])
2012-09-07 15:08:50 +02:00
fi
if test z`which catdoc 2>/dev/null` != "z"; then
catdoc=`which catdoc`
2014-11-04 12:01:39 +01:00
AC_DEFINE_UNQUOTED(HAVE_CATDOC, "$catdoc", [path to catdoc])
fi
if test z`which catppt 2>/dev/null` != "z"; then
catppt=`which catppt`
2014-11-04 12:01:39 +01:00
AC_DEFINE_UNQUOTED(HAVE_CATPPT, "$catppt", [path to catppt])
fi
if test z`which ppthtml 2>/dev/null` != "z"; then
ppthtml=`which ppthtml`
2014-11-04 12:01:39 +01:00
AC_DEFINE_UNQUOTED(HAVE_PPTHTML, "$ppthtml", [path to ppthtml])
fi
if test z`which xls2csv 2>/dev/null` != "z"; then
xls2csv=`which xls2csv`
2014-11-04 12:01:39 +01:00
AC_DEFINE_UNQUOTED(HAVE_XLS2CSV, "$xls2csv", [path to xls2csv])
fi
2012-09-14 15:03:00 +02:00
if test z`which unrtf 2>/dev/null` != "z"; then
unrtf=`which unrtf`
2014-11-04 12:01:39 +01:00
AC_DEFINE_UNQUOTED(HAVE_UNRTF, "$unrtf", [path to unrtf])
2012-09-14 15:03:00 +02:00
fi
2013-09-11 09:19:29 +02:00
if test z`which tnef 2>/dev/null` != "z"; then
tnef=`which tnef`
2014-11-04 12:01:39 +01:00
AC_DEFINE_UNQUOTED(HAVE_TNEF, "$tnef", [path to tnef])
2013-09-11 09:19:29 +02:00
fi
if test "$have_tweak_sent_time" = "yes"; then
AC_DEFINE_UNQUOTED(HAVE_TWEAK_SENT_TIME, 1, [tweak sent time])
fi
2012-09-11 14:27:29 +02:00
echo
2012-09-07 15:08:50 +02:00
echo "pdftotext: $pdftotext"
echo "catdoc: $catdoc"
echo "catppt: $catppt"
echo "ppthtml: $ppthtml"
echo "xls2csv: $xls2csv"
2012-09-14 15:03:00 +02:00
echo "unrtf: $unrtf"
2013-09-11 09:19:29 +02:00
echo "tnef: $tnef"
2012-09-07 15:08:50 +02:00
2011-11-14 15:57:52 +01:00
id -u $RUNNING_USER 2>/dev/null 1>/dev/null
if test $? -eq 1; then echo "the user \"$RUNNING_USER\" does not exists, please create it, first with adduser..."; exit 1; fi
echo; echo
CFLAGS="$static -O2 -Wall -g"
2012-01-07 00:00:36 +01:00
LIBS="$antispam_libs $sunos_libs "
2016-03-03 11:04:32 +01:00
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o smtp.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o import_gui.o imap.o pop3.o extract.o mydomains.o $objs"
2011-11-14 15:57:52 +01:00
2015-11-27 12:17:19 +01:00
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile unit_tests/Makefile contrib/imap/Makefile])
2011-11-14 15:57:52 +01:00
AC_OUTPUT
2013-01-26 10:23:58 +01:00
echo
echo
echo "IMPORTANT! If you upgrade, be sure to read http://www.mailpiler.org/en/upgrade.html"
echo
echo