AC_INIT(src) dnl AC_CONFIG_SRCDIR([src]) AC_CANONICAL_SYSTEM AC_PREREQ(2.53) AM_INIT_AUTOMAKE(libpreludedb, 0.1) AM_CONFIG_HEADER(config.h) AM_DISABLE_STATIC AM_MAINTAINER_MODE dnl AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL dnl Checks for programs AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(libprelude_db_libs) AC_SUBST(libprelude_db_cflags) dnl ************************************************** dnl * Check for libprelude * dnl ************************************************** AC_PATH_GENERIC(libprelude, 0.8.0, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?) ) defined="$defined $LIBPRELUDE_CFLAGS" AC_SUBST(defined) dnl ********************************* database stuff dnl *************************************************** dnl * Check for the MySQL library (MySQL plugin * dnl *************************************************** # Check for mysql_config. If it is not found, look for mysql libraries # and headers in standard places AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, true, false) if test x$MYSQL_CONFIG = xtrue; then MYSQL_LIBS=`mysql_config --libs` MYSQL_CFLAGS=`mysql_config --cflags` mysql_use=true else for dir in /usr/lib /usr/lib/mysql /usr/local/lib \ /usr/local/lib/mysql; do AC_CHECK_FILE($dir/libmysqlclient.so, mysql_dir=$dir) done if test $mysql_dir ; then mysql_use=true; MYSQL_LIBS="-L$mysql_dir -lmysqlclient" fi for dir in /usr/include /usr/include/mysql /usr/local/include \ /usr/local/include/mysql; do AC_CHECK_FILE($dir/mysql.h, mysql_inc=$dir) done if test $mysql_inc ; then MYSQL_CFLAGS=-I$mysql_inc else mysql_use=false; fi fi if test x$mysql_use = xtrue; then # mysql_config --libs outputs -L'directory' instead of -Ldirectory # and escaped version fools gcc in AC_CHECK_LIB so we must remove # apostrophes temp_mysql_flags=`echo $MYSQL_LIBS | sed -e s/\'//g` # this is needed for correct linking. If we don't add mysql library # flags to CFLAGS the test will always fail due to a linker error CFLAGS_bak=$CFLAGS CFLAGS="$CFLAGS $temp_mysql_flags" AC_CHECK_LIB(mysqlclient, mysql_real_escape_string, have_real_escape_string=yes) if test x$have_real_escape_string = xyes; then AC_DEFINE(HAVE_MYSQL_REAL_ESCAPE_STRING, , mysql_real_escape_string function present) fi # restore the normal setting CFLAGS=$CFLAGS_bak fi AC_ARG_ENABLE(mysql, [ --enable-mysql Enable MySQL plugin [default=auto]], enable_mysql="$enableval", enable_mysql=auto) if test x$enable_mysql = xauto; then if test x$mysql_use = xtrue; then enable_mysql=yes; else enable_mysql=no; fi fi AM_CONDITIONAL(HAVE_MYSQL, test x$enable_mysql = xyes) AC_SUBST(HAVE_MYSQL) AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_CFLAGS) dnl ******************************************************** dnl * Check for the PostgreSQL library (PostgreSQL plugin) * dnl ******************************************************** AC_CHECK_PROG(PGSQL_CONFIG, pg_config, true, false) if test x$PGSQL_CONFIG = xtrue; then PGSQL_LIBDIR=`pg_config --libdir` PGSQL_INCLUDEDIR=`pg_config --includedir` AC_CHECK_HEADER($PGSQL_INCLUDEDIR/libpq-fe.h, pgsql_hdr=true) fi AC_ARG_ENABLE(pgsql, [ --enable-pgsql Enable PostgreSQL plugin [default=auto]], enable_pgsql="$enableval", enable_pgsql=auto) if test x$enable_pgsql = xauto; then if test x$PGSQL_CONFIG = xtrue && test x$pgsql_hdr = xtrue; then enable_pgsql=yes; else enable_pgsql=no; fi fi AM_CONDITIONAL(HAVE_PGSQL, test x$enable_pgsql = xyes) AC_SUBST(HAVE_PGSQL) AC_SUBST(PGSQL_LIBDIR) AC_SUBST(PGSQL_INCLUDEDIR) dnl ************************************************** dnl * Perl support * dnl ************************************************** AC_ARG_ENABLE(perl, [ --enable-perl Enable Perl binding [default=auto]], enable_perl="$enableval", enable_perl="yes") if test x$enable_perl = xyes; then AC_CHECK_PROG(PERL, perl, yes, no) fi if test x$enable_perl = xyes; then perl_includedir="`perl -e 'use Config; print $Config{archlib}'`/CORE" AC_CHECK_FILE($perl_includedir/perl.h, enable_perl=yes, enable_perl=no) fi if test x$enable_perl = xyes; then perl_privlib=`perl -e 'use Config; print $Config{privlib}'` if test -w $perl_privlib; then perl_dir=$perl_privlib else perl_dir=$libdir/libpreludedb/bindings/perl fi PERL_CFLAGS="-I$perl_includedir" AC_SUBST(perl_dir) AC_SUBST(PERL_CFLAGS) fi AM_CONDITIONAL(HAVE_PERL, test x$enable_perl = xyes) dnl ************************************************** dnl * Python support * dnl ************************************************** AC_ARG_ENABLE(python, [ --enable-python Enable Python binding [default=auto]], enable_python="$enableval", enable_python=yes) if test x$enable_python = xyes; then AC_CHECK_PROG(enable_python, python, yes, no) fi if test x$enable_python = xyes; then python_includedir=`python -c 'from distutils.sysconfig import get_python_inc print get_python_inc()'` AC_CHECK_FILE($python_includedir/Python.h, enable_python=yes, enable_python=no) fi if test x$enable_python = xyes; then python_lib_path=`python -c 'from distutils.sysconfig import get_python_lib print get_python_lib()'` if test -w $python_lib_path; then python_dir=$python_lib_path else python_dir=$libdir/libpreludedb/bindings/python fi PYTHON_CFLAGS="-I$python_includedir" AC_SUBST(PYTHON_CFLAGS) AC_SUBST(python_dir) fi AM_CONDITIONAL(HAVE_PYTHON, test x$enable_python = xyes) sql_plugin_dir=$libdir/libpreludedb/plugins/sql format_plugin_dir=$libdir/libpreludedb/plugins/formats format_config_dir=$sysconfdir/libpreludedb/plugins/formats filter_plugin_dir=$libdir/libpreludedb/plugins/filters AC_SUBST(sql_plugin_dir) AC_SUBST(format_plugin_dir) AC_SUBST(format_config_dir) AC_SUBST(filter_plugin_dir) CFLAGS="$CFLAGS -Wall -Wno-strict-prototypes -Wmissing-prototypes -Wmissing-declarations \ -Wbad-function-cast -Wcast-qual -Wcast-align -Wnested-externs -Wunused" AC_SUBST(CFLAGS) AC_CONFIG_FILES([ libpreludedb-config Makefile src/Makefile src/include/Makefile plugins/Makefile plugins/sql/Makefile plugins/sql/mysql/Makefile plugins/sql/pgsql/Makefile plugins/format/Makefile plugins/format/classic/Makefile plugins/filters/Makefile plugins/filters/skeleton/Makefile bindings/Makefile bindings/perl/Makefile bindings/python/Makefile ]) AC_CONFIG_COMMANDS([default],[[ chmod +x libpreludedb-config ]],[[]]) AC_OUTPUT echo echo "*** Dumping configuration ***" echo " - Generate documentation : $enable_gtk_doc" echo " - Enable profiling : $enable_profiling" echo " - Enable MySQL plugin : $enable_mysql" echo " - Enable PostgreSQL plugin : $enable_pgsql" echo " - Perl binding: $enable_perl" echo " - Python binding: $enable_python";