commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9594 - gnuradio/branches/developers/trondeau/qtgui/co


From: trondeau
Subject: [Commit-gnuradio] r9594 - gnuradio/branches/developers/trondeau/qtgui/config
Date: Tue, 16 Sep 2008 20:40:37 -0600 (MDT)

Author: trondeau
Date: 2008-09-16 20:40:35 -0600 (Tue, 16 Sep 2008)
New Revision: 9594

Modified:
   gnuradio/branches/developers/trondeau/qtgui/config/gr_qwt.m4
Log:
wip: looking in different places for QWT library; should work for default 
installations on both Fedora and Ubuntu.

Modified: gnuradio/branches/developers/trondeau/qtgui/config/gr_qwt.m4
===================================================================
--- gnuradio/branches/developers/trondeau/qtgui/config/gr_qwt.m4        
2008-09-17 01:37:40 UTC (rev 9593)
+++ gnuradio/branches/developers/trondeau/qtgui/config/gr_qwt.m4        
2008-09-17 02:40:35 UTC (rev 9594)
@@ -30,8 +30,8 @@
 AC_DEFUN([GR_QWT],
 [
     dnl QWT Library Version
-    QWT_LIBRARY=-lqwt-qt4
-    QWT_INCLUDE_DIR=/usr/include/qwt-qt4
+    QWT_LIBRARY1=-lqwt-qt4
+    QWT_LIBRARY2=-lqwt
 
     dnl Save the environment
     AC_LANG_PUSH(C++)
@@ -47,42 +47,77 @@
 
     AC_ARG_WITH([qwt-incdir],
                [  --with-qwt-incdir=path  Prefix where QWT include files are 
(optional)],
-               [qwt_incdir="$withval"], [qwt_incdir=$QWT_INCLUDE_DIR])
+               [qwt_incdir="$withval"], [qwt_incdir=""])
 
-    dnl Create QWT_CFLAGS based on user input
-    AC_MSG_CHECKING(QWT_CFLAGS)
-    if test "$qwt_incdir" != "" ; then
+    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 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 -Iqwt"
+        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 -Iqwt-qt4"
+            else
+                dnl otherwise, qwt.h wasn't found, so set the flag to no
+                libqwt_ok=no
+                AC_MSG_RESULT([cannot find usable qwt headers])
+            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;AC_MSG_RESULT([cannot find usable qwt headers])]
+        )
     fi
-    #AC_MSG_RESULT($QWT_CFLAGS)
-    
-    dnl Set CPPFLAGS so C++ tests can operate
-    CPPFLAGS="$CPPFLAGS $QTCORE_CFLAGS $QTGUI_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 Check for QWT library (qwt or qwt-qt4)
 
-    dnl Set QWT_LIBS based on user input
-    AC_MSG_CHECKING(QWT_LIBS)
-    QWT_LIBS="$QWT_LIBS $QWT_LIBRARY"
+    dnl User-defined QWT library path
     if test "$qwt_libdir" != "" ; then
-       QWT_LIBS="-L$qwt_libdir $QWT_LIBS"
+        QWT_LIBS="-L$qwt_libdir $QWT_LIBS"
     fi
-    AC_MSG_RESULT($QWT_LIBS)
+    
+    dnl temporarily set these so the AC_CHECK_LIB works
+    CPPFLAGS="$CPPFLAGS $QWT_CFLAGS"
+    LIBS="$qwt_save_LIBS $QT_LIBS $QWT_LIBS -lqwt"
 
-    dnl Set LIBS so C++ link test can operate
-    LIBS="$QWT_LIBS $QT_LIBS $LIBS"
+    dnl Check for 'main' in libqwt (Fedora)
+    AC_CHECK_LIB([qwt], [main], [libqwt_ok=yes], [libqwt_ok=no])
 
-    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 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_ERROR([Could not link to libqwt.so])
+        fi
+    fi
 
     dnl Restore saved variables
     LIBS="$qwt_save_LIBS"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]