diff --git a/.gitignore b/.gitignore index dd8f3e41c..d05493151 100644 --- a/.gitignore +++ b/.gitignore @@ -32,9 +32,12 @@ hamlib-*.tar.gz include/config.h include/config.h.in include/stamp-h1 +libltdl/ +macros/argz.m4 macros/libtool.m4 macros/ltoptions.m4 macros/ltsugar.m4 +macros/ltdl.m4 macros/ltversion.m4 macros/lt~obsolete.m4 rpcrig/rpc.rigd diff --git a/Makefile.am b/Makefile.am index 6a0cb7f90..d9766144f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ EXTRA_DIST = PLAN TODO LICENSE hamlib.m4 hamlib.pc.in README.developer \ README.betatester README.win32 # BINDINGS_LIST subdirs are no longer built -SUBDIRS = macros include lib $(subdirs) src @BACKEND_LIST@ @ROT_BACKEND_LIST@ \ +SUBDIRS = libltdl macros include lib $(subdirs) src @BACKEND_LIST@ @ROT_BACKEND_LIST@ \ @BINDINGS@ tests doc # perl and kylix subdirs are no longer distributed diff --git a/autogen.sh b/autogen.sh index b16d41082..7411bd3e1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -77,4 +77,5 @@ if test -z "$*"; then echo "to pass any to it, please specify them on the $0 command line." fi -$SRCDIR/configure --enable-maintainer-mode "$@" +# $SRCDIR/configure --enable-maintainer-mode "$@" +$SRCDIR/configure "$@" diff --git a/configure.ac b/configure.ac index 25d0e055d..4f1479c86 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,7 @@ AC_INIT([Hamlib], AC_CONFIG_SRCDIR([include/hamlib/rig.h]) AC_CONFIG_MACRO_DIR([macros]) +AC_CONFIG_HEADERS([include/config.h]) ## ------------------------ ## @@ -29,14 +30,13 @@ AC_CONFIG_MACRO_DIR([macros]) dnl Passing AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION to AM_INIT_AUTOMAKE is dnl obsolete as these values are obtained from the AC_INIT macro. AM_INIT_AUTOMAKE([-Wall]) -AC_CONFIG_HEADERS([include/config.h]) dnl Clean compilation output makes compiler warnings more visible m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) dnl TODO: Maintainer mode has arguments against its use. dnl Consider its removal at some point. -AM_MAINTAINER_MODE +dnl AM_MAINTAINER_MODE ## ------------------------------ ## @@ -162,7 +162,7 @@ dnl Checks for libraries. AC_CHECK_FUNC([sin], [MATH_LIBS=""], [MATH_LIBS="-lm"]) AC_SUBST([MATH_LIBS]) -dnl Interactive UNIX? You've got to be kidding! +dnl Interactive UNIX? You have got to be kidding! dnl #-------------------------------------------------------------------- dnl # Interactive UNIX requires -linet instead of -lsocket, plus it dnl # needs net/errno.h to define the socket-related error codes. @@ -176,10 +176,10 @@ dnl AC_CHECK_LIB([inet], [main], [LIBS="$LIBS -linet"], [], []) # special considerations: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. -# 2. Use each function name only once: can't redo a check because -# autoconf caches the results of the last check and won't redo it. +# 2. Use each function name only once: cannot redo a check because +# autoconf caches the results of the last check and will not redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that -# aren't already present in the normal libraries. This is because +# are not already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. @@ -243,7 +243,7 @@ AC_CHECK_FUNCS([strcasecmp strchr strdup strerror strrchr strstr strtol]) AC_CHECK_FUNCS([cfmakeraw setitimer ioctl sigaction]) AC_FUNC_ALLOCA -dnl Doesn't seem to be needed anymore +dnl Does not seem to be needed anymore dnl AC_FUNC_MALLOC dnl Obsolecent macro @@ -258,59 +258,70 @@ AC_LIBOBJ([dummy]) ## ------------------------ ## ## N.b. LT_INIT([dlopen], [win32-dll]) does not work for older libtool LT_PREREQ([2.2.6b]) + +# Name the subdirectory that contains libltdl sources +LT_CONFIG_LTDL_DIR([libltdl]) + +# Name the subdirectory that contains libltdl sources LT_INIT([dlopen win32-dll]) + +# Enable building of the convenience libltdl library +# (requires --with-included-ltdl be given to configure for the included +# libltdl to be used), useful on systems where libltdl-dev is not installed. +LTDL_INIT([convenience]) + dnl AC_LIBTOOL_DLOPEN dnl AC_LIBTOOL_WIN32_DLL dnl AC_PROG_LIBTOOL dnl AM_PROG_LIBTOOL -INCLTDL="" -LIBLTDL="-lltdl" -AC_SUBST([INCLTDL]) -AC_SUBST([LIBLTDL]) +dnl INCLTDL="" +dnl LIBLTDL="-lltdl" +dnl AC_SUBST([INCLTDL]) +dnl AC_SUBST([LIBLTDL]) -## ---------------------------------- ## -## Custom host libtool configurations ## -## ---------------------------------- ## +## -------------------------- ## +## Custom host configurations ## +## -------------------------- ## AS_CASE(["$host_os"], [freebsd*], [ - AM_CPPFLAGS="-I/usr/local/include ${AM_CPPFLAGS}" - AM_LDFLAGS="${AM_LDFLAGS} -L/usr/local/lib" - AC_SUBST([AM_LDFLAGS])], + AM_CPPFLAGS="-I/usr/local/include ${AM_CPPFLAGS}" + AM_LDFLAGS="${AM_LDFLAGS} -L/usr/local/lib" + AC_SUBST([AM_LDFLAGS])], [darwin* | rhapsody*], [ - # Trick from http://fink.sourceforge.net/doc/porting/ - # TODO: check the compiler actually does support these options - CFLAGS="${CFLAGS} -no-cpp-precomp" - CXXFLAGS="${CXXFLAGS} -no-cpp-precomp" + # Trick from http://fink.sourceforge.net/doc/porting/ + # TODO: check the compiler actually does support these options + CFLAGS="${CFLAGS} -no-cpp-precomp" + CXXFLAGS="${CXXFLAGS} -no-cpp-precomp" - # Tell the OS X linker to allocate enough space inside the - # libhamlib.X.dylib shared object for install_name_tool(1) to - # work. This is useful when including hamlib in an app bundle. - OSXLDFLAGS="-Wl,-headerpad_max_install_names" - AC_SUBST([OSXLDFLAGS])], + # Tell the OS X linker to allocate enough space inside the + # libhamlib.X.dylib shared object for install_name_tool(1) to + # work. This is useful when including hamlib in an app bundle. + OSXLDFLAGS="-Wl,-headerpad_max_install_names" + AC_SUBST([OSXLDFLAGS])], [mingw* | pw32* | cygwin*], [ - WINLDFLAGS="-Wl,--output-def,libhamlib.def -Wl,--add-stdcall-alias" - AC_SUBST([WINLDFLAGS]) + WINLDFLAGS="-Wl,--output-def,libhamlib.def -Wl,--add-stdcall-alias" + AC_SUBST([WINLDFLAGS]) - # Prerequisite for Mingw build (import and build internal ./libltdl): - # $ libtoolize --ltdl - # $ ( cd libltdl; ./configure --host=i586-mingw32msvc && make ) - # Use internal ./libltdl during configure: - CFLAGS="${CFLAGS} -I./libltdl" +dnl # Prerequisite for Mingw build (import and build internal ./libltdl): +dnl # $ libtoolize --ltdl +dnl # $ ( cd libltdl; ./configure --host=i586-mingw32msvc && make ) +dnl # Use internal ./libltdl during configure: +dnl CFLAGS="${CFLAGS} -I./libltdl" - # use internal $(top_builddir)/libltdl during build: - INCLTDL="-I\$(top_builddir)/libltdl" - AC_SUBST([INCLTDL]) +dnl # use internal $(top_builddir)/libltdl during build: +dnl INCLTDL="-I\$(top_builddir)/libltdl" +dnl AC_SUBST([INCLTDL]) - # - use internal $(top_builddir)/libltdl during build and library 'ltdlc': - LIBLTDL="-L\$(top_builddir)/libltdl -lltdlc" - AC_SUBST([LIBLTDL]) +dnl # - use internal $(top_builddir)/libltdl during build and library 'ltdlc': +dnl LIBLTDL="-L\$(top_builddir)/libltdl -lltdlc" +dnl AC_SUBST([LIBLTDL]) - # Enable ld's "auto import" for executables - WINEXELDFLAGS="-Wl,--enable-auto-import" - AC_SUBST([WINEXELDFLAGS]) + # Enable ld's "auto import" for executables + WINEXELDFLAGS="-Wl,--enable-auto-import" + AC_SUBST([WINEXELDFLAGS]) ]) ## ---------------------- ## @@ -318,12 +329,15 @@ AS_CASE(["$host_os"], ## ---------------------- ## dnl Check whether we can actually find ltdl.h -AC_CHECK_HEADER([ltdl.h], - [AC_MSG_RESULT([yes])], - [AC_MSG_ERROR([ltdl.h not found. Please install the libltdl development -files package which provides /usr/include/ltdl.h -(perhaps called 'libltdl-dev' or 'libltdl-devel').]) - ]) +dnl (only needed if not using included libltdl). +AS_IF([test "${with_included_ltdl}" = "no"], [ + AC_CHECK_HEADER([ltdl.h], + [AC_MSG_RESULT([yes])], + [AC_MSG_ERROR([ltdl.h not found. Please install the libltdl development + files package which provides /usr/include/ltdl.h + (perhaps called 'libltdl-dev' or 'libltdl-devel').]) + ]) + ]) dnl Check if C99 struct initializers are supported @@ -406,7 +420,7 @@ AS_IF([test "${cf_with_cxx_binding}" = "yes"], [BINDINGS="${BINDINGS} c++"]) -dnl Check if perl-binding not wanted, default is to not build it +dnl Check if perl-binding is wanted, default is to not build it # Perl binding AC_MSG_CHECKING([whether to build perl binding and demo]) @@ -442,7 +456,7 @@ AC_ARG_WITH([tcl-binding], [build_tcl=no]) AC_MSG_RESULT([$build_tcl]) -dnl SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG from macros/tcl.m4 +dnl SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG from macros/tcl.m4 AS_IF([test x"${build_tcl}" = "xyes"],[ SC_PATH_TCLCONFIG SC_LOAD_TCLCONFIG @@ -690,6 +704,8 @@ echo \ With Perl binding ${cf_with_perl_binding} With Python binding ${cf_with_python_binding} With TCL binding ${build_tcl} + With included ltdl ${with_included_ltdl} + Enable Rig Matrix ${enable_rigmatrix} Enable WinRadio ${cf_with_winradio} Enable USRP ${cf_with_usrp} diff --git a/scripts/README.build-win32 b/scripts/README.build-win32 index 2419f1517..fcb32fd80 100644 --- a/scripts/README.build-win32 +++ b/scripts/README.build-win32 @@ -11,10 +11,9 @@ 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. -Under Linux you need the mingw32 package to cross-compile it, an internal -copy of libltdl (configured and built as below), 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: +Under Linux you need the mingw32 package to cross-compile it, 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 @@ -64,13 +63,19 @@ Build for Win32, 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): - $ tar xvfz ~/Downloads/hamlib-1.2.14~git-72c52d6-20110618.tar.gz + $ tar xvfz ~/Downloads/hamlib-3.0~git-???????-20121007.tar.gz -Invoke the build-win32.sh script (it requires a Bash shell) with the name -of the directory/Hamlib version to build (you need not cd into the hamlib -directory, although it won't hurt. The script uses absolute paths): +Invoke the build-win32.sh script (it requires a Bash shell) with the name of +the directory/Hamlib version to build (you need not cd into the hamlib +directory, although it won't hurt. The build-win32 script uses absolute +paths): - build-win32.sh hamlib-1.2.14~git + $ build-win32.sh hamlib-3.0~git + +Note: As of 7 Oct 2012 the build should be independent of installed libtool +versions as libltdl is included in the source tarball (enabled with the +‘--with-included-ltdl’ option to the configure script (which this script +passes to configure)). The note below should now be obsolete. Note: At this time (18 Jun 2011) the build will fail on Debian Unstable due to a libtool version mismatch between libtool 2.2.6b included in the diff --git a/scripts/build-win32.sh b/scripts/build-win32.sh index b42ded7dd..bb80ca435 100644 --- a/scripts/build-win32.sh +++ b/scripts/build-win32.sh @@ -1,5 +1,7 @@ #!/bin/bash +# Builds Hamlib 3.x Win32 binary distribution. + # 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 @@ -37,8 +39,6 @@ else exit $EX_NOINPUT fi -# FIXME: Determine RELEASE only from AC_INIT line to avoid any other similar -# values and avoid hard coded version number. RELEASE=`/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[3\./ {print $2}' ./configure.ac` INST_DIR=`pwd`/mingw-inst ZIP_DIR=`pwd`/hamlib-win32-${RELEASE} @@ -50,7 +50,7 @@ cat > README.win32-bin < Radio model 120, or Yaesu FT-817 (use -l for a list) + -m -> Radio model 120, or Yaesu FT-817 (use 'rigctl -l' for a list) -r -> Radio device, in this case COM1 -v -> Verbosity level. For testing four or five v characters are required. - Five v's set a debug level of TRACE which generates a lot of screen + Five 'v's set a debug level of TRACE which generates a lot of screen output showing communication to the radio and values of important variables. These traces are vital information for Hamlib rig backend development. @@ -118,12 +130,19 @@ Edit|Paste from the typical GUI menu). All feedback is welcome to the mail address below. +Uninstall +========= + +To uninstall, simply delete the Hamlib directory. You may wish to edit the +PATH as above to remove the Hamlib bin path, if desired. + + Information for Win32 Programmers ================================= -There's a .LIB import library for MS-VC++ in lib/msvc. Simply #include +There is a .LIB import library for MS-VC++ in lib/msvc. Simply #include (add directory to include path), include the .LIB in your -project and you're done. Note: MS-VC++ cannot compile all the Hamlib code, +project and you are done. Note: MS-VC++ cannot compile all the Hamlib code, but the API defined by rig.h has been made MSVC friendly :-) As the source code for the library DLLs is licensed under the LGPL, your @@ -149,19 +168,16 @@ http://www.hamlib.org END_OF_README -# Import internal ./libltdl and build it for mingw32 -libtoolize --ltdl -cd libltdl; ./configure --host=i586-mingw32msvc && make; cd .. - # Configure and build hamlib for mingw32, with libusb-win32 ./configure --disable-static \ --host=i586-mingw32msvc \ --prefix=`pwd`/mingw-inst \ - --without-rpc-backends \ --without-cxx-binding \ + --with-included-ltdl \ PKG_CONFIG_LIBDIR=${LIBUSB_WIN32_BIN_PATH}/lib/pkgconfig + make install mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/pdf @@ -178,7 +194,7 @@ for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README README.betatester cd tests for f in rigctl.1 rigctld.8 rigmem.1 rigsmtr.1 rigswr.1 rotctl.1 rotctld.8 ; do \ - groff -mandoc >${f}.ps ${f} ; ps2pdf ${f}.ps ; rm ${f}.ps ; \ + groff -mandoc >${f}.ps ${f} ; ps2pdf ${f}.ps ; rm ${f}.ps ; \ cp -a ${f}.pdf ${ZIP_DIR}/pdf/. ; done cd ${BUILD_DIR}/$1 @@ -196,3 +212,4 @@ cp -a ${LIBUSB_WIN32_BIN_PATH}/bin/x86/libusb0_x86.dll ${ZIP_DIR}/bin/libusb0.dl # 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}` + diff --git a/src/Makefile.am b/src/Makefile.am index 300b0695c..e2605e043 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,8 @@ -AM_CPPFLAGS = @AM_CPPFLAGS@ @INCLTDL@ +# src/Makefile.am + +# $(LTDLINCL) is set by LTDL_INIT macro in configure.ac +AM_CPPFLAGS = @AM_CPPFLAGS@ $(LTDLINCL) + RIGSRC = rig.c serial.c misc.c register.c event.c cal.c conf.c tones.c \ rotator.c locator.c rot_reg.c rot_conf.c iofunc.c ext.c \ mem.c settings.c parallel.c usb_port.c debug.c network.c \ @@ -8,7 +12,9 @@ lib_LTLIBRARIES = libhamlib.la libhamlib_la_SOURCES = $(RIGSRC) libhamlib_la_LDFLAGS = $(WINLDFLAGS) $(OSXLDFLAGS) -no-undefined -version-info @ABI_VERSION@:0:0 libhamlib_la_CFLAGS = -DIN_HAMLIB $(AM_CFLAGS) -DHAMLIB_MODULE_DIR=\"$(pkglibdir)\" -libhamlib_la_LIBADD = @LIBLTDL@ $(top_builddir)/lib/libmisc.la \ + +# $(LIBLTDL) is set by LTDL_INIT macro +libhamlib_la_LIBADD = $(LIBLTDL) $(top_builddir)/lib/libmisc.la \ @NET_LIBS@ @MATH_LIBS@ $(LIBUSB_LIBS) noinst_HEADERS = event.h misc.h serial.h iofunc.h cal.h tones.h \