Salome HOME
Merge from V6_main_20120808 08Aug12
[tools/hxx2salome.git] / config_files / check_qt.m4
index 5859b6afce7671fdbb82edea677fbff19921a807..2c9d2b9241b1ab0f98e1f824d514eb9efa7b26b7 100644 (file)
@@ -1,4 +1,4 @@
-dnl  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+dnl  Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
 dnl
 dnl  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 dnl  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -51,6 +51,8 @@ fi
 
 qt_ok=yes
 
+QTDIR=$(echo $QTDIR | sed 's%[/]\+$%%')
+
 AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
 
@@ -75,26 +77,33 @@ fi
 if test "x$with_qt" != "x" ; then
   dnl Using "--with-qt" prefix path
   QTDIR="$with_qt"
-else
-  if test -z $QTDIR ; then
-    AC_MSG_WARN(undefined QTDIR variable which specify where Qt product was installed)
-    for d in /usr/local/lib/qt4 /usr/lib/qt4 ; do
-      if test -f ${d}/include/Qt/qconfig.h ; then
-        AC_MSG_RESULT(trying ${d})
-        QTDIR="${d}"
-        break
-      else
-        if test -f ${d}/include/qconfig.h ; then
-          AC_MSG_RESULT(trying ${d})
-          QTDIR="${d}"
-          break
-        fi
-      fi
-    done
-  else
-    dnl Using QTDIR environment variable
-    AC_MSG_RESULT(QTDIR is $QTDIR)
+elif test "$QTDIR" = "/usr/lib/qt3" ; then
+  dnl Using QTDIR environment variable
+  AC_MSG_RESULT(current QTDIR is $QTDIR)
+  dnl 
+  if test -d /usr/lib/qt4 ; then
+    AC_MSG_RESULT(it is strange for a qt4 installation !)
+    AC_MSG_RESULT(/usr/lib/qt4 is present)
+    AC_MSG_RESULT(replacing QTDIR by /usr/lib/qt4)
+    QTDIR=/usr/lib/qt4
   fi
+elif test -z $QTDIR ; then
+  AC_MSG_WARN(undefined QTDIR variable which specify where Qt product was installed)
+  for d in /usr/local/lib/qt4 /usr/lib/qt4 /usr ; do
+    if test -f ${d}/lib/libQtCore.so ; then
+      AC_MSG_RESULT(trying ${d})
+      QTDIR="${d}"
+      break
+    elif test -f ${d}/lib64/libQtCore.so ; then
+      AC_MSG_RESULT(trying ${d})
+      QTDIR="${d}"
+      break
+    elif test -f ${d}/libQtCore.so ; then
+      AC_MSG_RESULT(trying ${d})
+      QTDIR="${d}"
+      break
+    fi
+  done
 fi
 
 #
@@ -169,7 +178,7 @@ then
       AC_MSG_RESULT(yes)
       qt_ok=yes
     else
-      AC_MSG_RESULT(moc tool and Qt product are inpompatible $MOC_VERSION)
+      AC_MSG_RESULT(moc tool and Qt product are incompatible $MOC_VERSION)
       qt_ok=no
     fi
   fi
@@ -226,7 +235,7 @@ then
       AC_MSG_RESULT(yes)
       qt_ok=yes
     else
-      AC_MSG_RESULT(rcc tool and Qt product are inpompatible)
+      AC_MSG_RESULT(rcc tool and Qt product are incompatible)
       qt_ok=no
     fi
   fi
@@ -262,7 +271,7 @@ then
       AC_MSG_RESULT(yes)
       qt_ok=yes
     else
-      AC_MSG_RESULT(lrelease tool and Qt product are inpompatible)
+      AC_MSG_RESULT(lrelease tool and Qt product are incompatible)
       qt_ok=no
     fi
   fi
@@ -323,13 +332,14 @@ then
   CXXFLAGS="$CXXFLAGS $QT_INCLUDES"
 
   LIBS_old=$LIBS
-  if test "x$QTDIR" = "x/usr"
-  then
+  if test "x$QTDIR" = "x/usr" ; then
     QT_LIB_DIR=""
   elif test -d ${QTDIR}/lib; then
     QT_LIB_DIR="-L$QTDIR/lib"
   elif test -d ${QTDIR}/lib64; then
     QT_LIB_DIR="-L$QTDIR/lib64"
+  elif test "x$QTDIR" = "x/usr/lib/qt4" ; then
+    QT_LIB_DIR=""
   else
     AC_MSG_ERROR(Can't detect of Qt library directory )
     qt_ok=no