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

125
configure vendored
View File

@ -623,13 +623,14 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS
DATADIR
CFGDIR
PSQL_CONFIG
MYSQL_CONFIG
iv
id_bin
libclamav_extra_libs
mysql_obj
mysql_libs
mysql_includes
sql_obj
sql_libs
sql_includes
MAKE
SUBDIRS
RUNNING_USER
@ -699,6 +700,7 @@ enable_starttls
enable_tcpwrappers
enable_multitenancy
enable_tweak_sent_time
with_database
with_piler_user
'
ac_precious_vars='build_alias
@ -1328,6 +1330,7 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--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
Some influential environment variables:
@ -3436,6 +3439,7 @@ have_clamd="no"
have_antivirus="no"
have_mysql="no"
have_psql="no"
have_tre="no"
have_zip="no"
have_zlib="no"
@ -3458,7 +3462,7 @@ antispam_libs="-lz -lm -ldl -lcrypto -lssl"
defs=""
objs=""
user_obj=""
mysql_obj=""
sql_obj=""
os=`uname -s`
id_bin="id"
@ -4247,7 +4251,18 @@ if test "$have_zlib" = "no"; then
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
@ -4285,16 +4300,17 @@ fi
if test x$MYSQL_CONFIG = xyes; then
have_mysql="yes"
fi
if test x$MYSQL_CONFIG = xyes; then
have_mysql="yes"
fi
if test "$have_mysql" = "yes"; then
if test "$have_mysql" = "yes"; then
mysql_includes=`mysql_config --cflags`
mysql_libs=`mysql_config --libs_r`
sql_includes=`mysql_config --cflags`
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; }
if ${ac_cv_lib_guide_main+:} false; then :
$as_echo_n "(cached) " >&6
@ -4370,10 +4386,72 @@ fi
fi
ac_cv_lib_guide=ac_cv_lib_guide_main
else
echo "MySQL support is not found"
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
echo "MySQL support is not found"
exit 1;
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
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
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
echo "tre library: yes"
defs="$defs -DHAVE_TRE"
@ -4555,7 +4648,7 @@ if test "$have_mysql" = "yes"; then
fi
if test "$have_icc_guide" = "yes" && test "$have_mysql" = "yes"; then
mysql_libs="$mysql_libs -lguide"
sql_libs="$sql_libs -lguide"
fi
if test "$have_multitenancy" = "yes"; then
@ -4653,7 +4746,7 @@ echo; echo
CFLAGS="$static -O2 -Wall -g"
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"