]> git.lyx.org Git - lyx.git/blobdiff - config/qt.m4
prepare for further work and a parlist thingie
[lyx.git] / config / qt.m4
index c6b6e1b0d5ade24f1a43293e20300fe712c03480..e4de0d9dfa2be48db2007c85f1beaa27f90b85cb 100644 (file)
@@ -1,8 +1,3 @@
-
-dnl Please leave this alone. I use this file in
-dnl oprofile.
-FATAL=0
-
 dnl find a binary in the path
 AC_DEFUN(QT_FIND_PATH,
 [
@@ -86,7 +81,8 @@ AC_DEFUN(QT_FIND_MOC,
 dnl check a particular libname
 AC_DEFUN(QT_TRY_LINK,
 [
-       CXXFLAGS="$BASE_CXXFLAGS $1"
+       SAVE_LIBS="$LIBS"
+       LIBS="$LIBS $1"
        AC_TRY_LINK([
        #include <qglobal.h>
        #include <qstring.h>
@@ -99,7 +95,7 @@ AC_DEFUN(QT_TRY_LINK,
        ],
        qt_cv_libname=$1,
        )
-       CXXFLAGS="$BASE_CXXFLAGS"
+       LIBS="$SAVE_LIBS"
 ])
  
 dnl check we can do a compile
@@ -111,9 +107,9 @@ AC_DEFUN(QT_CHECK_COMPILE,
        [
                AC_LANG_CPLUSPLUS
                SAVE_CXXFLAGS=$CXXFLAGS
-               BASE_CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS" 
+               CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QT_LDFLAGS" 
 
-               for libname in -lqt3 -lqt2 -lqt -lqt-mt;
+               for libname in -lqt-mt -lqt3 -lqt2 -lqt;
                do
                        QT_TRY_LINK($libname)
                        if test -n "$qt_cv_libname"; then
@@ -134,9 +130,39 @@ AC_DEFUN(QT_CHECK_COMPILE,
        fi
 ])
 
+dnl get Qt version we're using
+AC_DEFUN(QT_GET_VERSION,
+[
+       AC_CACHE_CHECK([Qt version],lyx_cv_qtversion,
+       [
+               AC_LANG_CPLUSPLUS
+               SAVE_CPPFLAGS=$CPPFLAGS
+               CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
+
+               cat > conftest.$ac_ext <<EOF
+#line __oline__ "configure"
+#include "confdefs.h"
+#include <qglobal.h>
+"%%%"QT_VERSION_STR"%%%"
+EOF
+               lyx_cv_qtversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
+                       grep '^"%%%"'  2>/dev/null | \
+                       sed -e 's/"%%%"//g' -e 's/"//g'`
+               rm -f conftest.$ac_ext
+               CPPFLAGS=$SAVE_CPPFLAGS
+       ])
+       QT_VERSION=$lyx_cv_qtversion
+       AC_SUBST(QT_VERSION)
+])
 dnl start here 
 AC_DEFUN(QT_DO_IT_ALL,
 [
+       dnl Please leave this alone. I use this file in
+       dnl oprofile.
+       FATAL=1
+
        AC_ARG_WITH(qt-dir, [  --with-qt-dir           where the root of Qt is installed ],
                [ qt_cv_dir=`eval echo "$withval"/` ])
         
@@ -184,4 +210,8 @@ AC_DEFUN(QT_DO_IT_ALL,
  
        QT_LIB=$qt_cv_libname;
        AC_SUBST(QT_LIB)
+
+       if test -n "$qt_cv_libname"; then
+               QT_GET_VERSION
+       fi
 ])