]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
Update check qt4
authorribes <ribes>
Mon, 6 Dec 2010 16:13:09 +0000 (16:13 +0000)
committerribes <ribes>
Mon, 6 Dec 2010 16:13:09 +0000 (16:13 +0000)
m4/i2_check_qt4.m4

index 7a90d0512e319e794adf1fa66d0cc99c71472bd8..0cad36cafafe09b77f598d84b65bc5cf990d580e 100644 (file)
@@ -1,4 +1,4 @@
-dnl  Copyright (C) 2009-2010  CEA/DEN, EDF R&D
+dnl  Copyright (C) 2006-2010  CEA/DEN, EDF R&D
 dnl
 dnl  This library is free software; you can redistribute it and/or
 dnl  modify it under the terms of the GNU Lesser General Public
@@ -16,6 +16,7 @@ dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
 dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
+
 dnl the following variables are exported:
 dnl  QT_MOC
 dnl  QT_UIC
@@ -28,6 +29,7 @@ dnl qt4 is searched in the following order
 dnl   path given with --with-qt4 options
 dnl   presence of QTDIR variable
 dnl   /usr
+dnl when HAS_GUI is false (no salome gui) and nothing is said for qt4, qt4 is not checked
 dnl usages
 dnl ./configure --prefix=/home/prascle/partage/maquettes/install 
 dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4
