improved Makefiles to support psql

This commit is contained in:
SJ 2013-05-16 22:13:46 +02:00
parent e597956eb5
commit 349298b90d
7 changed files with 191 additions and 48 deletions

View File

@ -16,9 +16,9 @@ localstatedir = @localstatedir@
CC = @CC@ CC = @CC@
CFLAGS = @CFLAGS@ @CPPFLAGS@ CFLAGS = @CFLAGS@ @CPPFLAGS@
DEFS = @defs@ DEFS = @defs@
INCDIR = -I. @INCDIR@ @mysql_includes@ INCDIR = -I. @INCDIR@ @sql_includes@
LIBDIR = -L. @LIBDIR@ @LDFLAGS@ LIBDIR = -L. @LIBDIR@ @LDFLAGS@
LIBS = @LIBS@ @mysql_libs@ LIBS = @LIBS@ @sql_libs@
RUNNING_USER = @RUNNING_USER@ RUNNING_USER = @RUNNING_USER@
RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)` RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`

119
configure vendored
View File

@ -623,13 +623,14 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS LIBOBJS
DATADIR DATADIR
CFGDIR CFGDIR
PSQL_CONFIG
MYSQL_CONFIG MYSQL_CONFIG
iv iv
id_bin id_bin
libclamav_extra_libs libclamav_extra_libs
mysql_obj sql_obj
mysql_libs sql_libs
mysql_includes sql_includes
MAKE MAKE
SUBDIRS SUBDIRS
RUNNING_USER RUNNING_USER
@ -699,6 +700,7 @@ enable_starttls
enable_tcpwrappers enable_tcpwrappers
enable_multitenancy enable_multitenancy
enable_tweak_sent_time enable_tweak_sent_time
with_database
with_piler_user with_piler_user
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
@ -1328,6 +1330,7 @@ Optional Features:
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-database[=mysql|psql] use either mysql or psql database for storing data (default: none)
--with-piler-user=username what user the piler daemon shall be run as --with-piler-user=username what user the piler daemon shall be run as
Some influential environment variables: Some influential environment variables:
@ -3436,6 +3439,7 @@ have_clamd="no"
have_antivirus="no" have_antivirus="no"
have_mysql="no" have_mysql="no"
have_psql="no"
have_tre="no" have_tre="no"
have_zip="no" have_zip="no"
have_zlib="no" have_zlib="no"
@ -3458,7 +3462,7 @@ antispam_libs="-lz -lm -ldl -lcrypto -lssl"
defs="" defs=""
objs="" objs=""
user_obj="" user_obj=""
mysql_obj="" sql_obj=""
os=`uname -s` os=`uname -s`
id_bin="id" id_bin="id"
@ -4247,7 +4251,18 @@ if test "$have_zlib" = "no"; then
fi fi
# Extract the first word of "mysql_config", so it can be a program name with args.
# Check whether --with-database was given.
if test "${with_database+set}" = set; then :
withval=$with_database;
if test "$withval" != "no" -a "$withval" != "yes"; then
DATABASE=$withval
fi
if test "$withval" = "mysql"; then
# Extract the first word of "mysql_config", so it can be a program name with args.
set dummy mysql_config; ac_word=$2 set dummy mysql_config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; } $as_echo_n "checking for $ac_word... " >&6; }
@ -4285,14 +4300,15 @@ fi
if test x$MYSQL_CONFIG = xyes; then if test x$MYSQL_CONFIG = xyes; then
have_mysql="yes" have_mysql="yes"
fi fi
if test "$have_mysql" = "yes"; then if test "$have_mysql" = "yes"; then
mysql_includes=`mysql_config --cflags` sql_includes=`mysql_config --cflags`
mysql_libs=`mysql_config --libs_r` sql_libs=`mysql_config --libs_r`
sql_obj="mysql.o"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lguide" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lguide" >&5
$as_echo_n "checking for main in -lguide... " >&6; } $as_echo_n "checking for main in -lguide... " >&6; }
@ -4370,10 +4386,72 @@ fi
fi fi
ac_cv_lib_guide=ac_cv_lib_guide_main ac_cv_lib_guide=ac_cv_lib_guide_main
else else
echo "MySQL support is not found" echo "MySQL support is not found"
exit 1; exit 1;
fi
fi
if test "$withval" = "psql"; then
# Extract the first word of "pg_config", so it can be a program name with args.
set dummy pg_config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_PSQL_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PSQL_CONFIG"; then
ac_cv_prog_PSQL_CONFIG="$PSQL_CONFIG" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_PSQL_CONFIG="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi fi
fi
PSQL_CONFIG=$ac_cv_prog_PSQL_CONFIG
if test -n "$PSQL_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PSQL_CONFIG" >&5
$as_echo "$PSQL_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
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
fi
@ -4449,6 +4527,12 @@ _ACEOF
if test "$have_mysql" = "no" && test "$have_psql" = "no"; then
echo
echo "please specify the used database with --with-database=..."
echo
exit 1
fi
@ -4498,6 +4582,15 @@ fi
echo echo
if test "$have_mysql" = "yes"; then
echo "database: mysql"
fi
if test "$have_psql" = "yes"; then
echo "database: psql"
fi
if test "$have_tre" = "yes"; then if test "$have_tre" = "yes"; then
echo "tre library: yes" echo "tre library: yes"
defs="$defs -DHAVE_TRE" defs="$defs -DHAVE_TRE"
@ -4555,7 +4648,7 @@ if test "$have_mysql" = "yes"; then
fi fi
if test "$have_icc_guide" = "yes" && test "$have_mysql" = "yes"; then if test "$have_icc_guide" = "yes" && test "$have_mysql" = "yes"; then
mysql_libs="$mysql_libs -lguide" sql_libs="$sql_libs -lguide"
fi fi
if test "$have_multitenancy" = "yes"; then if test "$have_multitenancy" = "yes"; then
@ -4653,7 +4746,7 @@ echo; echo
CFLAGS="$static -O2 -Wall -g" CFLAGS="$static -O2 -Wall -g"
LIBS="$antispam_libs $sunos_libs " LIBS="$antispam_libs $sunos_libs "
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o pop3.o extract.o mydomains.o retr.o mysql.o $objs" OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o pop3.o extract.o mydomains.o retr.o $objs"
ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile" ac_config_files="$ac_config_files Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile"

