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