M cmake/config.cmake +6 -1
@@ 1,5 1,5 @@
#
-# Copyright (c) 2020-2022 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+# Copyright (c) 2020-2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ 34,6 34,11 @@ include(CheckCSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES "${HAMLIB_INCLUDE_DIRS}")
check_c_source_compiles("
+#include <hamlib/config.h>
+int main() { return 0; }
+" HLOG_HAVE_HAMLIB_CONFIG_H)
+
+check_c_source_compiles("
#include <hamlib/rig.h>
int main() { return RIG_EDEPRECATED; }
" HLOG_HAVE_RIG_EDEPRECATED)
M common/include/hlog/config.h.in +2 -1
@@ 1,5 1,5 @@
/*
- * Copyright (c) 2022 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2022-2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ 24,6 24,7 @@
#define __COMMON_CONFIG_H
/* hamlib */
+#cmakedefine HLOG_HAVE_HAMLIB_CONFIG_H
#cmakedefine HLOG_HAVE_RIG_EDEPRECATED
#cmakedefine HLOG_HAVE_RIG_ESECURITY
M rpc/hamlib-quirks.c +30 -2
@@ 22,15 22,43 @@
#include <jeffpc/error.h>
+#include <hlog/config.h>
+
#include "hamlib-impl.h"
+#ifdef HLOG_HAVE_HAMLIB_CONFIG_H
+#include <hamlib/config.h>
+#endif
+
+/*
+ * Set the version to something small if it is missing.
+ */
+#ifndef ABI_VERSION_MAJOR
+#define ABI_VERSION_MAJOR 0
+#endif
+
+#ifndef ABI_VERSION_MINOR
+#define ABI_VERSION_MINOR 0
+#endif
+
+#ifndef ABI_VERSION_PATCH
+#define ABI_VERSION_PATCH 0
+#endif
+
+#define MKVER(ma, mi, pa) (((ma) << 16) | ((mi) << 8) | ((pa) << 0))
+
+#define CURRENT \
+ MKVER(ABI_VERSION_MAJOR, ABI_VERSION_MINOR, ABI_VERSION_PATCH)
+
void hamlib_set_quirks(struct hrig *rig, uint32_t model)
{
- if (model == RIG_MODEL_NETRIGCTL) {
+ if ((model == RIG_MODEL_NETRIGCTL) && (CURRENT <= MKVER(4, 3, 1))) {
rig->quirks.no_txpower = true;
cmn_err(CE_WARN, "Hamlib 4.3.1 and older has buggy netrigctl");
cmn_err(CE_WARN, "Disabling power announcements");
- } else if (model == RIG_MODEL_KX2) {
+ }
+
+ if ((model == RIG_MODEL_KX2) && (CURRENT <= MKVER(4, 5, 5))) {
rig->quirks.no_txpower = true;
cmn_err(CE_WARN, "Hamlib 4.5.5 and older has buggy KX2 backend");
cmn_err(CE_WARN, "Disabling power announcements");