Timur Davydov has uploaded this change for review. ( 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, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/88/42688/1
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..8692889 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -8,7 +8,9 @@ #include <osmo-bts/scheduler.h> #include <osmo-bts/bts_trx.h>
+#ifdef HAVE_LINUX_IF_PACKET_H #include <linux/if_packet.h> +#endif /* HAVE_LINUX_IF_PACKET_H */ #include "btsconfig.h"
@@ -64,8 +66,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;