blob: a0cdbe2354baae9e5055df110ded83f37912cf49 [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++])
4AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign])
5AM_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
Ratan Gupta1dc91782018-04-19 16:47:12 +053020# Checks for libraries.
21AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [],\
22[AC_MSG_ERROR(["Systemd version should be greater then 221."])])
23
24AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], [],\
25[AC_MSG_ERROR(["Requires sdbusplus package."])])
26
27
28AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
29
30AX_PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [], [phosphor-logging], [],\
31[AC_MSG_ERROR(["Requires phosphor-logging package."])])
32
33# Checks for header files.
34AC_CHECK_HEADER(systemd/sd-bus.h, ,\
35[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
36
37AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces],\
38[], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
39
Ratan Guptaec26fa62018-04-16 15:28:36 +053040AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],,\
41 AC_MSG_ERROR(["Requires net-snmp headers"]))
42
Ratan Gupta1dc91782018-04-19 16:47:12 +053043AC_ARG_VAR(BUSNAME_NETWORK_SNMP, [The Dbus busname to own])
44AS_IF([test "x$BUSNAME_NETWORK_SNMP" == "x"], [BUSNAME_NETWORK_SNMP="xyz.openbmc_project.Network.SNMP"])
45AC_DEFINE_UNQUOTED([BUSNAME_NETWORK_SNMP], ["$BUSNAME_NETWORK_SNMP"], [The DBus busname to own])
46
47AC_ARG_VAR(OBJ_NETWORK_SNMP, [The network snmp root DBus object path])
48AS_IF([test "x$OBJ_NETWORK_SNMP" == "x"], [OBJ_NETWORK_SNMP="/xyz/openbmc_project/network/snmp/manager"])
49AC_DEFINE_UNQUOTED([OBJ_NETWORK_SNMP], ["$OBJ_NETWORK_SNMP"], [The network snmp root DBus object path])
50
51
Ratan Guptaec26fa62018-04-16 15:28:36 +053052# Checks for library functions
53LT_INIT # Required for systemd linking
54
55# Check/set gtest specific functions.
56AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"])
57AC_SUBST(GTEST_CPPFLAGS)
58
59# Add the code covererage
60AX_CODE_COVERAGE
61
62AC_ARG_ENABLE([oe-sdk],
63 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
64)
65AC_ARG_VAR(OECORE_TARGET_SYSROOT,
66 [Path to the OE SDK SYSROOT])
67AS_IF([test "x$enable_oe_sdk" == "xyes"],
68 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
69 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
70 )
71 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
72 [
73 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
74 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
75 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
76 ]
77 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
78)
79
Ratan Gupta1dc91782018-04-19 16:47:12 +053080# Create configured output
81AC_CONFIG_HEADERS([config.h])
Ratan Guptaec26fa62018-04-16 15:28:36 +053082AC_CONFIG_FILES([Makefile])
83AC_CONFIG_FILES([phosphor-snmp.pc])
84AC_OUTPUT