summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/Makefile.am5
-rw-r--r--config/gr_git.m431
-rw-r--r--config/gr_omnithread.m452
-rw-r--r--config/gr_python.m46
-rw-r--r--config/gr_version.m451
-rw-r--r--config/grc_gr_audio_portaudio.m41
-rw-r--r--config/grc_gr_qtgui.m416
-rw-r--r--config/grc_mblock.m459
-rw-r--r--config/grc_omnithread.m446
-rw-r--r--config/grc_vrt.m464
-rw-r--r--[-rwxr-xr-x]config/usrp_libusb.m4219
11 files changed, 217 insertions, 333 deletions
diff --git a/config/Makefile.am b/config/Makefile.am
index 527aefa7e..4dc7216f1 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2001,2006,2008,2009 Free Software Foundation, Inc.
+# Copyright 2001,2006,2008,2009,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -69,9 +69,7 @@ m4macros = \
grc_gr_usrp.m4 \
grc_gr_video_sdl.m4 \
grc_gr_wxgui.m4 \
- grc_mblock.m4 \
grc_gruel.m4 \
- grc_vrt.m4 \
gr_check_createfilemapping.m4 \
gr_check_mc4020.m4 \
gr_check_shm_open.m4 \
@@ -87,7 +85,6 @@ m4macros = \
gr_lib64.m4 \
gr_libgnuradio_core_extra_ldflags.m4 \
gr_no_undefined.m4 \
- gr_omnithread.m4 \
gr_pwin32.m4 \
gr_python.m4 \
gr_require_mc4020.m4 \
diff --git a/config/gr_git.m4 b/config/gr_git.m4
index e27460713..c4f1ea0c0 100644
--- a/config/gr_git.m4
+++ b/config/gr_git.m4
@@ -1,4 +1,4 @@
-dnl Copyright 2009 Free Software Foundation, Inc.
+dnl Copyright 2009,2010 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -29,14 +29,35 @@ AC_DEFUN([GR_GIT],[
AC_MSG_RESULT([ok])
AC_MSG_CHECKING([git description of current commit])
if (cd $srcdir && $GIT describe >/dev/null 2>&1); then
- GIT_VERSION=`cd $srcdir && $GIT describe --abbrev=8 | cut -f 2- -d '-'`
- AC_MSG_RESULT([$GIT_DESCRIBE])
+ GIT_DESCRIBE=`cd $srcdir && $GIT describe --abbrev=8 --long`
+ # Release candidate tags create an extra -rcX field
+ case $GIT_DESCRIBE in
+ *-*-*-*)
+ GIT_TAG=`echo $GIT_DESCRIBE | cut -f -2 -d '-'`
+ GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 3 -d '-'`
+ GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 4 -d '-' | cut -f 2- -d 'g'`
+ ;;
+ *-*-*)
+ GIT_TAG=`echo $GIT_DESCRIBE | cut -f 1 -d '-'`
+ GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 2 -d '-'`
+ GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 3 -d '-' | cut -f 2- -d 'g'`
+ ;;
+ esac
+
+ AC_MSG_RESULT([$GIT_DESCRIBE])
else
- AC_MSG_RESULT([unable to find, using current commit])
- GIT_VERSION=`cd $srcdir && $GIT describe --always --abbrev=8`
+ AC_MSG_RESULT([no tag in history, using current commit])
+ GIT_TAG=''
+ GIT_SEQNO=''
+ GIT_COMMIT=`cd $srcdir && $GIT describe --always --abbrev=8`
fi
else
AC_MSG_RESULT([not found])
fi
+
+ AC_SUBST([GIT_DESCRIBE])
+ AC_SUBST([GIT_TAG])
+ AC_SUBST([GIT_SEQNO])
+ AC_SUBST([GIT_COMMIT])
fi
])
diff --git a/config/gr_omnithread.m4 b/config/gr_omnithread.m4
deleted file mode 100644
index 054f07824..000000000
--- a/config/gr_omnithread.m4
+++ /dev/null
@@ -1,52 +0,0 @@
-# Check for Omnithread (pthread/NT) thread support. -*- Autoconf -*-
-
-# Copyright 2003,2007 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Boston, MA
-# 02110-1301, USA.
-
-AC_DEFUN([GR_OMNITHREAD],
-[
- # Check first for POSIX
- ACX_PTHREAD(
- [ AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
- ot_posix="yes"
- DEFINES="$DEFINES -DOMNITHREAD_POSIX=1"
- ],[
- # If no POSIX support found, then check for NT threads
- AC_MSG_CHECKING([for NT threads])
-
- AC_LINK_IFELSE([
- #include <windows.h>
- #include <winbase.h>
- int main() { InitializeCriticalSection(NULL); return 0; }
- ],
- [
- ot_nt="yes"
- DEFINES="$DEFINES -DOMNITHREAD_NT=1"
- ],
- [AC_MSG_FAILURE([GNU Radio requires POSIX threads. pthreads not found.])]
- )
- AC_MSG_RESULT(yes)
- ])
- AM_CONDITIONAL(OMNITHREAD_POSIX, test "x$ot_posix" = xyes)
- AM_CONDITIONAL(OMNITHREAD_NT, test "x$ot_nt" = xyes)
-
- save_LIBS="$LIBS"
- AC_SEARCH_LIBS([clock_gettime], [rt], [PTHREAD_LIBS="$PTHREAD_LIBS $LIBS"])
- AC_CHECK_FUNCS([clock_gettime gettimeofday nanosleep])
- LIBS="$save_LIBS"
-])
-
diff --git a/config/gr_python.m4 b/config/gr_python.m4
index 43ccfc015..7aef1662e 100644
--- a/config/gr_python.m4
+++ b/config/gr_python.m4
@@ -153,14 +153,16 @@ AC_DEFUN([PYTHON_CHECK_MODULE],[
try:
import $1
assert $5
-except: exit(1)'
+except ImportError, AssertionError: exit(1)
+except: pass'
dnl ########################################
dnl # import checking only
dnl ########################################
else
python_cmd='
try: import $1
-except: exit(1)'
+except ImportError: exit(1)
+except: pass'
fi
if ! $PYTHON -c "$python_cmd" 2> /dev/null; then
AC_MSG_RESULT([no])
diff --git a/config/gr_version.m4 b/config/gr_version.m4
index 3360b7d54..a7a202238 100644
--- a/config/gr_version.m4
+++ b/config/gr_version.m4
@@ -1,4 +1,4 @@
-dnl Copyright 2009 Free Software Foundation, Inc.
+dnl Copyright 2009,2010 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -25,50 +25,49 @@ AC_DEFUN([GR_VERSION],[
dnl
dnl MAJOR_VERSION Major release generation (2.x, 3.x, etc.)
dnl API_COMPAT API compatibility version (3.2.x, 3.3.x, etc.)
- dnl MINOR_VERSION Minor release version
+ dnl MINOR_VERSION Minor release version (3.3.0, 3.3.1, etc.)
dnl MAINT_VERSION Pure bugfix additions to make maintenance release
dnl
dnl The last two fields can have 'git' instead of a number to indicate
dnl that this branch is between versions.
. $srcdir/version.sh
- RELEASE=$MAJOR_VERSION.$API_COMPAT
dnl Get git version if available
GR_GIT
dnl Test if we should use git version
if test "$MINOR_VERSION" == "git"; then
- dnl 3.3git-xxx-gxxxxxxxx
- RELEASE=$RELEASE$MINOR_VERSION
- DOCVER=$RELEASE
- if test "$GIT_VERSION" != "" ; then
- RELEASE=$RELEASE-$GIT_VERSION
- fi
+ dnl RELEASE: 3.3git-xxx-gxxxxxxxx
+ dnl DOCVER: 3.3git
+ dnl LIBVER: 3.3git
+ RELEASE=$GIT_DESCRIBE
+ DOCVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION
+ LIBVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION
else
if test "$MAINT_VERSION" == "git" ; then
- dnl 3.3.1git-xxx-gxxxxxxxx
- RELEASE=$RELEASE.$MINOR_VERSION$MAINT_VERSION
- DOCVER=$RELEASE
- if test "$GIT_VERSION" != "" ; then
- RELEASE=$RELEASE-$GIT_VERSION
- fi
+ dnl RELEASE: 3.3.1git-xxx-gxxxxxxxx
+ dnl DOCVER: 3.3.1git
+ dnl LIBVER: 3.3.1git
+ RELEASE=$GIT_DESCRIBE
+ DOCVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION
+ LIBVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION
else
- dnl This is a numbered reelase.
- dnl Test if minor version is 0, which we don't encode, unless it is also
- dnl a maintenance release
- if test "$MINOR_VERSION" != "0" -o "$MAINT_VERSION" != "0"; then
- dnl 3.3.1
- RELEASE=$RELEASE.$MINOR_VERSION
- if test "$MAINT_VERSION" != "0"; then
- dnl 3.3.0.1, 3.3.1.1
- RELEASE=$RELEASE.$MAINT_VERSION
- fi
- DOCVER=$RELEASE
+ dnl This is a numbered release.
+ dnl RELEASE: 3.3.1{.x}
+ dnl DOCVER: 3.3.1{.x}
+ dnl LIBVER: 3.3.1{.x}
+ RELEASE=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION
+ if test "$MAINT_VERSION" != "0"; then
+ RELEASE=$RELEASE.$MAINT_VERSION
fi
+
+ DOCVER=$RELEASE
+ LIBVER=$RELEASE
fi
fi
AC_MSG_NOTICE([GNU Radio Release $RELEASE])
AC_SUBST(RELEASE)
AC_SUBST(DOCVER)
+ AC_SUBST(LIBVER)
])
diff --git a/config/grc_gr_audio_portaudio.m4 b/config/grc_gr_audio_portaudio.m4
index 08d71f8fb..ff551b38a 100644
--- a/config/grc_gr_audio_portaudio.m4
+++ b/config/grc_gr_audio_portaudio.m4
@@ -22,7 +22,6 @@ AC_DEFUN([GRC_GR_AUDIO_PORTAUDIO],[
dnl Don't do gr-audio-portaudio if gnuradio-core skipped
GRC_CHECK_DEPENDENCY(gr-audio-portaudio, gnuradio-core)
- GRC_CHECK_DEPENDENCY(gr-audio-portaudio, omnithread)
dnl If execution gets to here, $passed will be:
dnl with : if the --with code didn't error out
diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4
index 84514d7ce..4027bb332 100644
--- a/config/grc_gr_qtgui.m4
+++ b/config/grc_gr_qtgui.m4
@@ -42,10 +42,9 @@ AC_DEFUN([GRC_GR_QTGUI],[
# QtGui
# QtCore
# qwt
-# qwtplot3d
# qt4
-# qt4-core, qt4-gui, qwt5-qt4, qwt5-qt4-dev, libqwtplot3d-qt4, libqwtplot3d-qt4-dev, qt4-dev-tools
+# qt4-core, qt4-gui, qwt5-qt4, qwt5-qt4-dev, qt4-dev-tools
if test $passed = yes; then
dnl Check for package qt or qt-mt, set QT_CFLAGS and QT_LIBS
@@ -59,20 +58,15 @@ AC_DEFUN([GRC_GR_QTGUI],[
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"
+ QT_INCLUDES="$QWT_CFLAGS $QTCORE_CFLAGS $QTGUI_CFLAGS"
+ QT_LIBS="$QWT_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 all includes from the QWT, without the -I;
dnl qmake appends the -I when processing the project file INCLUDEPATH
- for i in $QWT_CFLAGS $QWTPLOT3D_CFLAGS; do
+ for i in $QWT_CFLAGS; do
QMAKE_INCLUDES="$QMAKE_INCLUDES ${i##-I}"
done
diff --git a/config/grc_mblock.m4 b/config/grc_mblock.m4
deleted file mode 100644
index e3ae1817f..000000000
--- a/config/grc_mblock.m4
+++ /dev/null
@@ -1,59 +0,0 @@
-dnl Copyright 2001,2002,2003,2004,2005,2006,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.
-
-AC_DEFUN([GRC_MBLOCK],[
- GRC_ENABLE(mblock)
-
- GRC_WITH(mblock)
-
- dnl Don't do mblock if omnithread or pmt skipped
- GRC_CHECK_DEPENDENCY(mblock, pmt)
- GRC_CHECK_DEPENDENCY(mblock, omnithread)
-
- dnl If execution gets to here, $passed will be:
- 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 Don't do mblock if guile not available
- GRC_CHECK_GUILE(mblock)
- fi
- if test $passed != with; then
- dnl how and where to find INCLUDES and LA
- mblock_INCLUDES="-I\${abs_top_srcdir}/mblock/src/include"
- mblock_LA="\${abs_top_builddir}/mblock/src/lib/libmblock.la"
- fi
-
- AC_CONFIG_FILES([\
- mblock/Makefile \
- mblock/mblock.pc \
- mblock/doc/Makefile \
- mblock/src/Makefile \
- mblock/src/include/Makefile \
- mblock/src/include/mblock/Makefile \
- mblock/src/lib/Makefile \
- mblock/src/scheme/Makefile \
- mblock/src/scheme/gnuradio/Makefile \
- ])
-
- GRC_BUILD_CONDITIONAL(mblock,[
- dnl run_tests is created from run_tests.in. Make it executable.
- dnl AC_CONFIG_COMMANDS([run_tests_mblock], [chmod +x mblock/src/python/run_tests])
- ])
-])
diff --git a/config/grc_omnithread.m4 b/config/grc_omnithread.m4
deleted file mode 100644
index 1bcedebe1..000000000
--- a/config/grc_omnithread.m4
+++ /dev/null
@@ -1,46 +0,0 @@
-dnl Copyright 2001,2002,2003,2004,2005,2006,2007,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.
-
-AC_DEFUN([GRC_OMNITHREAD],[
- GRC_ENABLE(omnithread)
-
- GRC_WITH(omnithread, [], gnuradio-omnithread)
-
- dnl If execution gets to here, $passed will be:
- 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 != with; then
- dnl how and where to find INCLUDES and LA and such
- 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
-
- AC_CONFIG_FILES([ \
- omnithread/Makefile \
- omnithread/gnuradio/Makefile \
- omnithread/gnuradio-omnithread.pc
- ])
-
- 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])
- ])
-])
diff --git a/config/grc_vrt.m4 b/config/grc_vrt.m4
deleted file mode 100644
index 982c8863a..000000000
--- a/config/grc_vrt.m4
+++ /dev/null
@@ -1,64 +0,0 @@
-dnl Copyright 2008,2009 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.
-
-AC_DEFUN([GRC_VRT],[
- GRC_ENABLE(vrt)
-
- dnl If execution gets to here, $passed will be:
- 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 Needed for vrt_socket_opener
- AC_CHECK_HEADERS(arpa/inet.h byteswap.h linux/if_packet.h sys/socket.h sys/un.h)
- fi
- if test $passed != with; then
- dnl how and where to find INCLUDES and LA
- VRT_INCLUDES="-I\${abs_top_srcdir}/vrt/include"
- VRT_LA="\${abs_top_builddir}/vrt/lib/libvrt.la"
- fi
-
- # Test host OS compatibility
- AC_MSG_CHECKING([whether host_os is linux*])
- case "$host_os" in
- linux*)
- AC_MSG_RESULT([yes])
- ;;
- *)
- AC_MSG_RESULT([no])
- AC_MSG_NOTICE([libvrt currently requires Linux host OS, not found])
- passed="no"
- ;;
- esac
-
- dnl Include the vrt INCLUDES and LA
- AC_SUBST(VRT_INCLUDES)
- AC_SUBST(VRT_LA)
-
- AC_CONFIG_FILES([
- vrt/Makefile
- vrt/vrt.pc
- vrt/include/Makefile
- vrt/include/vrt/Makefile
- vrt/lib/Makefile
- vrt/apps/Makefile
- ])
-
- GRC_BUILD_CONDITIONAL(vrt)
-])
diff --git a/config/usrp_libusb.m4 b/config/usrp_libusb.m4
index 251f7df10..a434d379d 100755..100644
--- a/config/usrp_libusb.m4
+++ b/config/usrp_libusb.m4
@@ -28,64 +28,153 @@ AC_DEFUN([USRP_LIBUSB], [
dnl make sure the USB_* variables work (whether from PKGCONFIG
dnl or overridden by the user)
- libusbok=no
- have_libusb1=no
- LIBUSB_PKG_CONFIG_NAME=''
+ dnl do not use LDFLAGS, since PKGCONFIG will provide everything
+ saved_LDFLAGS=${LDFLAGS}
+ LDFLAGS=
+ LIBUSB_PKG_CONFIG_NAME=
+
+ dnl loop over various possible 'libusb' PKGCONFIG names, and choose
+ dnl the first one that meets both the user's selection (via
+ dnl configure flags) as well as what is installed
+
+ dnl create the list of libusb PKGCONFIG modules to test
+ libusb_list=''
if test x$1 = xyes; then
- PKG_CHECK_MODULES(USB, libusb-1.0, [
- libusbok=yes
- have_libusb1=yes
- usb_header='libusb-1.0/libusb.h'
- usb_lib_func='libusb_bulk_transfer'
- usb_lib_name='usb-1.0'
- LIBUSB_PKG_CONFIG_NAME='libusb-1.0'
- ])
+ dnl libusb-1.0 was requested; just test for it
+ libusb_list="libusb-1.0"
else
- dnl not using libusb1 (for now); see if legacy version is found.
- dnl it might be installed under the name either 'libusb' or
- dnl 'libusb-legacy', or just available via the
- dnl user's shell environment
-
- dnl see if the pkgconfig module 'libusb' is available
- PKG_CHECK_MODULES(USB, libusb, [
- libusbok=yes
- LIBUSB_PKG_CONFIG_NAME='libusb'
+ dnl test for legacy libusb only
+ libusb_list="libusb libusb-legacy"
+ fi
+ for libusb_name in ${libusb_list}; do
+ dnl clear internal variables
+ libusbok=no
+ have_libusb1=no
+ usb_header=''
+ usb_lib_func=''
+ usb_lib_name=''
+
+ dnl start checks
+ AC_MSG_NOTICE([Checking for LIBUSB version '${libusb_name}'])
+ if test ${libusb_name} = "libusb-1.0"; then
+ dnl see if the pkgconfig module is available
+ PKG_CHECK_MODULES(USB, ${libusb_name}, [
+ libusbok=yes
+ have_libusb1=yes
+ usb_header='libusb-1.0/libusb.h'
+ usb_lib_func='libusb_bulk_transfer'
], [libusbok=no])
- dnl PKG_CHECK_MODULES does not work correctly when embedded
- if test $libusbok = no; then
- dnl if not, see if the pkgconfig module 'libusb-legacy' is available
- PKG_CHECK_MODULES(USB, [libusb-legacy], [
+ else
+ dnl see if the pkgconfig module is available
+ PKG_CHECK_MODULES(USB, ${libusb_name}, [
libusbok=yes
- LIBUSB_PKG_CONFIG_NAME='libusb-legacy'
- ], [libusbok=no])
+ usb_header='usb.h'
+ usb_lib_func='usb_bulk_write'
+ ], [libusbok=no])
fi
- dnl set variables for further testing
- usb_header='usb.h'
- usb_lib_func='usb_bulk_write'
- usb_lib_name='usb'
- fi
- AC_SUBST(LIBUSB_PKG_CONFIG_NAME)
- if test x$1 != xyes || test $have_libusb1 = yes; then
- dnl Either (1) libusb1 was specified and found; or
- dnl (2) libusb1 was not specified. Restart checking.
- libusbok=yes
+ if test $libusbok = yes; then
+ dnl PKGCONFIG found a version of LIBUSB.
+ dnl Check it to make sure it meets enough criteria:
+ dnl Verify that $usb_header is a valid header. If so, then
+ dnl verify that $usb_lib_func can be found in the library
+ dnl $usb_lib_name. if so, verify that the symbol 'usb_debug' is
+ dnl found in the library.
+
+ dnl Check for the header. Similar to AC_CHECK_HEADERS,
+ dnl but doesn't append to known \#defines.
+ dnl If PKGCONFIG found variable USB_INCLUDEDIR, and it is
+ dnl not empty, use it for checking for $usb_header.
+ dnl Otherwise, maybe the user's shell environment is already
+ dnl configured to find this header.
+ AC_LANG_PUSH(C)
+ save_CPPFLAGS="$CPPFLAGS"
+ if test x$USB_INCLUDEDIR != x; then
+ USB_INCLUDES="-I$USB_INCLUDEDIR"
+ CPPFLAGS="$USB_INCLUDES"
+ fi
+ AC_MSG_CHECKING([$libusb_name for header $usb_header])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include "$usb_header"
+ ]], [])],
+ [libusbok=yes],[libusbok=no])
+ AC_MSG_RESULT([$libusbok])
+ CPPFLAGS="$save_CPPFLAGS"
+ AC_LANG_POP(C)
+
+ if test $libusbok = yes; then
+ dnl found the header; now make sure the library is OK
+ dnl On Darwin, need to include the IOKit library.
- dnl Verify that $usb_header is a valid header, and if so,
- dnl then verify that $usb_lib_func can be found in the
- dnl library $usb_lib_name.
+ AC_LANG_PUSH(C)
+ save_LIBS="$LIBS"
+ case "$host_os" in
+ darwin*)
+ USB_LIBS="$USB_LIBS -lIOKit"
+ ;;
+ *) ;;
+ esac
+ LIBS="$USB_LIBS"
- dnl If PKGCONFIG found variable USB_INCLUDEDIR, and it is
- dnl not empty, use it for checking for $usb_header.
- dnl Otherwise, maybe the user's shell environment is already
- dnl configured to find this header.
+ dnl find the library link name
+ usb_lib_name=`echo $USB_LIBS | sed -e "s@.*-l\(usb[[^ ]]*\).*@\1@"`
+ dnl Check for the function in the library. Similar to
+ dnl AC_CHECK_LIB, but doesn't append to known \#defines.
+ AC_MSG_CHECKING([$libusb_name for function $usb_lib_func in library $usb_lib_name])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+ char $usb_lib_func ();
+ ]], [[return $usb_lib_func ();]])],
+ [libusbok=yes],[libusbok=no])
+ AC_MSG_RESULT([$libusbok])
+ LIBS="$save_LIBS"
+ AC_LANG_POP(C)
+
+ if test $libusbok = yes; then
+ if test ${libusb_name} != "libusb-1.0"; then
+ dnl PKGCONFIG found a legacy version of libusb; make sure the
+ dnl variable _usb_debug is available in the found library
+ AC_LANG_PUSH(C)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$USB_INCLUDES"
+ save_LIBS="$LIBS"
+ LIBS="$USB_LIBS"
+ AC_MSG_CHECKING([$libusb_name for symbol usb_debug in library $usb_lib_name])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ extern int usb_debug;]],
+ [[usb_debug = 0;]])],
+ [libusbok=yes],[libusbok=no])
+ AC_MSG_RESULT([$libusbok])
+ LIBS="$save_LIBS"
+ CPPFLAGS="$save_CPPFLAGS"
+ AC_LANG_POP(C)
+ fi
+ fi
+ fi
+ fi
+ dnl if everything checks out OK, finish up
+ if test $libusbok = yes; then
+ LIBUSB_PKG_CONFIG_NAME="${libusb_name}"
+ break
+ else
+ dnl something wasn't found in this LIBUSB version.
+ dnl HACK: clear cache variables for header and library
+ unset USB_INCLUDEDIR
+ unset USB_INCLUDES
+ unset USB_LIBS
+ unset $as_ac_Header
+ unset $as_ac_Lib
+ fi
+ done
+
+ if test $libusbok = yes; then
+ dnl final error checking, mostly to create #define's
AC_LANG_PUSH(C)
save_CPPFLAGS="$CPPFLAGS"
- if test x$USB_INCLUDEDIR != x; then
- USB_INCLUDES="-I$USB_INCLUDEDIR"
- CPPFLAGS="$CPPFLAGS $USB_INCLUDES"
- AC_SUBST(USB_INCLUDES)
- fi
+ CPPFLAGS="$USB_INCLUDES"
+ dnl Check for the header.
AC_CHECK_HEADERS([$usb_header], [], [libusbok=no])
CPPFLAGS="$save_CPPFLAGS"
AC_LANG_POP(C)
@@ -93,24 +182,15 @@ AC_DEFUN([USRP_LIBUSB], [
if test $libusbok = no; then
AC_MSG_RESULT([USRP requires libusb header '$usb_header' which was not found or was not usable. See http://www.libusb.org])
else
-
- dnl found the header; now make sure the library is OK
- dnl On Darwin, need to include the IOKit library.
-
+ dnl check for the library (again)
AC_LANG_PUSH(C)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$USB_INCLUDES"
save_LIBS="$LIBS"
- LIBS=""
- case "$host_os" in
- darwin*)
- USB_LIBS="$USB_LIBS -lIOKit"
- LIBS="$USB_LIBS"
- ;;
- *) ;;
- esac
+ LIBS="$USB_LIBS"
AC_CHECK_LIB([$usb_lib_name], [$usb_lib_func], [], [
libusbok=no
- AC_MSG_RESULT([USRP requires library '$usb_lib_name' with function '$usb_lib_func', which was either not found or was not usable. See http://www.libusb.org])
- ])
+ AC_MSG_RESULT([USRP requires library '$usb_lib_name' with function '$usb_lib_func', which was either not found or was not usable. See http://www.libusb.org])])
case "$host_os" in
cygwin* | mingw*)
USB_LIBS="$LIBS"
@@ -118,15 +198,28 @@ AC_DEFUN([USRP_LIBUSB], [
*) ;;
esac
LIBS="$save_LIBS"
+ CPPFLAGS="$save_CPPFLAGS"
AC_LANG_POP(C)
fi
fi
+
if test $libusbok = yes; then
- AC_SUBST(USB_LIBS)
+ dnl success
+ AC_MSG_NOTICE([Using LIBUSB version '${libusb_name}'])
ifelse([$2], , :, [$2])
else
+ dnl not found; clear substitution variables
+ LIBUSB_PKG_CONFIG_NAME=
USB_INCLUDES=
USB_LIBS=
ifelse([$3], , :, [$3])
fi
+
+ dnl create substitution variables
+ AC_SUBST(USB_INCLUDES)
+ AC_SUBST(USB_LIBS)
+ AC_SUBST(LIBUSB_PKG_CONFIG_NAME)
+
+ dnl restore LDFLAGS
+ LDFLAGS=${saved_LDFLAGS}
])