diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/gr_qwt.m4 | 115 | ||||
-rw-r--r-- | config/gr_qwtplot3d.m4 | 151 | ||||
-rw-r--r-- | config/grc_gr_qtgui.m4 | 52 |
3 files changed, 282 insertions, 36 deletions
diff --git a/config/gr_qwt.m4 b/config/gr_qwt.m4 index bcdb7d98c..16ec63819 100644 --- a/config/gr_qwt.m4 +++ b/config/gr_qwt.m4 @@ -1,5 +1,5 @@ dnl -dnl Copyright 2007 Free Software Foundation, Inc. +dnl Copyright 2007,2008 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -29,12 +29,17 @@ dnl AC_DEFUN([GR_QWT], [ + dnl QWT Library Version + QWT_LIBRARY1=-lqwt-qt4 + QWT_LIBRARY2=-lqwt + dnl Save the environment AC_LANG_PUSH(C++) qwt_save_CPPFLAGS="$CPPFLAGS" qwt_save_LIBS="$LIBS" libqwt_ok=yes + dnl QWT Info dnl Allow user to specify where QWT files are AC_ARG_WITH([qwt-libdir], [ --with-qwt-libdir=path Prefix where QWT library is installed (optional)], @@ -43,41 +48,89 @@ AC_DEFUN([GR_QWT], AC_ARG_WITH([qwt-incdir], [ --with-qwt-incdir=path Prefix where QWT include files are (optional)], [qwt_incdir="$withval"], [qwt_incdir=""]) + AC_ARG_WITH([qwt-lib], + [ --with-qwt-lib=library QWT library name (optional)], + [qwt_lib="$withval"], [qwt_lib=""]) + + dnl Check for presence of header files + dnl if not user-specified, try the first include dir (Ubuntu), then + dnl try the second include dir (Fedora) + CPPFLAGS="$CPPFLAGS $QTCORE_CFLAGS" - dnl Create QWT_CFLAGS based on user input - AC_MSG_CHECKING(QWT_CFLAGS) - if test "$qwt_incdir" != "" ; then + dnl if not set by user + if test "$qwt_incdir" = "" ; then + dnl check qwt/qwt.h (as in Fedora) + AC_CHECK_HEADER( + [qwt/qwt.h], + [qwt_qwt_h=yes], + [qwt_qwt_h=no] + ) + dnl If it was found, set the flags and move on + if test "$qwt_qwt_h" = "yes" ; then + QWT_CFLAGS="$QWT_CFLAGS -I/usr/include/qwt" + else + dnl otherwise, check qwt-qt4/qwt.h (as in Ubuntu) + AC_CHECK_HEADER( + [qwt-qt4/qwt.h], + [qwt_qt4_qwt_h=yes], + [qwt_qt4_qwt_h=no] + ) + dnl if it was found, set the flags and move on + if test "$qwt_qt4_qwt_h" = "yes" ; then + QWT_CFLAGS="$QWT_CFLAGS -I/usr/include/qwt-qt4" + else + dnl otherwise, qwt.h wasn't found, so set the flag to no + libqwt_ok=no + fi + fi + else + dnl Using the user-specified include directory QWT_CFLAGS="$QWT_CFLAGS -I$qwt_incdir" + AC_CHECK_HEADER( + [$qwt_incdir/qwt.h], + [], + [libqwt_ok=no]) fi - AC_MSG_RESULT($QWT_CFLAGS) - - dnl Set CPPFLAGS so C++ tests can operate - CPPFLAGS="$CPPFLAGS $QT_CFLAGS $QWT_CFLAGS" - dnl Check for presence of header files - AC_CHECK_HEADERS([qwt.h], - [], - [libqwt_ok=no;AC_MSG_RESULT([cannot find usable qwt headers])] - ) - - dnl Set QWT_LIBS based on user input - AC_MSG_CHECKING(QWT_LIBS) - QWT_LIBS="$QWT_LIBS -lqwt" - if test "$qwt_libdir" != "" ; then - QWT_LIBS="-L$qwt_libdir $QWT_LIBS" + dnl Don't bother going on if we can't find the headers + if test "$libqwt_ok" = "yes" ; then + + dnl Check for QWT library (qwt or qwt-qt4) + + dnl User-defined QWT library path + if test "$qwt_libdir" != "" ; then + QWT_LIBS="-L$qwt_libdir $QWT_LIBS" + fi + + dnl temporarily set these so the AC_CHECK_LIB works + CPPFLAGS="$CPPFLAGS $QWT_CFLAGS" + LIBS="$qwt_save_LIBS $QT_LIBS $QWT_LIBS -lqwt" + + dnl If the user specified a qwt library name, use it here + if test "$qwt_lib" != "" ; then + AC_CHECK_LIB([$qwt_lib], [main], [libqwt_ok=yes], [libqwt_ok=no]) + + else + dnl Check for 'main' in libqwt (Fedora) + AC_CHECK_LIB([qwt], [main], [libqwt_ok=yes], [libqwt_ok=no]) + + dnl If library found properly, set the flag and move on + if test "$libqwt_ok" = "yes" ; then + QWT_LIBS="$QWT_LIBS -lqwt" + else + dnl Otherwise, check for 'main' in libqwt-qt4 (Ubuntu) + LIBS="$qwt_save_LIBS $QT_LIBS $QWT_LIBS -lqwt-qt4" + AC_CHECK_LIB([qwt-qt4], [main], [libqwt_ok=yes], [libqwt_ok=no]) + if test "$libqwt_ok" = "yes" ; then + QWT_LIBS="$QWT_LIBS -lqwt-qt4" + else + AC_MSG_RESULT([Could not link to libqwt.so]) + fi + fi + fi + else + AC_MSG_RESULT([Could not find qwt headers]) fi - AC_MSG_RESULT($QWT_LIBS) - - dnl Set LIBS so C++ link test can operate - LIBS="$QWT_LIBS $QT_LIBS $LIBS" - - dnl Check that library files can be linked in - dnl This references an arbitrary static class method - AC_TRY_LINK([#include <qwt_text.h>], - [QwtTextEngine const *te = QwtText::textEngine(QwtText::AutoText)], - [], - [libqwt_ok=no;AC_MSG_RESULT([unable to link QWT library])] - ) dnl Restore saved variables LIBS="$qwt_save_LIBS" diff --git a/config/gr_qwtplot3d.m4 b/config/gr_qwtplot3d.m4 new file mode 100644 index 000000000..758dfbc3e --- /dev/null +++ b/config/gr_qwtplot3d.m4 @@ -0,0 +1,151 @@ +dnl +dnl Copyright 2008 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 3, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 51 Franklin Street, +dnl Boston, MA 02110-1301, USA. +dnl + +dnl Configure paths for library qwtplot3d. +dnl +dnl GR_QWTPLOT3D([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +dnl Test for library qwtplot3d, set QWTPLOT3D_CFLAGS and QWTPLOT3D_LIBS if found. Assumes +dnl QT_CFLAGS and QT_LIBS have already been correctly set. +dnl + +AC_DEFUN([GR_QWTPLOT3D], +[ + dnl QWTPLOT3D Library Version + + dnl Save the environment + AC_LANG_PUSH(C++) + qwtplot3d_save_CPPFLAGS="$CPPFLAGS" + qwtplot3d_save_LIBS="$LIBS" + libqwtplot3d_ok=yes + + dnl Allow user to specify where QWTPLOT3D files are + AC_ARG_WITH([qwtplot3d-libdir], + [ --with-qwtplot3d-libdir=path Prefix where QWTPLOT3D library is installed (optional)], + [qwtplot3d_libdir="$withval"], [qwtplot3d_libdir=""]) + + AC_ARG_WITH([qwtplot3d-incdir], + [ --with-qwtplot3d-incdir=path Prefix where QWTPLOT3D include files are (optional)], + [qwtplot3d_incdir="$withval"], [qwtplot3d_incdir=""]) + + AC_ARG_WITH([qwtplot3d-lib], + [ --with-qwtplot3d-lib=library QWT Plot3D library name (optional)], + [qwtplot3d_lib="$withval"], [qwtplot3d_lib=""]) + + + dnl Check for presence of header files + dnl if not user-specified, try the first include dir (Ubuntu), then + dnl try the second include dir (Fedora) + CPPFLAGS="$CPPFLAGS $QTCORE_CFLAGS $QTGUI_CFLAGS $QWT_CFLAGS" + + dnl if not set by user + if test "$qwtplot3d_incdir" = "" ; then + dnl check qwtplot3d/qwtplot3d.h (as in Fedora) + AC_CHECK_HEADER( + [qwtplot3d/qwt3d_plot.h], + [qwtplot3d_qwtplot3d_h=yes], + [qwtplot3d_qwtplot3d_h=no] + ) + dnl If it was found, set the flags and move on + if test "$qwtplot3d_qwtplot3d_h" = "yes" ; then + QWTPLOT3D_CFLAGS="$QWTPLOT3D_CFLAGS -I/usr/include/qwtplot3d" + else + dnl otherwise, check qwtplot3d-qt4/qwtplot3d.h (as in Ubuntu) + AC_CHECK_HEADER( + [qwtplot3d-qt4/qwt3d_plot.h], + [qwtplot3d_qt4_qwtplot3d_h=yes], + [qwtplot3d_qt4_qwtplot3d_h=no] + ) + dnl if it was found, set the flags and move on + if test "$qwtplot3d_qt4_qwtplot3d_h" = "yes" ; then + QWTPLOT3D_CFLAGS="$QWTPLOT3D_CFLAGS -I/usr/include/qwtplot3d-qt4" + else + dnl otherwise, qwtplot3d.h wasn't found, so set the flag to no + libqwtplot3d_ok=no + fi + fi + else + dnl Using the user-specified include directory + QWTPLOT3D_CFLAGS="$QWTPLOT3D_CFLAGS -I$qwtplot3d_incdir" + AC_CHECK_HEADER( + [$qwtplot3d_incdir/qwt3d_plot.h], + [], + [libqwtplot3d_ok=no]) + fi + + dnl Don't bother going on if we can't find the headers + if test "$libqwtplot3d_ok" = "yes" ; then + + dnl Check for QWTPLOT3D library (qwtplot3d or qwtplot3d-qt4) + + dnl User-defined QWTPLOT3D library path + if test "$qwtplot3d_libdir" != "" ; then + QWTPLOT3D_LIBS="-L$qwtplot3d_libdir $QWTPLOT3D_LIBS" + fi + + dnl temporarily set these so the AC_CHECK_LIB works + CPPFLAGS="$CPPFLAGS $QWTPLOT3D_CFLAGS" + LIBS="$qwtplot3d_save_LIBS $QT_LIBS $QWTPLOT3D_LIBS -lqwtplot3d-qt4" + + dnl If the user specified a qwtplot3d library name, use it here + if test "$qwtplot3d_lib" != "" ; then + AC_CHECK_LIB([$qwtplot3d_lib], [main], [libqwtplot3d_ok=yes], [libqwtplot3d_ok=no]) + + else + dnl Check for 'main' in libqwtplot3d-qt4 + AC_CHECK_LIB([qwtplot3d-qt4], [main], [libqwtplot3d_ok=yes], [libqwtplot3d_ok=no]) + + dnl If library found properly, set the flag and move on + if test "$libqwtplot3d_ok" = "yes" ; then + QWTPLOT3D_LIBS="$QWTPLOT3D_LIBS -lqwtplot3d-qt4" + else + dnl Otherwise, check for 'main' in libqwtplot3d + LIBS="$qwtplot3d_save_LIBS $QT_LIBS $QWTPLOT3D_LIBS -lqwtplot3d" + AC_CHECK_LIB([qwtplot3d], [main], [libqwtplot3d_ok=yes], [libqwtplot3d_ok=no]) + if test "$libqwtplot3d_ok" = "yes" ; then + QWTPLOT3D_LIBS="$QWTPLOT3D_LIBS -lqwtplot3d" + else + AC_MSG_RESULT([Could not link to libqwtplot3d.so]) + fi + fi + fi + else + AC_MSG_RESULT([Could not find qwtplot3d headers]) + fi + + dnl Restore saved variables + LIBS="$qwtplot3d_save_LIBS" + CPPFLAGS="$qwtplot3d_save_CPPFLAGS" + AC_LANG_POP + + dnl Execute user actions + if test "x$libqwtplot3d_ok" = "xyes" ; then + ifelse([$1], , :, [$1]) + else + QWTPLOT3D_CFLAGS="" + QWTPLOT3D_LIBDIRS="" + ifelse([$2], , :, [$2]) + fi + + dnl Export our variables + AC_SUBST(QWTPLOT3D_CFLAGS) + AC_SUBST(QWTPLOT3D_LIBS) +]) diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4 index 479c15a3f..4a717c658 100644 --- a/config/grc_gr_qtgui.m4 +++ b/config/grc_gr_qtgui.m4 @@ -27,20 +27,62 @@ AC_DEFUN([GRC_GR_QTGUI],[ dnl with : if the --with code didn't error out dnl yes : if the --enable code passed muster and all dependencies are met dnl no : otherwise - if test $passed = yes; then - dnl Check for package qt or qt-mt, set QT_CFLAGS and QT_LIBS - PKG_CHECK_MODULES(QT, qt >= 3.3, [], [ - PKG_CHECK_MODULES(QT, qt-mt >= 3.3, [], - [passed=no;AC_MSG_RESULT([gr-qtgui requires libqt or libqt-mt, neither found.])])]) + +# Check for: +# QtOpenGL +# QtGui +# QtCore +# qwt +# qwtplot3d +# qt4 + +# qt4-core, qt4-gui, qwt5-qt4, qwt5-qt4-dev, libqwtplot3d-qt4, libqwtplot3d-qt4-dev, qt4-dev-tools + + if test $passed = yes; then + dnl Check for package qt or qt-mt, set QT_CFLAGS and QT_LIBS + PKG_CHECK_MODULES(QTCORE, QtCore >= 4.3.4, [], + [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtCore.])]) + PKG_CHECK_MODULES(QTGUI, QtGui >= 4.3.4, [], + [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtGui.])]) + PKG_CHECK_MODULES(QTOPENGL, QtOpenGL >= 4.3.4, [], + [passed=no; AC_MSG_RESULT([gr-qtgui requires libQtOpenGL.])]) + dnl Fetch QWT variables GR_QWT([], [passed=no]) + + dnl Process QWT Plot3D only if QWT passed + if test "$passed" = "yes"; then + GR_QWTPLOT3D([], [passed=no]) + fi + + dnl Export the include dirs and libraries (note: QTOPENGL_LIBS includes links + dnl to QtCore and QtGui libraries) + QT_INCLUDES="$QWT_CFLAGS $QWTPLOT3D_CFLAGS $QTCORE_CFLAGS $QTGUI_CFLAGS" + QT_LIBS="$QWT_LIBS $QWTPLOT3D_LIBS $QTOPENGL_LIBS" + + dnl Build an includes variable specifically for running qmake by extracting + dnl all includes from the QWT and QWTPLOT3D, without the -I; + dnl qmake appends the -I when processing the project file INCLUDEPATH + for i in $QWT_CFLAGS $QWTPLOT3D_CFLAGS; do + QMAKE_INCLUDES="$QMAKE_INCLUDES ${i##-I}" + done + + QT_MOC_EXEC=`pkg-config --variable=moc_location QtCore` + QT_UIC_EXEC=`pkg-config --variable=uic_location QtCore` + + AC_SUBST(QMAKE_INCLUDES) + AC_SUBST(QT_INCLUDES) + AC_SUBST(QT_LIBS) + AC_SUBST(QT_MOC_EXEC) + AC_SUBST(QT_UIC_EXEC) fi AC_CONFIG_FILES([ \ gr-qtgui/Makefile \ gr-qtgui/src/Makefile \ gr-qtgui/src/lib/Makefile \ + gr-qtgui/src/python/Makefile \ ]) GRC_BUILD_CONDITIONAL(gr-qtgui) |