diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-04-27 12:34:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-04-27 12:34:57 +0200 |
commit | f8b4329205ff7a1b965ce35e99a7943d9a82f5d4 (patch) | |
tree | 4fd6efd1155e675fb93e4ff0b53c837d034382d8 /m4 | |
parent | cca7bfddb2ac380481cf4445c8727f006f16f4b8 (diff) |
Use QtCore prefix when including Qt headers1.4.0
This appears to be more portable. For example, on Mac OS X with
-framework QtCore option include <QString> does not work while
including <QtCore/QString> does.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/libqt.m4 | 41 |
1 files changed, 37 insertions, 4 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 <string> -#include <QString> +#include <QtCore/QString> int main () @@ -44,7 +44,7 @@ if test x"$libqt_found" = xno; then CXX_LIBTOOL_LINK_IFELSE( AC_LANG_SOURCE([[ #include <string> -#include <QString> +#include <QtCore/QString> 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 <string> +#include <QtCore/QString> + +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 <string> -#include <QString> +#include <QtCore/QString> int main () @@ -111,7 +144,7 @@ if test x"$libqt_found" = xno; then CXX_LIBTOOL_LINK_IFELSE( AC_LANG_SOURCE([[ #include <string> -#include <QString> +#include <QtCore/QString> int main () |