blob: 6ac4cc69869ef3690666c02f969f66474a045122 [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])
Matt Spinler62b36bd2017-06-02 12:15:59 -05008AC_LANG([C++])
Matthew Barth71222442016-10-04 16:10:01 -05009
Matthew Barthc6329c92016-11-15 11:13:37 -060010# Modify header template
11AH_TOP([#pragma once])
Matthew Barth66da92d2017-01-04 14:37:25 -060012AH_BOTTOM([#include "libmapper/workaround/systemd.h"])
Matthew Barthc6329c92016-11-15 11:13:37 -060013
Matthew Barth71222442016-10-04 16:10:01 -050014# Checks for programs.
15AC_PROG_CC
Matt Spinler62b36bd2017-06-02 12:15:59 -050016AC_PROG_CXX
Matthew Barth71222442016-10-04 16:10:01 -050017AM_PROG_AR
18AC_PROG_INSTALL
19AC_PROG_MAKE_SET
Matthew Barth4a6f9982016-11-18 10:25:57 -060020AC_PROG_AWK
Matthew Barth71222442016-10-04 16:10:01 -050021# Python
22AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])], [AC_MSG_ERROR([Could not find python-2.7 installed...python-2.7 is required])])
23AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
24AC_SUBST([HAVE_PYTHON])
25AC_SUBST([PYTHONDIR], ${pythondir})
26
27# Checks for libraries.
28PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
Matt Spinler7c33bff2017-06-02 12:29:41 -050029PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, AC_MSG_ERROR(["Requires phosphor-logging."]))
Matthew Barth71222442016-10-04 16:10:01 -050030
31# Checks for header files.
32AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
33
34# Checks for typedefs, structures, and compiler characteristics.
Matt Spinler62b36bd2017-06-02 12:15:59 -050035AX_CXX_COMPILE_STDCXX_14([noext])
36AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CFLAGS CXXFLAGS])
Matthew Barth71222442016-10-04 16:10:01 -050037
38# Checks for library functions.
39LT_INIT([disable-static shared])
40
41# Check/set gtest specific functions.
42AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
43AC_SUBST(GTEST_CPPFLAGS)
44
45AC_ARG_ENABLE([oe-sdk],
46 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
47)
48AC_ARG_VAR(OECORE_TARGET_SYSROOT,
49 [Path to the OE SDK SYSROOT])
50AS_IF([test "x$enable_oe_sdk" == "xyes"],
51 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
52 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
53 )
54 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
55 [
56 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
57 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
58 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
59 ]
60 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
61)
62
63# Add defines to config header
64AC_DEFINE([MAPPER_BUSNAME], ["xyz.openbmc_project.ObjectMapper"], [Object mapper bus name])
65AC_DEFINE([MAPPER_INTERFACE], ["xyz.openbmc_project.ObjectMapper"], [Object mapper interface])
Leonel Gonzalez7fb0fe92017-03-09 15:27:36 -060066AC_DEFINE([MAPPER_PATH], ["/xyz/openbmc_project/object_mapper"], [Object mapper DBUS path])
Matthew Barth71222442016-10-04 16:10:01 -050067
Matthew Barthc6329c92016-11-15 11:13:37 -060068# Workaround for unpatched systemd installs
69AC_ARG_ENABLE([unpatched-systemd],
70 AS_HELP_STRING([--enable-unpatched-systemd], [Enable unpatched systemd workarounds]))
71AS_IF([test "x$enable_unpatched_systemd" == "xyes"],
72 AC_MSG_NOTICE([Enabling unpatched systemd workarounds])
73 [
74 AC_DEFINE([IS_UNPATCHED_SYSTEMD], ,[Enable unpatched systemd workarounds])
75 ]
76)
77
Matthew Barth71222442016-10-04 16:10:01 -050078# Create configured output
Matt Spinler62b36bd2017-06-02 12:15:59 -050079AC_CONFIG_FILES([Makefile setup.py fail-monitor/Makefile])
Matthew Barth71222442016-10-04 16:10:01 -050080AC_OUTPUT