2 dnl Copyright 2007,2008 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 QWT Library Version
33 QWT_LIBRARY1=-lqwt-qt4
36 dnl Save the environment
38 qwt_save_CPPFLAGS="$CPPFLAGS"
43 dnl Allow user to specify where QWT files are
44 AC_ARG_WITH([qwt-libdir],
45 [ --with-qwt-libdir=path Prefix where QWT library is installed (optional)],
46 [qwt_libdir="$withval"], [qwt_libdir=""])
48 AC_ARG_WITH([qwt-incdir],
49 [ --with-qwt-incdir=path Prefix where QWT include files are (optional)],
50 [qwt_incdir="$withval"], [qwt_incdir=""])
51 AC_ARG_WITH([qwt-lib],
52 [ --with-qwt-lib=library QWT library name (optional)],
53 [qwt_lib="$withval"], [qwt_lib=""])
55 dnl Check for presence of header files
56 dnl if not user-specified, try the first include dir (Ubuntu), then
57 dnl try the second include dir (Fedora)
58 CPPFLAGS="$CPPFLAGS $QTCORE_CFLAGS"
60 dnl if not set by user
61 if test "$qwt_incdir" = "" ; then
62 dnl check qwt/qwt.h (as in Fedora)
68 dnl If it was found, set the flags and move on
69 if test "$qwt_qwt_h" = "yes" ; then
70 QWT_CFLAGS="$QWT_CFLAGS -I/usr/include/qwt"
72 dnl otherwise, check qwt-qt4/qwt.h (as in Ubuntu)
78 dnl if it was found, set the flags and move on
79 if test "$qwt_qt4_qwt_h" = "yes" ; then
80 QWT_CFLAGS="$QWT_CFLAGS -I/usr/include/qwt-qt4"
82 dnl otherwise, qwt.h wasn't found, so set the flag to no
87 dnl Using the user-specified include directory
88 QWT_CFLAGS="$QWT_CFLAGS -I$qwt_incdir"
95 dnl Don't bother going on if we can't find the headers
96 if test "$libqwt_ok" = "yes" ; then
98 dnl Check for QWT library (qwt or qwt-qt4)
100 dnl User-defined QWT library path
101 if test "$qwt_libdir" != "" ; then
102 QWT_LIBS="-L$qwt_libdir $QWT_LIBS"
105 dnl temporarily set these so the AC_CHECK_LIB works
106 CPPFLAGS="$CPPFLAGS $QWT_CFLAGS"
107 LIBS="$qwt_save_LIBS $QT_LIBS $QWT_LIBS -lqwt"
109 dnl If the user specified a qwt library name, use it here
110 if test "$qwt_lib" != "" ; then
111 AC_CHECK_LIB([$qwt_lib], [main], [libqwt_ok=yes], [libqwt_ok=no])
114 dnl Check for 'main' in libqwt (Fedora)
115 AC_CHECK_LIB([qwt], [main], [libqwt_ok=yes], [libqwt_ok=no])
117 dnl If library found properly, set the flag and move on
118 if test "$libqwt_ok" = "yes" ; then
119 QWT_LIBS="$QWT_LIBS -lqwt"
121 dnl Otherwise, check for 'main' in libqwt-qt4 (Ubuntu)
122 LIBS="$qwt_save_LIBS $QT_LIBS $QWT_LIBS -lqwt-qt4"
123 AC_CHECK_LIB([qwt-qt4], [main], [libqwt_ok=yes], [libqwt_ok=no])
124 if test "$libqwt_ok" = "yes" ; then
125 QWT_LIBS="$QWT_LIBS -lqwt-qt4"
127 AC_MSG_RESULT([Could not link to libqwt.so])
132 AC_MSG_RESULT([Could not find qwt headers])
135 dnl Restore saved variables
136 LIBS="$qwt_save_LIBS"
137 CPPFLAGS="$qwt_save_CPPFLAGS"
140 dnl Execute user actions
141 if test "x$libqwt_ok" = "xyes" ; then
142 ifelse([$1], , :, [$1])
146 ifelse([$2], , :, [$2])
149 dnl Export our variables