From f8b4329205ff7a1b965ce35e99a7943d9a82f5d4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 27 Apr 2011 12:34:57 +0200 Subject: Use QtCore prefix when including Qt headers This appears to be more portable. For example, on Mac OS X with -framework QtCore option include does not work while including does. --- m4/libqt.m4 | 41 +++++++++++++++++++++++++++++++++++++---- qt/common/containers/test.hxx | 18 +++++++++--------- qt/common/smart-ptr/driver.cxx | 2 +- qt/mysql/basic/test.hxx | 4 ++-- qt/mysql/date-time/driver.cxx | 2 +- qt/mysql/date-time/test.hxx | 2 +- qt/sqlite/basic/test.hxx | 4 ++-- qt/sqlite/date-time/driver.cxx | 2 +- qt/sqlite/date-time/test.hxx | 2 +- 9 files changed, 55 insertions(+), 22 deletions(-) diff --git a/m4/libqt.m4 b/m4/libqt.m4 index 2ab8272..bb7ffa5 100644 --- a/m4/libqt.m4 +++ b/m4/libqt.m4 @@ -20,7 +20,7 @@ AC_MSG_CHECKING([for QtCore]) CXX_LIBTOOL_LINK_IFELSE( AC_LANG_SOURCE([[ #include -#include +#include int main () @@ -44,7 +44,7 @@ if test x"$libqt_found" = xno; then CXX_LIBTOOL_LINK_IFELSE( AC_LANG_SOURCE([[ #include -#include +#include int main () @@ -63,6 +63,39 @@ libqt_found=yes fi fi +# Try framework in case we are on Mac OS X. +# +if test x"$libqt_found" = xno; then + + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + + CPPFLAGS="$CPPFLAGS -framework QtCore" + LIBS="-framework QtCore $LIBS" + + CXX_LIBTOOL_LINK_IFELSE( +AC_LANG_SOURCE([[ +#include +#include + +int +main () +{ + QString qs ("test"); + std::string ss (qs.toStdString ()); + return ss.size () != 0; +} +]]), +[ +libqt_found=yes +]) + + if test x"$libqt_found" = xno; then + CPPFLAGS="$save_CPPFLAGS" + LIBS="$save_LIBS" + fi +fi + # If QtCore is not found, try its versioned variant, QtCore4. # if test x"$libqt_found" = xno; then @@ -73,7 +106,7 @@ if test x"$libqt_found" = xno; then CXX_LIBTOOL_LINK_IFELSE( AC_LANG_SOURCE([[ #include -#include +#include int main () @@ -111,7 +144,7 @@ if test x"$libqt_found" = xno; then CXX_LIBTOOL_LINK_IFELSE( AC_LANG_SOURCE([[ #include -#include +#include int main () diff --git a/qt/common/containers/test.hxx b/qt/common/containers/test.hxx index a85b540..7953d14 100644 --- a/qt/common/containers/test.hxx +++ b/qt/common/containers/test.hxx @@ -6,15 +6,15 @@ #ifndef TEST_HXX #define TEST_HXX -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/qt/common/smart-ptr/driver.cxx b/qt/common/smart-ptr/driver.cxx index 1d51f9c..ee53c57 100644 --- a/qt/common/smart-ptr/driver.cxx +++ b/qt/common/smart-ptr/driver.cxx @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/qt/mysql/basic/test.hxx b/qt/mysql/basic/test.hxx index 1e1f9e6..83b1396 100644 --- a/qt/mysql/basic/test.hxx +++ b/qt/mysql/basic/test.hxx @@ -6,8 +6,8 @@ #ifndef TEST_HXX #define TEST_HXX -#include -#include +#include +#include #pragma db object struct object diff --git a/qt/mysql/date-time/driver.cxx b/qt/mysql/date-time/driver.cxx index ae0643b..a6637bb 100644 --- a/qt/mysql/date-time/driver.cxx +++ b/qt/mysql/date-time/driver.cxx @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/qt/mysql/date-time/test.hxx b/qt/mysql/date-time/test.hxx index 9eb328e..b40f45f 100644 --- a/qt/mysql/date-time/test.hxx +++ b/qt/mysql/date-time/test.hxx @@ -8,7 +8,7 @@ #include -#include +#include #include diff --git a/qt/sqlite/basic/test.hxx b/qt/sqlite/basic/test.hxx index ca99d33..847e8c1 100644 --- a/qt/sqlite/basic/test.hxx +++ b/qt/sqlite/basic/test.hxx @@ -6,8 +6,8 @@ #ifndef TEST_HXX #define TEST_HXX -#include -#include +#include +#include #pragma db object struct object diff --git a/qt/sqlite/date-time/driver.cxx b/qt/sqlite/date-time/driver.cxx index 48ab63d..a095aa5 100644 --- a/qt/sqlite/date-time/driver.cxx +++ b/qt/sqlite/date-time/driver.cxx @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/qt/sqlite/date-time/test.hxx b/qt/sqlite/date-time/test.hxx index 0a140b7..7531362 100644 --- a/qt/sqlite/date-time/test.hxx +++ b/qt/sqlite/date-time/test.hxx @@ -8,7 +8,7 @@ #include -#include +#include #include -- cgit v1.1