blob: 2ad98553b6746f0817850ce5ef386b079acfbb0c [file] [log] [blame]
Matthew Barth71222442016-10-04 16:10:01 -05001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([phosphor-objmgr], [1.0], [https://github.com/openbmc/phosphor-objmgr/issues])
Matthew Barthf1d7c6e2016-11-15 11:22:30 -06004AC_CONFIG_HEADERS([libmapper/config.h])
Matthew Barth71222442016-10-04 16:10:01 -05005AC_CONFIG_MACRO_DIR([m4])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
7AM_SILENT_RULES([yes])
8
Matthew Barthc6329c92016-11-15 11:13:37 -06009# Modify header template
10AH_TOP([#pragma once])
Matthew Barth66da92d2017-01-04 14:37:25 -060011AH_BOTTOM([#include "libmapper/workaround/systemd.h"])
Matthew Barthc6329c92016-11-15 11:13:37 -060012
Matthew Barth71222442016-10-04 16:10:01 -050013# Checks for programs.
14AC_PROG_CC
15AM_PROG_AR
16AC_PROG_INSTALL
17AC_PROG_MAKE_SET
Matthew Barth4a6f9982016-11-18 10:25:57 -060018AC_PROG_AWK
Matthew Barth71222442016-10-04 16:10:01 -050019# Python
20AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR([Could not find python-2.7 installed...python-2.7 is required])])
21AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
22AC_SUBST([HAVE_PYTHON])
23AC_SUBST([PYTHONDIR], ${pythondir})
24
25# Checks for libraries.
26PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
27
28# Checks for header files.
29AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
30
31# Checks for typedefs, structures, and compiler characteristics.
32AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CFLAGS])
33
34# Checks for library functions.
35LT_INIT([disable-static shared])
36
37# Check/set gtest specific functions.
38AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
39AC_SUBST(GTEST_CPPFLAGS)
40
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
59# Add defines to config header
60AC_DEFINE([MAPPER_BUSNAME], ["xyz.openbmc_project.ObjectMapper"], [Object mapper bus name])
61AC_DEFINE([MAPPER_INTERFACE], ["xyz.openbmc_project.ObjectMapper"], [Object mapper interface])
62AC_DEFINE([MAPPER_PATH], ["/xyz/openbmc_project/ObjectMapper"], [Object mapper DBUS path])
63
Matthew Barthc6329c92016-11-15 11:13:37 -060064# Workaround for unpatched systemd installs
65AC_ARG_ENABLE([unpatched-systemd],
66 AS_HELP_STRING([--enable-unpatched-systemd], [Enable unpatched systemd workarounds]))
67AS_IF([test "x$enable_unpatched_systemd" == "xyes"],
68 AC_MSG_NOTICE([Enabling unpatched systemd workarounds])
69 [
70 AC_DEFINE([IS_UNPATCHED_SYSTEMD], ,[Enable unpatched systemd workarounds])
71 ]
72)
73
Matthew Barth71222442016-10-04 16:10:01 -050074# Create configured output
75AC_CONFIG_FILES([Makefile setup.py])
76AC_OUTPUT