blob: c5b47c806c4ba746a0edabe36e60e058ad9f6b94 [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
Ratan Guptaec26fa62018-04-16 15:28:36 +05307# Check for programs
8AC_PROG_CXX
9AM_PROG_AR
10AC_PROG_INSTALL
11AC_PROG_MAKE_SET
Ratan Gupta1dc91782018-04-19 16:47:12 +053012AC_PROG_MKDIR_P
Ratan Guptaec26fa62018-04-16 15:28:36 +053013
14LT_PREREQ([2.4.6])
15LT_INIT([dlopen disable-static shared])
16
Patrick Williams0357dff2022-04-15 10:12:01 -050017AX_CXX_COMPILE_STDCXX([20],[noext])
18AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
Vernon Maueryce714f42018-10-04 10:19:39 -070019
Ratan Gupta1dc91782018-04-19 16:47:12 +053020# Checks for libraries.
Patrick Venture7f1c6e12019-02-13 15:31:04 -080021AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221])
Ratan Gupta1dc91782018-04-19 16:47:12 +053022
Patrick Venture7f1c6e12019-02-13 15:31:04 -080023AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [])
Ratan Gupta1dc91782018-04-19 16:47:12 +053024
25AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
26
Patrick Venture7f1c6e12019-02-13 15:31:04 -080027AX_PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [], [phosphor-logging])
Ratan Gupta1dc91782018-04-19 16:47:12 +053028
29# Checks for header files.
30AC_CHECK_HEADER(systemd/sd-bus.h, ,\
31[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
32
Patrick Venture7f1c6e12019-02-13 15:31:04 -080033AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces])
Ratan Gupta1dc91782018-04-19 16:47:12 +053034
Ratan Guptaec26fa62018-04-16 15:28:36 +053035AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],,\
36 AC_MSG_ERROR(["Requires net-snmp headers"]))
37
Ratan Gupta1dc91782018-04-19 16:47:12 +053038AC_ARG_VAR(BUSNAME_NETWORK_SNMP, [The Dbus busname to own])
39AS_IF([test "x$BUSNAME_NETWORK_SNMP" == "x"], [BUSNAME_NETWORK_SNMP="xyz.openbmc_project.Network.SNMP"])
40AC_DEFINE_UNQUOTED([BUSNAME_NETWORK_SNMP], ["$BUSNAME_NETWORK_SNMP"], [The DBus busname to own])
41
42AC_ARG_VAR(OBJ_NETWORK_SNMP, [The network snmp root DBus object path])
43AS_IF([test "x$OBJ_NETWORK_SNMP" == "x"], [OBJ_NETWORK_SNMP="/xyz/openbmc_project/network/snmp/manager"])
44AC_DEFINE_UNQUOTED([OBJ_NETWORK_SNMP], ["$OBJ_NETWORK_SNMP"], [The network snmp root DBus object path])
45
Ratan Gupta212f53e2018-04-30 17:28:05 +053046AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal])
47AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1])
48AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal])
49
50AC_ARG_VAR(SNMP_CONF_PERSIST_PATH, [path of directory having persisted snmp managers.])
51AS_IF([test "x$SNMP_CONF_PERSIST_PATH" == "x"], \
52 [SNMP_CONF_PERSIST_PATH="/var/lib/phosphor-snmp/managers/"])
53AC_DEFINE_UNQUOTED([SNMP_CONF_PERSIST_PATH], ["$SNMP_CONF_PERSIST_PATH"], \
54 [Path of directory having persisted snmp managers.])
55
Ratan Guptaec26fa62018-04-16 15:28:36 +053056# Check/set gtest specific functions.
57AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
58AC_SUBST(GTEST_CPPFLAGS)
59
60# Add the code covererage
61AX_CODE_COVERAGE
Andrew Jeffery85c11b92019-08-02 13:46:31 +093062m4_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])])
65AX_ADD_AM_MACRO_STATIC([])
Ratan Guptaec26fa62018-04-16 15:28:36 +053066
67AC_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)
70AC_ARG_VAR(OECORE_TARGET_SYSROOT,
71 [Path to the OE SDK SYSROOT])
72AS_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 Gupta1dc91782018-04-19 16:47:12 +053085# Create configured output
86AC_CONFIG_HEADERS([config.h])
Ratan Guptaec26fa62018-04-16 15:28:36 +053087AC_CONFIG_FILES([Makefile])
88AC_CONFIG_FILES([phosphor-snmp.pc])
89AC_OUTPUT