AC_INIT(src) dnl AC_CONFIG_SRCDIR([src]) AC_CANONICAL_SYSTEM AC_PREREQ(2.59) AM_INIT_AUTOMAKE(libpreludedb, 0.9.13) dnl library soname dnl check http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 libpreludedb_current=4 libpreludedb_revision=5 libpreludedb_age=4 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 platform specific flags * dnl ********************************************************** AC_MSG_CHECKING(for platform-specific compiler flags) case "$host_os" in darwin*) # # It may be called "cc", but it's really a GCC derivative # with a problematic special precompiler and precompiled # headers; turn off the special precompiler, as some # apparently-legal code won't compile with its precompiled # headers. # AC_MSG_RESULT(Darwin: adding -no-cpp-precomp) AX_CFLAGS_GCC_OPTION(-no-cpp-precomp) ;; *) AC_MSG_RESULT(none needed) ;; esac 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.9, , 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 *************************************************** AC_ARG_WITH(mysql, AC_HELP_STRING(--with-mysql=@<:@=PATH@:>@, Enable MySQL plugin @<:@default=auto@:>@), mysql_required=true, with_mysql=yes) if test x$with_mysql != xno; then if test x$with_mysql != xyes; then mysql_path=$with_mysql/bin; else mysql_path=$PATH; fi with_mysql=no AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, $mysql_path) if test x$MYSQL_CONFIG != xno; then MYSQL_LIBS=`$MYSQL_CONFIG --libs` MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags` else for dir in /usr/lib /usr/lib/mysql /usr/local/lib /usr/local/lib/mysql; do AC_CHECK_FILE($dir/libmysqlclient.so, MYSQL_LIBS="-L$dir -lmysqlclient") done for dir in /usr/include /usr/include/mysql /usr/local/include /usr/local/include/mysql; do AC_CHECK_FILE($dir/mysql.h, MYSQL_CFLAGS="-I$dir") done fi if test -n "$MYSQL_LIBS" && test -n "$MYSQL_CFLAGS"; 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, with_mysql=yes, with_mysql=no) # restore the normal setting LIBS=$LIBS_bak CPPFLAGS=$CPPFLAGS_bak fi if test x$mysql_required = xtrue && test x$with_mysql != xyes; then AC_MSG_ERROR(error activating MySQL support) fi fi AM_CONDITIONAL(HAVE_MYSQL, test x$with_mysql = xyes) AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_CFLAGS) dnl ******************************************************** dnl * Check for the PostgreSQL library (PostgreSQL plugin) * dnl ******************************************************** AC_ARG_WITH(pgsql, AC_HELP_STRING(--with-pgsql=@<:@=PFX@:>@, Enable PostgreSQL plugin @<:@default=auto@:>@), pgsql_required=true, with_pgsql=yes) if test x$with_pgsql != xno; then if test x$with_pgsql != xyes; then default_path=$with_pgsql; fi AC_PATH_PROG(PG_CONFIG, pg_config, no, $PATH:$default_path/bin; fi) with_pgsql=no if test x$PG_CONFIG != xno; then PGSQL_LIBDIR=`$PG_CONFIG --libdir` PGSQL_INCLUDEDIR=`$PG_CONFIG --includedir` AC_CHECK_HEADER($PGSQL_INCLUDEDIR/libpq-fe.h, with_pgsql=yes) if test x$with_pgsql != xyes; then PGSQL_INCLUDEDIR="$PGSQL_INCLUDEDIR/postgresql" AC_CHECK_HEADER($PGSQL_INCLUDEDIR/libpq-fe.h, with_pgsql=yes) fi fi if test x$pgsql_required = xtrue && (test x$PG_CONFIG = xno -o x$with_pgsql != xyes); then AC_MSG_ERROR(error activating PostgreSQL support) fi fi AM_CONDITIONAL(HAVE_PGSQL, test x$with_pgsql = xyes) AC_SUBST(PGSQL_LIBDIR) AC_SUBST(PGSQL_INCLUDEDIR) dnl ******************************************************** dnl * Check for the SQLite3 library (SQLite3 plugin) * dnl ******************************************************** AC_ARG_WITH(sqlite3, AC_HELP_STRING(--with-sqlite3=@<:@=PFX@:>@, Enable Sqlite3 plugin @<:@default=auto@:>@), sqlite3_required=true, with_sqlite3=yes) if test x$with_sqlite3 != xno; then default_path="/usr /usr/local" if test x$with_sqlite3 != xyes; then default_path=$with_sqlite3; fi with_sqlite3=no for dir in $default_path; do AC_CHECK_FILE($dir/lib/libsqlite3.so, SQLITE3_LIBS="-L$dir -lsqlite3") if test -z "$SQLITE3_LIBS"; then continue fi AC_CHECK_FILE($dir/include/sqlite3.h, SQLITE3_CFLAGS="-I$dir") if test -n "$SQLITE3_CFLAGS"; then with_sqlite3=yes break fi done if test x$sqlite3_required = xtrue && test -z "$SQLITE3_LIBS"; then AC_MSG_ERROR(could not find libsqlite3.so) fi if test x$sqlite3_required = xtrue && test -z "$SQLITE3_CFLAGS"; then AC_MSG_ERROR(could not find sqlite3.h) fi fi AC_SUBST(SQLITE3_LIBS) AC_SUBST(SQLITE3_CFLAGS) AM_CONDITIONAL(HAVE_SQLITE3, test x$with_sqlite3 = xyes) dnl ************************************************** dnl * Swig support * dnl ************************************************** AC_ARG_WITH(swig, AC_HELP_STRING(--with-swig@<:@=PATH@:>@, Re-generate perl/python bindings sources @<:@default=auto@:>@), [swig_required=true; if test x$withval = xyes; then with_swig="swig"; fi], with_swig="swig") if test x$with_swig != xno; then AC_PATH_PROG(SWIG, `basename $with_swig`, no, `dirname $with_swig`:$PATH) if test x$SWIG = xno; then if test x$swig_required = xtrue; then AC_MSG_ERROR([Could not find $with_swig binary]) fi fi fi AM_CONDITIONAL(HAVE_SWIG, test x$SWIG != xno) dnl ************************************************** dnl * Perl support * dnl ************************************************** AC_ARG_WITH(perl, AC_HELP_STRING(--with-perl@<:@=PATH@:>@, Enable support for perl binding @<:@default=auto@:>@), [perl_required=true; if test x$withval = xyes; then with_perl="perl"; fi], with_perl="perl") if test x$with_perl != xno; then AC_PATH_PROG(PERL, `basename $with_perl`, no, `dirname $with_perl`:$PATH) if test x$PERL = xno; then if test x$perl_required = xtrue; then AC_MSG_ERROR([Could not find $with_perl binary]) fi with_perl=no else PERL_CFLAGS="-I`$PERL -e 'use Config; print $Config{archlib}'`/CORE" old_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $PERL_CFLAGS" AC_CHECK_HEADER(EXTERN.h, [AC_CHECK_HEADER(perl.h, with_perl=yes, with_perl=no, [#include ])], with_perl=no) CPPFLAGS="$old_CPPFLAGS" fi fi AM_CONDITIONAL(HAVE_PERL, test x$with_perl = xyes) PERL_INSTALLDIRS="site" AC_ARG_WITH(perl-installdirs, AC_HELP_STRING(--with-perl-installdirs=@<:@site|vendor@:>@, Specify where to install the Perl module @<:@default=site@:>@), PERL_INSTALLDIRS="$withval") if test x$PERL_INSTALLDIRS != xsite && test x$PERL_INSTALLDIRS != xvendor; then AC_MSG_ERROR(Invalid value for --with-perl-installdirs: only "site" or "vendor" supported.) fi PERL_EXTRA_PARAMS="INSTALLDIRS=$PERL_INSTALLDIRS" AC_SUBST(PERL_EXTRA_PARAMS) dnl ************************************************** dnl * Python support * dnl ************************************************** AC_ARG_WITH(python, AC_HELP_STRING(--with-python@<:@=PATH@:>@, Enable support for python binding @<:@default=auto@:>@), [python_required=true; if test x$withval = xyes; then with_python="python"; fi], with_python="python") if test x$with_python != xno; then AC_PATH_PROG(PYTHON, `basename $with_python`, no, `dirname $with_python`:$PATH) if test x$PYTHON = xno; then if test x$python_required = xtrue; then AC_MSG_ERROR([Could not find $with_python binary]) fi with_python=no else old_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I`$PYTHON -c 'from distutils.sysconfig import get_python_inc; print get_python_inc()'`" AC_CHECK_HEADER(Python.h, with_python=yes, with_python=no) CPPFLAGS="$old_CPPFLAGS" fi fi AM_CONDITIONAL(HAVE_PYTHON, test x$with_python = xyes) dnl ************************************************** dnl * Check for GTK-DOC * dnl ************************************************** GTK_DOC_CHECK(1.0) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_HEADER_TIME 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) AX_CFLAGS_GCC_OPTION(-Wformat) AX_CFLAGS_GCC_OPTION(-Wformat-security) 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 docs/manpages/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 : $with_mysql" echo " - Enable PostgreSQL plugin : $with_pgsql" echo " - Enable SQLite3 plugin : $with_sqlite3" echo " - Perl binding : $with_perl" echo " - Python binding : $with_python";