View File

@ -24,9 +24,9 @@ AC_SUBST(OBJS)
AC_SUBST(RUNNING_USER) AC_SUBST(RUNNING_USER)
AC_SUBST(SUBDIRS) AC_SUBST(SUBDIRS)
AC_SUBST(MAKE) AC_SUBST(MAKE)
AC_SUBST(mysql_includes) AC_SUBST(sql_includes)
AC_SUBST(mysql_libs) AC_SUBST(sql_libs)
AC_SUBST(mysql_obj) AC_SUBST(sql_obj)
AC_SUBST(libclamav_extra_libs) AC_SUBST(libclamav_extra_libs)
AC_SUBST(id_bin) AC_SUBST(id_bin)
AC_SUBST(iv) AC_SUBST(iv)
@ -37,6 +37,7 @@ have_clamd="no"
have_antivirus="no" have_antivirus="no"
have_mysql="no" have_mysql="no"
have_psql="no"
have_tre="no" have_tre="no"
have_zip="no" have_zip="no"
have_zlib="no" have_zlib="no"
@ -59,7 +60,7 @@ antispam_libs="-lz -lm -ldl -lcrypto -lssl"
defs="" defs=""
objs="" objs=""
user_obj="" user_obj=""
mysql_obj="" sql_obj=""
os=`uname -s` os=`uname -s`
id_bin="id" id_bin="id"
@ -182,23 +183,57 @@ if test "$have_zlib" = "no"; then
fi fi
AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, yes) AC_ARG_WITH(database,
[ --with-database[[=mysql|psql]] use either mysql or psql database for storing data (default: none)],[
if test "$withval" != "no" -a "$withval" != "yes"; then
DATABASE=$withval
fi
if test x$MYSQL_CONFIG = xyes; then
if test "$withval" = "mysql"; then
AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, yes)
if test x$MYSQL_CONFIG = xyes; then
have_mysql="yes" have_mysql="yes"
fi fi
if test "$have_mysql" = "yes"; then if test "$have_mysql" = "yes"; then
mysql_includes=`mysql_config --cflags` sql_includes=`mysql_config --cflags`
mysql_libs=`mysql_config --libs_r` 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 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 else
echo "MySQL support is not found" echo "MySQL support is not found"
exit 1; exit 1;
fi fi
fi
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
])
@ -257,6 +292,12 @@ AC_DEFINE_UNQUOTED(VIRUS_TEMPLATE, "$my_prefix/share/clapf/template.virus", [whe
AC_DEFINE_UNQUOTED(ZOMBIE_NET_REGEX, "$my_prefix/share/clapf/zombienets.regex", [where the virus template is]) AC_DEFINE_UNQUOTED(ZOMBIE_NET_REGEX, "$my_prefix/share/clapf/zombienets.regex", [where the virus template is])
if test "$have_mysql" = "no" && test "$have_psql" = "no"; then
echo
echo "please specify the used database with --with-database=..."
echo
exit 1
fi
dnl let us know if we are building on FreeBSD dnl let us know if we are building on FreeBSD
@ -302,6 +343,15 @@ fi
echo echo
if test "$have_mysql" = "yes"; then
echo "database: mysql"
fi
if test "$have_psql" = "yes"; then
echo "database: psql"
fi
if test "$have_tre" = "yes"; then if test "$have_tre" = "yes"; then
echo "tre library: yes" echo "tre library: yes"
defs="$defs -DHAVE_TRE" defs="$defs -DHAVE_TRE"
@ -347,7 +397,7 @@ if test "$have_mysql" = "yes"; then
fi fi
if test "$have_icc_guide" = "yes" && test "$have_mysql" = "yes"; then if test "$have_icc_guide" = "yes" && test "$have_mysql" = "yes"; then
mysql_libs="$mysql_libs -lguide" sql_libs="$sql_libs -lguide"
fi fi
if test "$have_multitenancy" = "yes"; then if test "$have_multitenancy" = "yes"; then
@ -417,7 +467,7 @@ echo; echo
CFLAGS="$static -O2 -Wall -g" CFLAGS="$static -O2 -Wall -g"
LIBS="$antispam_libs $sunos_libs " LIBS="$antispam_libs $sunos_libs "
OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o pop3.o extract.o mydomains.o retr.o mysql.o $objs" OBJS="dirs.o base64.o misc.o counters.o cfg.o sig.o decoder.o list.o parser.o parser_utils.o rules.o session.o message.o attachment.o digest.o store.o archive.o tai.o import.o imap.o pop3.o extract.o mydomains.o retr.o $objs"
AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile]) AC_CONFIG_FILES([Makefile src/Makefile etc/Makefile util/Makefile init.d/Makefile test/Makefile contrib/imap/Makefile])
AC_OUTPUT AC_OUTPUT

