AC_INIT(src) dnl AC_CONFIG_SRCDIR([src]) AC_CANONICAL_SYSTEM AC_PREREQ(2.53) AM_INIT_AUTOMAKE(libpreludedb, 0.9.6) dnl library soname dnl check http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 libpreludedb_current=2 libpreludedb_revision=2 libpreludedb_age=2 libpreludedb_soname=$libpreludedb_current:$libpreludedb_revision:$libpreludedb_age AC_SUBST(libpreludedb_soname) AM_CONFIG_HEADER(config.h) AM_DISABLE_STATIC AM_MAINTAINER_MODE dnl Checks for programs AC_PROG_CPP AC_PROG_CC gl_EARLY AC_PROG_INSTALL AC_PROG_MAKE_SET AC_C_INLINE AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) if test "x$prefix" = "xNONE"; then prefix="/usr/local" fi if test "x$localstatedir" = "x\${prefix}/var"; then localstatedir="$prefix/var" fi if test "x$sysconfdir" = "x\${prefix}/etc"; then sysconfdir="$prefix/etc" fi if test "x$datadir" = "x\${prefix}/share"; then datadir="$prefix/share" fi dnl ************************************************** dnl * Check for missing function replacement * dnl ************************************************** gl_SOURCE_BASE(libmissing) gl_M4_BASE(libmissing/m4) gl_INIT dnl ************************************************** dnl * Check for libprelude * dnl ************************************************** AM_PATH_LIBPRELUDE(0.9.5, , 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_PATH_PROG(MYSQL_CONFIG, mysql_config, false) mysql_use=false if test x$MYSQL_CONFIG != xfalse; 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 != xfalse; 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_libs=`echo $MYSQL_LIBS | sed -e s/\'//g` temp_mysql_cppflags=`echo $MYSQL_CFLAGS | 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 LIBS_bak=$LIBS CPPFLAGS_bak=$CPPFLAGS LIBS="$LIBS $temp_mysql_libs" CPPFLAGS="$CPPFLAGS $temp_mysql_cppflags" AC_CHECK_FUNC(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 AC_CHECK_HEADER(mysql.h, , mysql_use=false) # restore the normal setting LIBS=$LIBS_bak CPPFLAGS=$CPPFLAGS_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_PATH_PROG(PG_CONFIG, pg_config, false) if test x$PG_CONFIG != xfalse; then PGSQL_LIBDIR=`$PG_CONFIG --libdir` PGSQL_INCLUDEDIR=`$PG_CONFIG --includedir` AC_CHECK_HEADER($PGSQL_INCLUDEDIR/libpq-fe.h, pgsql_hdr=true) if test x$pgsql_hdr != xtrue; then PGSQL_INCLUDEDIR="$PGSQL_INCLUDEDIR/postgresql" AC_CHECK_HEADER($PGSQL_INCLUDEDIR/libpq-fe.h, pgsql_hdr=true) fi 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$PG_CONFIG != xfalse && 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 * Check for the SQLite3 library (SQLite3 plugin) * dnl ******************************************************** AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 Enable SQLite3 plugin [default=auto]], enable_sqlite3="$enableval", enable_sqlite3=auto) if test x$enable_sqlite3 != xno; then for dir in /usr/lib /usr/local/lib; do AC_CHECK_FILE($dir/libsqlite3.so, sqlite3_dir=$dir) done if test $sqlite3_dir ; then sqlite3_use=true; SQLITE3_LIBS="-L$sqlite3_dir -lsqlite3" fi for dir in /usr/include /usr/local/include; do AC_CHECK_FILE($dir/sqlite3.h, sqlite3_inc=$dir) done if test $sqlite3_inc ; then SQLITE3_CFLAGS=-I$sqlite3_inc else sqlite3_use=false; fi fi if test x$enable_sqlite3 = xauto; then if test x$sqlite3_use = xtrue; then enable_sqlite3=yes; else enable_sqlite3=no; fi fi AC_SUBST(SQLITE3_LIBS) AC_SUBST(SQLITE3_CFLAGS) AM_CONDITIONAL(HAVE_SQLITE3, test x$enable_sqlite3 = xyes) dnl ************************************************** dnl * Swig support * dnl ************************************************** AC_PATH_PROG(SWIG, swig, no) AM_CONDITIONAL(HAVE_SWIG, test x$SWIG != xno) 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_PATH_PROG(PERL, perl, no) if test x$PERL = xno; then enable_perl=no else perl_includedir="`$PERL -e 'use Config; print $Config{archlib}'`/CORE" AC_CHECK_FILE($perl_includedir/perl.h, enable_perl=yes, enable_perl=no) fi 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_PATH_PROG(PYTHON, python, no) if test x$PYTHON = xno; then enable_python=no else 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 fi AM_CONDITIONAL(HAVE_PYTHON, test x$enable_python = xyes) dnl ************************************************** dnl * Check for GTK-DOC * dnl ************************************************** GTK_DOC_CHECK(1.0) db_plugin_dir=$libdir/libpreludedb/plugins sql_plugin_dir=$db_plugin_dir/sql format_plugin_dir=$db_plugin_dir/formats format_schema_dir=$datadir/libpreludedb format_config_dir=$sysconfdir/libpreludedb/plugins/formats AC_SUBST(db_plugin_dir) AC_SUBST(sql_plugin_dir) AC_SUBST(format_plugin_dir) AC_SUBST(format_config_dir) AC_SUBST(format_schema_dir) AX_CFLAGS_GCC_OPTION(-Wall) AX_CFLAGS_GCC_OPTION(-Wstrict-prototypes) AX_CFLAGS_GCC_OPTION(-Wmissing-prototypes) AX_CFLAGS_GCC_OPTION(-Wmissing-declarations) AX_CFLAGS_GCC_OPTION(-Wbad-function-cast) AX_CFLAGS_GCC_OPTION(-Wcast-qual) AX_CFLAGS_GCC_OPTION(-Wcast-align) AX_CFLAGS_GCC_OPTION(-Wnested-externs) AX_CFLAGS_GCC_OPTION(-Wunused) AC_SUBST(CFLAGS) AC_CONFIG_FILES([ libpreludedb-config Makefile m4/Makefile libmissing/Makefile src/Makefile src/include/Makefile src/include/preludedb-version.h plugins/Makefile plugins/sql/Makefile plugins/sql/mysql/Makefile plugins/sql/pgsql/Makefile plugins/sql/sqlite3/Makefile plugins/format/Makefile plugins/format/classic/Makefile plugins/format/classic/include/Makefile docs/Makefile docs/api/Makefile bindings/Makefile bindings/perl/Makefile.PL bindings/python/setup.py ]) AC_CONFIG_COMMANDS([default],[[ chmod +x libpreludedb-config ]],[[]]) AC_OUTPUT echo echo "*** Dumping configuration ***" echo " - Generate documentation : $enable_gtk_doc" echo " - Enable MySQL plugin : $enable_mysql" echo " - Enable PostgreSQL plugin : $enable_pgsql" echo " - Enable SQLite3 plugin : $enable_sqlite3" echo " - Perl binding : $enable_perl" echo " - Python binding : $enable_python";