No longer rely on pkg-config for libusb

Use AC_CHECK_LIB macro to search for libusb rather than rely on
pkg-config.  Preserve environment variables LIBUSB_CFLAGS and
LIBUSB_LIBS as user precious variables.  Two features,
--with-xml-support and --enable-usrp still rely on pkg-config so only
invoke pkg-config when either or both of these features are selected.
Only the Winradio g313 model uses libdl so test for it only when
Winradio backend is enabled.
Hamlib-3.0
Nate Bargmann 2013-10-30 22:29:50 -05:00
rodzic e9ee671149
commit 0eda2b55d1
6 zmienionych plików z 194 dodań i 147 usunięć

24
INSTALL
Wyświetl plik

@ -154,15 +154,23 @@ variables to "-O3".
These variables may also follow all options on the configure command line:
./configure --prefix="$HOME/local" [more options] CFLAGS="-g -O0" CXXFLAGS="-g -O0"
./configure --prefix="$HOME/local" [more options] \
CFLAGS="-g -O0" \
CXXFLAGS="-g -O0"
which will set the installation path to the the directory named 'local' under
user's home directory(executables will be installed to $HOME/local/bin,
header files to $HOME/local/include, and so on) and tells the C and C++
compilers to enable debugging symbols and disable optimizations.
N.B. When setting environment variables on the configure command line, always
put them last so the configure script is aware of them and can store them in
the cache. When placed before the configure script on the command line, they
cannot be cached.
Depending on what languages the package uses, some of these options may
or may not be available. To see what is available, type:
% sh ./configure --help
About the configure script
@ -242,9 +250,19 @@ MS Windows
./configure --host=i686-w64-mingw32
- Specifying the directory of libusb for a Windows build using MinGW as
libusb must be installed separately, use the following environment
variables after all other options.
./configure [other options] \
CPPFLAGS="-I/path_to_libusb/include" \
LDFLAGS="-L/path_to_libusb/lib/gcc"
- Mingw compiler under Cygwin
CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" \
./configure --host=i686-pc-mingw32
./configure --host=i686-pc-mingw32 \
CC="gcc -mno-cygwin" \
CXX="g++ -mno-cygwin"
- Cygwin
Native Cygwin requires no special options besides regular ones.

8
NEWS
Wyświetl plik

@ -43,6 +43,14 @@ Version 3.0
Bill, G4WJS.
* New Peaberry models V1 and V2 added to kit backend. TNX ON8VQ
and R2AEE.
* New IC-7100 model. TNX Martin, CT1IQI.
* Use AC_CHECK_LIB macro to search for libusb rather than rely on
pkg-config. Preserve environment variables LIBUSB_CFLAGS and
LIBUSB_LIBS as user precious variables. Two features,
--with-xml-support and --enable-usrp still rely on pkg-config so
only invoke pkg-config when either or both of these features are
selected. Only the Winradio g313 model uses libdl so test for it
only when Winradio backend is enabled.
Version 1.2.15.3
2012-11-01

Wyświetl plik

@ -234,7 +234,6 @@ distributions may differ).
* autoconf 2.67 # autoconf --version
* automake 1.11 # automake --version
* libtool 2.2.6b+ # libtool --version
* pkg-config 0.25 # pkg-config --version
* Git for connection to git.code.sf.net/p/hamlib/code
* texinfo 4.13a # makeinfo --version
@ -251,6 +250,7 @@ Optional, but highly recommended:
* libusb devel # libusb-config --version (not 1.0.0!)
* libreadline devel # ver 5.2 or newer
* texlive # 5.1 tested with 'make distcheck'
* pkg-config 0.9.0 # pkg-config --version (libxml and USRP)
N.B.: The libusb package is required for building most of the 'kit' backend.
The older version is needed, not 1.0.0 or higher. Debian and derivatives

Wyświetl plik

