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++]) |
| 4 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign]) |
| 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 | |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 20 | # Checks for libraries. |
| 21 | AX_PKG_CHECK_MODULES([SYSTEMD], [], [libsystemd >= 221], [],\ |
| 22 | [AC_MSG_ERROR(["Systemd version should be greater then 221."])]) |
| 23 | |
| 24 | AX_PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], [],\ |
| 25 | [AC_MSG_ERROR(["Requires sdbusplus package."])]) |
| 26 | |
| 27 | |
| 28 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 29 | |
| 30 | AX_PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [], [phosphor-logging], [],\ |
| 31 | [AC_MSG_ERROR(["Requires phosphor-logging package."])]) |
| 32 | |
| 33 | # Checks for header files. |
| 34 | AC_CHECK_HEADER(systemd/sd-bus.h, ,\ |
| 35 | [AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])]) |
| 36 | |
| 37 | AX_PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [], [phosphor-dbus-interfaces],\ |
| 38 | [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])]) |
| 39 | |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 40 | AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],,\ |
| 41 | AC_MSG_ERROR(["Requires net-snmp headers"])) |
| 42 | |
Ratan Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 43 | AC_ARG_VAR(BUSNAME_NETWORK_SNMP, [The Dbus busname to own]) |
| 44 | AS_IF([test "x$BUSNAME_NETWORK_SNMP" == "x"], [BUSNAME_NETWORK_SNMP="xyz.openbmc_project.Network.SNMP"]) |
| 45 | AC_DEFINE_UNQUOTED([BUSNAME_NETWORK_SNMP], ["$BUSNAME_NETWORK_SNMP"], [The DBus busname to own]) |
| 46 | |
| 47 | AC_ARG_VAR(OBJ_NETWORK_SNMP, [The network snmp root DBus object path]) |
| 48 | AS_IF([test "x$OBJ_NETWORK_SNMP" == "x"], [OBJ_NETWORK_SNMP="/xyz/openbmc_project/network/snmp/manager"]) |
| 49 | AC_DEFINE_UNQUOTED([OBJ_NETWORK_SNMP], ["$OBJ_NETWORK_SNMP"], [The network snmp root DBus object path]) |
| 50 | |
| 51 | |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 52 | # Checks for library functions |
| 53 | LT_INIT # Required for systemd linking |
| 54 | |
| 55 | # Check/set gtest specific functions. |
| 56 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-GTEST_HAS_PTHREAD=0"]) |
| 57 | AC_SUBST(GTEST_CPPFLAGS) |
| 58 | |
| 59 | # Add the code covererage |
| 60 | AX_CODE_COVERAGE |
| 61 | |
| 62 | AC_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 | ) |
| 65 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 66 | [Path to the OE SDK SYSROOT]) |
| 67 | AS_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 Gupta | 1dc9178 | 2018-04-19 16:47:12 +0530 | [diff] [blame] | 80 | # Create configured output |
| 81 | AC_CONFIG_HEADERS([config.h]) |
Ratan Gupta | ec26fa6 | 2018-04-16 15:28:36 +0530 | [diff] [blame] | 82 | AC_CONFIG_FILES([Makefile]) |
| 83 | AC_CONFIG_FILES([phosphor-snmp.pc]) |
| 84 | AC_OUTPUT |