]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Porting to Qt 4
authorvsr <vsr@opencascade.com>
Fri, 22 Jun 2007 14:03:40 +0000 (14:03 +0000)
committervsr <vsr@opencascade.com>
Fri, 22 Jun 2007 14:03:40 +0000 (14:03 +0000)
adm_local/unix/config_files/check_pyqt.m4
adm_local/unix/config_files/check_qt.m4
adm_local/unix/config_files/check_sip.m4

index f63479879dce7340981677009dc6f17d9a52b3a8..99a1921df153db8bdc42ec0f25c51146c52e60c3 100644 (file)
@@ -6,8 +6,8 @@ AC_REQUIRE([CHECK_QT])dnl
 AC_REQUIRE([CHECK_SIP])dnl
 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
 
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
+dnl AC_LANG_SAVE
+dnl AC_LANG_CPLUSPLUS
 
 AC_ARG_WITH(pyqt,
     [  --with-pyqt=DIR      root directory path to PyQt installation ],
@@ -21,309 +21,160 @@ AC_ARG_WITH(pyqt_sips,
       AC_MSG_RESULT("select $withval as path to PyQt sips")
     ])
 
-
-AC_ARG_WITH(pyuic,
-    [  --with-pyuic=EXEC pyuic executable ],
+AC_ARG_WITH(pyuic4,
+    [  --with-pyuic4=EXEC pyuic4 executable ],
     [PYUIC="$withval"
       AC_MSG_RESULT("select $withval as pyqt executable")
     ])
 
 AC_CHECKING(for pyqt)
 
-pyqt_ok=yes
-
-dnl look for pyuic
-pyqt_uic_ok=no
-if test "x$PYUIC" != x; then
-  dnl try withval value
-  AC_CHECK_FILE($PYUIC,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-fi
-if test "x$pyqt_uic_ok" == "xno"; then
-  dnl try ${PYQTDIR}
-  if test "x${PYQTDIR}" != "x"; then
-    if test -d ${PYQTDIR} ; then
-      AC_CHECK_FILE(${PYQTDIR}/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-      if test "x$pyqt_uic_ok" == "xyes"; then
-        PYUIC="${PYQTDIR}/pyuic"
-      fi
-    fi
-  fi   
-fi
-if test "x$pyqt_uic_ok" == "xno"; then
-  dnl try in $PATH
-  AC_PATH_PROG(PYUIC, pyuic)
-  if test "x$PYUIC" != x; then
-    PYQTDIR=$PYUIC
-    PYQTDIR=`dirname $PYQTDIR`
-    PYQTDIR=`dirname $PYQTDIR`
-    pyqt_uic_ok=yes
-  fi
-fi
-if test "x$pyqt_uic_ok" == "xno"; then
-  dnl try ${SIPDIR}
-  if test "x${SIPDIR}" != "x"; then
-    if test -d ${SIPDIR} ; then
-      AC_CHECK_FILE(${SIPDIR}/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-      if test "x$pyqt_uic_ok" == "xyes"; then
-        PYUIC="${SIPDIR}/pyuic"
-      fi
-    fi
-  fi   
-fi
-if test "x$pyqt_uic_ok" == "xno"; then
-  dnl try ${PYTHONHOME}/bin
-  if test "x${PYTHONHOME}" != "x"; then
-    if test -d ${PYTHONHOME}/bin ; then
-      AC_CHECK_FILE(${PYTHONHOME}/bin/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-      if test "x$pyqt_uic_ok" == "xyes"; then
-        PYUIC="${PYTHONHOME}/bin/pyuic"
-      fi
-    fi
-  fi   
-fi
-if test "x$pyqt_uic_ok" == "xno"; then
-  dnl try /usr/bin
-  AC_CHECK_FILE(/usr/bin/pyuic,pyqt_uic_ok=yes,pyqt_uic_ok=no)
-  if test "x$pyqt_uic_ok" == "xyes"; then
-    PYUIC="/usr/bin/pyuic"
-  fi
-fi
-if test "x$pyqt_uic_ok" == "xno"; then
-  pyqt_ok=no
-fi
+pyqt_ok=no
 
-dnl look for PyQt libs
-pyqt_lib_ok=no
-if test "x${PYQTDIR}" != "x"; then
-  dnl try {PYQTDIR}
-  AC_CHECK_FILE(${PYQTDIR}/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-  if test "x$pyqt_lib_ok" == "xyes"; then
-    if test "x${PYQTDIR}" = "x/usr/lib"
-    then
-      PYQT_LIBS="-lqtcmodule"
-    else
-      PYQT_LIBS="-L${PYQTDIR} -lqtcmodule"
-    fi
-  else 
-    AC_CHECK_FILE(${PYQTDIR}/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-    if test "x$pyqt_lib_ok" == "xyes"; then
-      if test "x${PYQTDIR}" = "x/usr/lib"
-      then
-        PYQT_LIBS=""
-      else
-        PYQT_LIBS="-L${PYQTDIR}"
-      fi
+dnl check pyuic4
+if test "x$PYUIC" != "x" ; then
+    dnl try $withval value
+    AC_CHECK_FILE($PYUIC,pyqt_ok=yes,pyqt_ok=no)
+else
+    TEST_BIN_DIRS=""
+    if test "x${PYQTDIR}" != "x" ; then
+        TEST_BIN_DIRS="${TEST_BIN_DIRS} ${PYQTDIR} ${PYQTDIR}/bin"
     fi
-  fi
-  if test "x$pyqt_lib_ok" == "xno"; then
-    dnl try ${PYQTDIR}/lib
-    if test -d ${PYQTDIR}/lib; then
-      AC_CHECK_FILE(${PYQTDIR}/lib/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-      if test "x$pyqt_lib_ok" == "xyes"; then
-        PYQT_LIBS="-L${PYQTDIR}/lib -lqtcmodule"
-      else 
-        AC_CHECK_FILE(${PYQTDIR}/lib/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-        if test "x$pyqt_lib_ok" == "xyes"; then
-          PYQT_LIBS="-L${PYQTDIR}/lib"
-        fi
-      fi
+    TEST_BIN_DIRS="${TEST_BIN_DIRS} __CHECK__PATH__"
+    if test "x${SIPDIR}" != "x" ; then
+        TEST_BIN_DIRS="${TEST_BIN_DIRS} ${SIPDIR} ${SIPDIR}/bin"
     fi
-  fi
-  if test "x$pyqt_lib_ok" == "xno"; then
-    dnl try ${PYQTDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages
-    if test -d ${PYQTDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages; then
-      AC_CHECK_FILE(${PYQTDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-      if test "x$pyqt_lib_ok" == "xyes"; then
-        PYQT_LIBS="-L${PYQTDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages -lqtcmodule"
-      else 
-        AC_CHECK_FILE(${PYQTDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-        if test "x$pyqt_lib_ok" == "xyes"; then
-          PYQT_LIBS="-L${PYQTDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
-        fi
-      fi
+    if test "x${PYTHONHOME}" != "x" ; then
+        TEST_BIN_DIRS="${TEST_BIN_DIRS} ${PYTHONHOME}/bin"
     fi
-  fi
-fi
-if test "x$pyqt_lib_ok" == "xno"; then
-  dnl try ${SIPDIR}
-  if test "x${SIPDIR}" != "x"; then
-    if test -d ${SIPDIR} ; then
-      AC_CHECK_FILE(${SIPDIR}/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-      if test "x$pyqt_lib_ok" == "xyes"; then
-        if test "x${SIPDIR}" = "x/usr/lib"
-        then
-          PYQT_LIBS="-lqtcmodule"
+    TEST_BIN_DIRS="${TEST_BIN_DIRS} /usr/bin"
+
+    dnl search pyuic4
+    pyqt_ok=no
+    for d in ${TEST_BIN_DIRS} ; do
+        if test "x${d}" = "x__CHECK__PATH__" ; then
+            AC_PATH_PROG(TEMP, pyuic4)
+            if test "x${TEMP}" != "x" ; then
+                PYUIC=${TEMP}
+                PYQTDIR=`dirname ${PYUIC}`
+                PYQTDIR=`dirname ${PYQTDIR}`
+                pyqt_ok=yes
+                break
+            fi
         else
-          PYQT_LIBS="-L${SIPDIR} -lqtcmodule"
-        fi
-      else 
-        AC_CHECK_FILE(${SIPDIR}/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-        if test "x$pyqt_lib_ok" == "xyes"; then
-          if test "x${SIPDIR}" = "x/usr/lib"
-          then
-            PYQT_LIBS=""
-          else
-            PYQT_LIBS="-L${SIPDIR}"
-          fi
-        fi
-      fi
-    fi
-  fi
-fi
-if test "x$pyqt_lib_ok" == "xno"; then
-  dnl try ${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages
-  if test "x${PYTHONHOME}" != "x"; then
-    if test -d ${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages ; then
-      AC_CHECK_FILE(${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-      if test "x$pyqt_lib_ok" == "xyes"; then
-        PYQT_LIBS="-L${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages -lqtcmodule"
-      else 
-        AC_CHECK_FILE(${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-        if test "x$pyqt_lib_ok" == "xyes"; then
-          PYQT_LIBS="-L${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
+            if test -d $d ; then
+                AC_CHECK_FILE(${d}/pyuic4,pyqt_ok=yes,pyqt_ok=no)
+               if test "x$pyqt_ok" == "xyes" ; then
+                    PYUIC=${d}/pyuic4
+                    break
+                fi
+            fi
         fi
-      fi
-    fi
-  fi   
-fi
-if test "x$pyqt_lib_ok" == "xno"; then
-  dnl try /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages
-  AC_CHECK_FILE(/usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/libqtcmodule.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-  if test "x$pyqt_lib_ok" == "xyes"; then
-    PYQT_LIBS="-L/usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages -lqtcmodule"
-  else 
-    AC_CHECK_FILE(/usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/qt.so,pyqt_lib_ok=yes,pyqt_lib_ok=no)
-    if test "x$pyqt_lib_ok" == "xyes"; then
-      PYQT_LIBS="-L/usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
+    done
+fi
+
+dnl check PyQt version
+if test "x$pyqt_ok" == "xyes" ; then
+    AC_MSG_CHECKING(whether PyQt version >= 4.2)
+    PYQT_VERSION=`${PYUIC} --version 2>/dev/null`
+    PYQT_VERSION=`echo $PYQT_VERSION | sed -e 's%[[[:alpha:][:space:]]]*\([[[:digit:].]]*\).*%\1%g'`
+    PYQT_VERSION_ID=`echo $PYQT_VERSION | awk -F. '{v=$[1]*10000+$[2]*100+$[3];print v}'`
+    if test $PYQT_VERSION_ID -ge 40200 ; then 
+        AC_MSG_RESULT(yes)
+        AC_MSG_RESULT(PyQt version is $PYQT_VERSION)
+    else
+        AC_MSG_RESULT(no)
+        AC_MSG_RESULT(WARNING! PyQt version $PYQT_VERSION is not supported (at least 4.2 is required)!)
+        pyqt_ok=no
     fi
-  fi
-fi
-if test "x$pyqt_lib_ok" == "xno"; then
-  pyqt_ok=no
-fi
-
-dnl look for PyQt sips
-pyqt_sips_ok=no
-dnl try ${PYQT_SIPS} or ${PYQT_SIPS}/qt
-if test "x${PYQT_SIPS}" != "x"; then
-  AC_CHECK_FILE(${PYQT_SIPS}/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-  if test "x$pyqt_sips_ok" == "xno"; then
-    AC_CHECK_FILE(${PYQT_SIPS}/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-    if test "x$pyqt_sips_ok" == "xyes"; then
-      PYQT_SIPS="${PYQT_SIPS}/qt"
+else
+    AC_MSG_RESULT(Warning! pyuic4 is not found!)
+fi
+
+if test "x$pyqt_ok" == "xyes" ; then
+    TESTLIBFILE=QtCore.so
+    TESTSIPFILE=QtCore/QtCoremod.sip
+    TEST_LIB_DIRS=""
+    TEST_SIPS_DIRS=""
+    if test "x${PYQTDIR}" != "x" ; then
+        TEST_LIB_DIRS="${TEST_LIB_DIRS} ${PYQTDIR} ${PYQTDIR}/lib ${PYQTDIR}/PyQt4"
+        TEST_LIB_DIRS="${TEST_LIB_DIRS} ${PYQTDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
+        TEST_LIB_DIRS="${TEST_LIB_DIRS} ${PYQTDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/PyQt4"
+        TEST_SIPS_DIRS="${TEST_SIPS_DIRS} ${PYQTDIR} ${PYQTDIR}/sip"
+       TEST_SIPS_DIRS="${TEST_SIPS_DIRS} ${PYQTDIR}/share ${PYQTDIR}/share/sip"
     fi
-  fi
-fi
-if test "x$pyqt_sips_ok" == "xno"; then
-  dnl try ${PYQTDIR}/sip
-  if test "x${PYQTDIR}" != "x"; then
-    if test -d ${PYQTDIR}/sip ; then
-      AC_CHECK_FILE(${PYQTDIR}/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-      if test "x$pyqt_sips_ok" == "xyes"; then
-        PYQT_SIPS="${PYQTDIR}/sip"
-      else
-        AC_CHECK_FILE(${PYQTDIR}/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-        if test "x$pyqt_sips_ok" == "xyes"; then
-          PYQT_SIPS="${PYQTDIR}/sip/qt"
-        fi
-      fi
+    if test "x${SIPDIR}" != "x" ; then
+        TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR} ${SIPDIR}/lib ${SIPDIR}/PyQt4"
+       TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
+       TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/PyQt4"
+        TEST_SIPS_DIRS="${TEST_SIPS_DIRS} ${SIPDIR} ${SIPDIR}/sip"
+        TEST_SIPS_DIRS="${TEST_SIPS_DIRS} ${SIPDIR}/share ${SIPDIR}/share/sip"
     fi
-  fi
-fi
-if test "x$pyqt_sips_ok" == "xno"; then
-  dnl try ${PYQTDIR}/share/sip/qt
-  if test "x${PYQTDIR}" != "x"; then
-    if test -d ${PYQTDIR}/share/sip/qt ; then
-      AC_CHECK_FILE(${PYQTDIR}/share/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-      if test "x$pyqt_sips_ok" == "xyes"; then
-        PYQT_SIPS="${PYQTDIR}/share/sip/qt"
-      fi
+    if test "x${PYTHONHOME}" != "x" ; then
+        TEST_LIB_DIRS="${TEST_LIB_DIRS} ${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
+        TEST_LIB_DIRS="${TEST_LIB_DIRS} ${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/PyQt4"
     fi
-  fi
-fi
-if test "x$pyqt_sips_ok" == "xno"; then
-  dnl try ${SIPDIR}/sip
-  if test "x${SIPDIR}" != "x"; then
-    if test -d ${SIPDIR}/sip ; then
-      AC_CHECK_FILE(${SIPDIR}/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-      if test "x$pyqt_sips_ok" == "xyes"; then
-        PYQT_SIPS="${SIPDIR}/sip"
-      else
-        AC_CHECK_FILE(${SIPDIR}/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-        if test "x$pyqt_sips_ok" == "xyes"; then
-          PYQT_SIPS="${SIPDIR}/sip/qt"
+    TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX} /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
+    TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/PyQt4"
+    TEST_SIPS_DIRS="${TEST_SIPS_DIRS} /usr/share/sip"
+
+    dnl check PyQt libs
+    pyqt_ok=no
+    for d in ${TEST_LIB_DIRS} ; do
+        if test -d $d ; then
+            AC_CHECK_FILE(${d}/${TESTLIBFILE},pyqt_ok=yes,pyqt_ok=no)
+            if test "x$pyqt_ok" == "xyes" ; then
+                if test "x${d}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
+                    PYQT_LIBS=""
+                else
+                    PYQT_LIBS="-L${d}"
+                fi
+                break
+            fi
         fi
-      fi
+    done
+
+    dnl check PyQt sips
+    if test "x$pyqt_ok" == "xyes" ; then
+        pyqt_ok=no
+        for d in ${TEST_SIPS_DIRS} ; do
+            if test -d $d ; then
+                AC_CHECK_FILE(${d}/${TESTSIPFILE},pyqt_ok=yes,pyqt_ok=no)
+                if test "x$pyqt_ok" == "xyes" ; then
+                    PYQT_SIPS=${d}
+                    PYQT_INCLUDES="-I ${d}"
+                    PYQT_INCLUDES="${PYQT_INCLUDES} -I ${d}/QtCore -I ${d}/QtGui"
+                    PYQT_INCLUDES="${PYQT_INCLUDES} -I ${d}/QtXml -I ${d}/QtOpenGL"
+                    PYQT_INCLUDES="${PYQT_INCLUDES} -I ${d}/QtAssistant -I ${d}/QtDesigner"
+                    PYQT_INCLUDES="${PYQT_INCLUDES} -I ${d}/QtNetwork -I ${d}/QtSql"
+                    PYQT_INCLUDES="${PYQT_INCLUDES} -I ${d}/QtSvg -I ${d}/QtTest"
+
+                    # check compatibility with Qt
+                    SUPPORTED=`grep -e "[[[:space:]]]*Qt_[[[:digit:]_]]\+}" ${PYQT_SIPS}/QtCore/QtCoremod.sip | sed -e "s/\(.*\)[[[:space:]]]*\(Qt_[[[:digit:]_]]\+\)}/\2/g"`
+                    SUPPORTED=`echo $SUPPORTED | sed -e "s/Qt_//g" -e "s/_/./g"`
+                    SUPPORTED_ID=`echo $SUPPORTED | awk -F. '{v=$[1]*10000+$[2]*100+$[3];print v}'`
+                    if test $SUPPORTED_ID -lt $QT_VERSION_ID ; then 
+                        AC_MSG_RESULT(Warning! Used Qt version ($QT_VERSION) is not supported by PyQt)
+                        AC_MSG_RESULT(Latest supported Qt version is ${SUPPORTED})
+                    else
+                        SUPPORTED=${QT_VERSION}
+                    fi
+                    SUPPORTED="Qt_`echo ${SUPPORTED} | sed -e 's/\./_/g'`"
+                    PYQT_SIPFLAGS="-x VendorID -x PyQt_NoPrintRangeBug -t WS_X11 -t ${SUPPORTED} -g -s ".cc" -c . ${PYQT_INCLUDES}"
+                    break
+                fi
+            fi
+        done
     fi
-  fi
-fi
-if test "x$pyqt_sips_ok" == "xno"; then
-  dnl try /usr/share/sip
-  if test -d /usr/share/sip ; then
-    AC_CHECK_FILE(/usr/share/sip/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-    if test "x$pyqt_sips_ok" == "xyes"; then
-      PYQT_SIPS="/usr/share/sip"
-    else
-      AC_CHECK_FILE(/usr/share/sip/qt/qglobal.sip,pyqt_sips_ok=yes,pyqt_sips_ok=no)
-      if test "x$pyqt_sips_ok" == "xyes"; then
-        PYQT_SIPS="/usr/share/sip/qt"
-      fi
-    fi
-  fi
-fi
-if test "x$pyqt_sips_ok" == "xno"; then
-  pyqt_ok=no
-else
-  PYQT_INCLUDES="-I$PYQT_SIPS"
-  
-  dnl Additional sip flags required for correct wrappers compilation
-  AC_MSG_CHECKING(which qt classes should be excluded)
-
-  PYQT_SIPFLAGS=""
-
-  CXXFLAGS_old=$CXXFLAGS
-  CXXFLAGS="$CXXFLAGS $QT_INCLUDES"
-  LIBS_old=$LIBS
-  LIBS="$LIBS $QT_LIBS"
-
-  AC_TRY_COMPILE([#include <qcdestyle.h>],
-                 [new QCDEStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_CDE")
-  AC_TRY_COMPILE([#include <qinterlacestyle.h>],
-                 [new QInterlaceStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_INTERLACE")
-  AC_TRY_COMPILE([#include <qmotifstyle.h>],
-                 [new QMotifStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_MOTIF")
-  AC_TRY_COMPILE([#include <qmotifplusstyle.h>],
-                 [new QMotifPlusStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_MOTIFPLUS")
-  AC_TRY_COMPILE([#include <qplatinumstyle.h>],
-                 [new QPlatinumStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_PLATINUM")
-  AC_TRY_COMPILE([#include <qsgistyle.h>],
-                 [new QSGIStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_SGI")
-  AC_TRY_COMPILE([#include <qwindowsstyle.h>],
-                 [new QWindowsStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_WINDOWS")
-  AC_TRY_COMPILE([#include <qwindowsxpstyle.h>],
-                 [new QWindowsXPStyle();],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_STYLE_WINDOWSXP")
-
-  LIBS="$LIBS -lqassistantclient"
-  AC_TRY_LINK([#include <qassistantclient.h>],
-              [new QAssistantClient("foo");],,PYQT_SIPFLAGS="$PYQT_SIPFLAGS -x Qt_ASSISTANTCLIENT")
-
-  AC_MSG_RESULT(done)
-
-  CXXFLAGS=$CXXFLAGS_old
-  LIBS=$LIBS_old
 fi
-# get latest Qt version supported
-QT_VERS=`grep -e "[[[:space:]]]*Qt_[[[:digit:]_]]\+}" ${PYQT_SIPS}/versions.sip | sed -e "s/\(.*\)[[[:space:]]]*\(Qt_[[[:digit:]_]]\+\)}/\2/g"`
-AC_MSG_RESULT(Latest Qt version supported by PyQt is $QT_VERS)
 
 AC_SUBST(PYQT_INCLUDES)
 AC_SUBST(PYQT_LIBS)
 AC_SUBST(PYQT_SIPS)
 AC_SUBST(PYUIC)
 AC_SUBST(PYQT_SIPFLAGS)
-AC_SUBST(QT_VERS)
 
-AC_LANG_RESTORE
+dnl AC_LANG_RESTORE
 
 AC_MSG_RESULT(for pyqt: $pyqt_ok)
 
index d0a5eee512cb6883406b677c5363a87a3e296f0e..61cd1895c1f071385eae0b158d0c5ec70dbff58c 100644 (file)
@@ -68,8 +68,8 @@ then
    then
      AC_MSG_CHECKING(whether Qt version >= 4.0)
      QT_VERSION=`grep "QT_VERSION_STR" ${QTDIR}/include${QTINC}/QtCore/qglobal.h | sed -e 's%^#define QT_VERSION_STR[[:space:]]*\"\([[:digit:]\.]*\)\"%\1%g'`
-     QT_VERSION_NUM=`echo $QT_VERSION | awk -F. '{maj=1;min=2;rel=3;v=$maj*10000+$min*100+$rel;print v}'`
-     if test $QT_VERSION_NUM -ge 40000
+     QT_VERSION_ID=`echo $QT_VERSION | awk -F. '{v=$[1]*10000+$[2]*100+$[3];print v}'`
+     if test $QT_VERSION_ID -ge 40000
      then
        AC_MSG_RESULT(yes)
      else
@@ -297,6 +297,7 @@ AC_SUBST(QT_OTHER_LIBS)
 AC_SUBST(QT_LIBS)
 AC_SUBST(QT_MT_LIBS)
 AC_SUBST(QT_VERSION)
+AC_SUBST(QT_VERSION_ID)
 
 AC_LANG_RESTORE
 
index b9aa397fc74b7721b028204ea55db6bc299e0976..7d209267c5333d093447beb4c3282f6bedd3c932 100644 (file)
@@ -10,172 +10,85 @@ sip_ok=yes
 AC_ARG_WITH(sip,
     [  --with-sip=EXEC sip executable ],
     [SIP="$withval"
-      AC_MSG_RESULT("select $withval as sip executable")
+      AC_MSG_RESULT(Try $withval as sip executable)
     ], [
       AC_PATH_PROG(SIP, sip)
     ])
 
 if test "x$SIP" = "x" ; then
     sip_ok=no
-    AC_MSG_RESULT(sip not in PATH variable)
+    AC_MSG_RESULT(sip is not in the PATH variable)
 else
-    version=`$SIP -V`
-    AC_MSG_RESULT(sip version is $version)
-    case "$version" in
-         3.2*)
-           SIP_VERS=v3_old ;;
-         3.3*)
-           SIP_VERS=v3_old ;;
-         3.4*)
-           SIP_VERS=v3_old ;;
-         3.5*)
-           SIP_VERS=v3_old ;;
-         3.6*)
-           SIP_VERS=v3_old ;;
-         3.7*)
-           SIP_VERS=v3_old ;;
-         3.8*)
-           SIP_VERS=v3_old ;;
-         3.9*)
-           SIP_VERS=v3_old ;;
-         3.10*)
-           SIP_VERS=v3_new ;;
-         4.1*)
-           SIP_VERS=v4_old ;;
-         4.2*)
-           SIP_VERS=v4_new ;;
-         4.3*)
-           SIP_VERS=v4_new ;;
-         4.4*)
-           SIP_VERS=v4_new ;;
-         4.5*)
-           SIP_VERS=v4_new ;;
-         *)
-           AC_MSG_RESULT(sip version $version not supported)
-           SIP_VERS=unsupported ;;
-    esac
+    AC_MSG_CHECKING(whether sip version >= 4.6)
+    SIP_VERSION=`$SIP -V | awk '{print $[1]}'`
+    SIP_VERSION_ID=`echo $SIP_VERSION | awk -F. '{v=$[1]*10000+$[2]*100+$[3];print v}'`
+    if test $SIP_VERSION_ID -ge 40600 ; then 
+        AC_MSG_RESULT(yes)
+        AC_MSG_RESULT(sip version is $SIP_VERSION)
+    else
+        AC_MSG_RESULT(no)
+        AC_MSG_RESULT(WARNING! sip version $SIP_VERSION is not supported (at least 4.6 is required)!)
+        sip_ok=no
+    fi
+fi
 
+if test "x$sip_ok" = "xyes" ; then
     if test "x$SIPDIR" = "x" ; then
         SIPDIR=`dirname $SIP`
         SIPDIR=`dirname $SIPDIR`
     fi
 
-    sip_ok=no
-    dnl Search sip.h file
-    if test "x$SIPDIR" != "x" ; then
-        dnl look for sip.h in ${SIPDIR}
-        AC_CHECK_FILE(${SIPDIR}/sip.h,sip_ok=yes,sip_ok=no)
-       if test "x$sip_ok" == "xyes" ; then
-           SIP_INCLUDES="-I${SIPDIR}"
-       fi
-        if test "x$sip_ok" == "xno" ; then
-            dnl look for sip.h in ${SIPDIR}/include/python${PYTHON_VERSION}
-           if test -d ${SIPDIR}/include/python${PYTHON_VERSION} ; then
-               AC_CHECK_FILE(${SIPDIR}/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
-               if test "x$sip_ok" == "xyes" ; then
-                   SIP_INCLUDES="-I${SIPDIR}/include/python${PYTHON_VERSION}"
-               fi
-           fi
-       fi
+    TEST_INC_DIRS=""
+    TEST_LIB_DIRS=""
+    if test "x${SIPDIR}" != "x" ; then
+        TEST_INC_DIRS="${TEST_INC_DIRS} ${SIPDIR} ${SIPDIR}/include"
+       TEST_INC_DIRS="${TEST_INC_DIRS} ${SIPDIR}/include/python${PYTHON_VERSION}"
+        TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR} ${SIPDIR}/lib"
+       TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
     fi
-    if test "x$sip_ok" == "xno" ; then
-        dnl look for sip.h in ${PYTHON_PREFIX}/include/python${PYTHON_VERSION}
-       if test -d ${PYTHON_PREFIX}/include/python${PYTHON_VERSION} ; then
-            AC_CHECK_FILE(${PYTHON_PREFIX}/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
-           if test "x$sip_ok" == "xyes" ; then
-               SIP_INCLUDES="${PYTHON_INCLUDES}"
-            fi
-       fi
+    if test "x${PYTHONHOME}" != "x" ; then
+       TEST_INC_DIRS="${TEST_INC_DIRS} ${PYTHONHOME}/include/python${PYTHON_VERSION}"
+       TEST_LIB_DIRS="${TEST_LIB_DIRS} ${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
     fi
-    if test "x$sip_ok" == "xno" ; then
-        dnl look for sip.h in /usr/include/python${PYTHON_VERSION}
-       if test -d /usr/include/python${PYTHON_VERSION} ; then
-            AC_CHECK_FILE(/usr/include/python${PYTHON_VERSION}/sip.h,sip_ok=yes,sip_ok=no)
-           if test "x$sip_ok" == "xyes" ; then
-               SIP_INCLUDES="/usr/include/python${PYTHON_VERSION}"
-            fi
-       fi
-    fi
-       
-    dnl Search (lib)sip.so file
-    sip_lib_ok=no
-    if test "x$SIPDIR" != "x" ; then
-        dnl look for (lib)sip.so in ${SIPDIR}
-        AC_CHECK_FILE(${SIPDIR}/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
-       if test "x$sip_lib_ok" == "xyes" ; then
-            if test "x${SIPDIR}" = "x/usr/lib"
-            then
-              SIP_LIBS="-lsip"
-            else
-              SIP_LIBS="-L${SIPDIR} -lsip"
+    TEST_INC_DIRS="${TEST_INC_DIRS} /usr/include /usr/include/python${PYTHON_VERSION}"
+    TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX} /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
+
+    dnl Search sip.h file
+    sip_ok=no
+    for d in ${TEST_INC_DIRS} ; do
+        if test -d $d ; then
+            AC_CHECK_FILE(${d}/sip.h,sip_ok=yes,sip_ok=no)
+           if test "x$sip_ok" == "xyes" ; then
+               SIP_INCLUDES="-I${d}"
+                break
             fi
-       else
-           AC_CHECK_FILE(${SIPDIR}/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
-           if test "x$sip_lib_ok" == "xyes" ; then
-              if test "x${SIPDIR}" = "x/usr/lib"
-              then
-                SIP_LIBS=""
-              else
-                SIP_LIBS="-L${SIPDIR}"
-              fi
-           fi
-       fi
+        fi
+    done
 
-        if test "x$sip_lib_ok" == "xno" ; then
-            dnl look for (lib)sip.so in ${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages
-           if test -d ${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages ; then
-               AC_CHECK_FILE(${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
-               if test "x$sip_lib_ok" == "xyes" ; then
-                   SIP_LIBS="-L${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages -lsip"
-               else
-                   AC_CHECK_FILE(${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
-                   if test "x$sip_lib_ok" == "xyes" ; then
-                       SIP_LIBS="-L${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
-                   fi
-               fi
-           fi
-       fi
-    fi
-    if test "x$sip_lib_ok" == "xno" ; then
-        dnl look for (lib)sip.so in ${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages
-       if test -d ${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages ; then
-            AC_CHECK_FILE(${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
-           if test "x$sip_lib_ok" == "xyes" ; then
-               SIP_LIBS="-L${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages -lsip"
-           else
-               AC_CHECK_FILE(${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
-                if test "x$sip_lib_ok" == "xyes" ; then
-                   SIP_LIBS="-L${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
+    if test "x$sip_ok" == "xyes" ; then
+        dnl Search sip.so file
+        sip_ok=no
+        for d in ${TEST_LIB_DIRS} ; do
+            if test -d $d ; then
+                AC_CHECK_FILE(${d}/sip.so,sip_ok=yes,sip_ok=no)
+               if test "x$sip_ok" == "xyes" ; then
+                    if test "x${d}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
+                        SIP_LIBS=""
+                    else
+                        SIP_LIBS="-L${d}"
+                    fi
+                    break
                 fi
-           fi
-       fi
-    fi
-    if test "x$sip_lib_ok" == "xno" ; then
-        dnl look for (lib)sip.so in /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages
-       if test -d /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages ; then
-            AC_CHECK_FILE(/usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/libsip.so,sip_lib_ok=yes,sip_lib_ok=no)
-           if test "x$sip_lib_ok" == "xyes" ; then
-               SIP_LIBS="-L$/usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages -lsip"
-           else
-               AC_CHECK_FILE(/usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/sip.so,sip_lib_ok=yes,sip_lib_ok=no)
-                if test "x$sip_lib_ok" == "xyes" ; then
-                   SIP_LIBS="-L/usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages"
-               fi
             fi
-       fi
-    fi
-    if test "x$sip_lib_ok" == "xno" ; then
-        sip_ok=no
+        done
     fi
 fi
 
 AC_SUBST(SIP)
 AC_SUBST(SIP_INCLUDES)
 AC_SUBST(SIP_LIBS)
-AC_SUBST(SIP_VERS)
-
-AM_CONDITIONAL(IS_SIP_V4, [test $SIP_VERS == v4_old || test $SIP_VERS == v4_new])
-AM_CONDITIONAL(IS_SIP_NEW, [test $SIP_VERS == v3_new || test $SIP_VERS == v4_new])
+AC_SUBST(SIP_VERSION)
+AC_SUBST(SIP_VERSION_ID)
 
 AC_MSG_RESULT(for sip: $sip_ok)