blob: 63b6decea2fb44337dbca8c57fe78aa8e8c0ab71 [file] [log] [blame]
Patrick Venturee6206562018-03-08 15:36:53 -08001# Initialization
2AC_PREREQ([2.69])
Patrick Ventured7523572018-11-26 09:01:54 -08003AC_INIT([swampd], [0.1], [https://github.com/openbmc/phosphor-pid-control/issues])
Patrick Venturee6206562018-03-08 15:36:53 -08004AC_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.
Patrick Venture54c2e5e2018-09-10 13:06:38 -070020AX_CXX_COMPILE_STDCXX_17([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.
Patrick Venturee54c7ff2018-11-21 21:30:56 -080024PKG_CHECK_MODULES(
25 [SYSTEMD],
26 [libsystemd >= 221],
27 [],
28 [AC_MSG_ERROR(["systemd required and not found"])]
29)
30PKG_CHECK_MODULES(
31 [SDBUSPLUS],
32 [sdbusplus],
33 [],
34 [AC_MSG_ERROR([The openbmc/sdbusplus package is required])]
35)
36PKG_CHECK_MODULES(
37 [PHOSPHOR_LOGGING],
38 [phosphor-logging],
39 [],
40 [AC_MSG_ERROR([The openbmc/phosphor-logging package is required])]
41)
42PKG_CHECK_MODULES(
43 [PHOSPHOR_DBUS_INTERFACES],
44 [phosphor-dbus-interfaces],
45 [],
46 [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])]
47)
William A. Kennington III331143c2019-02-07 15:52:44 -080048PKG_CHECK_MODULES(
49 [LIBIPMID],
50 [libipmid],
51 [],
52 [AC_MSG_ERROR([Could not find libipmid...openbmc/phosphor-host-ipmid package required])]
Patrick Venturee54c7ff2018-11-21 21:30:56 -080053)
54AC_CHECK_HEADER(
55 experimental/filesystem,
56 [],
57 [AC_MSG_ERROR([Could not find experimental/filesystem...libstdc++fs development package required])]
58)
Patrick Venture31eebcd2019-02-12 07:23:42 -080059AC_CHECK_HEADER(
60 nlohmann/json.hpp,
61 [],
62 [AC_MSG_ERROR([Could not find nlohmann/json.hpp])]
63)
Patrick Venture2e3ecb52018-06-22 08:18:19 -070064AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])])
Patrick Venturee6206562018-03-08 15:36:53 -080065
66# Checks for library functions.
67LT_INIT # Required for systemd linking
68
69# Check/set gtest specific functions.
Patrick Venturef77ecc72018-11-26 09:08:49 -080070PKG_CHECK_MODULES(
71 [GTEST],
72 [gtest],
73 [],
74 [AC_MSG_NOTICE([gtest not found, tests will not build])]
75)
76PKG_CHECK_MODULES(
77 [GMOCK],
78 [gmock],
79 [],
80 [AC_MSG_NOTICE([gmock not found, tests will not build])]
81)
82PKG_CHECK_MODULES(
83 [GTEST_MAIN],
84 [gtest_main],
85 [],
86 [AC_MSG_NOTICE([gtest_main not found, tests will not build])]
87)
Patrick Venturee6206562018-03-08 15:36:53 -080088
89AC_ARG_ENABLE([oe-sdk],
Patrick Venturef77ecc72018-11-26 09:08:49 -080090 AS_HELP_STRING(
91 [--enable-oe-sdk],
92 [Link testcases absolutely against OE SDK so they can be ran within it.]
93 )
Patrick Venturee6206562018-03-08 15:36:53 -080094)
95AC_ARG_VAR(OECORE_TARGET_SYSROOT,
Patrick Venturef77ecc72018-11-26 09:08:49 -080096 [Path to the OE SDK SYSROOT]
97)
Patrick Venturee6206562018-03-08 15:36:53 -080098AS_IF([test "x$enable_oe_sdk" == "xyes"],
99 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
100 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
101 )
102 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
103 [
104 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
105 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
106 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
107 ]
108 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
109)
110
111AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="sensor-example.yaml"])
112SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN"
113AC_SUBST(SENSORGEN)
114
115AS_IF([test "x$PID_YAML_GEN" == "x"], [PID_YAML_GEN="pid-example.yaml"])
116PIDGEN="$PYTHON ${srcdir}/scripts/pid_gen.py -i $PID_YAML_GEN"
117AC_SUBST(PIDGEN)
118
119AS_IF([test "x$ZONE_YAML_GEN" == "x"], [ZONE_YAML_GEN="zone-example.yaml"])
120ZONEGEN="$PYTHON ${srcdir}/scripts/zone_gen.py -i $ZONE_YAML_GEN"
121AC_SUBST(ZONEGEN)
122
James Feist7136a5a2018-07-19 09:52:05 -0700123AC_ARG_ENABLE([configure-dbus],
Patrick Venturef77ecc72018-11-26 09:08:49 -0800124 AS_HELP_STRING(
125 [--enable-configure-dbus], [Enable configuring pid from D-Bus.]
126 )
127)
James Feist7136a5a2018-07-19 09:52:05 -0700128AM_CONDITIONAL(CONFIGURE_DBUS, [test "x$enable_configure_dbus" = "xyes"])
129AS_IF([test "x$enable_configure_dbus" = "xyes"],
James Feistce15e022018-09-26 10:01:33 -0700130 [AC_DEFINE(CONFIGURE_DBUS, [1], [Read configuration from D-Bus.])],
131 [AC_DEFINE(CONFIGURE_DBUS, [0], [Do not read configuration from D-Bus.])]
James Feist7136a5a2018-07-19 09:52:05 -0700132)
133
Patrick Venturee6206562018-03-08 15:36:53 -0800134# Create configured output
Patrick Venture7a841b62018-06-13 09:39:46 -0700135AC_CONFIG_FILES([Makefile test/Makefile])
Patrick Venturee6206562018-03-08 15:36:53 -0800136AC_OUTPUT