1 dnl Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
3 dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Lesser General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2.1 of the License, or (at your option) any later version.
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Lesser General Public License for more details.
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this library; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 AC_DEFUN([CHECK_QWT],[
24 AC_REQUIRE([CHECK_QT])dnl
25 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
37 [ --with-qwt=DIR directory path to QWT installation ],
39 AC_MSG_RESULT("select $withval as path to QWT")
43 [ --with-qwt_inc=DIR directory path to QWT includes ],
44 [QWT_INCDIR="$withval"
45 AC_MSG_RESULT("select $withval as path to QWT includes")
49 if test -z $QWTHOME; then
50 AC_MSG_RESULT(QWTHOME not defined)
51 AC_MSG_NOTICE(Trying native Qwt...)
53 if test "x$exist_ok" = "xno"; then
54 for d in /usr /usr/local ; do
55 for extension in qwt-qt4 qwt; do
56 AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/lib${extension}.so,exist_ok=yes,exist_ok=no)
57 if test "x$exist_ok" = "xyes"; then
59 AC_MSG_RESULT(lib${extension}.so detected in $d/lib)
60 libqwt_name=${extension}
61 dnl break, libqwt-qt4.so is choosen before libqwt.so since it is surely the Qt4 version.
65 if test "x$exist_ok" = "xyes"; then
70 if test "x$exist_ok" = "xno"; then
71 if test "${build_cpu::6}" = "x86_64" ; then
72 for d in /usr /usr/local ; do
73 for extension in qwt-qt4 qwt; do
74 AC_CHECK_FILE(${d}/lib64/lib${extension}.so,exist_ok=yes,exist_ok=no)
75 if test "x$exist_ok" = "xyes"; then
77 AC_MSG_RESULT(lib${extension}.so detected in $d/lib)
78 libqwt_name=${extension}
79 dnl break, libqwt-qt4.so is choosen before libqwt.so since it is surely the Qt4 version.
83 if test "x$exist_ok" = "xyes"; then
89 if test "x$exist_ok" = "xno"; then
90 for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
91 if test -f $d/libqwt.so ; then
92 AC_MSG_RESULT(libqwt.so detected in $d)
94 QWTHOME=`echo ${QWTHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
100 if test "x$exist_ok" = "xyes"; then
101 if test -z $QWT_INCDIR; then
102 QWT_INCDIR=$QWTHOME"/include/qwt-qt4"
103 if test ! -f $QWT_INCDIR/qwt.h ; then
104 QWT_INCDIR=/usr/include/qwt
106 if test ! -f $QWT_INCDIR/qwt.h ; then
107 QWT_INCDIR=$QWTHOME"/include"
109 if test ! -f $QWT_INCDIR/qwt.h ; then
110 QWT_INCDIR=/usr/lib/qt4/include/qwt
117 AC_MSG_NOTICE(Trying Qwt from $QWTHOME ...)
118 if test -z $QWT_INCDIR; then
119 QWT_INCDIR="$QWTHOME/include"
123 if test "x$qwt_ok" = xno -o ! -d "$QWTHOME" ; then
125 AC_MSG_WARN(qwt not found)
128 CPPFLAGS_old=$CPPFLAGS
129 CPPFLAGS="$CPPFLAGS $QT_INCLUDES -I$QWT_INCDIR"
131 AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no)
132 CPPFLAGS=$CPPFLAGS_old
134 AC_MSG_CHECKING(include of qwt headers)
136 if test "x$qwt_ok" = xno ; then
138 AC_MSG_WARN(qwt not found)
141 QWT_INCLUDES=-I$QWT_INCDIR
147 if test "x$qwt_ok" = "xyes" ; then
148 AC_MSG_CHECKING(linking qwt library)
151 LIBS="$LIBS $QT_LIBS"
152 if test "x$QWTHOME" = "x/usr" ; then
153 LIBS="$LIBS -l${libqwt_name}"
155 LIBS="$LIBS -L$QWTHOME/lib -l${libqwt_name}"
158 CXXFLAGS_old=$CXXFLAGS
159 CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QWT_INCLUDES"
161 AC_CACHE_VAL(salome_cv_lib_qwt,[
163 #include <QApplication>
164 #include <qwt_plot.h>
167 QApplication a(n, s);
169 p.resize( 600, 400 );
172 eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no")
174 qwt_ok="$salome_cv_lib_qwt"
176 if test "x$qwt_ok" = "xno" ; then
177 AC_MSG_RESULT(unable to link with qwt library)
178 AC_MSG_RESULT(QWTHOME environment variable may be wrong)
181 if test "x$QWTHOME" = "x/usr" ; then
182 QWT_LIBS=" -l${libqwt_name}"
184 QWT_LIBS="-L$QWTHOME/lib -l${libqwt_name}"
189 CXXFLAGS=$CXXFLAGS_old
193 AC_SUBST(QWT_INCLUDES)
198 AC_MSG_RESULT(for qwt: $qwt_ok)