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]) |
Ratan Gupta | bf9ba40 | 2017-04-14 17:16:04 +0530 | [diff] [blame] | 35 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
William A. Kennington III | 8fac535 | 2019-02-12 18:49:19 -0800 | [diff] [blame] | 36 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) |
| 37 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
William A. Kennington III | 01defca | 2019-03-21 16:23:12 -0700 | [diff] [blame] | 38 | PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0]) |
Patrick Venture | 9a85a2c | 2018-11-22 10:07:46 -0800 | [diff] [blame] | 39 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 40 | # Checks for header files. |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 41 | AC_CHECK_HEADER(systemd/sd-bus.h, ,\ |
| 42 | [AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) |
| 43 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 44 | # Checks for typedefs, structures, and compiler characteristics. |
| 45 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror -Wno-unused-result], [CFLAGS]) |
| 46 | |
Patrick Venture | 042e472 | 2019-01-07 07:42:11 -0800 | [diff] [blame] | 47 | PKG_PROG_PKG_CONFIG |
| 48 | AC_ARG_WITH([systemdsystemunitdir], |
| 49 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])], |
| 50 | [], |
| 51 | [with_systemdsystemunitdir=auto] |
| 52 | ) |
| 53 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], |
| 54 | [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 55 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 56 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 57 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])] |
| 58 | ) |
| 59 | with_systemdsystemunitdir=no], |
| 60 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"] |
| 61 | )] |
| 62 | ) |
| 63 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 64 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])] |
| 65 | ) |
| 66 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 67 | |
| 68 | AC_ARG_WITH([dbuspolicydir], |
| 69 | AS_HELP_STRING([--with-dbuspolicydir=DIR], [Directory for D-Bus system policy files]) |
| 70 | ) |
| 71 | AS_IF([test "x$with_dbuspolicydir" = "x"], |
William A. Kennington III | 26c0dc4 | 2019-02-12 18:51:58 -0800 | [diff] [blame] | 72 | [with_dbuspolicydir='${sysconfdir}/dbus-1/system.d'] |
Patrick Venture | 042e472 | 2019-01-07 07:42:11 -0800 | [diff] [blame] | 73 | ) |
| 74 | AC_SUBST([dbuspolicydir], [$with_dbuspolicydir]) |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 75 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 76 | # Check/set gtest specific functions. |
| 77 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"]) |
| 78 | AC_SUBST(GTEST_CPPFLAGS) |
| 79 | |
| 80 | AC_ARG_ENABLE([oe-sdk], |
| 81 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 82 | ) |
| 83 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 84 | [Path to the OE SDK SYSROOT]) |
| 85 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 86 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 87 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 88 | ) |
| 89 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 90 | [ |
| 91 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 92 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 93 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 94 | ] |
| 95 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 96 | ) |
| 97 | |
Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame] | 98 | # 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] | 99 | AC_ARG_ENABLE( |
| 100 | [link-local-autoconfiguration], |
| 101 | AS_HELP_STRING([--disable-link-local-autoconfiguration], [Disable link-local IP address autoconfiguration]), |
| 102 | [], |
| 103 | [enable_link_local_autoconfiguration="yes"] |
Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame] | 104 | ) |
William A. Kennington III | 639cfe1 | 2019-02-12 18:57:59 -0800 | [diff] [blame] | 105 | if test "x$enable_link_local_autoconfiguration" = "xyes"; then |
| 106 | AC_DEFINE([LINK_LOCAL_AUTOCONFIGURATION], [1], [Enable link-local IP address autoconfiguration]) |
| 107 | fi |
Oskar Senft | ad21fc2 | 2018-07-26 16:32:23 -0400 | [diff] [blame] | 108 | |
William A. Kennington III | 5f1eb46 | 2019-02-12 19:47:51 -0800 | [diff] [blame] | 109 | DEFAULT_BUSNAME='xyz.openbmc_project.Network' |
| 110 | AC_DEFINE_UNQUOTED([DEFAULT_BUSNAME], ["$DEFAULT_BUSNAME"], [The DBus busname to own]) |
| 111 | AC_SUBST(DEFAULT_BUSNAME, ["$DEFAULT_BUSNAME"]) |
Ratan Gupta | 8c83493 | 2017-04-14 16:30:24 +0530 | [diff] [blame] | 112 | |
Patrick Venture | 042e472 | 2019-01-07 07:42:11 -0800 | [diff] [blame] | 113 | AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service") |
| 114 | AS_IF([test "x$SYSTEMD_TARGET" == "x"], [SYSTEMD_TARGET="multi-user.target"]) |
| 115 | |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 116 | # Create configured output. |
Ratan Gupta | 594123d | 2017-05-16 22:48:35 +0530 | [diff] [blame] | 117 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Patrick Venture | 042e472 | 2019-01-07 07:42:11 -0800 | [diff] [blame] | 118 | AC_CONFIG_FILES([xyz.openbmc_project.Network.service]) |
| 119 | AC_CONFIG_FILES([xyz.openbmc_project.Network.conf]) |
Matthew Barth | 5e60ba5 | 2016-09-26 13:40:01 -0500 | [diff] [blame] | 120 | AC_OUTPUT |