You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/01/13 17:18:18 UTC
(axis-axis2-c-core) 03/06: Fix macOS/FreeBSD build failure in uuid_gen_unix.c (AXIS2C-1672, AXIS2C-1239)
This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git
commit acb12fdc591f5af7075971f05c9d1518d080f813
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Tue Jan 13 05:20:26 2026 -1000
Fix macOS/FreeBSD build failure in uuid_gen_unix.c (AXIS2C-1672, AXIS2C-1239)
The SIOCGARP ioctl is Solaris-specific and doesn't exist on macOS or
FreeBSD. The uuid_gen_unix.c file has three code paths for getting
MAC addresses:
1. HAVE_LINUX_IF_H: Linux using SIOCGIFHWADDR
2. HAVE_GETIFADDRS: BSD/macOS using getifaddrs()
3. else: Solaris using SIOCGARP
The problem was that autoconf's AC_CHECK_FUNCS(getifaddrs) could fail
to detect the function if <ifaddrs.h> wasn't included in the test,
causing builds to fall through to the Solaris path.
Fix by:
1. Adding platform detection fallback in uuid_gen_unix.c to define
HAVE_GETIFADDRS on macOS, FreeBSD, NetBSD, OpenBSD, and DragonFlyBSD
2. Adding AC_CHECK_HEADERS([ifaddrs.h]) to configure.ac
This ensures the getifaddrs() code path is used on BSD-derived systems.
Co-Authored-By: Claude Opus 4.5 <no...@anthropic.com>
---
util/configure.ac | 2 ++
util/src/platforms/unix/uuid_gen_unix.c | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/util/configure.ac b/util/configure.ac
index 95afb3581..0eea2da7a 100644
--- a/util/configure.ac
+++ b/util/configure.ac
@@ -140,6 +140,8 @@ AC_CHECK_HEADERS([linux/if.h],[],[],
#endif
])
AC_CHECK_HEADERS([net/if_types.h net/if_dl.h])
+dnl AXIS2C-1672/AXIS2C-1239: Check for ifaddrs.h (BSD/macOS getifaddrs support)
+AC_CHECK_HEADERS([ifaddrs.h])
dnl This is a check to see if we are running MacOS X
dnl It may be better to do a Darwin check
diff --git a/util/src/platforms/unix/uuid_gen_unix.c b/util/src/platforms/unix/uuid_gen_unix.c
index 467a051cc..8dfe8846d 100644
--- a/util/src/platforms/unix/uuid_gen_unix.c
+++ b/util/src/platforms/unix/uuid_gen_unix.c
@@ -45,6 +45,25 @@
# include <net/if_dl.h>
# endif
#endif
+/* AXIS2C-1672/AXIS2C-1239 FIX: Ensure HAVE_GETIFADDRS is defined on platforms
+ * that support it but may not have it detected by autoconf.
+ *
+ * On macOS, FreeBSD, NetBSD, OpenBSD, and DragonFlyBSD, the getifaddrs()
+ * function is available in libc and declared in <ifaddrs.h>. However,
+ * autoconf's AC_CHECK_FUNCS(getifaddrs) may fail to detect it if the
+ * <ifaddrs.h> header is not included in the test.
+ *
+ * Without this fix, builds fall through to the Solaris code path which
+ * uses SIOCGARP - an ioctl that doesn't exist on BSD-derived systems,
+ * causing: "error: 'SIOCGARP' undeclared"
+ */
+#if !defined(HAVE_GETIFADDRS)
+# if defined(IS_MACOSX) || defined(__APPLE__) || defined(__FreeBSD__) || \
+ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+# define HAVE_GETIFADDRS 1
+# endif
+#endif
+
#ifdef HAVE_GETIFADDRS
#include <ifaddrs.h>
#endif