2 dnl Copyright 2007 Free Software Foundation, Inc.
4 dnl This file is part of GNU Radio
6 dnl GNU Radio is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 3, or (at your option)
11 dnl GNU Radio 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
14 dnl GNU General Public License for more details.
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with GNU Radio; see the file COPYING. If not, write to
18 dnl the Free Software Foundation, Inc., 51 Franklin Street,
19 dnl Boston, MA 02110-1301, USA.
22 dnl Configure paths for library qwt.
24 dnl GR_QWT([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
26 dnl Test for library qwt, set QWT_CFLAGS and QWT_LIBS if found. Assumes
27 dnl QT_CFLAGS and QT_LIBS have already been correctly set.
32 dnl Save the environment
34 qwt_save_CPPFLAGS="$CPPFLAGS"
38 dnl Allow user to specify where QWT files are
39 AC_ARG_WITH([qwt-libdir],
40 [ --with-qwt-libdir=path Prefix where QWT library is installed (optional)],
41 [qwt_libdir="$withval"], [qwt_libdir=""])
43 AC_ARG_WITH([qwt-incdir],
44 [ --with-qwt-incdir=path Prefix where QWT include files are (optional)],
45 [qwt_incdir="$withval"], [qwt_incdir=""])
47 dnl Create QWT_CFLAGS based on user input
48 AC_MSG_CHECKING(QWT_CFLAGS)
49 if test "$qwt_incdir" != "" ; then
50 QWT_CFLAGS="$QWT_CFLAGS -I$qwt_incdir"
52 AC_MSG_RESULT($QWT_CFLAGS)
54 dnl Set CPPFLAGS so C++ tests can operate
55 CPPFLAGS="$CPPFLAGS $QT_CFLAGS $QWT_CFLAGS"
57 dnl Check for presence of header files
58 AC_CHECK_HEADERS([qwt.h],
60 [libqwt_ok=no;AC_MSG_RESULT([cannot find usable qwt headers])]
63 dnl Set QWT_LIBS based on user input
64 AC_MSG_CHECKING(QWT_LIBS)
65 QWT_LIBS="$QWT_LIBS -lqwt"
66 if test "$qwt_libdir" != "" ; then
67 QWT_LIBS="-L$qwt_libdir $QWT_LIBS"
69 AC_MSG_RESULT($QWT_LIBS)
71 dnl Set LIBS so C++ link test can operate
72 LIBS="$QWT_LIBS $QT_LIBS $LIBS"
74 dnl Check that library files can be linked in
75 dnl This references an arbitrary static class method
76 AC_TRY_LINK([#include <qwt_text.h>],
77 [QwtTextEngine const *te = QwtText::textEngine(QwtText::AutoText)],
79 [libqwt_ok=no;AC_MSG_RESULT([unable to link QWT library])]
82 dnl Restore saved variables
84 CPPFLAGS="$qwt_save_CPPFLAGS"
87 dnl Execute user actions
88 if test "x$libqwt_ok" = "xyes" ; then
89 ifelse([$1], , :, [$1])
93 ifelse([$2], , :, [$2])
96 dnl Export our variables