2 dnl Copyright 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 qwtplot3d.
24 dnl GR_QWTPLOT3D([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
26 dnl Test for library qwtplot3d, set QWTPLOT3D_CFLAGS and QWTPLOT3D_LIBS if found. Assumes
27 dnl QT_CFLAGS and QT_LIBS have already been correctly set.
30 AC_DEFUN([GR_QWTPLOT3D],
32 dnl QWTPLOT3D Library Version
34 dnl Save the environment
36 qwtplot3d_save_CPPFLAGS="$CPPFLAGS"
37 qwtplot3d_save_LIBS="$LIBS"
40 dnl Allow user to specify where QWTPLOT3D files are
41 AC_ARG_WITH([qwtplot3d-libdir],
42 [ --with-qwtplot3d-libdir=path Prefix where QWTPLOT3D library is installed (optional)],
43 [qwtplot3d_libdir="$withval"], [qwtplot3d_libdir=""])
45 AC_ARG_WITH([qwtplot3d-incdir],
46 [ --with-qwtplot3d-incdir=path Prefix where QWTPLOT3D include files are (optional)],
47 [qwtplot3d_incdir="$withval"], [qwtplot3d_incdir=""])
49 AC_ARG_WITH([qwtplot3d-lib],
50 [ --with-qwtplot3d-lib=library QWT Plot3D library name (optional)],
51 [qwtplot3d_lib="$withval"], [qwtplot3d_lib=""])
54 dnl Check for presence of header files
55 dnl if not user-specified, try the first include dir (Ubuntu), then
56 dnl try the second include dir (Fedora)
57 CPPFLAGS="$CPPFLAGS $QTCORE_CFLAGS $QTGUI_CFLAGS $QWT_CFLAGS"
59 dnl if not set by user
60 if test "$qwtplot3d_incdir" = "" ; then
61 dnl check qwtplot3d/qwtplot3d.h (as in Fedora)
63 [qwtplot3d/qwt3d_plot.h],
64 [qwtplot3d_qwtplot3d_h=yes],
65 [qwtplot3d_qwtplot3d_h=no]
67 dnl If it was found, set the flags and move on
68 if test "$qwtplot3d_qwtplot3d_h" = "yes" ; then
69 QWTPLOT3D_CFLAGS="$QWTPLOT3D_CFLAGS -I/usr/include/qwtplot3d"
71 dnl otherwise, check qwtplot3d-qt4/qwtplot3d.h (as in Ubuntu)
73 [qwtplot3d-qt4/qwt3d_plot.h],
74 [qwtplot3d_qt4_qwtplot3d_h=yes],
75 [qwtplot3d_qt4_qwtplot3d_h=no]
77 dnl if it was found, set the flags and move on
78 if test "$qwtplot3d_qt4_qwtplot3d_h" = "yes" ; then
79 QWTPLOT3D_CFLAGS="$QWTPLOT3D_CFLAGS -I/usr/include/qwtplot3d-qt4"
81 dnl otherwise, qwtplot3d.h wasn't found, so set the flag to no
86 dnl Using the user-specified include directory
87 QWTPLOT3D_CFLAGS="$QWTPLOT3D_CFLAGS -I$qwtplot3d_incdir"
89 [$qwtplot3d_incdir/qwt3d_plot.h],
94 dnl Don't bother going on if we can't find the headers
95 if test "$libqwtplot3d_ok" = "yes" ; then
97 dnl Check for QWTPLOT3D library (qwtplot3d or qwtplot3d-qt4)
99 dnl User-defined QWTPLOT3D library path
100 if test "$qwtplot3d_libdir" != "" ; then
101 QWTPLOT3D_LIBS="-L$qwtplot3d_libdir $QWTPLOT3D_LIBS"
104 dnl temporarily set these so the AC_CHECK_LIB works
105 CPPFLAGS="$CPPFLAGS $QWTPLOT3D_CFLAGS"
106 LIBS="$qwtplot3d_save_LIBS $QT_LIBS $QWTPLOT3D_LIBS -lqwtplot3d-qt4"
108 dnl If the user specified a qwtplot3d library name, use it here
109 if test "$qwtplot3d_lib" != "" ; then
110 AC_CHECK_LIB([$qwtplot3d_lib], [main], [libqwtplot3d_ok=yes], [libqwtplot3d_ok=no])
113 dnl Check for 'main' in libqwtplot3d-qt4
114 AC_CHECK_LIB([qwtplot3d-qt4], [main], [libqwtplot3d_ok=yes], [libqwtplot3d_ok=no])
116 dnl If library found properly, set the flag and move on
117 if test "$libqwtplot3d_ok" = "yes" ; then
118 QWTPLOT3D_LIBS="$QWTPLOT3D_LIBS -lqwtplot3d-qt4"
120 dnl Otherwise, check for 'main' in libqwtplot3d
121 LIBS="$qwtplot3d_save_LIBS $QT_LIBS $QWTPLOT3D_LIBS -lqwtplot3d"
122 AC_CHECK_LIB([qwtplot3d], [main], [libqwtplot3d_ok=yes], [libqwtplot3d_ok=no])
123 if test "$libqwtplot3d_ok" = "yes" ; then
124 QWTPLOT3D_LIBS="$QWTPLOT3D_LIBS -lqwtplot3d"
126 AC_MSG_RESULT([Could not link to libqwtplot3d.so])
131 AC_MSG_RESULT([Could not find qwtplot3d headers])
134 dnl Restore saved variables
135 LIBS="$qwtplot3d_save_LIBS"
136 CPPFLAGS="$qwtplot3d_save_CPPFLAGS"
139 dnl Execute user actions
140 if test "x$libqwtplot3d_ok" = "xyes" ; then
141 ifelse([$1], , :, [$1])
145 ifelse([$2], , :, [$2])
148 dnl Export our variables
149 AC_SUBST(QWTPLOT3D_CFLAGS)
150 AC_SUBST(QWTPLOT3D_LIBS)