blob: 1b38879a165670b8ba4622afb926d27c05eb23c9 [file] [log] [blame]
Ratan Guptaec26fa62018-04-16 15:28:36 +05301AC_PREREQ([2.69])
2AC_INIT([phosphor-snmp], [1.0], [https://github.com/openbmc/openbmc/phosphor-snmp.git])
3AC_LANG([C++])
Andrew Jeffery85c11b92019-08-02 13:46:31 +09304AM_INIT_AUTOMAKE([subdir-objects -Wall -Wno-portability -Werror foreign])
Ratan Guptaec26fa62018-04-16 15:28:36 +05305AM_SILENT_RULES([yes])
6
7# Compiler flags
8CXXFLAGS="$CXXFLAGS -fpic -Wall -Werror"
9
10# Check for programs
11AC_PROG_CXX
12AM_PROG_AR
13AC_PROG_INSTALL
14AC_PROG_MAKE_SET
Ratan Gupta1dc91782018-04-19 16:47:12 +053015AC_PROG_MKDIR_P
Ratan Guptaec26fa62018-04-16 15:28:36 +053016
17LT_PREREQ([2.4.6])
18LT_INIT([dlopen disable-static shared])
19
Vernon Maueryce714f42018-10-04 10:19:39 -070020AX_CXX_COMPILE_STDCXX_17([noext])
21
Ratan Gupta1dc91782018-04-19 16:47:12 +053022# Checks for libraries.
Patrick Venture7f1c6e12019-02-13 15:31:04 -080023AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221])
Ratan Gupta1dc91782018-04-19 16:47:12 +053024
Patrick Venture7f1c6e12019-02-13 15:31:04 -080025AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [])
Ratan Gupta1dc91782018-04-19 16:47:12 +053026
27AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
28
Patrick Venture7f1c6e12019-02-13 15:31:04 -080029AX_PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [], [phosphor-logging])
Ratan Gupta1dc91782018-04-19 16:47:12 +053030
31# Checks for header files.
32AC_CHECK_HEADER(systemd/sd-bus.h, ,\
33[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
34
Patrick Venture7f1c6e12019-02-13 15:31:04 -080035AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces])
Ratan Gupta1dc91782018-04-19 16:47:12 +053036
Ratan Guptaec26fa62018-04-16 15:28:36 +053037AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],,\
38 AC_MSG_ERROR(["Requires net-snmp headers"]))
39
Ratan Gupta1dc91782018-04-19 16:47:12 +053040AC_ARG_VAR(BUSNAME_NETWORK_SNMP, [The Dbus busname to own])
41AS_IF([test "x$BUSNAME_NETWORK_SNMP" == "x"], [BUSNAME_NETWORK_SNMP="xyz.openbmc_project.Network.SNMP"])
42AC_DEFINE_UNQUOTED([BUSNAME_NETWORK_SNMP], ["$BUSNAME_NETWORK_SNMP"], [The DBus busname to own])
43
44AC_ARG_VAR(OBJ_NETWORK_SNMP, [The network snmp root DBus object path])
45AS_IF([test "x$OBJ_NETWORK_SNMP" == "x"], [OBJ_NETWORK_SNMP="/xyz/openbmc_project/network/snmp/manager"])
46AC_DEFINE_UNQUOTED([OBJ_NETWORK_SNMP], ["$OBJ_NETWORK_SNMP"], [The network snmp root DBus object path])
47
Ratan Gupta212f53e2018-04-30 17:28:05 +053048AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal])
49AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1])
50AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal])
51
52AC_ARG_VAR(SNMP_CONF_PERSIST_PATH, [path of directory having persisted snmp managers.])
53AS_IF([test "x$SNMP_CONF_PERSIST_PATH" == "x"], \
54 [SNMP_CONF_PERSIST_PATH="/var/lib/phosphor-snmp/managers/"])
55AC_DEFINE_UNQUOTED([SNMP_CONF_PERSIST_PATH], ["$SNMP_CONF_PERSIST_PATH"], \
56 [Path of directory having persisted snmp managers.])
57
Ratan Gupta1dc91782018-04-19 16:47:12 +053058
Ratan Guptaec26fa62018-04-16 15:28:36 +053059# Checks for library functions
60LT_INIT # Required for systemd linking
61
62# Check/set gtest specific functions.
63AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
64AC_SUBST(GTEST_CPPFLAGS)
65
66# Add the code covererage
67AX_CODE_COVERAGE
Andrew Jeffery85c11b92019-08-02 13:46:31 +093068m4_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])])
71AX_ADD_AM_MACRO_STATIC([])
Ratan Guptaec26fa62018-04-16 15:28:36 +053072
73AC_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)
76AC_ARG_VAR(OECORE_TARGET_SYSROOT,
77 [Path to the OE SDK SYSROOT])
78AS_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 Gupta1dc91782018-04-19 16:47:12 +053091# Create configured output
92AC_CONFIG_HEADERS([config.h])
Ratan Guptaec26fa62018-04-16 15:28:36 +053093AC_CONFIG_FILES([Makefile])
94AC_CONFIG_FILES([phosphor-snmp.pc])
95AC_OUTPUT