From 8aef511877d460e4d7e75c978142f1ca3bd50451 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 28 May 2009 11:12:26 +1000 Subject: Adds support for linking against iodbc on linux. If unixodbc detection fails, try and link/detect iodbc libraries and link against them. Reviewed-by: Lincoln Ramsay --- config.tests/unix/iodbc/iodbc.cpp | 7 +++++++ config.tests/unix/iodbc/iodbc.pro | 4 ++++ configure | 25 ++++++++++++++++++------- projects.pro | 1 + src/plugins/sqldrivers/odbc/odbc.pro | 8 +------- 5 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 config.tests/unix/iodbc/iodbc.cpp create mode 100644 config.tests/unix/iodbc/iodbc.pro diff --git a/config.tests/unix/iodbc/iodbc.cpp b/config.tests/unix/iodbc/iodbc.cpp new file mode 100644 index 0000000..6b64e12 --- /dev/null +++ b/config.tests/unix/iodbc/iodbc.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main(int, char **) +{ + return 0; +} diff --git a/config.tests/unix/iodbc/iodbc.pro b/config.tests/unix/iodbc/iodbc.pro new file mode 100644 index 0000000..465a9a7 --- /dev/null +++ b/config.tests/unix/iodbc/iodbc.pro @@ -0,0 +1,4 @@ +SOURCES = iodbc.cpp +CONFIG -= qt dylib +mac:CONFIG -= app_bundle +LIBS += -liodbc diff --git a/configure b/configure index 85ce3da..764840e 100755 --- a/configure +++ b/configure @@ -716,6 +716,7 @@ QT_LFLAGS_MYSQL= QT_LFLAGS_MYSQL_R= QT_CFLAGS_SQLITE= QT_LFLAGS_SQLITE= +QT_LFLAGS_ODBC="-lodbc" # flags for libdbus-1 QT_CFLAGS_DBUS= @@ -4431,14 +4432,21 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do CFG_SQL_odbc=plugin fi else - if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then - echo "ODBC support cannot be enabled due to functionality tests!" - echo " Turn on verbose messaging (-v) to $0 to see the final report." - echo " If you believe this message is in error you may use the continue" - echo " switch (-continue) to $0 to continue." - exit 101 + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iodbc "iODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then + QT_LFLAGS_ODBC="-liodbc" + if [ "$CFG_SQL_odbc" = "auto" ]; then + CFG_SQL_odbc=plugin + fi else - CFG_SQL_odbc=no + if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "ODBC support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_SQL_odbc=no + fi fi fi fi @@ -6684,6 +6692,9 @@ fi if [ -n "$QT_LFLAGS_SQLITE" ]; then echo "QT_LFLAGS_SQLITE = $QT_LFLAGS_SQLITE" >> "$CACHEFILE.tmp" fi +if [ -n "$QT_LFLAGS_ODBC" ]; then + echo "QT_LFLAGS_ODBC = $QT_LFLAGS_ODBC" >> "$CACHEFILE.tmp" +fi if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$CACHEFILE.tmp" diff --git a/projects.pro b/projects.pro index 2596c0a..3817792 100644 --- a/projects.pro +++ b/projects.pro @@ -61,6 +61,7 @@ unix { (cd config.tests/unix/mysql_r && $(MAKE) distclean); \ (cd config.tests/unix/nis && $(MAKE) distclean); \ (cd config.tests/unix/nix && $(MAKE) distclean); \ + (cd config.tests/unix/iodbc && $(MAKE) distclean); \ (cd config.tests/unix/odbc && $(MAKE) distclean); \ (cd config.tests/unix/oci && $(MAKE) distclean); \ (cd config.tests/unix/tds && $(MAKE) distclean); \ diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro index 0835ce1..3de8ab2 100644 --- a/src/plugins/sqldrivers/odbc/odbc.pro +++ b/src/plugins/sqldrivers/odbc/odbc.pro @@ -4,15 +4,9 @@ HEADERS = ../../../sql/drivers/odbc/qsql_odbc.h SOURCES = main.cpp \ ../../../sql/drivers/odbc/qsql_odbc.cpp -mac { - !contains( LIBS, .*odbc.* ) { - LIBS *= -liodbc - } -} - unix { !contains( LIBS, .*odbc.* ) { - LIBS *= -lodbc + LIBS *= $$QT_LFLAGS_ODBC } } -- cgit v0.12