1 dnl Copyright (C) 2007-2008 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.
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
22 AC_DEFUN([CHECK_QWT],[
23 AC_REQUIRE([CHECK_QT])dnl
24 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
36 [ --with-qwt=DIR directory path to QWT installation ],
38 AC_MSG_RESULT("select $withval as path to QWT")
42 [ --with-qwt_inc=DIR directory path to QWT includes ],
43 [QWT_INCDIR="$withval"
44 AC_MSG_RESULT("select $withval as path to QWT includes")
48 if test -z $QWTHOME; then
49 AC_MSG_RESULT(QWTHOME not defined)
50 AC_MSG_NOTICE(Trying native Qwt...)
52 if test "x$exist_ok" = "xno"; then
53 for d in /usr /usr/local ; do
54 for extension in qwt-qt4 qwt; do
55 AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/lib${extension}.so,exist_ok=yes,exist_ok=no)
56 if test "x$exist_ok" = "xyes"; then
58 AC_MSG_RESULT(lib${extension}.so detected in $d/lib)
59 libqwt_name=${extension}
60 dnl break, libqwt-qt4.so is choosen before libqwt.so since it is surely the Qt4 version.
64 if test "x$exist_ok" = "xyes"; then
69 if test "x$exist_ok" = "xno"; then
70 for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do
71 if test -f $d/libqwt.so ; then
72 AC_MSG_RESULT(libqwt.so detected in $d)
74 QWTHOME=`echo ${QWTHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
80 if test "x$exist_ok" = "xyes"; then
81 if test -z $QWT_INCDIR; then
82 QWT_INCDIR=$QWTHOME"/include/qwt-qt4"
83 if test ! -f $QWT_INCDIR/qwt.h ; then
84 QWT_INCDIR=/usr/include/qwt
86 if test ! -f $QWT_INCDIR/qwt.h ; then
87 QWT_INCDIR=$QWTHOME"/include"
89 if test ! -f $QWT_INCDIR/qwt.h ; then
90 QWT_INCDIR=/usr/lib/qt4/include/qwt
97 AC_MSG_NOTICE(Trying Qwt from $QWTHOME ...)
98 if test -z $QWT_INCDIR; then
99 QWT_INCDIR="$QWTHOME/include"
103 if test "x$qwt_ok" = xno -o ! -d "$QWTHOME" ; then
105 AC_MSG_WARN(qwt not found)
108 CPPFLAGS_old=$CPPFLAGS
109 CPPFLAGS="$CPPFLAGS $QT_INCLUDES -I$QWT_INCDIR"
111 AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no)
112 CPPFLAGS=$CPPFLAGS_old
114 AC_MSG_CHECKING(include of qwt headers)
116 if test "x$qwt_ok" = xno ; then
118 AC_MSG_WARN(qwt not found)
121 QWT_INCLUDES=-I$QWT_INCDIR
127 if test "x$qwt_ok" = "xyes" ; then
128 AC_MSG_CHECKING(linking qwt library)
131 LIBS="$LIBS $QT_LIBS"
132 if test "x$QWTHOME" = "x/usr" ; then
133 LIBS="$LIBS -l${libqwt_name}"
135 LIBS="$LIBS -L$QWTHOME/lib -l${libqwt_name}"
138 CXXFLAGS_old=$CXXFLAGS
139 CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QWT_INCLUDES"
141 AC_CACHE_VAL(salome_cv_lib_qwt,[
143 #include <QApplication>
144 #include <qwt_plot.h>
147 QApplication a(n, s);
149 p.resize( 600, 400 );
152 eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no")
154 qwt_ok="$salome_cv_lib_qwt"
156 if test "x$qwt_ok" = "xno" ; then
157 AC_MSG_RESULT(unable to link with qwt library)
158 AC_MSG_RESULT(QWTHOME environment variable may be wrong)
161 if test "x$QWTHOME" = "x/usr" ; then
162 QWT_LIBS=" -l${libqwt_name}"
164 QWT_LIBS="-L$QWTHOME/lib -l${libqwt_name}"
169 CXXFLAGS=$CXXFLAGS_old
173 AC_SUBST(QWT_INCLUDES)
178 AC_MSG_RESULT(for qwt: $qwt_ok)