blob: b86d0c62f72720d7f6dea48e93aaee938af1164f [file] [log] [blame]
Patrick Venturee6206562018-03-08 15:36:53 -08001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([swampd], [1.0], [https://www.google.com])
4AC_LANG([C++])
5AC_CONFIG_HEADERS([config.h])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
7AM_SILENT_RULES([yes])
8
9# Checks for programs.
10AC_PROG_CXX
11AM_PROG_AR
12AC_PROG_INSTALL
13AC_PROG_MAKE_SET
14
15# Python
16AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])],
17[AC_MSG_ERROR([Could not find python-2.7 installed...python-2.7 is required])])
18
19# Checks for typedefs, structures, and compiler characteristics.
20AX_CXX_COMPILE_STDCXX_14([noext])
21AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
22
23# Checks for libraries.
24# AC_CHECK_LIB([mapper], [mapper_get_service], ,[AC_MSG_ERROR([Could not find libmapper...openbmc/phosphor-objmgr package required])])
25PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])])
26PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], ,[AC_MSG_ERROR([The openbmc/sdbusplus package is required])])
27PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging], ,[AC_MSG_ERROR([The openbmc/phosphor-logging package is required])])
28PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
29AC_CHECK_HEADER(experimental/any, ,[AC_MSG_ERROR([Could not find experimental/any...libstdc++fs developement package required])])
30
31# Checks for library functions.
32LT_INIT # Required for systemd linking
33
34# Check/set gtest specific functions.
35AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
36AC_SUBST(GTEST_CPPFLAGS)
37
38AC_ARG_ENABLE([oe-sdk],
39 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
40)
41AC_ARG_VAR(OECORE_TARGET_SYSROOT,
42 [Path to the OE SDK SYSROOT])
43AS_IF([test "x$enable_oe_sdk" == "xyes"],
44 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
45 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
46 )
47 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
48 [
49 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
50 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
51 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
52 ]
53 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
54)
55
56AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="sensor-example.yaml"])
57SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN"
58AC_SUBST(SENSORGEN)
59
60AS_IF([test "x$PID_YAML_GEN" == "x"], [PID_YAML_GEN="pid-example.yaml"])
61PIDGEN="$PYTHON ${srcdir}/scripts/pid_gen.py -i $PID_YAML_GEN"
62AC_SUBST(PIDGEN)
63
64AS_IF([test "x$ZONE_YAML_GEN" == "x"], [ZONE_YAML_GEN="zone-example.yaml"])
65ZONEGEN="$PYTHON ${srcdir}/scripts/zone_gen.py -i $ZONE_YAML_GEN"
66AC_SUBST(ZONEGEN)
67
68# Create configured output
69AC_CONFIG_FILES([Makefile])
70AC_OUTPUT