You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koffice/kexi/kexidb/drivers/configure.in.in

376 lines
11 KiB

dnl ========================================
dnl checks for MySQL
dnl taken form KDEDB
dnl ========================================
AC_ARG_ENABLE(mysql,
AC_HELP_STRING([--enable-mysql],[build MySQL-plugin [default=yes]]),
mysql_plugin=$enableval, mysql_plugin=yes)
if test "x$mysql_plugin" = "xyes"; then
compile_mysql_plugin="yes"
else
compile_mysql_plugin="no"
fi
AC_ARG_WITH(mysql_includes,
AC_HELP_STRING([--with-mysql-includes=DIR],[use MySQL-includes installed in this directory]),
[
ac_mysql_incdir=$withval
], ac_mysql_incdir=
)
AC_ARG_WITH(mysql_libraries,
AC_HELP_STRING([--with-mysql-libraries=DIR],[use MySQL-libs installed in this directory ]),
[
ac_mysql_libdir=$withval
], ac_mysql_libdir=
)
dnl ==============================================
dnl check whether MySQL should be compiled
dnl and where headers and libraries are installed
dnl if present compile mysql-plugin
dnl ==============================================
AC_MSG_CHECKING([for MySQL])
if test "$compile_mysql_plugin" = "yes"; then
if test -n "$ac_mysql_incdir" -o -n "$ac_mysql_libdir"; then
dnl *** Configure arguments for includes or libs given ***
dnl *** and MySQL not explicitly disabled. ***
dnl *** Check that the paths given to configure are valid ***
AC_MSG_CHECKING([for MySQL headers])
mysql_incdirs="$ac_mysql_incdir /usr/local/include /usr/include"
AC_FIND_FILE(mysql/mysql.h, $mysql_incdirs, mysql_incdir)
if test -r $mysql_incdir/mysql/mysql.h; then
MYSQL_INC=$mysql_incdir
AC_MSG_RESULT([$MYSQL_INC])
AC_SUBST(MYSQL_INC)
else
compile_mysql_plugin="no"
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING([for MySQL libraries])
mysql_libdirs="$ac_mysql_libdir /usr/local/lib$tdelibsuff /usr/lib$tdelibsuff"
AC_FIND_FILE(mysql/libmysqlclient.so, $mysql_libdirs, mysql_libdir)
if test -r $mysql_libdir/mysql/libmysqlclient.so; then
MYSQL_LIBS=$mysql_libdir
AC_MSG_RESULT([$MYSQL_LIBS])
AC_SUBST(MYSQL_LIBS)
else
compile_mysql_plugin="no"
AC_MSG_RESULT([not found])
fi
else
dnl *** No configure arguments for includes or libs given ***
dnl *** and MySQL not explicitly disabled. ***
KDE_FIND_PATH(mysql_config, MYSQL_CONFIG,
[${prefix}/bin ${exec_prefix}/bin /usr/local/bin /usr/bin ], [
AC_MSG_RESULT([not found])
])
if test -n "$MYSQL_CONFIG"; then
mysql_incdir=`$MYSQL_CONFIG --cflags| $SED -e "s,-I,,g" | cut -d " " -f 1`
mysql_libdir=`$MYSQL_CONFIG --libs| $SED -e "s,',,g"`
MYSQL_INC=$mysql_incdir
MYSQL_LIBS=$mysql_libdir
AC_SUBST(MYSQL_INC)
AC_SUBST(MYSQL_LIBS)
compile_mypsql_plugin="yes"
AC_MSG_RESULT([headers $mysql_incdir, libraries $mysql_libdir])
else
compile_mysql_plugin="no"
fi
fi
else
dnl *** MySQL plugin explicitly disabled. ***
dnl *** Show that we are doing as requested. ***
AC_MSG_NOTICE([Not attempting to configure MySQL as requested])
fi
if test "$compile_mysql_plugin" = "yes"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -I$mysql_incdir"
AC_MSG_CHECKING([if mysql has st_mysql struct])
AC_TRY_COMPILE(
[
#include <mysql.h>
typedef struct st_mysql MYSQL;
],
[],
AC_MSG_RESULT( yes )
mysql_struct=st_mysql,
AC_MSG_RESULT( no )
[
AC_MSG_CHECKING([if mysql has MYSQL struct])
AC_TRY_COMPILE(
[
#include <mysql.h>
typedef struct MYSQL MYSQL;
],
[],
AC_MSG_RESULT( yes )
mysql_struct=MYSQL,
AC_MSG_RESULT( no )
compile_mysql_plugin=no
)
]
)
CXXFLAGS="$save_CXXFLAGS"
AC_LANG_RESTORE
fi
AC_DEFINE_UNQUOTED(MYSQL_STRUCT, $mysql_struct, [struct type name for MySql])
AM_CONDITIONAL(compile_mysql_plugin, test "$compile_mysql_plugin" = "yes")
dnl ========================================
dnl Checks for PostgreSQL
dnl ========================================
dnl ========================================
dnl libpq
dnl Add configure-args
dnl ========================================
dnl Assume we're building until something fails, unless explicitly disabled
AC_ARG_ENABLE(pgsql,
AC_HELP_STRING([--enable-pgsql],[build PostgreSQL-plugin [default=yes]]),
pgsql_plugin=$enableval, pgsql_plugin=yes)
if test "x$pgsql_plugin" = "xyes"; then
compile_pgsql_plugin="yes"
else
compile_pgsql_plugin="no"
fi
AC_ARG_WITH(pgsql-includes,
AC_HELP_STRING([--with-pgsql-includes=DIR],[use PostgreSQL(libpq)-includes installed in this directory ]),
[
ac_pgsql_incdir=$withval
], ac_pgsql_incdir=
)
AC_ARG_WITH(pgsql-libraries,
AC_HELP_STRING([--with-pgsql-libraries=DIR],[use PostgreSQL(libpq)-libraries installed in this directory ]),
[
ac_pgsql_libdir=$withval
], ac_pgsql_libdir=
)
dnl ========================================
dnl header/library directories
dnl ========================================
if test "$compile_pgsql_plugin" = "yes"; then
if test -n "$ac_pgsql_incdir" -o -n "$ac_pgsql_libdir"; then
dnl *** Configure arguments for includes or libs given ***
dnl *** and PostgreSQL not explicitly disabled. ***
dnl *** Check that the paths given to configure are valid ***
AC_MSG_CHECKING([for PostgreSQL C API headers])
pgsql_incdirs="$ac_pgsql_incdir /usr/local/include /usr/include"
AC_FIND_FILE(libpq-fe.h, $pgsql_incdirs, pgsql_incdir)
if test -r $pgsql_incdir/libpq-fe.h; then
PG_INCDIR=$pgsql_incdir
AC_MSG_RESULT([$PG_INCDIR])
AC_SUBST(PG_INCDIR)
else
compile_pgsql_plugin="no"
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING([for PostgreSQL C API libraries])
pgsql_libdirs="$ac_pgsql_libdir /usr/local/lib$tdelibsuff /usr/lib$tdelibsuff"
AC_FIND_FILE(libpq.so, $pgsql_libdirs, pgsql_libdir)
if test -r $pgsql_libdir/libpq.so; then
PG_LIBDIR=$pgsql_libdir
AC_MSG_RESULT([$PG_LIBDIR])
AC_SUBST(PG_LIBDIR)
else
compile_pgsql_plugin="no"
AC_MSG_RESULT([not found])
fi
else
dnl *** No configure arguments for includes or libs given ***
dnl *** and PostgreSQL not explicitly disabled. ***
KDE_FIND_PATH(pg_config, PG_CONFIG,
[${prefix}/bin ${exec_prefix}/bin /usr/local/bin /usr/bin ], [
AC_MSG_RESULT([not found])
])
if test -n "$PG_CONFIG"; then
pgsql_incdir=`$PG_CONFIG --includedir`
pgsql_libdir=`$PG_CONFIG --libdir`
PG_INCDIR=$pgsql_incdir
PG_LIBDIR=$pgsql_libdir
AC_SUBST(PG_LIBDIR)
compile_pgsql_plugin="yes"
AC_MSG_RESULT([headers $pgsql_incdir, libraries $pgsql_libdir])
else
compile_pgsql_plugin="no"
fi
fi
else
dnl *** PostgreSQL plugin explicitly disabled. ***
dnl *** Show that we are doing as requested. ***
AC_MSG_NOTICE([Not attempting to configure PostgreSQL as requested])
fi
AM_CONDITIONAL(compile_pgsql_plugin, test "$compile_pgsql_plugin" = "yes")
dnl ========================================
dnl libpqxx checks
dnl ========================================
AC_ARG_WITH(pqxx-includes,
AC_HELP_STRING([--with-pqxx-includes=DIR],[use PostgreSQL(libpqxx)-includes installed in this directory ]),
[
ac_pqxx_incdir=$withval
], ac_pqxx_incdir=
)
AC_ARG_WITH(pqxx-libraries,
AC_HELP_STRING([--with-pqxx-libraries=DIR],[use PostgreSQL(libpqxx)-libraries installed in this directory ]),
[
ac_pqxx_libdir=$withval
], ac_pqxx_libdir=
)
dnl ========================================
dnl libpqxx headers
dnl ========================================
if test "$compile_pgsql_plugin" = "yes"; then
AC_MSG_CHECKING([for PostgreSQL C++ includes])
pqxx_incdirs="$ac_pqxx_incdir /usr/local/include /usr/include"
AC_FIND_FILE(pqxx/pqxx, $pqxx_incdirs, pqxx_incdir)
if test -r $pqxx_incdir/pqxx/pqxx; then
PQXX_INCDIR=$pqxx_incdir
AC_MSG_RESULT([$PQXX_INCDIR])
AC_SUBST(PQXX_INCDIR)
else
compile_pgsql_plugin="no"
AC_MSG_RESULT([not found])
fi
fi
dnl ========================================
dnl libpqxx libraries
dnl ========================================
if test "$compile_pgsql_plugin" = "yes"; then
AC_MSG_CHECKING([for PostgreSQL C++ libraries])
pqxx_libdirs="$ac_pqxx_libdir $sys_lib_dlsearch_path_spec /usr/local/lib$tdelibsuff /usr/lib$tdelibsuff"
AC_FIND_FILE(libpqxx.so, $pqxx_libdirs, pqxx_libdir)
if test -r $pqxx_libdir/libpqxx.so; then
PQXX_LIBDIR=$pqxx_libdir
AC_MSG_RESULT([$PQXX_LIBDIR])
AC_SUBST(PQXX_LIBDIR)
else
compile_pgsql_plugin="no"
AC_MSG_RESULT([not found])
fi
fi
dnl ========================================
dnl libpqxx build flags
dnl ========================================
if test "$compile_pgsql_plugin" = "yes"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
SAVED_CXXFLAGS="$CXXFLAGS"
AC_MSG_CHECKING([PostgreSQL build with default flags])
PQXX_CXXFLAGS=""
CXXFLAGS="$SAVED_CXXFLAGS $PQXX_CXXFLAGS"
AC_TRY_COMPILE([
#include <$PQXX_INCDIR/pqxx/pqxx>
],[ ],
pqxx_flags=yes,
pqxx_flags=no
)
if test "x$pqxx_flags" = "xno"; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING([PostgreSQL build with enabled exceptions])
PQXX_CXXFLAGS+=" $USE_EXCEPTIONS"
CXXFLAGS="$SAVED_CXXFLAGS $PQXX_CXXFLAGS"
AC_TRY_COMPILE([
#include <$PQXX_INCDIR/pqxx/pqxx>
],[ ],
pqxx_exceptions=yes,
pqxx_exceptions=no
)
if test "x$pqxx_exceptions" = "xno"; then
AC_MSG_RESULT(no)
for CXX_STD_TEST in 11 14 17; do
AC_MSG_CHECKING([PostgreSQL build with C++$CXX_STD_TEST])
CXXFLAGS="$SAVED_CXXFLAGS $PQXX_CXXFLAGS -std=c++$CXX_STD_TEST"
AC_TRY_COMPILE([
#include <$PQXX_INCDIR/pqxx/pqxx>
],[ ],
pqxx_cxx_std=yes,
pqxx_cxx_std=no
)
if test "x$pqxx_cxx_std" = "xyes"; then
AC_MSG_RESULT(yes)
compile_pgsql_plugin="yes"
PQXX_CXXFLAGS+=" -std=c++$CXX_STD_TEST"
AC_SUBST(PQXX_CXXFLAGS)
break
else
AC_MSG_RESULT(no)
compile_pgsql_plugin="no"
fi
done
else
AC_MSG_RESULT(yes)
AC_SUBST(PQXX_CXXFLAGS)
fi
else
AC_MSG_RESULT(yes)
AC_SUBST(PQXX_CXXFLAGS)
fi
CXXFLAGS="$SAVED_CXXFLAGS"
AC_LANG_RESTORE
fi
dnl ========================================
dnl libpqxx field class name
dnl ========================================
if test "$compile_pgsql_plugin" = "yes"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
SAVED_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=$PQXX_CXXFLAGS
for PQXX_FIELD_CLASS in "pqxx::field" "pqxx::result::field"; do
AC_MSG_CHECKING([for PostgreSQL field class name - $PQXX_FIELD_CLASS])
AC_TRY_COMPILE([
#include <$PQXX_INCDIR/pqxx/pqxx>
],[
sizeof($PQXX_FIELD_CLASS);
],
pqxx_field_class=yes,
pqxx_field_class=no
)
if test "x$pqxx_field_class" = "xyes"; then
compile_pgsql_plugin="yes"
AC_DEFINE_UNQUOTED(PQXX_FIELD_CLASS, $PQXX_FIELD_CLASS, [ PQXX field class name ])
AC_MSG_RESULT(yes)
break
else
compile_pgsql_plugin="no"
AC_MSG_RESULT(no)
fi
done
CXXFLAGS="$SAVED_CXXFLAGS"
AC_LANG_RESTORE
fi
AM_CONDITIONAL(compile_pgsql_plugin, test "$compile_pgsql_plugin" = "yes")