View File

@ -16,9 +16,9 @@ localstatedir = @localstatedir@
CC = @CC@ CC = @CC@
CFLAGS = @CFLAGS@ @CPPFLAGS@ CFLAGS = @CFLAGS@ @CPPFLAGS@
DEFS = @defs@ DEFS = @defs@
INCDIR = -I. -I../.. -I../../src @INCDIR@ @mysql_includes@ INCDIR = -I. -I../.. -I../../src @INCDIR@ @sql_includes@
LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../../src LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../../src
LIBS = @LIBS@ @mysql_libs@ LIBS = @LIBS@ @sql_libs@
RUNNING_USER = @RUNNING_USER@ RUNNING_USER = @RUNNING_USER@
RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)` RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`

View File

@ -16,11 +16,11 @@ localstatedir = @localstatedir@
CC = @CC@ CC = @CC@
CFLAGS = @CFLAGS@ @CPPFLAGS@ CFLAGS = @CFLAGS@ @CPPFLAGS@
DEFS = @defs@ DEFS = @defs@
INCDIR = -I. -I.. @INCDIR@ @mysql_includes@ INCDIR = -I. -I.. @INCDIR@ @sql_includes@
LIBDIR = -L. @LIBDIR@ @LDFLAGS@ LIBDIR = -L. @LIBDIR@ @LDFLAGS@
LIBS = @LIBS@ @mysql_libs@ LIBS = @LIBS@ @sql_libs@
OBJS = @OBJS@ OBJS = @OBJS@
MYSQL_OBJS = @mysql_obj@ SQL_OBJS = @sql_obj@
RUNNING_USER = @RUNNING_USER@ RUNNING_USER = @RUNNING_USER@
RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)` RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`
@ -43,10 +43,10 @@ piler: piler.c libpiler.a
pilergetd: pilergetd.c libpiler.a pilergetd: pilergetd.c libpiler.a
$(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) @LDFLAGS@ @libclamav_extra_libs@ $(CC) $(CFLAGS) $(INCDIR) $(DEFS) -o $@ $< -lpiler $(LIBS) $(LIBDIR) @LDFLAGS@ @libclamav_extra_libs@
libpiler.a: $(OBJS) $(MYSQL_OBJS) libpiler.a: $(OBJS) $(SQL_OBJS)
ar cr libpiler.a $(OBJS) $(MYSQL_OBJS) ar cr libpiler.a $(OBJS) $(SQL_OBJS)
ranlib libpiler.a ranlib libpiler.a
$(CC) -shared -o libpiler.so.$(LIBPILER_VERSION) $(OBJS) $(MYSQL_OBJS) $(CC) -shared -o libpiler.so.$(LIBPILER_VERSION) $(OBJS) $(SQL_OBJS)
ln -sf libpiler.so.$(LIBPILER_VERSION) libpiler.so ln -sf libpiler.so.$(LIBPILER_VERSION) libpiler.so
ln -sf libpiler.so.$(LIBPILER_VERSION) libpiler.so.$(PILER_VERSION) ln -sf libpiler.so.$(LIBPILER_VERSION) libpiler.so.$(PILER_VERSION)

