pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/42688?usp=email )
Change subject: build: make linux/if_packet.h usage optional ......................................................................
build: make linux/if_packet.h usage optional
Check for presence of linux/if_packet.h in configure and guard its usage with HAVE_LINUX_IF_PACKET_H.
This avoids build failures on non-Linux platforms or environments where the header is unavailable.
Change-Id: I8a02b0676e65fa4b6191073c84e0646a2e67a010 --- M configure.ac M include/osmo-bts/phy_link.h 2 files changed, 11 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve
diff --git a/configure.ac b/configure.ac index fe69954..d18d8b3 100644 --- a/configure.ac +++ b/configure.ac @@ -321,6 +321,11 @@ AM_CONDITIONAL(ENABLE_ORTP, test "x$ENABLE_ORTP" = "xyes") AC_SUBST(ENABLE_ORTP)
+AC_CHECK_HEADER([linux/if_packet.h], [linux_if_packet_header="yes"], []) +if test "x$linux_if_packet_header" = "xyes" ; then + AC_DEFINE(HAVE_LINUX_IF_PACKET_H, 1, [Define if we found linux/if_packet.h]) +fi + # Generate manuals AC_ARG_ENABLE(manuals, [AS_HELP_STRING( diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h index 719c329..6ca316e 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -8,9 +8,12 @@ #include <osmo-bts/scheduler.h> #include <osmo-bts/bts_trx.h>
-#include <linux/if_packet.h> #include "btsconfig.h"
+#ifdef HAVE_LINUX_IF_PACKET_H +#include <linux/if_packet.h> +#endif /* HAVE_LINUX_IF_PACKET_H */ +
struct virt_um_inst;
@@ -64,8 +67,10 @@ struct virt_um_inst *virt_um; } virt; struct { +#ifdef HAVE_LINUX_IF_PACKET_H /* MAC address of the PHY */ struct sockaddr_ll phy_addr; +#endif /* HAVE_LINUX_IF_PACKET_H */ /* Network device name */ char *netdev_name;