blob: 8dfe11389f86dd82e0d9073d3435c306755a42a0 [file] [log] [blame]
Matthew Barth5e60ba52016-09-26 13:40:01 -05001# Initializaion
2AC_PREREQ([2.69])
3AC_INIT([phosphor-networkd], [1.0], [https://github.com/openbmc/phosphor-networkd/issues])
Ratan Gupta8c834932017-04-14 16:30:24 +05304AC_LANG([C++])
Matthew Barth5e60ba52016-09-26 13:40:01 -05005AC_CONFIG_HEADERS([config.h])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
7AM_SILENT_RULES([yes])
8
Ratan Gupta8c834932017-04-14 16:30:24 +05309
10# Checks for typedefs, structures, and compiler characteristics.
William A. Kennington III548e9f12018-09-20 18:48:13 -070011AX_CXX_COMPILE_STDCXX_17([noext])
Ratan Gupta8c834932017-04-14 16:30:24 +053012AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
13
Matthew Barth5e60ba52016-09-26 13:40:01 -050014# Checks for programs.
Ratan Gupta8c834932017-04-14 16:30:24 +053015AC_PROG_CXX
Matthew Barth5e60ba52016-09-26 13:40:01 -050016AC_PROG_CC
17AM_PROG_AR
18AC_PROG_INSTALL
19AC_PROG_MAKE_SET
20
Ratan Guptabbe45792018-03-23 00:22:55 +053021# Download ncsi.h from github if necessary.
22AC_CHECK_HEADER(linux/ncsi.h,[HAVE_LINUX_NCSI_H=""],[HAVE_LINUX_NCSI_H="-I linux/ncsi.h"])
23AS_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 Millsd75f0492017-10-25 20:33:32 -050028# Suppress the --with-libtool-sysroot error
Ratan Gupta8c834932017-04-14 16:30:24 +053029LT_INIT
30
Matthew Barth5e60ba52016-09-26 13:40:01 -050031# Checks for libraries.
32PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
William A. Kennington III8fac5352019-02-12 18:49:19 -080033PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
34PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus])
William A. Kennington III12beaad2020-06-13 19:30:41 -070035PKG_CHECK_MODULES([STDPLUS], [stdplus])
Ratan Guptabf9ba402017-04-14 17:16:04 +053036AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
William A. Kennington III8fac5352019-02-12 18:49:19 -080037PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
38PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
William A. Kennington III01defca2019-03-21 16:23:12 -070039PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0])
Patrick Venture9a85a2c2018-11-22 10:07:46 -080040
Matthew Barth5e60ba52016-09-26 13:40:01 -050041# Checks for header files.
Ratan Gupta8c834932017-04-14 16:30:24 +053042AC_CHECK_HEADER(systemd/sd-bus.h, ,\
43[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
44
Matthew Barth5e60ba52016-09-26 13:40:01 -050045# Checks for typedefs, structures, and compiler characteristics.
46AX_APPEND_COMPILE_FLAGS([-Wall -Werror -Wno-unused-result], [CFLAGS])
47
Patrick Venture042e4722019-01-07 07:42:11 -080048PKG_PROG_PKG_CONFIG
49AC_ARG_WITH([systemdsystemunitdir],
50 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],
51 [],
52 [with_systemdsystemunitdir=auto]
53)
54AS_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)
64AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
65 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]
66)
67AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
68
69AC_ARG_WITH([dbuspolicydir],
70 AS_HELP_STRING([--with-dbuspolicydir=DIR], [Directory for D-Bus system policy files])
71)
72AS_IF([test "x$with_dbuspolicydir" = "x"],
William A. Kennington III26c0dc42019-02-12 18:51:58 -080073 [with_dbuspolicydir='${sysconfdir}/dbus-1/system.d']
Patrick Venture042e4722019-01-07 07:42:11 -080074)
75AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
Ratan Gupta8c834932017-04-14 16:30:24 +053076
Benjamin Fair06345732020-04-15 16:06:32 -070077AC_ARG_WITH([uboot-env],
78 AS_HELP_STRING([--without-uboot-env], [Disable features that require a u-boot environment]))
79AS_IF([test "x$with_uboot_env" != "xno"], [
80 AC_DEFINE([HAVE_UBOOT_ENV], [1], [u-boot environment is available])
81])
82
Matthew Barth5e60ba52016-09-26 13:40:01 -050083# Check/set gtest specific functions.
84AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
85AC_SUBST(GTEST_CPPFLAGS)
86
87AC_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)
90AC_ARG_VAR(OECORE_TARGET_SYSROOT,
91 [Path to the OE SDK SYSROOT])
92AS_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 Senftad21fc22018-07-26 16:32:23 -0400105# If set, auto-configure a link-local address on the NIC.
William A. Kennington III639cfe12019-02-12 18:57:59 -0800106AC_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 Senftad21fc22018-07-26 16:32:23 -0400111)
William A. Kennington III639cfe12019-02-12 18:57:59 -0800112if test "x$enable_link_local_autoconfiguration" = "xyes"; then
113 AC_DEFINE([LINK_LOCAL_AUTOCONFIGURATION], [1], [Enable link-local IP address autoconfiguration])
114fi
Oskar Senftad21fc22018-07-26 16:32:23 -0400115
William A. Kennington III5f1eb462019-02-12 19:47:51 -0800116DEFAULT_BUSNAME='xyz.openbmc_project.Network'
117AC_DEFINE_UNQUOTED([DEFAULT_BUSNAME], ["$DEFAULT_BUSNAME"], [The DBus busname to own])
118AC_SUBST(DEFAULT_BUSNAME, ["$DEFAULT_BUSNAME"])
Ratan Gupta8c834932017-04-14 16:30:24 +0530119
Patrick Venture042e4722019-01-07 07:42:11 -0800120AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service")
121AS_IF([test "x$SYSTEMD_TARGET" == "x"], [SYSTEMD_TARGET="multi-user.target"])
122
Johnathan Manteyad4bf5c2020-01-24 13:30:39 -0800123AC_ARG_ENABLE([nic_ethtool],
124 [ --enable-nic-ethtool Enable/disable the use of ETHTOOL features in the NIC driver],
125 [case "${enableval}" in
126 yes) nic_ethtool=true ;;
127 no) nic_ethtool=false ;;
128 *) AC_MSG_ERROR([bad value ${nic_ethtool} for --enable-nic-ethtool]) ;;
129 esac],[nic_ethtool=false]
130 )
131AM_CONDITIONAL([FEATURE_NIC_ETHTOOL], [test x$nic_ethtool = xtrue])
132
Manojkiran Eda75e08ea2020-06-17 19:03:24 +0530133# Configure option to enable sync operation between the MAC address in the Inventory
134# on to the respective ethernet interface
135AC_ARG_ENABLE([sync_mac],
136 [ --enable-sync-mac Enable/disable sync mac mapping for ethernet interface],
137 [case "${enableval}" in
138 yes) sync_mac=true ;;
139 no) sync_mac=false ;;
140 *) AC_MSG_ERROR([bad value ${sync_mac} for --enable-sync-mac]) ;;
141 esac],[sync_mac=false]
142 )
143AM_CONDITIONAL([FEATURE_SYNC_MAC_FROM_INVENTORY], [test x$sync_mac = xtrue])
144
Manojkiran Eda05ceb392020-06-19 09:58:25 +0530145#check for nlohmann-json header files.
146AS_IF([test "x$sync_mac" == "xtrue"],[
147AC_CHECK_HEADER(
148 nlohmann/json.hpp,
149 [],
150 [AC_MSG_ERROR([Could not find nlohmann/json.hpp])]]
151))
152
Matthew Barth5e60ba52016-09-26 13:40:01 -0500153# Create configured output.
Ratan Gupta594123d2017-05-16 22:48:35 +0530154AC_CONFIG_FILES([Makefile test/Makefile])
Patrick Venture042e4722019-01-07 07:42:11 -0800155AC_CONFIG_FILES([xyz.openbmc_project.Network.service])
156AC_CONFIG_FILES([xyz.openbmc_project.Network.conf])
Matthew Barth5e60ba52016-09-26 13:40:01 -0500157AC_OUTPUT