blob: 14ed38243f72caed24fcbeaf88fa5d6bd37c07c8 [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])
33
Ratan Gupta8c834932017-04-14 16:30:24 +053034PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,\
35AC_MSG_ERROR(["Requires sdbusplus package."]))
36
William A. Kennington III3a70fa22018-09-20 18:48:20 -070037PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus],,\
38AC_MSG_ERROR(["Requires sdeventplus package."]))
Ratan Guptabf9ba402017-04-14 17:16:04 +053039
40AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
41
Ratan Gupta8c834932017-04-14 16:30:24 +053042PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,\
43AC_MSG_ERROR(["Requires phosphor-logging package."]))
44
Patrick Venture9a85a2c2018-11-22 10:07:46 -080045PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],\
46[], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
47
Matthew Barth5e60ba52016-09-26 13:40:01 -050048# Checks for header files.
Ratan Gupta8c834932017-04-14 16:30:24 +053049AC_CHECK_HEADER(systemd/sd-bus.h, ,\
50[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
51
Matthew Barth5e60ba52016-09-26 13:40:01 -050052# Checks for typedefs, structures, and compiler characteristics.
53AX_APPEND_COMPILE_FLAGS([-Wall -Werror -Wno-unused-result], [CFLAGS])
54
55# Checks for library functions.
56LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
57
Patrick Venture042e4722019-01-07 07:42:11 -080058PKG_PROG_PKG_CONFIG
59AC_ARG_WITH([systemdsystemunitdir],
60 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],
61 [],
62 [with_systemdsystemunitdir=auto]
63)
64AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
65 [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
66 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
67 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
68 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]
69 )
70 with_systemdsystemunitdir=no],
71 [with_systemdsystemunitdir="$def_systemdsystemunitdir"]
72 )]
73)
74AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
75 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]
76)
77AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
78
79AC_ARG_WITH([dbuspolicydir],
80 AS_HELP_STRING([--with-dbuspolicydir=DIR], [Directory for D-Bus system policy files])
81)
82AS_IF([test "x$with_dbuspolicydir" = "x"],
83 [with_dbuspolicydir="${sysconfdir}/dbus-1/system.d"]
84)
85AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
Ratan Gupta8c834932017-04-14 16:30:24 +053086
Matthew Barth5e60ba52016-09-26 13:40:01 -050087# Check/set gtest specific functions.
88AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
89AC_SUBST(GTEST_CPPFLAGS)
90
91AC_ARG_ENABLE([oe-sdk],
92 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
93)
94AC_ARG_VAR(OECORE_TARGET_SYSROOT,
95 [Path to the OE SDK SYSROOT])
96AS_IF([test "x$enable_oe_sdk" == "xyes"],
97 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
98 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
99 )
100 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
101 [
102 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
103 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
104 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
105 ]
106 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
107)
108
Oskar Senftad21fc22018-07-26 16:32:23 -0400109# If set, auto-configure a link-local address on the NIC.
110AC_ARG_ENABLE([link-local-autoconfiguration],
111 AS_HELP_STRING([--disable-link-local-autoconfiguration], [Disable link-local IP address autoconfiguration])
112)
113
114AC_ARG_VAR(LINK_LOCAL_AUTOCONFIGURATION, [Enable link-local address autoconfiguration])
115
116AS_IF([test "x$enable_link_local_autoconfiguration" != "xno"],
117 [LINK_LOCAL_AUTOCONFIGURATION="yes"]
118 AC_DEFINE_UNQUOTED([LINK_LOCAL_AUTOCONFIGURATION], ["$LINK_LOCAL_AUTOCONFIGURATION"], [Enable link-local IP address autoconfiguration])
119)
120
Vishwanatha Subbanna18891c62017-10-17 15:22:46 +0530121AC_ARG_VAR(DNS_ENTRY_FILE, [File having DNS entries supplied by DHCP])
122AS_IF([test "x$DNS_ENTRY_FILE" == "x"], [DNS_ENTRY_FILE="/run/systemd/netif/state"])
123AC_DEFINE_UNQUOTED([DNS_ENTRY_FILE], ["$DNS_ENTRY_FILE"], [File having DNS entries supplied by DHCP])
124
Ratan Gupta8c834932017-04-14 16:30:24 +0530125AC_ARG_VAR(BUSNAME_NETWORK, [The Dbus busname to own])
126AS_IF([test "x$BUSNAME_NETWORK" == "x"], [BUSNAME_NETWORK="xyz.openbmc_project.Network"])
127AC_DEFINE_UNQUOTED([BUSNAME_NETWORK], ["$BUSNAME_NETWORK"], [The DBus busname to own])
128
129AC_ARG_VAR(OBJ_NETWORK, [The network manager DBus object path])
130AS_IF([test "x$OBJ_NETWORK" == "x"], [OBJ_NETWORK="/xyz/openbmc_project/network"])
131AC_DEFINE_UNQUOTED([OBJ_NETWORK], ["$OBJ_NETWORK"], [The network manager DBus object path])
132
Ratan Guptad8edf112017-05-14 11:53:18 +0530133AC_ARG_VAR(NETWORK_CONF_DIR, [Network configuration directory])
134AS_IF([test "x$NETWORK_CONF_DIR" == "x"], [NETWORK_CONF_DIR="/etc/systemd/network"])
135AC_DEFINE_UNQUOTED([NETWORK_CONF_DIR], ["$NETWORK_CONF_DIR"], [Network configuration directory])
136
Patrick Venture042e4722019-01-07 07:42:11 -0800137AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service")
138AS_IF([test "x$SYSTEMD_TARGET" == "x"], [SYSTEMD_TARGET="multi-user.target"])
139
Ratan Gupta4f1c18b2017-05-25 12:59:35 +0530140AC_DEFINE(SYSTEMD_BUSNAME, "org.freedesktop.systemd1", [systemd busname.])
141AC_DEFINE(SYSTEMD_PATH, "/org/freedesktop/systemd1", [systemd path.])
142AC_DEFINE(SYSTEMD_INTERFACE, "org.freedesktop.systemd1.Manager", [systemd interface.])
143
Matthew Barth5e60ba52016-09-26 13:40:01 -0500144# Create configured output.
Ratan Gupta594123d2017-05-16 22:48:35 +0530145AC_CONFIG_FILES([Makefile test/Makefile])
Patrick Venture042e4722019-01-07 07:42:11 -0800146AC_CONFIG_FILES([xyz.openbmc_project.Network.service])
147AC_CONFIG_FILES([xyz.openbmc_project.Network.conf])
Matthew Barth5e60ba52016-09-26 13:40:01 -0500148AC_OUTPUT