View File

@ -16,9 +16,9 @@ localstatedir = @localstatedir@
CC = @CC@ CC = @CC@
CFLAGS = @CFLAGS@ @CPPFLAGS@ CFLAGS = @CFLAGS@ @CPPFLAGS@
DEFS = @defs@ DEFS = @defs@
INCDIR = -I. -I.. -I../.. -I../../src -I../src @INCDIR@ @mysql_includes@ INCDIR = -I. -I.. -I../.. -I../../src -I../src @INCDIR@ @sql_includes@
LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../src LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../src
LIBS = @LIBS@ @mysql_libs@ LIBS = @LIBS@ @sql_libs@
RUNNING_USER = @RUNNING_USER@ RUNNING_USER = @RUNNING_USER@
RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)` RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`
OBJS = import_helper.o OBJS = import_helper.o

View File

@ -16,9 +16,9 @@ localstatedir = @localstatedir@
CC = @CC@ CC = @CC@
CFLAGS = @CFLAGS@ @CPPFLAGS@ CFLAGS = @CFLAGS@ @CPPFLAGS@
DEFS = @defs@ DEFS = @defs@
INCDIR = -I. -I../.. -I../../src @INCDIR@ @mysql_includes@ INCDIR = -I. -I../.. -I../../src @INCDIR@ @sql_includes@
LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../../src LIBDIR = -L. @LIBDIR@ @LDFLAGS@ -L../../src
LIBS = @LIBS@ @mysql_libs@ LIBS = @LIBS@ @sql_libs@
RUNNING_USER = @RUNNING_USER@ RUNNING_USER = @RUNNING_USER@
RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)` RUNNING_GROUP = `@id_bin@ -gn $(RUNNING_USER)`