Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 1 | # Initializaion |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-networkd], [1.0], [https://github.com/openbmc/phosphor-networkd/issues]) |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 4 | AC_LANG([C++]) |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 5 | AC_CONFIG_HEADERS([config.h]) |
| 6 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 7 | AM_SILENT_RULES([yes]) |
| 8 | |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 9 | |
| 10 | # Checks for typedefs, structures, and compiler characteristics. |
William A. Kennington III | 548e9f1 | 2018-09-20 18:48:13 -0700 | [diff] [blame] | 11 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 12 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
| 13 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 14 | # Checks for programs. |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 15 | AC_PROG_CXX |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 16 | AC_PROG_CC |
| 17 | AM_PROG_AR |
| 18 | AC_PROG_INSTALL |
| 19 | AC_PROG_MAKE_SET |
| 20 | |
Ratan Gupta | bbe4579 | 2018-03-23 00:22:55 +0530 | [diff] [blame] | 21 | # Download ncsi.h from github if necessary. |
| 22 | AC_CHECK_HEADER(linux/ncsi.h,[HAVE_LINUX_NCSI_H=""],[HAVE_LINUX_NCSI_H="-I linux/ncsi.h"]) |
| 23 | AS_IF([test "$HAVE_LINUX_NCSI_H" != ""], |
| 24 | AC_MSG_WARN([Could not find linux/ncsi.h: Attempting to download locally for building from https://raw.githubusercontent.com/openbmc/linux/dev-4.13/include/uapi/linux/ncsi.h]) |
| 25 | AC_SUBST([BT_BMC_DL],[`mkdir -p linux;wget https://raw.githubusercontent.com/openbmc/linux/dev-4.13/include/uapi/linux/ncsi.h -O linux/ncsi.h`]) |
| 26 | ) |
| 27 | |
Gunnar Mills | d75f049 | 2017-10-25 20:33:32 -0500 | [diff] [blame] | 28 | # Suppress the --with-libtool-sysroot error |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 29 | LT_INIT |
| 30 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 31 | # Checks for libraries. |
| 32 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221]) |
William A. Kennington III | 8fac535 | 2019-02-12 18:49:19 -0800 | [diff] [blame] | 33 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 34 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) |
William A. Kennington III | 12beaad | 2020-06-13 19:30:41 -0700 | [diff] [blame] | 35 | PKG_CHECK_MODULES([STDPLUS], [stdplus]) |
Ratan Gupta | bf9ba40 | 2017-04-14 17:16:04 +0530 | [diff] [blame] | 36 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
William A. Kennington III | 8fac535 | 2019-02-12 18:49:19 -0800 | [diff] [blame] | 37 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
| 38 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
William A. Kennington III | 01defca | 2019-03-21 16:23:12 -0700 | [diff] [blame] | 39 | PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0]) |
Patrick Venture | 9a85a2c | 2018-11-22 10:07:46 -0800 | [diff] [blame] | 40 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 41 | # Checks for header files. |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 42 | AC_CHECK_HEADER(systemd/sd-bus.h, ,\ |
| 43 | [AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) |
| 44 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 45 | # Checks for typedefs, structures, and compiler characteristics. |
| 46 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror -Wno-unused-result], [CFLAGS]) |
| 47 | |
Patrick Venture | 042e472 | 2019-01-07 07:42:11 -0800 | [diff] [blame] | 48 | PKG_PROG_PKG_CONFIG |
| 49 | AC_ARG_WITH([systemdsystemunitdir], |
| 50 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])], |
| 51 | [], |
| 52 | [with_systemdsystemunitdir=auto] |
| 53 | ) |
| 54 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], |
| 55 | [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 56 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 57 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 58 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])] |
| 59 | ) |
| 60 | with_systemdsystemunitdir=no], |
| 61 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"] |
| 62 | )] |
| 63 | ) |
| 64 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 65 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])] |
| 66 | ) |
| 67 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 68 | |
| 69 | AC_ARG_WITH([dbuspolicydir], |
| 70 | AS_HELP_STRING([--with-dbuspolicydir=DIR], [Directory for D-Bus system policy files]) |
| 71 | ) |
| 72 | AS_IF([test "x$with_dbuspolicydir" = "x"], |
William A. Kennington III | 26c0dc4 | 2019-02-12 18:51:58 -0800 | [diff] [blame] | 73 | [with_dbuspolicydir='${sysconfdir}/dbus-1/system.d'] |
Patrick Venture | 042e472 | 2019-01-07 07:42:11 -0800 | [diff] [blame] | 74 | ) |
| 75 | AC_SUBST([dbuspolicydir], [$with_dbuspolicydir]) |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 76 | |
Benjamin Fair | 0634573 | 2020-04-15 16:06:32 -0700 | [diff] [blame] | 77 | AC_ARG_WITH([uboot-env], |
| 78 | AS_HELP_STRING([--without-uboot-env], [Disable features that require a u-boot environment])) |
| 79 | AS_IF([test "x$with_uboot_env" != "xno"], [ |
| 80 | AC_DEFINE([HAVE_UBOOT_ENV], [1], [u-boot environment is available]) |
| 81 | ]) |
| 82 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 83 | # Check/set gtest specific functions. |
| 84 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"]) |
| 85 | AC_SUBST(GTEST_CPPFLAGS) |
| 86 | |
| 87 | AC_ARG_ENABLE([oe-sdk], |
| 88 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 89 | ) |
| 90 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 91 | [Path to the OE SDK SYSROOT]) |
| 92 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 93 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 94 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 95 | ) |
| 96 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 97 | [ |
| 98 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 99 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 100 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 101 | ] |
| 102 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 103 | ) |
| 104 | |
Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame] | 105 | # If set, auto-configure a link-local address on the NIC. |
William A. Kennington III | 639cfe1 | 2019-02-12 18:57:59 -0800 | [diff] [blame] | 106 | AC_ARG_ENABLE( |
| 107 | [link-local-autoconfiguration], |
| 108 | AS_HELP_STRING([--disable-link-local-autoconfiguration], [Disable link-local IP address autoconfiguration]), |
| 109 | [], |
| 110 | [enable_link_local_autoconfiguration="yes"] |
Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame] | 111 | ) |
William A. Kennington III | 639cfe1 | 2019-02-12 18:57:59 -0800 | [diff] [blame] | 112 | if test "x$enable_link_local_autoconfiguration" = "xyes"; then |
| 113 | AC_DEFINE([LINK_LOCAL_AUTOCONFIGURATION], [1], [Enable link-local IP address autoconfiguration]) |
| 114 | fi |
Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame] | 115 | |
Johnathan Mantey | 200678a | 2021-04-28 13:59:46 -0700 | [diff] [blame] | 116 | # If set, enable the BMC to accept IPv6 Router Advertisement for IPv6 address |
| 117 | # configuration. |
| 118 | AC_ARG_ENABLE([ipv6_accept_ra], |
| 119 | [ --enable-ipv6-accept-ra Enable/disable the use of ETHTOOL features in the NIC driver], |
| 120 | [case "${enableval}" in |
| 121 | yes) enable_ipv6_accept_ra=true ;; |
| 122 | no) enable_ipv6_accept_ra=false ;; |
| 123 | *) AC_MSG_ERROR([bad value ${ipv6_accept_ra} for --enable-ipv6-accept-ra]) ;; |
| 124 | esac],[enable_ipv6_accept_ra=false] |
| 125 | ) |
| 126 | if test "x$enable_ipv6_accept_ra" = "xtrue"; then |
| 127 | AC_DEFINE([ENABLE_IPV6_ACCEPT_RA], [1], [Enable IPv6 Router Advertisement]) |
| 128 | fi |
| 129 | |
William A. Kennington III | 5f1eb46 | 2019-02-12 19:47:51 -0800 | [diff] [blame] | 130 | DEFAULT_BUSNAME='xyz.openbmc_project.Network' |
| 131 | AC_DEFINE_UNQUOTED([DEFAULT_BUSNAME], ["$DEFAULT_BUSNAME"], [The DBus busname to own]) |
| 132 | AC_SUBST(DEFAULT_BUSNAME, ["$DEFAULT_BUSNAME"]) |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 133 | |
Patrick Venture | 042e472 | 2019-01-07 07:42:11 -0800 | [diff] [blame] | 134 | AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service") |
| 135 | AS_IF([test "x$SYSTEMD_TARGET" == "x"], [SYSTEMD_TARGET="multi-user.target"]) |
| 136 | |
Johnathan Mantey | ad4bf5c | 2020-01-24 13:30:39 -0800 | [diff] [blame] | 137 | AC_ARG_ENABLE([nic_ethtool], |
| 138 | [ --enable-nic-ethtool Enable/disable the use of ETHTOOL features in the NIC driver], |
| 139 | [case "${enableval}" in |
| 140 | yes) nic_ethtool=true ;; |
| 141 | no) nic_ethtool=false ;; |
| 142 | *) AC_MSG_ERROR([bad value ${nic_ethtool} for --enable-nic-ethtool]) ;; |
| 143 | esac],[nic_ethtool=false] |
| 144 | ) |
| 145 | AM_CONDITIONAL([FEATURE_NIC_ETHTOOL], [test x$nic_ethtool = xtrue]) |
| 146 | |
Manojkiran Eda | 75e08ea | 2020-06-17 19:03:24 +0530 | [diff] [blame] | 147 | # Configure option to enable sync operation between the MAC address in the Inventory |
| 148 | # on to the respective ethernet interface |
| 149 | AC_ARG_ENABLE([sync_mac], |
| 150 | [ --enable-sync-mac Enable/disable sync mac mapping for ethernet interface], |
| 151 | [case "${enableval}" in |
| 152 | yes) sync_mac=true ;; |
| 153 | no) sync_mac=false ;; |
| 154 | *) AC_MSG_ERROR([bad value ${sync_mac} for --enable-sync-mac]) ;; |
| 155 | esac],[sync_mac=false] |
| 156 | ) |
| 157 | AM_CONDITIONAL([FEATURE_SYNC_MAC_FROM_INVENTORY], [test x$sync_mac = xtrue]) |
| 158 | |
Manojkiran Eda | 05ceb39 | 2020-06-19 09:58:25 +0530 | [diff] [blame] | 159 | #check for nlohmann-json header files. |
| 160 | AS_IF([test "x$sync_mac" == "xtrue"],[ |
| 161 | AC_CHECK_HEADER( |
| 162 | nlohmann/json.hpp, |
| 163 | [], |
| 164 | [AC_MSG_ERROR([Could not find nlohmann/json.hpp])]] |
| 165 | )) |
| 166 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 167 | # Create configured output. |
Ratan Gupta | 594123d | 2017-05-16 22:48:35 +0530 | [diff] [blame] | 168 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Patrick Venture | 042e472 | 2019-01-07 07:42:11 -0800 | [diff] [blame] | 169 | AC_CONFIG_FILES([xyz.openbmc_project.Network.service]) |
| 170 | AC_CONFIG_FILES([xyz.openbmc_project.Network.conf]) |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 171 | AC_OUTPUT |