From 0f4556fc2343dc0ade0bb1e0d1fc6f85770d77af Mon Sep 17 00:00:00 2001 From: "Andrey V.Kosteltsev" Date: Fri, 15 Jul 2022 10:36:51 +0300 Subject: First commit: Sila SNMP Sub Agent and configuration manager --- configure.ac | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 configure.ac (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c20c2e5 --- /dev/null +++ b/configure.ac @@ -0,0 +1,99 @@ +AC_PREREQ([2.69]) +AC_INIT([sila-snmp], + [m4_esyscmd_s([git describe --dirty --long --always])], + [https://github.com/SILA/obmc-sila-snmp]) +AC_LANG([C++]) +AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign]) +AM_SILENT_RULES([yes]) + +# Checks for programs +AC_PROG_CXX +AM_PROG_AR +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_MKDIR_P + +# Checks for typedefs, structures and compiler characteristics. +AX_CXX_COMPILE_STDCXX_17([noext]) +AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) + +# Checks for libraries. +PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) +AC_SUBST(SDBUSPLUS_CFLAGS) +AC_SUBST(SDBUSPLUS_LIBS) + +PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) +AC_SUBST(SDEVENTPLUS_CLFAGS) +AC_SUBST(SDEVENTPLUS_LIBS) + +PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging]) +PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) + +# Check for sdbus++ +AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) +AS_IF([test "x$SDBUSPLUSPLUS" == "x"], + AC_MSG_ERROR(["Requires sdbus++"])) + +AC_CHECK_HEADERS([net-snmp/net-snmp-config.h],,\ + AC_MSG_ERROR(["Requires net-snmp headers"])) + +# Check for net-snmp-config +AC_PATH_PROG([NETSNMP_CONFIG], [net-snmp-config]) +AS_IF([test "x$NETSNMP_CONFIG" == "x"], + AC_MSG_ERROR(["Requires net-snmp-config"])) + +NETSNMP_CFLAGS=`$NETSNMP_CONFIG --base-cflags` +NETSNMP_AGENT_LIBS=`$NETSNMP_CONFIG --agent-libs` +AC_SUBST([NETSNMP_CFLAGS]) +AC_SUBST([NETSNMP_AGENT_LIBS]) + +# Checks for library functions +LT_INIT # Required for systemd linking + +PKG_PROG_PKG_CONFIG +AC_ARG_WITH([systemdsystemunitdir], + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])], + [], + [with_systemdsystemunitdir=auto] +) +AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], + [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) + AS_IF([test "x$def_systemdsystemunitdir" = "x"], + [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], + [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])] + ) + with_systemdsystemunitdir=no], + [with_systemdsystemunitdir="$def_systemdsystemunitdir"] + )] +) +AS_IF([test "x$with_systemdsystemunitdir" != "xno"], + [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])] +) +AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) + +AC_ARG_ENABLE([agent], + AS_HELP_STRING([--disable-agent], [Disable sila-snmp-agent.])) +AC_ARG_ENABLE([cfg-manager], + AS_HELP_STRING([--disable-cfg-manager], [Disable sila-snmp-cfg-manager.])) + +AM_CONDITIONAL([WANT_AGENT], [test "x$enable_agent" != "xno"]) +AM_CONDITIONAL([WANT_CFG_MANAGER], [test "x$enable_cfg_manager" != "xno"]) + +AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service") +AS_IF([test "x$SYSTEMD_TARGET" = "x"], [SYSTEMD_TARGET="multi-user.target"]) + +# Package specific checks. +AS_IF([test "x$enable_agent" != "xno"], [ + AC_CONFIG_FILES([agent/Makefile]) + AC_CONFIG_FILES([agent/sila-snmp-agent.service]) +]) +AS_IF([test "x$enable_cfg_manager" != "xno"], [ + AC_CONFIG_FILES([snmpcfg/Makefile]) + AC_CONFIG_FILES([snmpcfg/sila-snmp-cfg-manager.service]) +]) + +# Create configured output +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT + -- cgit v1.2.3