xref: /openbmc/phosphor-event/configure.ac (revision 37fd9a65c57285b3220bade9234bf6c66bb11ede)
1# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-event], [1.0], [https://github.com/openbmc/phosphor-event/issues])
4AC_CONFIG_HEADERS([config.h])
5AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
6AM_SILENT_RULES([yes])
7
8# Checks for programs.
9AC_PROG_CXX
10AC_PROG_CC
11AM_PROG_AR
12AC_PROG_INSTALL
13AC_PROG_MAKE_SET
14
15# Checks for libraries.
16PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
17
18# Checks for header files.
19AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])
20
21# Checks for typedefs, structures, and compiler characteristics.
22AX_CXX_COMPILE_STDCXX_14([noext])
23AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CFLAGS])
24AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS])
25
26# Checks for library functions.
27LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
28
29# Check/set gtest specific functions.
30AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
31AC_SUBST(GTEST_CPPFLAGS)
32
33AC_ARG_ENABLE([oe-sdk],
34    AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
35)
36AC_ARG_VAR(OECORE_TARGET_SYSROOT,
37    [Path to the OE SDK SYSROOT])
38AS_IF([test "x$enable_oe_sdk" == "xyes"],
39    AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
40          AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
41    )
42    AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
43    [
44        testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
45        testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
46        testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
47    ]
48    AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
49)
50
51# Create configured output
52AC_CONFIG_FILES([
53		Makefile
54		test/Makefile])
55AC_OUTPUT
56