blob: 06c18ae70fd4f167b5d2755d0fb7682489ed90f1 [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])
Patrick Ventureab28cb32018-06-20 18:37:48 -070021AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
Patrick Venturee6206562018-03-08 15:36:53 -080022
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."])])
Gunnar Mills08afbb22018-06-14 08:50:53 -050029AC_CHECK_HEADER(experimental/any, ,[AC_MSG_ERROR([Could not find experimental/any...libstdc++fs development package required])])
Patrick Venture29172472018-05-10 08:50:35 -070030PKG_CHECK_MODULES([LIBCONFIGXX], [libconfig++ >= 1.5], ,AC_MSG_ERROR([libconfig++ 1.5 or newer not found.]))
Patrick Venture2e3ecb52018-06-22 08:18:19 -070031AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])])
Patrick Venturee6206562018-03-08 15:36:53 -080032
33# Checks for library functions.
34LT_INIT # Required for systemd linking
35
36# Check/set gtest specific functions.
Patrick Venture7a841b62018-06-13 09:39:46 -070037PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
38PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])])
Patrick Venture2e3ecb52018-06-22 08:18:19 -070039PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])])
Patrick Venturee6206562018-03-08 15:36:53 -080040
41AC_ARG_ENABLE([oe-sdk],
42 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
43)
44AC_ARG_VAR(OECORE_TARGET_SYSROOT,
45 [Path to the OE SDK SYSROOT])
46AS_IF([test "x$enable_oe_sdk" == "xyes"],
47 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
48 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
49 )
50 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
51 [
52 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
53 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
54 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
55 ]
56 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
57)
58
59AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="sensor-example.yaml"])
60SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN"
61AC_SUBST(SENSORGEN)
62
63AS_IF([test "x$PID_YAML_GEN" == "x"], [PID_YAML_GEN="pid-example.yaml"])
64PIDGEN="$PYTHON ${srcdir}/scripts/pid_gen.py -i $PID_YAML_GEN"
65AC_SUBST(PIDGEN)
66
67AS_IF([test "x$ZONE_YAML_GEN" == "x"], [ZONE_YAML_GEN="zone-example.yaml"])
68ZONEGEN="$PYTHON ${srcdir}/scripts/zone_gen.py -i $ZONE_YAML_GEN"
69AC_SUBST(ZONEGEN)
70
71# Create configured output
Patrick Venture7a841b62018-06-13 09:39:46 -070072AC_CONFIG_FILES([Makefile test/Makefile])
Patrick Venturee6206562018-03-08 15:36:53 -080073AC_OUTPUT