commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: trondeau
Subject: [Commit-gnuradio] r9597 - gnuradio/branches/developers/trondeau/qtgui/config
Date: Tue, 16 Sep 2008 22:30:38 -0600 (MDT)

Author: trondeau
Date: 2008-09-16 22:30:38 -0600 (Tue, 16 Sep 2008)
New Revision: 9597

Modified:
   gnuradio/branches/developers/trondeau/qtgui/config/gr_qwtplot3d.m4
Log:
wip: similar changes to qwt M4 file to build in (hopefully) most standard 
installations.

Modified: gnuradio/branches/developers/trondeau/qtgui/config/gr_qwtplot3d.m4
===================================================================
--- gnuradio/branches/developers/trondeau/qtgui/config/gr_qwtplot3d.m4  
2008-09-17 03:13:42 UTC (rev 9596)
+++ gnuradio/branches/developers/trondeau/qtgui/config/gr_qwtplot3d.m4  
2008-09-17 04:30:38 UTC (rev 9597)
@@ -30,8 +30,6 @@
 AC_DEFUN([GR_QWTPLOT3D],
 [
     dnl QWTPLOT3D Library Version
-    QWTPLOT3D_LIBRARY=-lqwtplot3d-qt4
-    QWTPLOT3D_INCLUDE_DIR=/usr/include/qwtplot3d-qt4
 
     dnl Save the environment
     AC_LANG_PUSH(C++)
@@ -46,41 +44,93 @@
 
     AC_ARG_WITH([qwtplot3d-incdir],
                [  --with-qwtplot3d-incdir=path  Prefix where QWTPLOT3D include 
files are (optional)],
-               [qwtplot3d_incdir="$withval"], 
[qwtplot3d_incdir=$QWTPLOT3D_INCLUDE_DIR])
+               [qwtplot3d_incdir="$withval"], [qwtplot3d_incdir=""])
 
-    dnl Create QWTPLOT3D_CFLAGS based on user input
-    AC_MSG_CHECKING(QWTPLOT3D_CFLAGS)
-    if test "$qwtplot3d_incdir" != "" ; then
-       QWTPLOT3D_CFLAGS="$QWTPLOT3D_CFLAGS -I$qwtplot3d_incdir"
-    fi
-    AC_MSG_RESULT($QWTPLOT3D_CFLAGS)
-    
-    dnl Set CPPFLAGS so C++ tests can operate
-    CPPFLAGS="$CPPFLAGS $QTCORE_CFLAGS $QTGUI_CFLAGS $QWT_CFLAGS 
$QWTPLOT3D_CFLAGS"
+    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
-    AC_CHECK_HEADERS([qwt3d_plot.h], 
-                    [],
-                    [libqwtplot3d_ok=no;AC_MSG_RESULT([cannot find usable 
qwtplot3d headers])]
-    )
+    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 Set QWTPLOT3D_LIBS based on user input
-    AC_MSG_CHECKING(QWTPLOT3D_LIBS)
-    QWTPLOT3D_LIBS="$QWTPLOT3D_LIBS $QWTPLOT3D_LIBRARY"
-    if test "$qwtplot3d_libdir" != "" ; then
-       QWTPLOT3D_LIBS="-L$qwtplot3d_libdir $QWTPLOT3D_LIBS"
+    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
-    AC_MSG_RESULT($QWTPLOT3D_LIBS)
 
-    dnl Set LIBS so C++ link test can operate
-    LIBS="$QWTPLOT3D_LIBS $QT_LIBS $LIBS"
+    dnl Don't bother going on if we can't find the headers
+    if test "$libqwtplot3d_ok" = "yes" ; then
 
-    dnl Check that library files can be linked in
-    AC_CHECK_LIB([qwtplot3d],
-                [main],
-                 [], [libqwtplot3d_ok=no;AC_MSG_RESULT([unable to link 
QWTPLOT3D library])]
-    )
+        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"





reply via email to

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