[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. ee439484d4748b82e6a7f
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2025-09-18 02:51:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via ee439484d4748b82e6a7fddbaf3ad3a584d4bd09 (commit) via 48a53a0492b2d4b761003b44c9a2984c2e6977a1 (commit) via d04364e685e9a020afc907e86dfab66423a014ad (commit) via 65c766e1b33c718e2e25079f469d1751e256c336 (commit) via 33706f8a733efd06001fe599bdbdf15cf1626628 (commit) via 8196e9ccd9731c2e9a1e71c452bb28e15f31c132 (commit) from fd68f3874353e415a7b177f45379a75bb656909b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ee439484d4748b82e6a7fddbaf3ad3a584d4bd09 Merge: 48a53a049 33706f8a7 Author: Nate Bargmann <n0...@n0...> Date: Wed Sep 17 21:39:00 2025 -0500 Merge branch 'N0NB-issue-1892' of github.com:N0NB/Hamlib into N0NB-issue-1892 commit 48a53a0492b2d4b761003b44c9a2984c2e6977a1 Author: Nate Bargmann <n0...@n0...> Date: Wed Sep 17 21:36:26 2025 -0500 Update NEWS for libusb detection via pkg-config Use spaces for indentation. diff --git a/NEWS b/NEWS index 23b9189fe..0a1c50f4f 100644 --- a/NEWS +++ b/NEWS @@ -14,11 +14,12 @@ Version 5.x -- future Version 4.7.0 * 2025-12-01 (target) - * Some internal functions change names to avoid conflicts with apps. - * POSIX threads are required to build and run Hamlib. Note that it was - actually the case for 4.6.x, but now the configuration step will - fail instead of the compilation. - * Functions rig_get_conf, rot_get_conf, amp_get_conf deprecated; + * libusb is now detected using the pkg-config facility. + * Some internal functions change names to avoid conflicts with apps. + * POSIX threads are required to build and run Hamlib. Note that it was + actually the case for 4.6.x, but now the configuration step will + fail instead of the compilation. + * Functions rig_get_conf, rot_get_conf, amp_get_conf deprecated; use *_get_conf2() instead. Also rig_set_trn and rig_get_trn deprecated. * Fix handling of unprintable characters in kenwood.c that broke radios such as the TM-D710/TM-V71 that use EOM_TH (\r) as the command terminator. commit d04364e685e9a020afc907e86dfab66423a014ad Author: Nate Bargmann <n0...@n0...> Date: Tue Sep 9 18:59:59 2025 -0500 Use pkgconf/pkg-config to test for libusb-1.0 As reported in GitHub issue #1892, configure on FreeBSD failed to search for the name of the library correctly which is libusb. As pkg-config correctly holds the library name for linking, modify the search for libusb-1.0 to use the pkg-config capability. If pkg-config (now largely replaced by pkgconf) is not installed or found, the modules depending on it will be gracefull disabled, i.e. the configure script will complete with those modules disabled. Modify the output summary to use spaces instead of tabs as things were not lining up nicely in my FreeBSD terminal. Rename the Automake substituted variable 'HAVE_LIBUSB' to 'TESTS_HAVE_LIBUSB' to avoid confusion with identically named variable written to include/hamlib/config.h. Likewise, rename the AutoConf substituted name 'LIBUSB' to 'HAMLIB_PC_LIBUSB' to avoid confusion with the 'LIBUSB' string passed to PKG_CHECK_MODULES. Update hamlib.pc.in and tests/Makefile.am to use the new variable names. Make sure all source files no longer reference HAVE_LIBUSB_H or HAVE_LIBUSB_1_0_LIBUSB_H as these variables no longer exist. Fix src/Makefile.am to provide include path for usb_port.c. diff --git a/android/config.h b/android/config.h index 9163a5a47..1487c89e9 100644 --- a/android/config.h +++ b/android/config.h @@ -82,6 +82,9 @@ /* Define to 1 if you have the `syslog' library (-lsyslog). */ /* #undef HAVE_LIBSYSLOG */ +/* Define if libusb-1.0 is available */ +//#define HAVE_LIBUSB 1 + /* Define to 1 if you have the <linux/ioctl.h> header file. */ #define HAVE_LINUX_IOCTL_H 1 @@ -222,12 +225,6 @@ /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 -/* Define to 1 if you have the <libusb.h> header file. */ -//#define HAVE_LIBUSB_H 1 - -/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */ -//#define HAVE_LIBUSB_1_0_LIBUSB_H 1 - /* Define to 1 if you have the `usleep' function. */ #define HAVE_USLEEP 1 diff --git a/configure.ac b/configure.ac index e9fc775b8..327e3823f 100644 --- a/configure.ac +++ b/configure.ac @@ -347,42 +347,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], "Have you considered GCC lately?."]) ]) -dnl Check for libusb, treat LIBUSB_LIBS and LIBUSB_CFLAGS as precious variables -AC_MSG_CHECKING([whether to build USB dependent backends]) -AC_ARG_WITH([libusb], - [AS_HELP_STRING([--without-libusb], - [disable USB dependent backends @<:@default=yes@:>@])], - [cf_with_libusb=$with_libusb], - [cf_with_libusb=yes] - ) - -AC_MSG_RESULT([$cf_with_libusb]) - -LIBUSB="" -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-1.0.a (see INSTALL))]) - -AS_IF([test x"${cf_with_libusb}" = "xyes"], [ - AS_IF([test -z $LIBUSB_LIBS], - [AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBUSB_LIBS="-lusb-1.0"], - [AC_MSG_WARN([libusb_init was not found in libusb-1.0--USB backends will be disabled])] - [cf_with_libusb="no"]) - ], [cf_with_libusb="yes"]) - - AS_IF([test x"${cf_with_libusb}" = "xyes"], - [AC_CHECK_HEADERS([libusb.h libusb-1.0/libusb.h]) - AC_DEFINE([HAVE_LIBUSB], - [1], - [Define if libusb-1.0 is available]) - LIBUSB="libusb-1.0"])]) - -AM_CONDITIONAL([HAVE_LIBUSB], [test x"${cf_with_libusb}" = "xyes"]) -AC_SUBST([HAVE_LIBUSB]) - -# Only used in hamlib.pc.in -AC_SUBST([LIBUSB]) - - dnl Check if readline support in rigctl/rotctl is wanted AC_MSG_CHECKING([whether to use readline in rigctl/rotctl]) AC_ARG_WITH([readline], @@ -478,10 +442,46 @@ 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. +dnl These features rely on the external pkg-config/pkgconf functionality being +dnl available. At least pkg-config/pkgconf version 0.29.2 or newer is required +dnl for support of these modules. If pkg-config or pkgconf is not installed, +dnl their support will be gracefully disabled. + +PKG_PROG_PKG_CONFIG([0.29.2]) + +dnl Check for libusb, treat LIBUSB_LIBS and LIBUSB_CFLAGS as precious variables. +AC_MSG_CHECKING([whether to build USB dependent backends]) +AC_ARG_WITH([libusb], + [AS_HELP_STRING([--without-libusb], + [disable USB dependent backends @<:@default=yes@:>@])], + [cf_with_libusb=$with_libusb], + [cf_with_libusb=yes] + ) + +AC_MSG_RESULT([$cf_with_libusb]) + +dnl Only used in hamlib.pc.in +HAMLIB_PC_LIBUSB="" + +AS_IF([test x"${cf_with_libusb}" = "xyes"], [ + PKG_CHECK_MODULES([LIBUSB], + [libusb-1.0], + [AC_DEFINE([HAVE_LIBUSB], + [1], + [Define if libusb-1.0 is available]) + HAMLIB_PC_LIBUSB="libusb-1.0"], + [AC_MSG_WARN([libusb-1.0 or pkg_config not found, USB backend support will be disabled]) + cf_with_libusb=no + ]) + ]) + +AC_SUBST([HAMLIB_PC_LIBUSB]) + +dnl Configure the tests/Makefile.am conditional +AM_CONDITIONAL([TESTS_HAVE_LIBUSB], [test x"${cf_with_libusb}" = "xyes"]) -# libxml2 required rigmem xml support, make it user optional + +dnl libxml2 required for rigmem XML support; make it build time optional. AC_MSG_CHECKING([whether to build rigmem XML support]) AC_ARG_WITH([xml-support], [AS_HELP_STRING([--with-xml-support], @@ -490,8 +490,19 @@ AC_ARG_WITH([xml-support], [cf_with_xml_support=no]) AC_MSG_RESULT([$cf_with_xml_support]) +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 or pkgconf/pkg-config not found, XML support will be disabled]) + ]) + ]) + -# USRP needs a C++ compiler, tested for presence above. +dnl USRP needs a C++ compiler, tested for presence above. +dnl Default is to not build USRP support. AS_IF([test x"${cf_with_cxx}" = "xyes"], [ AC_MSG_CHECKING([whether to build USRP backend]) AC_ARG_ENABLE([usrp], @@ -502,39 +513,6 @@ AS_IF([test x"${cf_with_cxx}" = "xyes"], [ 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]) @@ -990,28 +968,28 @@ echo \ ${PACKAGE_NAME} Version ${PACKAGE_VERSION} configuration: - Prefix ${prefix} - Preprocessor ${CPP} ${CPPFLAGS} - C Compiler ${CC} ${CFLAGS} - C++ Compiler ${CXX} ${CXXFLAGS} + Prefix ${prefix} + Preprocessor ${CPP} ${CPPFLAGS} + C Compiler ${CC} ${CFLAGS} + C++ Compiler ${CXX} ${CXXFLAGS} Package features: - With C++ binding ${cf_with_cxx_binding} - With Perl binding ${cf_with_perl_binding} - With Python binding ${cf_with_python_binding} - With TCL binding ${build_tcl} - With Lua binding ${cf_with_lua_binding} - With rigmem XML support ${cf_with_xml_support} - With Readline support ${cf_with_readline_support} - With INDI support ${cf_with_indi_support} + With C++ binding ${cf_with_cxx_binding} + With Perl binding ${cf_with_perl_binding} + With Python binding ${cf_with_python_binding} + With TCL binding ${build_tcl} + With Lua binding ${cf_with_lua_binding} + With rigmem XML support ${cf_with_xml_support} + With Readline support ${cf_with_readline_support} + With INDI support ${cf_with_indi_support} Enable HTML rig feature matrix ${cf_enable_html_matrix} - Enable WinRadio ${cf_with_winradio} - Enable Parallel ${cf_with_parallel} - Enable USRP ${cf_with_usrp} - Enable USB backends ${cf_with_libusb} - Enable shared libs ${enable_shared} - Enable static libs ${enable_static} - Enable Python tests ${enable_pytest} + Enable WinRadio ${cf_with_winradio} + Enable Parallel ${cf_with_parallel} + Enable USRP ${cf_with_usrp} + Enable USB backends ${cf_with_libusb} + Enable shared libs ${enable_shared} + Enable static libs ${enable_static} + Enable Python tests ${enable_pytest} -----------------------------------------------------------------------" diff --git a/hamlib.pc.in b/hamlib.pc.in index a08b29726..f6b8d1af9 100644 --- a/hamlib.pc.in +++ b/hamlib.pc.in @@ -7,7 +7,7 @@ Name: @PACKAGE_NAME@ Description: Library to control radio and rotator equipment. URL: @PACKAGE_URL@ Version: @PACKAGE_VERSION@ -Requires.private: @LIBUSB@ +Requires.private: @HAMLIB_PC_LIBUSB@ Cflags: -I${includedir} @PTHREAD_CFLAGS@ Libs: -L${libdir} -lhamlib Libs.private: @MATH_LIBS@ @DL_LIBS@ @NET_LIBS@ @PTHREAD_LIBS@ diff --git a/rigs/kit/dwt.c b/rigs/kit/dwt.c index afbdb4274..3416998f6 100644 --- a/rigs/kit/dwt.c +++ b/rigs/kit/dwt.c @@ -503,13 +503,12 @@ static const char *dwtdll_get_info(RIG *rig) } -#elif defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#elif defined(HAVE_LIBUSB) -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. +#ifdef HAVE_LIBUSB # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> #endif diff --git a/rigs/kit/elektor507.c b/rigs/kit/elektor507.c index fa26b0680..00a768f30 100644 --- a/rigs/kit/elektor507.c +++ b/rigs/kit/elektor507.c @@ -29,7 +29,7 @@ #ifdef _WIN32 #define USE_FTDI_DLL -#elif defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#elif defined(HAVE_LIBUSB) #define USE_LIBUSB #endif @@ -148,12 +148,8 @@ struct elektor507_extra_priv_data #elif defined(USE_LIBUSB) - -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> -#endif #define USB_VID_FTDI 0x0403 /* Future Technology Devices International */ diff --git a/rigs/kit/fifisdr.c b/rigs/kit/fifisdr.c index 14eb4da98..2d28d65e2 100644 --- a/rigs/kit/fifisdr.c +++ b/rigs/kit/fifisdr.c @@ -37,14 +37,11 @@ /* * Compile this model only if libusb is available */ -#if defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#if defined(HAVE_LIBUSB) -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> -#endif /* Selected request codes of the original AVR USB Si570 firmware */ @@ -836,4 +833,4 @@ static int fifisdr_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, return ret; } -#endif /* defined(HAVE_LIBUSB) && defined(HAVE_LIBUSB_H) */ +#endif /* defined(HAVE_LIBUSB) */ diff --git a/rigs/kit/funcube.c b/rigs/kit/funcube.c index 6989d2b84..0e1561e86 100644 --- a/rigs/kit/funcube.c +++ b/rigs/kit/funcube.c @@ -34,14 +34,11 @@ /* * Compile this model only if libusb is available */ -#if defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#if defined(HAVE_LIBUSB) -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> -#endif #include "funcube.h" @@ -954,4 +951,4 @@ static int funcube_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, return RIG_OK; } -#endif /* defined(HAVE_LIBUSB) && defined(HAVE_LIBUSB_H) */ +#endif /* defined(HAVE_LIBUSB) */ diff --git a/rigs/kit/kit.c b/rigs/kit/kit.c index 2124c4962..27077c584 100644 --- a/rigs/kit/kit.c +++ b/rigs/kit/kit.c @@ -40,7 +40,7 @@ DECLARE_INITRIG_BACKEND(kit) rig_register(&hiqsdr_caps); rig_register(&rshfiq_caps); -#if (defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H))) +#if defined(HAVE_LIBUSB) rig_register(&si570avrusb_caps); rig_register(&si570picusb_caps); rig_register(&si570peaberry1_caps); @@ -50,7 +50,7 @@ DECLARE_INITRIG_BACKEND(kit) rig_register(&fasdr_caps); rig_register(&funcubeplus_caps); #endif -#if (defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H))) || defined(_WIN32) +#if (defined(HAVE_LIBUSB) || defined(_WIN32)) /* rigs with alternate DLL support on Win32 */ rig_register(&dwt_caps); rig_register(&elektor507_caps); diff --git a/rigs/kit/si570avrusb.c b/rigs/kit/si570avrusb.c index 926af28d2..287a1e28d 100644 --- a/rigs/kit/si570avrusb.c +++ b/rigs/kit/si570avrusb.c @@ -39,14 +39,11 @@ /* * Compile this model only if libusb is available */ -#if defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#if defined(HAVE_LIBUSB) -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> -#endif #include "si570avrusb.h" @@ -1418,4 +1415,4 @@ int si570xxxusb_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) return RIG_OK; } -#endif /* defined(HAVE_LIBUSB) && defined(HAVE_LIBUSB_H) */ +#endif /* defined(HAVE_LIBUSB) */ diff --git a/src/Makefile.am b/src/Makefile.am index a1a92ba23..8714ba81e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,4 @@ +AM_CFLAGS += $(LIBUSB_CFLAGS) BUILT_SOURCES = $(builddir)/hamlibdatetime.h diff --git a/src/iofunc.c b/src/iofunc.c index 99e75414f..65a8d5009 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -335,7 +335,7 @@ int HAMLIB_API port_open(hamlib_port_t *p) p->fd = status; break; -#if defined(HAVE_LIBUSB_H) || defined (HAVE_LIBUSB_1_0_LIBUSB_H) +#if defined(HAVE_LIBUSB) case RIG_PORT_USB: status = usb_port_open(p); @@ -393,7 +393,7 @@ int HAMLIB_API port_close(hamlib_port_t *p, rig_port_t port_type) ret = ser_close(p); break; -#if defined(HAVE_LIBUSB_H) || defined (HAVE_LIBUSB_1_0_LIBUSB_H) +#if defined(HAVE_LIBUSB) case RIG_PORT_USB: ret = usb_port_close(p); diff --git a/src/usb_port.c b/src/usb_port.c index 80c9bc9f9..7e7a3333e 100644 --- a/src/usb_port.c +++ b/src/usb_port.c @@ -41,10 +41,9 @@ #include "hamlib/rig.h" #include "hamlib/port.h" -#ifdef HAVE_LIBUSB_H -# include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. +#ifdef HAVE_LIBUSB +#include <libusb.h> #endif #include "usb_port.h" @@ -52,7 +51,7 @@ /* * Compile only if libusb is available */ -#if defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#if defined(HAVE_LIBUSB) /** * \brief Find and open USB device @@ -423,6 +422,6 @@ int usb_port_close(hamlib_port_t *port) } //! @endcond -#endif /* defined(HAVE_LIBUSB) && defined(HAVE_LIBUSB_H) */ +#endif /* defined(HAVE_LIBUSB) */ /** @} */ diff --git a/tests/Makefile.am b/tests/Makefile.am index f657e15f8..81c86953a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,7 +4,7 @@ # AUTOMAKE_OPTIONS = dejagnu # DEJATOOL = testfreq testbcd testloc rigctl -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB TESTLIBUSB = rigtestlibusb else TESTLIBUSB = @@ -32,7 +32,7 @@ rotctld_SOURCES = rotctld.c $(ROTCOMMONSRC) ampctl_SOURCES = ampctl.c $(AMPCOMMONSRC) ampctld_SOURCES = ampctld.c $(AMPCOMMONSRC) rigmem_SOURCES = rigmem.c memsave.c memload.c memcsv.c -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB rigtestlibusb_SOURCES = rigtestlibusb.c endif @@ -51,7 +51,7 @@ ampctld_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src rigctlcom_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security rigctltcp_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security rigctlsync_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB rigtestlibusb_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(LIBUSB_CFLAGS) endif @@ -68,7 +68,7 @@ rigmem_LDADD = $(LIBXML2_LIBS) $(LDADD) rigctlcom_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) rigctltcp_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) rigctlsync_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB rigtestlibusb_LDADD = $(LIBUSB_LIBS) endif @@ -88,7 +88,7 @@ ampctld_LDFLAGS = $(WINEXELDFLAGS) rigctlcom_LDFLAGS = $(WINEXELDFLAGS) rigctltcp_LDFLAGS = $(WINEXELDFLAGS) rigctlsync_LDFLAGS = $(WINEXELDFLAGS) -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB rigtestlibusb_LDFLAGS = $(WINEXELDFLAGS) endif diff --git a/tests/rigtestlibusb.c b/tests/rigtestlibusb.c index 119625152..315d56ca0 100644 --- a/tests/rigtestlibusb.c +++ b/tests/rigtestlibusb.c @@ -26,10 +26,10 @@ #include <stdio.h> #include <string.h> #include <hamlib/config.h> -#if defined(HAVE_LIBUSB_H) + +#ifdef HAVE_LIBUSB +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. #include <libusb.h> -#elif defined(HAVE_LIBUSB_1_0_LIBUSB_H) -#include <libusb-1.0/libusb.h> #endif #ifdef __FreeBSD__ commit 65c766e1b33c718e2e25079f469d1751e256c336 Author: Larry Gadallah <lga...@gm...> Date: Sun Sep 7 08:48:31 2025 -0700 Include needed headers in rigs/dummy/rot_pstrotator.c Per GitHub issue #1894, This file failed to build on FreeBSD. Closes GitHub #1894. diff --git a/rigs/dummy/rot_pstrotator.c b/rigs/dummy/rot_pstrotator.c index a4b31d675..da8a2a0d5 100644 --- a/rigs/dummy/rot_pstrotator.c +++ b/rigs/dummy/rot_pstrotator.c @@ -23,6 +23,17 @@ #include <sys/time.h> #include <errno.h> +#include "hamlib/config.h" +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#ifdef HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif + #include "hamlib/rotator.h" #include "dummy_common.h" #include "rig.h" commit 33706f8a733efd06001fe599bdbdf15cf1626628 Author: Nate Bargmann <n0...@n0...> Date: Tue Sep 9 18:59:59 2025 -0500 Use pkgconf/pkg-config to test for libusb-1.0 As reported in GitHub issue #1892, configure on FreeBSD failed to search for the name of the library correctly which is libusb. As pkg-config correctly holds the library name for linking, modify the search for libusb-1.0 to use the pkg-config capability. If pkg-config (now largely replaced by pkgconf) is not installed or found, the modules depending on it will be gracefull disabled, i.e. the configure script will complete with those modules disabled. Modify the output summary to use spaces instead of tabs as things were not lining up nicely in my FreeBSD terminal. Rename the Automake substituted variable 'HAVE_LIBUSB' to 'TESTS_HAVE_LIBUSB' to avoid confusion with identically named variable written to include/hamlib/config.h. Likewise, rename the AutoConf substituted name 'LIBUSB' to 'HAMLIB_PC_LIBUSB' to avoid confusion with the 'LIBUSB' string passed to PKG_CHECK_MODULES. Update hamlib.pc.in and tests/Makefile.am to use the new variable names. Make sure all source files no longer reference HAVE_LIBUSB_H or HAVE_LIBUSB_1_0_LIBUSB_H as these variables no longer exist. Fix src/Makefile.am to provide include path for usb_port.c. diff --git a/android/config.h b/android/config.h index 9163a5a47..1487c89e9 100644 --- a/android/config.h +++ b/android/config.h @@ -82,6 +82,9 @@ /* Define to 1 if you have the `syslog' library (-lsyslog). */ /* #undef HAVE_LIBSYSLOG */ +/* Define if libusb-1.0 is available */ +//#define HAVE_LIBUSB 1 + /* Define to 1 if you have the <linux/ioctl.h> header file. */ #define HAVE_LINUX_IOCTL_H 1 @@ -222,12 +225,6 @@ /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 -/* Define to 1 if you have the <libusb.h> header file. */ -//#define HAVE_LIBUSB_H 1 - -/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */ -//#define HAVE_LIBUSB_1_0_LIBUSB_H 1 - /* Define to 1 if you have the `usleep' function. */ #define HAVE_USLEEP 1 diff --git a/configure.ac b/configure.ac index e9fc775b8..327e3823f 100644 --- a/configure.ac +++ b/configure.ac @@ -347,42 +347,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], "Have you considered GCC lately?."]) ]) -dnl Check for libusb, treat LIBUSB_LIBS and LIBUSB_CFLAGS as precious variables -AC_MSG_CHECKING([whether to build USB dependent backends]) -AC_ARG_WITH([libusb], - [AS_HELP_STRING([--without-libusb], - [disable USB dependent backends @<:@default=yes@:>@])], - [cf_with_libusb=$with_libusb], - [cf_with_libusb=yes] - ) - -AC_MSG_RESULT([$cf_with_libusb]) - -LIBUSB="" -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-1.0.a (see INSTALL))]) - -AS_IF([test x"${cf_with_libusb}" = "xyes"], [ - AS_IF([test -z $LIBUSB_LIBS], - [AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBUSB_LIBS="-lusb-1.0"], - [AC_MSG_WARN([libusb_init was not found in libusb-1.0--USB backends will be disabled])] - [cf_with_libusb="no"]) - ], [cf_with_libusb="yes"]) - - AS_IF([test x"${cf_with_libusb}" = "xyes"], - [AC_CHECK_HEADERS([libusb.h libusb-1.0/libusb.h]) - AC_DEFINE([HAVE_LIBUSB], - [1], - [Define if libusb-1.0 is available]) - LIBUSB="libusb-1.0"])]) - -AM_CONDITIONAL([HAVE_LIBUSB], [test x"${cf_with_libusb}" = "xyes"]) -AC_SUBST([HAVE_LIBUSB]) - -# Only used in hamlib.pc.in -AC_SUBST([LIBUSB]) - - dnl Check if readline support in rigctl/rotctl is wanted AC_MSG_CHECKING([whether to use readline in rigctl/rotctl]) AC_ARG_WITH([readline], @@ -478,10 +442,46 @@ 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. +dnl These features rely on the external pkg-config/pkgconf functionality being +dnl available. At least pkg-config/pkgconf version 0.29.2 or newer is required +dnl for support of these modules. If pkg-config or pkgconf is not installed, +dnl their support will be gracefully disabled. + +PKG_PROG_PKG_CONFIG([0.29.2]) + +dnl Check for libusb, treat LIBUSB_LIBS and LIBUSB_CFLAGS as precious variables. +AC_MSG_CHECKING([whether to build USB dependent backends]) +AC_ARG_WITH([libusb], + [AS_HELP_STRING([--without-libusb], + [disable USB dependent backends @<:@default=yes@:>@])], + [cf_with_libusb=$with_libusb], + [cf_with_libusb=yes] + ) + +AC_MSG_RESULT([$cf_with_libusb]) + +dnl Only used in hamlib.pc.in +HAMLIB_PC_LIBUSB="" + +AS_IF([test x"${cf_with_libusb}" = "xyes"], [ + PKG_CHECK_MODULES([LIBUSB], + [libusb-1.0], + [AC_DEFINE([HAVE_LIBUSB], + [1], + [Define if libusb-1.0 is available]) + HAMLIB_PC_LIBUSB="libusb-1.0"], + [AC_MSG_WARN([libusb-1.0 or pkg_config not found, USB backend support will be disabled]) + cf_with_libusb=no + ]) + ]) + +AC_SUBST([HAMLIB_PC_LIBUSB]) + +dnl Configure the tests/Makefile.am conditional +AM_CONDITIONAL([TESTS_HAVE_LIBUSB], [test x"${cf_with_libusb}" = "xyes"]) -# libxml2 required rigmem xml support, make it user optional + +dnl libxml2 required for rigmem XML support; make it build time optional. AC_MSG_CHECKING([whether to build rigmem XML support]) AC_ARG_WITH([xml-support], [AS_HELP_STRING([--with-xml-support], @@ -490,8 +490,19 @@ AC_ARG_WITH([xml-support], [cf_with_xml_support=no]) AC_MSG_RESULT([$cf_with_xml_support]) +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 or pkgconf/pkg-config not found, XML support will be disabled]) + ]) + ]) + -# USRP needs a C++ compiler, tested for presence above. +dnl USRP needs a C++ compiler, tested for presence above. +dnl Default is to not build USRP support. AS_IF([test x"${cf_with_cxx}" = "xyes"], [ AC_MSG_CHECKING([whether to build USRP backend]) AC_ARG_ENABLE([usrp], @@ -502,39 +513,6 @@ AS_IF([test x"${cf_with_cxx}" = "xyes"], [ 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]) @@ -990,28 +968,28 @@ echo \ ${PACKAGE_NAME} Version ${PACKAGE_VERSION} configuration: - Prefix ${prefix} - Preprocessor ${CPP} ${CPPFLAGS} - C Compiler ${CC} ${CFLAGS} - C++ Compiler ${CXX} ${CXXFLAGS} + Prefix ${prefix} + Preprocessor ${CPP} ${CPPFLAGS} + C Compiler ${CC} ${CFLAGS} + C++ Compiler ${CXX} ${CXXFLAGS} Package features: - With C++ binding ${cf_with_cxx_binding} - With Perl binding ${cf_with_perl_binding} - With Python binding ${cf_with_python_binding} - With TCL binding ${build_tcl} - With Lua binding ${cf_with_lua_binding} - With rigmem XML support ${cf_with_xml_support} - With Readline support ${cf_with_readline_support} - With INDI support ${cf_with_indi_support} + With C++ binding ${cf_with_cxx_binding} + With Perl binding ${cf_with_perl_binding} + With Python binding ${cf_with_python_binding} + With TCL binding ${build_tcl} + With Lua binding ${cf_with_lua_binding} + With rigmem XML support ${cf_with_xml_support} + With Readline support ${cf_with_readline_support} + With INDI support ${cf_with_indi_support} Enable HTML rig feature matrix ${cf_enable_html_matrix} - Enable WinRadio ${cf_with_winradio} - Enable Parallel ${cf_with_parallel} - Enable USRP ${cf_with_usrp} - Enable USB backends ${cf_with_libusb} - Enable shared libs ${enable_shared} - Enable static libs ${enable_static} - Enable Python tests ${enable_pytest} + Enable WinRadio ${cf_with_winradio} + Enable Parallel ${cf_with_parallel} + Enable USRP ${cf_with_usrp} + Enable USB backends ${cf_with_libusb} + Enable shared libs ${enable_shared} + Enable static libs ${enable_static} + Enable Python tests ${enable_pytest} -----------------------------------------------------------------------" diff --git a/hamlib.pc.in b/hamlib.pc.in index a08b29726..f6b8d1af9 100644 --- a/hamlib.pc.in +++ b/hamlib.pc.in @@ -7,7 +7,7 @@ Name: @PACKAGE_NAME@ Description: Library to control radio and rotator equipment. URL: @PACKAGE_URL@ Version: @PACKAGE_VERSION@ -Requires.private: @LIBUSB@ +Requires.private: @HAMLIB_PC_LIBUSB@ Cflags: -I${includedir} @PTHREAD_CFLAGS@ Libs: -L${libdir} -lhamlib Libs.private: @MATH_LIBS@ @DL_LIBS@ @NET_LIBS@ @PTHREAD_LIBS@ diff --git a/rigs/kit/dwt.c b/rigs/kit/dwt.c index afbdb4274..3416998f6 100644 --- a/rigs/kit/dwt.c +++ b/rigs/kit/dwt.c @@ -503,13 +503,12 @@ static const char *dwtdll_get_info(RIG *rig) } -#elif defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#elif defined(HAVE_LIBUSB) -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. +#ifdef HAVE_LIBUSB # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> #endif diff --git a/rigs/kit/elektor507.c b/rigs/kit/elektor507.c index fa26b0680..00a768f30 100644 --- a/rigs/kit/elektor507.c +++ b/rigs/kit/elektor507.c @@ -29,7 +29,7 @@ #ifdef _WIN32 #define USE_FTDI_DLL -#elif defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#elif defined(HAVE_LIBUSB) #define USE_LIBUSB #endif @@ -148,12 +148,8 @@ struct elektor507_extra_priv_data #elif defined(USE_LIBUSB) - -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> -#endif #define USB_VID_FTDI 0x0403 /* Future Technology Devices International */ diff --git a/rigs/kit/fifisdr.c b/rigs/kit/fifisdr.c index 14eb4da98..2d28d65e2 100644 --- a/rigs/kit/fifisdr.c +++ b/rigs/kit/fifisdr.c @@ -37,14 +37,11 @@ /* * Compile this model only if libusb is available */ -#if defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#if defined(HAVE_LIBUSB) -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> -#endif /* Selected request codes of the original AVR USB Si570 firmware */ @@ -836,4 +833,4 @@ static int fifisdr_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, return ret; } -#endif /* defined(HAVE_LIBUSB) && defined(HAVE_LIBUSB_H) */ +#endif /* defined(HAVE_LIBUSB) */ diff --git a/rigs/kit/funcube.c b/rigs/kit/funcube.c index 6989d2b84..0e1561e86 100644 --- a/rigs/kit/funcube.c +++ b/rigs/kit/funcube.c @@ -34,14 +34,11 @@ /* * Compile this model only if libusb is available */ -#if defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#if defined(HAVE_LIBUSB) -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> -#endif #include "funcube.h" @@ -954,4 +951,4 @@ static int funcube_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, return RIG_OK; } -#endif /* defined(HAVE_LIBUSB) && defined(HAVE_LIBUSB_H) */ +#endif /* defined(HAVE_LIBUSB) */ diff --git a/rigs/kit/kit.c b/rigs/kit/kit.c index 2124c4962..27077c584 100644 --- a/rigs/kit/kit.c +++ b/rigs/kit/kit.c @@ -40,7 +40,7 @@ DECLARE_INITRIG_BACKEND(kit) rig_register(&hiqsdr_caps); rig_register(&rshfiq_caps); -#if (defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H))) +#if defined(HAVE_LIBUSB) rig_register(&si570avrusb_caps); rig_register(&si570picusb_caps); rig_register(&si570peaberry1_caps); @@ -50,7 +50,7 @@ DECLARE_INITRIG_BACKEND(kit) rig_register(&fasdr_caps); rig_register(&funcubeplus_caps); #endif -#if (defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H))) || defined(_WIN32) +#if (defined(HAVE_LIBUSB) || defined(_WIN32)) /* rigs with alternate DLL support on Win32 */ rig_register(&dwt_caps); rig_register(&elektor507_caps); diff --git a/rigs/kit/si570avrusb.c b/rigs/kit/si570avrusb.c index 926af28d2..287a1e28d 100644 --- a/rigs/kit/si570avrusb.c +++ b/rigs/kit/si570avrusb.c @@ -39,14 +39,11 @@ /* * Compile this model only if libusb is available */ -#if defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#if defined(HAVE_LIBUSB) -#ifdef HAVE_LIBUSB_H +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. # include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> -#endif #include "si570avrusb.h" @@ -1418,4 +1415,4 @@ int si570xxxusb_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) return RIG_OK; } -#endif /* defined(HAVE_LIBUSB) && defined(HAVE_LIBUSB_H) */ +#endif /* defined(HAVE_LIBUSB) */ diff --git a/src/Makefile.am b/src/Makefile.am index a1a92ba23..8714ba81e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,4 @@ +AM_CFLAGS += $(LIBUSB_CFLAGS) BUILT_SOURCES = $(builddir)/hamlibdatetime.h diff --git a/src/iofunc.c b/src/iofunc.c index 99e75414f..65a8d5009 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -335,7 +335,7 @@ int HAMLIB_API port_open(hamlib_port_t *p) p->fd = status; break; -#if defined(HAVE_LIBUSB_H) || defined (HAVE_LIBUSB_1_0_LIBUSB_H) +#if defined(HAVE_LIBUSB) case RIG_PORT_USB: status = usb_port_open(p); @@ -393,7 +393,7 @@ int HAMLIB_API port_close(hamlib_port_t *p, rig_port_t port_type) ret = ser_close(p); break; -#if defined(HAVE_LIBUSB_H) || defined (HAVE_LIBUSB_1_0_LIBUSB_H) +#if defined(HAVE_LIBUSB) case RIG_PORT_USB: ret = usb_port_close(p); diff --git a/src/usb_port.c b/src/usb_port.c index 80c9bc9f9..7e7a3333e 100644 --- a/src/usb_port.c +++ b/src/usb_port.c @@ -41,10 +41,9 @@ #include "hamlib/rig.h" #include "hamlib/port.h" -#ifdef HAVE_LIBUSB_H -# include <libusb.h> -#elif defined HAVE_LIBUSB_1_0_LIBUSB_H -# include <libusb-1.0/libusb.h> +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. +#ifdef HAVE_LIBUSB +#include <libusb.h> #endif #include "usb_port.h" @@ -52,7 +51,7 @@ /* * Compile only if libusb is available */ -#if defined(HAVE_LIBUSB) && (defined(HAVE_LIBUSB_H) || defined(HAVE_LIBUSB_1_0_LIBUSB_H)) +#if defined(HAVE_LIBUSB) /** * \brief Find and open USB device @@ -423,6 +422,6 @@ int usb_port_close(hamlib_port_t *port) } //! @endcond -#endif /* defined(HAVE_LIBUSB) && defined(HAVE_LIBUSB_H) */ +#endif /* defined(HAVE_LIBUSB) */ /** @} */ diff --git a/tests/Makefile.am b/tests/Makefile.am index bfc57de9c..d95942b23 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,7 +4,7 @@ # AUTOMAKE_OPTIONS = dejagnu # DEJATOOL = testfreq testbcd testloc rigctl -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB TESTLIBUSB = rigtestlibusb else TESTLIBUSB = @@ -32,7 +32,7 @@ rotctld_SOURCES = rotctld.c $(ROTCOMMONSRC) ampctl_SOURCES = ampctl.c $(AMPCOMMONSRC) ampctld_SOURCES = ampctld.c $(AMPCOMMONSRC) rigmem_SOURCES = rigmem.c memsave.c memload.c memcsv.c -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB rigtestlibusb_SOURCES = rigtestlibusb.c endif @@ -51,7 +51,7 @@ ampctld_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src rigctlcom_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security rigctltcp_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security rigctlsync_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB rigtestlibusb_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(LIBUSB_CFLAGS) endif @@ -68,7 +68,7 @@ rigmem_LDADD = $(LIBXML2_LIBS) $(LDADD) rigctlcom_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) rigctltcp_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) rigctlsync_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS) -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB rigtestlibusb_LDADD = $(LIBUSB_LIBS) endif @@ -88,7 +88,7 @@ ampctld_LDFLAGS = $(WINEXELDFLAGS) rigctlcom_LDFLAGS = $(WINEXELDFLAGS) rigctltcp_LDFLAGS = $(WINEXELDFLAGS) rigctlsync_LDFLAGS = $(WINEXELDFLAGS) -if HAVE_LIBUSB +if TESTS_HAVE_LIBUSB rigtestlibusb_LDFLAGS = $(WINEXELDFLAGS) endif diff --git a/tests/rigtestlibusb.c b/tests/rigtestlibusb.c index 119625152..315d56ca0 100644 --- a/tests/rigtestlibusb.c +++ b/tests/rigtestlibusb.c @@ -26,10 +26,10 @@ #include <stdio.h> #include <string.h> #include <hamlib/config.h> -#if defined(HAVE_LIBUSB_H) + +#ifdef HAVE_LIBUSB +// LIBUSB_CFLAGS set by pkg-config should set the include path appropriately. #include <libusb.h> -#elif defined(HAVE_LIBUSB_1_0_LIBUSB_H) -#include <libusb-1.0/libusb.h> #endif #ifdef __FreeBSD__ commit 8196e9ccd9731c2e9a1e71c452bb28e15f31c132 Author: Larry Gadallah <lga...@gm...> Date: Sun Sep 7 08:48:31 2025 -0700 Include needed headers in rigs/dummy/rot_pstrotator.c Per GitHub issue #1894, This file failed to build on FreeBSD. Closes GitHub #1894. diff --git a/rigs/dummy/rot_pstrotator.c b/rigs/dummy/rot_pstrotator.c index a4b31d675..da8a2a0d5 100644 --- a/rigs/dummy/rot_pstrotator.c +++ b/rigs/dummy/rot_pstrotator.c @@ -23,6 +23,17 @@ #include <sys/time.h> #include <errno.h> +#include "hamlib/config.h" +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#ifdef HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif + #include "hamlib/rotator.h" #include "dummy_common.h" #include "rig.h" ----------------------------------------------------------------------- Summary of changes: NEWS | 11 +-- android/config.h | 9 +-- configure.ac | 162 +++++++++++++++++++------------------------- hamlib.pc.in | 2 +- rigs/dummy/rot_pstrotator.c | 11 +++ rigs/kit/dwt.c | 7 +- rigs/kit/elektor507.c | 8 +-- rigs/kit/fifisdr.c | 9 +-- rigs/kit/funcube.c | 9 +-- rigs/kit/kit.c | 4 +- rigs/kit/si570avrusb.c | 9 +-- src/Makefile.am | 1 + src/iofunc.c | 4 +- src/usb_port.c | 11 ++- tests/Makefile.am | 10 +-- tests/rigtestlibusb.c | 6 +- 16 files changed, 123 insertions(+), 150 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |