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