From 8cf90fe814c1ac2673d9800cf2512bc98d672292 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 09:51:25 +0100 Subject: mysqlconnector: initial import from CWS mysqlnative --- configure.in | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 3505be436cf6..ec14139f035e 100644 --- a/configure.in +++ b/configure.in @@ -375,6 +375,23 @@ AC_ARG_WITH(lucene-analyzers-jar, [ --with-lucene-analyzers-jar=JARFILE Specify path to jarfile manually ], [ LUCENE_ANALYZERS_JAR="$withval" ]) +AC_ARG_ENABLE(mysql-connector, +[ --enable-mysql-connector enables the build of the MySQL Connector/OOo extension. + This requires access to the MySQL Connector/C (aka libmysql) to be given, too, with + either the --with-system-mysql or --with-libmysql-path option. +],,) +AC_ARG_WITH(system-mysql, +[ --with-system-mysql Use MySQL libraries already on system, for building the MySQL Connector/OOo extension. + Requires MYSQLCONFIG to point to the mysql_config executable. +],,with_system_mysql="no") +AC_ARG_WITH(libmysql-path, +[ --with-libmysql-path Use Connector/C (libmysql) installation for building the MySQL Connector/OOo extension. + + Usage: --with-libmysql-path= +],,) +AC_ARG_WITH(system-mysql-cppconn, +[ --with-system-mysql-cppconn Use MySQL C++ Connector libraries already on system +],,) AC_ARG_WITH(system-hsqldb, [ --with-system-hsqldb Use hsqldb already on system ],,) @@ -3930,6 +3947,128 @@ AC_SUBST(SYSTEM_LUCENE) AC_SUBST(LUCENE_CORE_JAR) AC_SUBST(LUCENE_ANALYZERS_JAR) +AC_MSG_CHECKING([whether to build the MySQL Connector extension]) +if test -n "$enable_mysql_connector" -a "$enable_mysql_connector" != "no"; then + AC_MSG_RESULT([yes]) + ENABLE_MYSQLC=YES + AC_MSG_CHECKING([for mysqlc module]) + if test -d mysqlc; then + AC_MSG_RESULT([OK]) + else + AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)]) + fi + BUILD_TYPE="$BUILD_TYPE MYSQLC" +else + AC_MSG_RESULT([no]) + ENABLE_MYSQLC=NO +fi +AC_SUBST(ENABLE_MYSQLC) + +if test "$ENABLE_MYSQLC" = "YES"; then +dnl =================================================================== +dnl Check for system MySQL +dnl =================================================================== +AC_MSG_CHECKING([for mysql pre-requisites]) +if test -n "$with_system_mysql" -o -n "$with_system_libs" && \ + test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then + AC_MSG_RESULT([external MySQL]) + SYSTEM_MYSQL=YES + AC_PATH_PROG( MYSQLCONFIG, mysql_config) + AC_MSG_CHECKING([MySQL version]) + MYSQL_VERSION=`$MYSQLCONFIG --version` + MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1` + if test "$MYSQL_MAJOR" -ge "5"; then + AC_MSG_RESULT([OK]) + else + AC_MSG_ERROR([too old, use 5.0.x or 5.1.x]) + fi + AC_MSG_CHECKING([for MySQL Client library]) + MYSQL_INC=`$MYSQLCONFIG --include` + MYSQL_LIB=`$MYSQLCONFIG --libs` + MYSQL_DEFINES=`$MYSQLCONFIG --cflags | sed -e s,$MYSQL_INC,,` + AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB]) +else + SYSTEM_MYSQL=NO + if test -n "$with_libmysql_path"; then + AC_MSG_RESULT([external Connector/C (libmysql)]) + LIBMYSQL=libmysql.so + if test "$_os" = "Darwin"; then + LIBMYSQL=libmysql.dylib + elif test "$_os" = "WINNT"; then + LIBMYSQL=libmysql.dll + fi + AC_MSG_CHECKING([for $LIBMYSQL]) + if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then + AC_MSG_RESULT([found.]) + LIBMYSQL_PATH=$with_libmysql_path + else + AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.]) + fi + else + AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path]) + fi +fi +AC_SUBST(SYSTEM_MYSQL) +AC_SUBST(MYSQL_INC) +AC_SUBST(MYSQL_LIB) +AC_SUBST(MYSQL_DEFINES) +AC_SUBST(LIBMYSQL_PATH) + +AC_LANG_PUSH([C++]) +dnl =================================================================== +dnl Check for system MySQL C++ Connector +dnl =================================================================== +# FIXME! +# who thought this too-generic cppconn dir was a good idea? +AC_MSG_CHECKING([MySQL Connector/C++]) +if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \ + test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then + AC_MSG_RESULT([external]) + SYSTEM_MYSQL_CPPCONN=YES + AC_LANG_PUSH([C++]) + AC_CHECK_HEADER(mysql_driver.h, [], + [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], []) + AC_CHECK_LIB(mysqlcppconn, main, [], + [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], []) + AC_MSG_CHECKING([version]) + AC_TRY_RUN([ +#include + +int main(int argc, char **argv) { + sql::Driver *driver; + driver = get_driver_instance(); + if (driver->getMajorVersion() > 1 || \ + (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \ + (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6)) + return 0; + else + return 1; +} + ], [AC_MSG_RESULT(OK)], [AC_MSG_ERROR([not suitable, we need >= 1.0.6])]) + AC_LANG_POP([C++]) + + AC_MSG_CHECKING([STL compatibility]) + if test "$WITH_STLPORT" != "no"; then + AC_MSG_ERROR([to use system mysqlcppconn you need to use --without-stlport]) + else + AC_MSG_RESULT([OK]) + fi + +else + AC_MSG_RESULT([internal]) + AC_MSG_CHECKING([for mysqlcppconn module]) + if test -d mysqlcppconn; then + AC_MSG_RESULT([OK]) + else + AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)]) + fi + BUILD_TYPE="$BUILD_TYPE MYSQLCPPCONN" + SYSTEM_MYSQL_CPPCONN=NO +fi +AC_LANG_POP([C++]) +AC_SUBST(SYSTEM_MYSQL_CPPCONN) +fi + dnl =================================================================== dnl Check for system hsqldb dnl =================================================================== -- cgit