From 42d9c6f495503d3d9d2db47a9979036c9233f976 Mon Sep 17 00:00:00 2001
From: jcorgan
Date: Fri, 8 Feb 2008 23:32:10 +0000
Subject: Merged r7478:7608 from michaelld/t186 into trunk.  Adds ability to
 compile GNU Radio modules individually, using already installed dependent
 libraries and include files.  New functionality is enabled using --with-* on
 configure command line; existing build options should remain unchanged.  Nice
 work by Michael Dickens, still needs documentation update on wiki.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7617 221aa14e-8319-0410-a670-987f0aec2ac5
---
 config/grc_omnithread.m4 | 42 ++++++++++++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 10 deletions(-)

(limited to 'config/grc_omnithread.m4')

diff --git a/config/grc_omnithread.m4 b/config/grc_omnithread.m4
index f38a312cb..77618e902 100644
--- a/config/grc_omnithread.m4
+++ b/config/grc_omnithread.m4
@@ -1,4 +1,4 @@
-dnl Copyright 2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+dnl Copyright 2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
 dnl 
 dnl This file is part of GNU Radio
 dnl 
@@ -19,16 +19,38 @@ dnl Boston, MA 02110-1301, USA.
 
 AC_DEFUN([GRC_OMNITHREAD],[
     GRC_ENABLE([omnithread])
-
-    AC_CONFIG_FILES([ \
-        omnithread/Makefile \
-	omnithread/gnuradio-omnithread.pc
-    ])
-    
-    passed=yes
+    GRC_WITH([omnithread])
+    passed=no
+    if test x$with_omnithread = xyes; then
+        if test x$enable_omnithread = xyes; then
+	    AC_MSG_ERROR([Component omnithread: Cannot use both --enable and --with])
+        else
+	    PKG_CHECK_MODULES(OMNITHREAD, gnuradio-omnithread, passed=with,
+	    	   AC_MSG_RESULT([Component omnithread: PKGCONFIG cannot find info]))
+            if test x$passed = xwith; then
+                omnithread_INCLUDES=`$PKG_CONFIG --cflags-only-I gnuradio-omnithread`
+   	        omnithread_LA=$OMNITHREAD_LIBS
+		omnithread_LIBDIRPATH=`$PKG_CONFIG --variable=libdir gnuradio-omnithread`
+            fi
+	fi
+    fi
+    dnl if $passed = with, then "--with" worked; ignore the "--enable" stuff
+    dnl otherwise, $passed = no; check the "--enable" stuff
+    if test x$passed = xno; then
+        AC_CONFIG_FILES([ \
+            omnithread/Makefile \
+   	    omnithread/gnuradio-omnithread.pc
+        ])
+        passed=yes
+        omnithread_INCLUDES="-I\${abs_top_srcdir}/omnithread"
+        omnithread_LA="\${abs_top_builddir}/omnithread/libgromnithread.la"
+	omnithread_LIBDIRPATH="\${abs_top_builddir}/omnithread:\${abs_top_builddir}/omnithread/.libs"
+    fi
     GRC_BUILD_CONDITIONAL([omnithread],[
         dnl run_tests is created from run_tests.in.  Make it executable.
-	dnl AC_CONFIG_COMMANDS([run_tests_omnithread], [chmod +x omnithread/run_tests])
-
+        dnl AC_CONFIG_COMMANDS([run_tests_omnithread], [chmod +x omnithread/run_tests])
     ])
+    AC_SUBST([omnithread_INCLUDES])
+    AC_SUBST([omnithread_LA])
+    AC_SUBST([omnithread_LIBDIRPATH])
 ])
-- 
cgit