Salome HOME
0020676: EDF 1212 GEOM: Partition operation creates vertices which causes mesh comput...
[modules/smesh.git] / adm_local / unix / config_files / check_qwt.m4
index c62506993e6b1203f8d81038fd442c8027a5e530..bae22ac31a3c6f9ccc94a781150b934a43d2f095 100644 (file)
@@ -44,15 +44,25 @@ AC_ARG_WITH(qwt_inc,
       AC_MSG_RESULT("select $withval as path to QWT includes")
     ])
 
+libqwt_name=qwt
 if test -z $QWTHOME; then
   AC_MSG_RESULT(QWTHOME not defined)
+  AC_MSG_NOTICE(Trying native Qwt...)
   exist_ok=no  
   if test "x$exist_ok" = "xno"; then
-     for d in /usr/local /usr ; do
-        AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/libqwt.so,exist_ok=yes,exist_ok=no)
+     for d in /usr /usr/local ; do
+        for extension in qwt-qt4 qwt; do
+           AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/lib${extension}.so,exist_ok=yes,exist_ok=no)
+           if test "x$exist_ok" = "xyes"; then
+              QWTHOME=$d
+              AC_MSG_RESULT(lib${extension}.so detected in $d/lib)
+              libqwt_name=${extension}
+              dnl  break, libqwt-qt4.so is choosen before libqwt.so since it is surely the Qt4 version.
+              break
+           fi
+        done
         if test "x$exist_ok" = "xyes"; then
-           QWTHOME=$d
-           AC_MSG_RESULT(libqwt.so detected in $d/lib)
+           break
         fi
      done
   fi
@@ -69,7 +79,10 @@ if test -z $QWTHOME; then
   fi
   if test "x$exist_ok" = "xyes"; then
      if test -z $QWT_INCDIR; then
-        QWT_INCDIR=$QWTHOME"/include/qwt"
+        QWT_INCDIR=$QWTHOME"/include/qwt-qt4"
+        if test ! -f $QWT_INCDIR/qwt.h ; then
+          QWT_INCDIR=/usr/include/qwt
+        fi
         if test ! -f $QWT_INCDIR/qwt.h ; then
           QWT_INCDIR=$QWTHOME"/include"
         fi
@@ -81,6 +94,7 @@ if test -z $QWTHOME; then
      qwt_ok=no
   fi
 else
+  AC_MSG_NOTICE(Trying Qwt from $QWTHOME ...)
   if test -z $QWT_INCDIR; then
      QWT_INCDIR="$QWTHOME/include"
   fi           
@@ -116,9 +130,9 @@ else
     LIBS_old=$LIBS
     LIBS="$LIBS $QT_LIBS"
     if test "x$QWTHOME" = "x/usr" ; then
-      LIBS="$LIBS -lqwt"
+      LIBS="$LIBS -l${libqwt_name}"
     else
-      LIBS="$LIBS -L$QWTHOME/lib -lqwt"
+      LIBS="$LIBS -L$QWTHOME/lib -l${libqwt_name}"
     fi
 
     CXXFLAGS_old=$CXXFLAGS
@@ -145,9 +159,9 @@ else
     else
       AC_MSG_RESULT(yes)
       if test "x$QWTHOME" = "x/usr" ; then
-        QWT_LIBS=" -lqwt"
+        QWT_LIBS=" -l${libqwt_name}"
       else
-        QWT_LIBS="-L$QWTHOME/lib -lqwt"
+        QWT_LIBS="-L$QWTHOME/lib -l${libqwt_name}"
       fi
     fi