Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 1 | AC_PREREQ([2.69]) |
| 2 | AC_INIT([phosphor-snmp], [1.0], [https://github.com/openbmc/openbmc/phosphor-snmp.git]) |
| 3 | AC_LANG([C++]) |
Andrew Jeffery | 85c11b9 | 2019-08-02 13:46:31 +0930 | [diff] [blame] | 4 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Wno-portability -Werror foreign]) |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 5 | AM_SILENT_RULES([yes]) |
| 6 | |
| 7 | # Compiler flags |
| 8 | CXXFLAGS="$CXXFLAGS -fpic -Wall -Werror" |
| 9 | |
| 10 | # Check for programs |
| 11 | AC_PROG_CXX |
| 12 | AM_PROG_AR |
| 13 | AC_PROG_INSTALL |
| 14 | AC_PROG_MAKE_SET |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 15 | AC_PROG_MKDIR_P |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 16 | |
| 17 | LT_PREREQ([2.4.6]) |
| 18 | LT_INIT([dlopen disable-static shared]) |
| 19 | |
Vernon Mauery | ce714f4 | 2018-10-04 10:19:39 -0700 | [diff] [blame] | 20 | AX_CXX_COMPILE_STDCXX_17([noext]) |
| 21 | |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 22 | # Checks for libraries. |
Patrick Venture | 7f1c6e1 | 2019-02-13 15:31:04 -0800 | [diff] [blame] | 23 | AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221]) |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 24 | |
Patrick Venture | 7f1c6e1 | 2019-02-13 15:31:04 -0800 | [diff] [blame] | 25 | AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], []) |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 26 | |
| 27 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 28 | |
Patrick Venture | 7f1c6e1 | 2019-02-13 15:31:04 -0800 | [diff] [blame] | 29 | AX_PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [], [phosphor-logging]) |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 30 | |
| 31 | # Checks for header files. |
| 32 | AC_CHECK_HEADER(systemd/sd-bus.h, ,\ |
| 33 | [AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) |
| 34 | |
Patrick Venture | 7f1c6e1 | 2019-02-13 15:31:04 -0800 | [diff] [blame] | 35 | AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces]) |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 36 | |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 37 | AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],,\ |
| 38 | AC_MSG_ERROR(["Requires net-snmp headers"])) |
| 39 | |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 40 | AC_ARG_VAR(BUSNAME_NETWORK_SNMP, [The Dbus busname to own]) |
| 41 | AS_IF([test "x$BUSNAME_NETWORK_SNMP" == "x"], [BUSNAME_NETWORK_SNMP="xyz.openbmc_project.Network.SNMP"]) |
| 42 | AC_DEFINE_UNQUOTED([BUSNAME_NETWORK_SNMP], ["$BUSNAME_NETWORK_SNMP"], [The DBus busname to own]) |
| 43 | |
| 44 | AC_ARG_VAR(OBJ_NETWORK_SNMP, [The network snmp root DBus object path]) |
| 45 | AS_IF([test "x$OBJ_NETWORK_SNMP" == "x"], [OBJ_NETWORK_SNMP="/xyz/openbmc_project/network/snmp/manager"]) |
| 46 | AC_DEFINE_UNQUOTED([OBJ_NETWORK_SNMP], ["$OBJ_NETWORK_SNMP"], [The network snmp root DBus object path]) |
| 47 | |
Ratan Gupta | 212f53e | 2018-04-30 17:28:05 +0530 | [diff] [blame] | 48 | AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal]) |
| 49 | AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1]) |
| 50 | AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal]) |
| 51 | |
| 52 | AC_ARG_VAR(SNMP_CONF_PERSIST_PATH, [path of directory having persisted snmp managers.]) |
| 53 | AS_IF([test "x$SNMP_CONF_PERSIST_PATH" == "x"], \ |
| 54 | [SNMP_CONF_PERSIST_PATH="/var/lib/phosphor-snmp/managers/"]) |
| 55 | AC_DEFINE_UNQUOTED([SNMP_CONF_PERSIST_PATH], ["$SNMP_CONF_PERSIST_PATH"], \ |
| 56 | [Path of directory having persisted snmp managers.]) |
| 57 | |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 58 | |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 59 | # Checks for library functions |
| 60 | LT_INIT # Required for systemd linking |
| 61 | |
| 62 | # Check/set gtest specific functions. |
| 63 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"]) |
| 64 | AC_SUBST(GTEST_CPPFLAGS) |
| 65 | |
| 66 | # Add the code covererage |
| 67 | AX_CODE_COVERAGE |
Andrew Jeffery | 85c11b9 | 2019-08-02 13:46:31 +0930 | [diff] [blame] | 68 | m4_ifdef([_AX_CODE_COVERAGE_RULES], |
| 69 | [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])], |
| 70 | [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])]) |
| 71 | AX_ADD_AM_MACRO_STATIC([]) |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 72 | |
| 73 | AC_ARG_ENABLE([oe-sdk], |
| 74 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 75 | ) |
| 76 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 77 | [Path to the OE SDK SYSROOT]) |
| 78 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 79 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 80 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 81 | ) |
| 82 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 83 | [ |
| 84 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 85 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 86 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 87 | ] |
| 88 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 89 | ) |
| 90 | |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 91 | # Create configured output |
| 92 | AC_CONFIG_HEADERS([config.h]) |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 93 | AC_CONFIG_FILES([Makefile]) |
| 94 | AC_CONFIG_FILES([phosphor-snmp.pc]) |
| 95 | AC_OUTPUT |