blob: 6ef46d92cf053292211aeb1ded90fb6080d6122d [file] [log] [blame]
Patrick Williams5e0b6812016-11-04 16:45:33 -05001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([sdbusplus], [1.0], [https://github.com/openbmc/sdbusplus/issues])
4AC_CONFIG_HEADERS([config.h])
William A. Kennington IIIc65d74e2018-06-19 18:32:09 -07005AC_CONFIG_MACRO_DIRS([m4])
6AC_CONFIG_AUX_DIR([build-aux])
Patrick Williams5e0b6812016-11-04 16:45:33 -05007AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
8AM_SILENT_RULES([yes])
9
10# Checks for programs.
Patrick Williams83a9d0b2016-11-04 17:06:13 -050011AC_PROG_CXX
Patrick Williams5e0b6812016-11-04 16:45:33 -050012AC_PROG_CC
13AM_PROG_AR
14AC_PROG_INSTALL
15AC_PROG_MAKE_SET
16
Brad Bishopbba7f8c2016-11-10 09:32:58 -050017# setup sdbus++
18AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])])
19AC_SUBST([PYTHONDIR], ${pythondir})
20AS_IF([test "$PYTHON" != :], [have_python=yes], [have_python=no])
21
22AC_ARG_ENABLE([sdbuspp],
23 AS_HELP_STRING([--disable-sdbuspp], [Disable sdbus++]))
24
25AS_IF([test "x$enable_sdbuspp" != "xno"],
26 [AS_IF([test "x$have_python" = "xno"], [AC_MSG_ERROR([sdbus++ requires python])])])
27
28AM_CONDITIONAL([WANT_SDBUSPP], [test "x$enable_sdbuspp" != "xno"])
29
Brad Bishop14275cf2016-11-10 16:24:48 -050030# setup libsdbusplus
Brad Bishop5e703892017-02-10 11:52:48 -050031AX_PKG_CHECK_MODULES(
32 [SYSTEMD],
33 [libsystemd >= 221],
34 [],
35 [have_systemd=yes],
36 [have_systemd=no])
Brad Bishop14275cf2016-11-10 16:24:48 -050037AC_ARG_ENABLE([libsdbusplus],
38 AS_HELP_STRING([--disable-libsdbusplus], [Disable libsdbusplus]))
39
40AS_IF([test "x$enable_libsdbusplus" != "xno"],
41 [AS_IF([test "x$have_systemd" = "xno"], [AC_MSG_ERROR([libsdbusplus requires systemd])])])
42
43AM_CONDITIONAL([WANT_LIBSDBUSPLUS], [test "x$enable_libsdbusplus" != "xno"])
Patrick Williams5e0b6812016-11-04 16:45:33 -050044
Adriana Kobylakfd43ef72017-02-12 09:12:37 -060045# setup transaction
46AC_ARG_ENABLE([transaction],
47 AS_HELP_STRING([--enable-transaction], [Enable transaction id support.]))
48AC_ARG_VAR(WANT_TRANSACTION, [Enable transaction id support.])
49AS_IF([test "x$enable_transaction" = "xyes"], \
50 [WANT_TRANSACTION="1"], \
51 [WANT_TRANSACTION="0"])
52AM_CONDITIONAL([WANT_TRANSACTION], [test "x$enable_transaction" = "xyes"])
53
Patrick Williams5e0b6812016-11-04 16:45:33 -050054# Checks for header files.
Patrick Williamsab7de322017-01-06 15:14:45 -060055AS_IF([test "x$enable_libsdbusplus" != "xno"],
Gunnar Millsa4b4a0b2018-04-08 14:30:38 -050056 [AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])])
Patrick Williams5e0b6812016-11-04 16:45:33 -050057
58# Checks for typedefs, structures, and compiler characteristics.
Patrick Williamsab7de322017-01-06 15:14:45 -060059AS_IF([test "x$enable_libsdbusplus" != "xno"],
Brad Bishop14275cf2016-11-10 16:24:48 -050060 [AX_CXX_COMPILE_STDCXX_14([noext])])
Patrick Williams83a9d0b2016-11-04 17:06:13 -050061AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
62AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
Patrick Williams5e0b6812016-11-04 16:45:33 -050063
64# Checks for library functions.
65LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
66
67# Check/set gtest specific functions.
68AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
69AC_SUBST(GTEST_CPPFLAGS)
70
71AC_ARG_ENABLE([oe-sdk],
72 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
73)
74AC_ARG_VAR(OECORE_TARGET_SYSROOT,
75 [Path to the OE SDK SYSROOT])
76AS_IF([test "x$enable_oe_sdk" == "xyes"],
77 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
78 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
79 )
80 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
81 [
82 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
83 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
84 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
85 ]
86 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
87)
88
89# Create configured output
Brad Bishopbba7f8c2016-11-10 09:32:58 -050090AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile tools/setup.py])
Patrick Williams4edb7852017-07-03 11:50:11 -050091AC_CONFIG_FILES([example/Makefile])
Adriana Kobylaka1fb5e62017-01-30 11:41:19 -060092AC_CONFIG_FILES([sdbusplus.pc])
Adriana Kobylakfd43ef72017-02-12 09:12:37 -060093AC_CONFIG_FILES([sdbusplus/bus.hpp])
94AC_CONFIG_FILES([sdbusplus/server.hpp])
95AC_CONFIG_FILES([tools/sdbusplus/templates/interface.mako.server.cpp])
96AC_CONFIG_FILES([tools/sdbusplus/templates/method.mako.prototype.hpp])
Adriana Kobylakee6ac692018-06-06 09:36:51 -050097AC_CONFIG_FILES([tools/sdbusplus/templates/property.mako.prototype.hpp])
Patrick Williams5e0b6812016-11-04 16:45:33 -050098AC_OUTPUT