blob: 9ecf38fa1a60cf660e38b911a0915d8c7be493f8 [file] [log] [blame]
Patrick Venture33569752018-03-12 18:56:14 -07001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-host-postd], [1.0], [https://github.com/openbmc/phosphor-host-postd/issues])
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# Checks for typedefs, structures, and compiler characteristics.
Patrick Venture384bc4c2018-09-10 13:10:51 -070016AX_CXX_COMPILE_STDCXX_17([noext])
Kun Yi2ae207c2018-06-11 16:09:46 -070017AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
Patrick Venture33569752018-03-12 18:56:14 -070018
19# Checks for libraries.
Patrick Venture7101f762019-02-13 15:41:06 -080020PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
21PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
22PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus])
23PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
Patrick Venturef8a20832018-10-11 15:54:51 -070024AC_CHECK_HEADER(experimental/filesystem, ,[AC_MSG_ERROR([Could not find experimental/filesystem...libstdc++fs development package required])])
Patrick Venture33569752018-03-12 18:56:14 -070025
26# Checks for library functions.
27LT_INIT # Required for systemd linking
28
Patrick Ventureba7d1ec2018-10-17 19:04:02 -070029AC_ARG_VAR(SNOOP_DEVICE, "Path to snoop device")
30AC_ARG_VAR(POST_CODE_BYTES, "Post code byte size")
31AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service")
Patrick Ventureba7d1ec2018-10-17 19:04:02 -070032
33PKG_PROG_PKG_CONFIG
34AC_ARG_WITH([systemdsystemunitdir],
35 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
36 [with_systemdsystemunitdir=auto])
37AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
38 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
39
40 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
41 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
42 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
43 with_systemdsystemunitdir=no],
44 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
45AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
46 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
47AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
48
Kun Yi2ae207c2018-06-11 16:09:46 -070049# Check/set gtest specific functions.
Benjamin Faira6c593a2018-07-13 16:27:55 -070050PKG_CHECK_MODULES([GTEST], [gtest_main], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
Kun Yi2ae207c2018-06-11 16:09:46 -070051PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])])
52AX_PTHREAD([GTEST_CFLAGS+=" -DGTEST_HAS_PTHREAD=1 "],[GTEST_CFLAGS+=" -DGTEST_HAS_PTHREAD=0 "])
Patrick Venture33569752018-03-12 18:56:14 -070053
Benjamin Fair938c0e42020-04-01 17:44:46 -070054AC_ARG_ENABLE([7seg],
55 AS_HELP_STRING([--enable-7seg], [Build daemon to send POST codes to a 7-segment display.])
56)
57AM_CONDITIONAL([ENABLE_7SEG], [test "x$enable_7seg" = "xyes"])
58
59AS_IF([test "x$enable_7seg" = "xyes"], [
60 PKG_CHECK_VAR([UDEVRULESDIR], [udev], [udevdir])
61 AC_MSG_CHECKING([udev rules path])
62 AS_IF([test "x$UDEVRULESDIR" = "x"], [
63 AC_MSG_FAILURE([Unable to identify udev rules path.])
64 ])
65])
66
Kun Yi2ae207c2018-06-11 16:09:46 -070067# Add --enable-oe-sdk flag to configure script
68AC_ARG_ENABLE([oe-sdk],
69 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
70)
71
72# Check for OECORE_TARGET_SYSROOT in the environment.
73AC_ARG_VAR(OECORE_TARGET_SYSROOT,
74 [Path to the OE SDK SYSROOT])
75
76# Configure OESDK_TESTCASE_FLAGS environment variable, which will be later
77# used in test/Makefile.am
78AS_IF([test "x$enable_oe_sdk" == "xyes"],
79 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
80 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
81 )
82 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
83 [
84 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
85 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
86 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
87 ]
88 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
89)
90
91# Create configured output
92AC_CONFIG_FILES([Makefile test/Makefile])
Patrick Ventureba7d1ec2018-10-17 19:04:02 -070093AC_CONFIG_FILES([lpcsnoop.service])
Kun Yi2ae207c2018-06-11 16:09:46 -070094AC_OUTPUT