@@ -42,6 +44,8 @@ AC_DEFUN([I2_CHECK_QT4],
   AC_REQUIRE([AC_PROG_CPP])
 
   qt_ok=no
+  qt4_wanted=yes
+  WITH_QT4=0
 
   # --- check if qt4 standard install directory is defined (with subdirectories bin lib include)
   qt4_install_path=""
@@ -60,34 +64,49 @@ AC_DEFUN([I2_CHECK_QT4],
     fi
   fi
 
-  # --- if qt4 standard install directory is not defined: QTDIR value if defined, or /usr
+  # --- if qt4 standard install directory is not defined
+  #       if HAS_GUI= 0: Qt4 not wanted
+  #       else: QTDIR value if defined, or /usr
   if test x${withval} = xnotset
   then
-    if test -z $QTDIR
+    if test x${HAS_GUI} = x0
     then
-      qt4_install_path="/usr"
+      qt4_wanted=no
+      AC_MSG_NOTICE([SALOME GUI not present, Qt4 not specified, skip detection])
     else
-      if test $QTDIR = /usr/lib/qt3 ; then
-        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
+      if test -z $QTDIR
+      then
+        qt4_install_path="/usr"
+      else
+        if test $QTDIR = /usr/lib/qt3 ; then
+          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
         fi
+        qt4_install_path=$QTDIR
       fi
-      qt4_install_path=$QTDIR
     fi
   fi
   
   # --- if qt4 standard install directory is not wanted: --without-qt4 or --with-qt4=no
   if test x${withval} = xno
   then
-    qt4_install_path=""
+    qt4_wanted=no
+    AC_MSG_NOTICE([Qt4 is not wanted, skip detection])
   fi
 
   QT_DIR=${qt4_install_path}
   AC_SUBST(QT_DIR)
 
+  # ----------------------------------------------------------------------
+  # --- only when qt4 wanted (no explicit --without-qt4 nor --with-qt4=no)
+
+  if test x${qt4_wanted} = xyes
+  then
+
   # --- check if qt4 includes directory is defined
   qt4_include_path=""
   AC_ARG_WITH([qt4-includes],
@@ -146,11 +165,6 @@ AC_DEFUN([I2_CHECK_QT4],
     fi
   fi
 
-  WITH_QT4=0
-
-  AC_MSG_NOTICE(${qt4_include_path})
-  AC_MSG_NOTICE(${qt4_library_path})
-  AC_MSG_NOTICE(${qt4_tools_path})
 
   # test if qt4 is completely defined
   qt4_defined=yes
@@ -158,16 +172,22 @@ AC_DEFUN([I2_CHECK_QT4],
   then
     qt4_defined=no
     AC_MSG_NOTICE([No Qt4 include path defined])
+  else
+    AC_MSG_NOTICE([Qt4 include path is ${qt4_include_path}])
   fi
   if test x${qt4_library_path} = x
   then
     qt4_defined=no
     AC_MSG_NOTICE([No Qt4 library path defined])
+  else
+    AC_MSG_NOTICE([Qt4 library path is ${qt4_library_path}])
   fi
   if test x${qt4_tools_path} = x
   then
     qt4_defined=no
     AC_MSG_NOTICE([No Qt4 tools path defined])
+  else
+    AC_MSG_NOTICE([Qt4 tools   path is ${qt4_tools_path}])
   fi
 
   # saving values for compilation variables
@@ -218,7 +238,7 @@ AC_DEFUN([I2_CHECK_QT4],
     AC_SUBST(qt4_cppflags)
 
     # --- we test the library file presence and usability
-    if test x${qt4_library_path} = /usr/lib
+    if test x${qt4_library_path} = x/usr/lib
     then
       qt4_ldflags=""
     else
@@ -226,8 +246,7 @@ AC_DEFUN([I2_CHECK_QT4],
     fi
 
     AC_MSG_NOTICE([checking whether link with qt4 is working])
-    qt4_lib_name=QtGui
-    qt4_libs="-l$qt4_lib_name"
+    qt4_libs="-lQtCore -lQtGui"
     LDFLAGS="${LDFLAGS} ${qt4_ldflags}"
     LIBS="${LIBS} ${qt4_libs}"
     AC_LANG_PUSH(C++)
@@ -257,6 +276,15 @@ AC_DEFUN([I2_CHECK_QT4],
     AC_MSG_NOTICE([No Qt4 support])
   fi
 
+  # restoring saved values
+  CPPFLAGS=$saved_CPPFLAGS
+  LDFLAGS=$saved_LDFLAGS
+  LIBS=$saved_LIBS
+
+  fi
+  # --- end: only when qt4 wanted (no explicit --without-qt4 nor --with-qt4=no)
+  # ----------------------------------------------------------------------
+
   # Propagate test into atlocal
   AC_SUBST(WITH_QT4)
 
@@ -266,21 +294,21 @@ AC_DEFUN([I2_CHECK_QT4],
   # ... and into source files
   AC_DEFINE_UNQUOTED(HAS_QT4, $WITH_QT4, [Qt4 library])
 
-  # restoring saved values
-  CPPFLAGS=$saved_CPPFLAGS
-  LDFLAGS=$saved_LDFLAGS
-  LIBS=$saved_LIBS
-
 ])
 
 
 AC_DEFUN([I2_CHECK_QSCINTILLA],
 [
   AC_REQUIRE([I2_CHECK_QT4])
-
   qscintilla_ok=no
   WITH_QSCI4=0
 
+  # ----------------------------------------------------------------------
+  # --- check qscintilla only when qt4 OK
+
+  if test x${WITH_QT4} = x1
+  then
+
   # --- check if qsci4 includes directory is defined
   qsci4_include_path=""
   qsci4_cppflags=""
@@ -389,23 +417,30 @@ AC_DEFUN([I2_CHECK_QSCINTILLA],
       AC_SUBST(qsci4_libs)
       WITH_QSCI4=1
       qscintilla_ok=yes
-      # Propagate test into atlocal
-      AC_SUBST(WITH_QSCI4)
     fi
 
   else
     AC_MSG_NOTICE([no support for qscintilla for qt4])
   fi
 
+  # restoring saved values
+  CPPFLAGS=$saved_CPPFLAGS
+  LDFLAGS=$saved_LDFLAGS
+  LIBS=$saved_LIBS
+
+  else
+  # --- end: check qscintilla only when qt4 OK
+  # ----------------------------------------------------------------------
+    AC_MSG_NOTICE([qscintilla for qt4 not checked because Qt4 not wanted or not detected])
+  fi
+
+  # Propagate test into atlocal
+  AC_SUBST(WITH_QSCI4)
+  
   # Propagate test into Makefiles...
   AM_CONDITIONAL(WITH_QSCI4, test $WITH_QSCI4 = 1)
 
   # ... and into source files
   AC_DEFINE_UNQUOTED(HAS_QSCI4, $WITH_QSCI4, [QsciScintilla library])
 
-  # restoring saved values
-  CPPFLAGS=$saved_CPPFLAGS
-  LDFLAGS=$saved_LDFLAGS
-  LIBS=$saved_LIBS
-
 ])