@ -85,12 +85,14 @@ AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
# TODO: check whether CXX is functional
AC_CHECK_PROG([cf_with_cxx], ["${CXX}"], [yes], [no])
AM_CONDITIONAL([ENABLE_CXX], [test x"${cf_with_cxx}" = "xyes"])
dnl Broke on older Automake, so test for its existence.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
dnl Pkgconfig assists when using certain external packages
PKG_PROG_PKG_CONFIG
## ----------------------------------- ##
## Miscellaneous configuration macros ##
@ -235,14 +237,6 @@ ioctl memchr memmove memset pow rint select setitimer setlocale sigaction \
snprintf socket sqrt strchr strdup strerror strncasecmp strrchr strstr strtol])
AC_FUNC_ALLOCA
# Check for libdl and set DL_LIB if found
AC_CHECK_LIB([dl],
[dlopen],
[DL_LIB="-ldl"],
[],
[])
AC_SUBST([DL_LIB])
dnl AC_LIBOBJ replacement functions directory
AC_CONFIG_LIBOBJ_DIR([lib])
@ -312,65 +306,25 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
])
# libxml2 required rigmem xml support, make it user optional
AC_MSG_CHECKING([whether to build rigmem XML support])
AC_ARG_WITH([xml-support],
[AS_HELP_STRING([--with-xml-support],
[build rigmem with XML support @<:@default=no@:>@])],
[cf_with_xml_support=$withval],
[cf_with_xml_support=no])
AC_MSG_RESULT([$cf_with_xml_support])
dnl Check for libusb, treat LIBUSB_LIBS and LIBUSB_CFLAGS as precious variables
AC_ARG_VAR([LIBUSB_CFLAGS], [C compiler flags for libusb, overriding configure defaults])
AC_ARG_VAR([LIBUSB_LIBS], [linker flags for libusb, overriding configure check (useful for specifying static libusb.a (see INSTALL))])
cf_with_libusb="no"
dnl Check for pkg-config presence and if not installed define a dummy macro
dnl to disable libxml2 use. Code borrowed from:
dnl http://lists.gnu.org/archive/html/automake/2011-03/msg00008.html
# Check for pkg-config program, used for configuring some libraries.
#
m4_define_default([PKG_PROG_PKG_CONFIG],
[AC_MSG_CHECKING([pkg-config])
AC_MSG_RESULT([no])])
AS_IF([test -z $LIBUSB_LIBS],
[AC_CHECK_LIB([usb], [usb_init], [LIBUSB_LIBS="-lusb" cf_with_libusb="yes"],
[AC_MSG_WARN([usb_init was not found in libusb--USB backends will be disabled])])
], [cf_with_libusb="yes"])
PKG_PROG_PKG_CONFIG
LIBUSB=""
# If the pkg-config autoconf support isn't installed, define its
# autoconf macro to disable any packages depending on it.
#
m4_define_default([PKG_CHECK_MODULES],
[AC_MSG_CHECKING([$1])
AC_MSG_RESULT([no])
$4])
AS_IF([test x"${cf_with_xml_support}" = "xyes"], [
PKG_CHECK_MODULES([LIBXML2],
[libxml-2.0],
[AC_DEFINE([HAVE_XML2],
[1],
[Define if libxml2 is available])],
[AC_MSG_WARN([libxml-2.0 pkg-config not found, XML support will be disabled])
])
])
AC_SUBST([LIBXML2_LIBS])
AC_SUBST([LIBXML2_CFLAGS])
dnl Defines LIBUSB_CFLAGS and LIBUSB_LIBS as precious variables
dnl so they appear in all Makefiles.
# macros/pkg.m4
PKG_CHECK_MODULES([LIBUSB], [libusb >= 0.1],
[AC_CHECK_HEADERS([usb.h])
AC_DEFINE([HAVE_LIBUSB],
[1],
[Define if libusb is available])
cf_with_libusb="yes"
LIBUSB="libusb"],
[cf_with_libusb="no"
LIBUSB=""])
AS_IF([test x"${cf_with_libusb}" = xno],
[AC_MSG_WARN([libusb pkg-config not found, USB backends will be disabled])
])
AS_IF([test x"${cf_with_libusb}" = "xyes"],
[AC_CHECK_HEADERS([usb.h])
AC_DEFINE([HAVE_LIBUSB],
[1],
[Define if libusb is available])
LIBUSB="libusb"])
# Only used in hamlib.pc.in
AC_SUBST([LIBUSB])
@ -423,6 +377,71 @@ AS_IF([test x"$cf_enable_html_matrix" != "xno"],
AM_CONDITIONAL([HTML_MATRIX], [test x"${cf_enable_html_matrix}" = "xyes"])
## ------------------ ##
## PKG Config support ##
## ------------------ ##
dnl These features rely on the external pkg-config functionality being available.
dnl Test for pkg-config only when these features are enabled.
# libxml2 required rigmem xml support, make it user optional
AC_MSG_CHECKING([whether to build rigmem XML support])
AC_ARG_WITH([xml-support],
[AS_HELP_STRING([--with-xml-support],
[build rigmem with XML support @<:@default=no@:>@])],
[cf_with_xml_support=$withval],
[cf_with_xml_support=no])
AC_MSG_RESULT([$cf_with_xml_support])
# USRP needs a C++ compiler, tested for presence above.
AS_IF([test x"${cf_with_cxx}" = "xyes"], [
AC_MSG_CHECKING([whether to build USRP backend])
AC_ARG_ENABLE([usrp],
[AS_HELP_STRING([--enable-usrp],
[build USRP backend @<:@default=no@:>@])],
[cf_with_usrp=$enableval],
[cf_with_usrp="no"])
AC_MSG_RESULT([$cf_with_usrp])
])
dnl Only check for pkg-config when either of the dependent features are enabled.
AS_IF([test x"${cf_with_xml_support}" = "xyes" || test x"${cf_with_usrp}" = "xyes"], [
dnl Check for pkg-config presence and if not installed define a dummy macro
dnl to disable libxml2 and USRP use. Code borrowed from:
dnl http://lists.gnu.org/archive/html/automake/2011-03/msg00008.html
dnl
dnl Check for pkg-config program, used for configuring some libraries.
m4_define_default([PKG_PROG_PKG_CONFIG],
[AC_MSG_CHECKING([pkg-config])
AC_MSG_RESULT([no])])
PKG_PROG_PKG_CONFIG
dnl If the pkg-config autoconf support isn't installed, define its
dnl autoconf macro to disable any packages depending on it.
m4_define_default([PKG_CHECK_MODULES],
[AC_MSG_CHECKING([$1])
AC_MSG_RESULT([no])
$4])
])
AS_IF([test x"${cf_with_xml_support}" = "xyes"], [
PKG_CHECK_MODULES([LIBXML2],
[libxml-2.0],
[AC_DEFINE([HAVE_XML2],
[1],
[Define if libxml2 is available])],
[AC_MSG_WARN([libxml-2.0 pkg-config not found, XML support will be disabled])
])
])
AC_SUBST([LIBXML2_LIBS])
AC_SUBST([LIBXML2_CFLAGS])
## ----------------- ##
## Language bindings ##
## ----------------- ##
@ -442,9 +461,6 @@ BINDING_LIB_TARGETS=""
dnl Check if cxx-binding not wanted, default is to build it
# C++ binding
# TODO: check whether CXX is functional
AC_CHECK_PROG([cf_with_cxx], ["${CXX}"], [yes], [no])
AC_MSG_CHECKING([whether to build C++ binding and demo])
AC_ARG_WITH([cxx-binding],
[AS_HELP_STRING([--without-cxx-binding],
@ -572,15 +588,11 @@ AC_SUBST([BINDING_LIST])
AC_SUBST([BINDING_LIB_TARGETS])
dnl Not sure where this goes...
dnl # TODO: require "${ac_cv_header_sys_socket_h}" = "no"
## ----------------- ##
## Optional backends ##
## ----------------- ##
# Winradio only under Linux (until someone ports it on other os)
dnl Winradio only under Linux (until someone ports it on other os)
AC_MSG_CHECKING([whether to build winradio backend])
AC_ARG_ENABLE([winradio],
[AS_HELP_STRING([--disable-winradio],
@ -590,28 +602,22 @@ AC_ARG_ENABLE([winradio],
AC_MSG_RESULT([$cf_with_winradio])
AS_IF([test x"${cf_with_winradio}" = "xyes"],
[BACKEND_LIST="$BACKEND_LIST winradio"])
# stuff that requires C++ support
AS_IF([test x"${cf_with_cxx}" = "xyes"],[
AC_MSG_CHECKING([whether to build USRP backend])
AC_ARG_ENABLE([usrp],
[AS_HELP_STRING([--enable-usrp],
[build USRP backend @<:@default=no@:>@])],
[cf_with_usrp=$enableval],
[cf_with_usrp="no"])
AC_MSG_RESULT([$cf_with_usrp])
AS_IF([test x"${cf_with_usrp}" = "xyes"],[
PKG_CHECK_MODULES([USRP],
[usrp >= 0.8],
[AC_DEFINE([HAVE_USRP],[1],[Define if usrp is available])
])
])
[BACKEND_LIST="$BACKEND_LIST winradio"
dnl Check for libdl and set DL_LIB if found--used for linradio backend
AC_CHECK_LIB([dl], [dlopen], [DL_LIB="-ldl"],
[AC_MSG_WARN([dlopen was not found in libdl--linradio backend will be disabled])])
AC_SUBST([DL_LIB])
])
AM_CONDITIONAL([ENABLE_CXX], [test x"${cf_with_cxx}" = "xyes"])
dnl stuff that requires C++ support
AS_IF([test x"${cf_with_usrp}" = "xyes"],[
PKG_CHECK_MODULES([USRP],
[usrp >= 0.8],
[AC_DEFINE([HAVE_USRP],[1],[Define if usrp is available])
])
])
AM_CONDITIONAL([HAVE_USRP], [test x"${cf_with_usrp}" = "xyes"])
@ -619,17 +625,17 @@ AM_CONDITIONAL([HAVE_USRP], [test x"${cf_with_usrp}" = "xyes"])
## Prepare rig backend dependencies ##
## -------------------------------- ##
# otherwise parallel 'make -jn' will fail
dnl otherwise parallel 'make -jn' will fail
for be in ${BACKEND_LIST} ; do
BACKENDEPS="${BACKENDEPS} \$(top_builddir)/${be}/libhamlib-${be}.la"
done
# dlopen force or preopen self for static version ?
BACKENDLNK=""
for be in ${BACKEND_LIST} ; do
BACKENDLNK="${BACKENDLNK} \$(top_builddir)/${be}/libhamlib-${be}.la"
done
AC_SUBST([BACKEND_LIST])
AC_SUBST([BACKENDLNK])
AC_SUBST([BACKENDEPS])
@ -645,15 +651,20 @@ for be in ${ROT_BACKEND_LIST} ; do
ROT_BACKENDEPS="${ROT_BACKENDEPS} \$(top_builddir)/${be}/libhamlib-${be}.la"
done
# dlopen force or preopen self for static version ?
ROT_BACKENDLNK=""
for be in ${ROT_BACKEND_LIST} ; do
ROT_BACKENDLNK="${ROT_BACKENDLNK} \$(top_builddir)/${be}/libhamlib-${be}.la"
done
AC_SUBST([ROT_BACKEND_LIST])
AC_SUBST([ROT_BACKENDLNK])
AC_SUBST([ROT_BACKENDEPS])
## ------------ ##
## Final output ##
## ------------ ##
dnl Output accumulated flags to the Makefile files.
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])

Wyświetl plik

@ -1,23 +1,24 @@
This file is a HOWTO for the cross-compiling of Win32 binary DLLs built from
a tarball generated by 'make dist' in a Git checkout. The resulting DLLs
are built with a cdecl interface compatible with MS VC++.
This file is a HOWTO for the cross-compiling of Windows 32 bit binary DLLs
built from a tarball generated by 'make dist' in a Git checkout. The
resulting DLLs are built with a cdecl interface compatible with MS VC++.
Prerequisites
=============
In these steps the release or daily snapshot tarball is unpacked in ~/builds
for the Win32 build and all operations are done from there unless otherwise
noted.
for the Windows 32 build and all operations are done from there unless
otherwise noted.
Under Linux you need the mingw32 package to cross-compile it, zip to create
Under Linux you need at least the mingw32 package to cross-compile it (although
mingw-w64-i696 is being used to build the daily snapshots) zip to create
the archive, the tofrodos or dos2unix package installed to convert to DOS
text format, and Wine plus the free MVC++Toolkit available from:
http://uploading.com/files/HNH73WB3/VCToolkitSetup%28v1.01%29%282004.07.06%29.zip.html
to create the Win32 .LIB file (unzip and then install it with Wine in the
to create the Windows 32 .LIB file (unzip and then install it with Wine in the
usual way).
NB: Debian Squeeze and later users will need at least the mingw32-runtime
@ -26,39 +27,33 @@ Ubuntu version from:
http://packages.ubuntu.com/maverick/devel/mingw32-runtime
Finally, the Win32 version of libusb must be available for the USB backends to
be built. Download the latest libusb-win32-bin-1.2.4.0.zip from:
On Debian Jesse the mingw-w64-i686 pacakge works and is being used to build
the daily Windows 32 snapshots.
Finally, the Windows 32 version of libusb must be available for the USB backends
to be built. Download the latest libusb-win32-bin-1.2.4.0.zip from:
https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/
and unzip the archive in ~/builds/libusb-win32-bin-1.2.4.0 and then copy the
following into libusb-win32-bin-1.2.4.0/lib/pkgconfig/libusb.pc (the
pkgconfig directory will need to be created):
---------------CUT-----------------------------
prefix=/home/USER/builds/libusb-win32-bin-1.2.4.0
exec_prefix=${prefix}
libdir=${exec_prefix}/lib/gcc
bindir=${exec_prefix}/bin
includedir=${prefix}/include
Name: libusb
Description: USB access library
Version: 1.2.4.0
Libs: -L${libdir} -L${bindir} -lusb
Cflags: -I${includedir}
---------------CUT-----------------------------
and unzip the archive in ~/builds/libusb-win32-bin-1.2.4.0
Any version of libusb from 1.2.3.0 is known to work.
Several variables may need to be set differently at the top of the script file
depending on your system.
The script now relies on a pair of environment variables to locate the needed
libusb files and the third party pkg-config utility is no longer used for
libusb.
The script generates PDF documents for the included .EXE files using the
groff and ps2pdf utilities to convert the nroff formatted man pages. On
Debian and derivatives, installing the groff and ghostscript packages will
provide them.
Build for Win32, cross-compile on Linux:
========================================
Build for Windows 32, cross-compile on Linux:
=============================================
Extract the Hamlib tarball into ~/builds (if you prefer another directory
be sure to edit the BUILD_DIR variable in the build-win32.sh script):
@ -81,6 +76,7 @@ The structure of the archive is:
$ tree -d
.
|-- bin
|-- doc
|-- include
| `-- hamlib
|-- lib
@ -88,14 +84,15 @@ $ tree -d
| `-- msvc
`-- pdf
7 directories
8 directories
The bin directory is were the executables and DLL files are placed. Header
The bin directory is where the executables and DLL files are placed. Header
files are under include/Hamlib and compiler specific files are under lib/*.
PDF documents for the .EXE programs are in pdf/ while text documents
(READMEs and such) are in the main archive directory. The embedded
README.win32-bin file generated by the build-win32.sh script describes
setting the PATH environment variable in Windows 2000 and Windows XP.
(READMEs and such) are in the main archive directory. The doc/ directory
contains the generated HTML manual. The embedded README.win32-bin file
generated by the build-win32.sh script describes setting the PATH
environment variable in Windows 2000, Windows XP, and Windows 7.
73, Nate, N0NB

Wyświetl plik

@ -4,9 +4,9 @@
# A script to build a set of Win32 binary DLLs from a Hamlib tarball.
# This script assumes that the Hamlib tarball has been extracted to the
# directory specified in $build_dir and that libusb-win32-bin-1.x.y.z has also
# been extracted to $build_dir and a libusb.pc file has been created. The
# MS VC++Toolkit must also be installed.
# directory specified in $BUILD_DIR and that libusb-win32-bin-1.x.y.z has also
# been extracted to $BUILD_DIR. The MS VC++Toolkit must also be installed
# and working with Wine.
#
# See README.build-win32 for complete details.
@ -17,6 +17,13 @@ BUILD_DIR=~/builds
# Set this to LibUSB archive extracted in $BUILD_DIR
LIBUSB_VER=libusb-win32-bin-1.2.4.0
# uncomment the correct HOST_ARCH= line for your minGW installation
# HOST_ARCH=i586-mingw32msvc
HOST_ARCH=i686-w64-mingw32
# Set to the strip name for your version of minGW
# HOST_ARCH_STRIP=i586-mingw32msvc-strip
HOST_ARCH_STRIP=i686-w64-mingw32-strip
# Error return codes. See /usr/include/sysexits.h
EX_USAGE=64
@ -51,7 +58,8 @@ What is it?
===========
This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE
cross-compiled for Win32 using MinGW under Xubuntu Linux 10.10 (nice, heh!).
cross-compiled for MS Windows 32 bit using MinGW under Debian GNU/Linux
(nice, heh!).
The DLL has a cdecl interface for MS VC++.
@ -72,8 +80,8 @@ reasonable choice.
Make sure *all* the .DLL files are in your PATH (leave them in the bin
directory and set the PATH). To set the PATH environment variable in
Windows 2000, Windows XP, and Windows 7 (need info on Vista) do the
following:
Windows 2000, Windows XP, and Windows 7 (need info on Vista and Windows 8)
do the following:
* W2k/XP: Right-click on "My Computer"
Win7: Right-click on "Computer"
@ -174,10 +182,13 @@ END_OF_README
# Configure and build hamlib for mingw32, with libusb-win32
./configure --host=i586-mingw32msvc \
./configure --host=${HOST_ARCH} \
--prefix=`pwd`/mingw-inst \
--without-cxx-binding \
PKG_CONFIG_LIBDIR=${LIBUSB_WIN32_BIN_PATH}/lib/pkgconfig
--disable-static \
CPPFLAGS="-I${LIBUSB_WIN32_BIN_PATH}/include" \
LDFLAGS="-L${LIBUSB_WIN32_BIN_PATH}/lib/gcc"
make install
@ -204,15 +215,17 @@ cd ${BUILD_DIR}/$1
# Copy build files into specific locations for Zip file
cp -a ${INST_DIR}/bin/{rigctld.exe,rigctl.exe,rigmem.exe,rigsmtr.exe,rigswr.exe,rotctld.exe,rotctl.exe} ${ZIP_DIR}/bin/.
cp -a ${INST_DIR}/lib/hamlib/hamlib-*.dll ${ZIP_DIR}/bin/.
cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/.
cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/.
# NB: Do not strip libusb0.dll
i586-mingw32msvc-strip ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll
cp -a ${LIBUSB_WIN32_BIN_PATH}/bin/x86/libusb0_x86.dll ${ZIP_DIR}/bin/libusb0.dll
# NB: Strip Hamlib DLLs and EXEs
${HOST_ARCH_STRIP} ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll
# Copy needed third party DLLs
cp -a /usr/i686-w64-mingw32/lib/libwinpthread-1.dll ${ZIP_DIR}/bin/.
# Need VC++ free toolkit installed (default Wine directory installation shown)
( cd ${ZIP_DIR}/lib/msvc/ && wine ~/.wine/drive_c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin/link.exe /lib /machine:i386 /def:libhamlib-2.def )
zip -r hamlib-win32-${RELEASE}.zip `basename ${ZIP_DIR}`