blob: d2156ab4135bcd4bc14f4b293e74f26585173899 [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])
5AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
6AM_SILENT_RULES([yes])
7
8# Checks for programs.
Patrick Williams83a9d0b2016-11-04 17:06:13 -05009AC_PROG_CXX
Patrick Williams5e0b6812016-11-04 16:45:33 -050010AC_PROG_CC
11AM_PROG_AR
12AC_PROG_INSTALL
13AC_PROG_MAKE_SET
14
Brad Bishopbba7f8c2016-11-10 09:32:58 -050015# setup sdbus++
16AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])])
17AC_SUBST([PYTHONDIR], ${pythondir})
18AS_IF([test "$PYTHON" != :], [have_python=yes], [have_python=no])
19
20AC_ARG_ENABLE([sdbuspp],
21 AS_HELP_STRING([--disable-sdbuspp], [Disable sdbus++]))
22
23AS_IF([test "x$enable_sdbuspp" != "xno"],
24 [AS_IF([test "x$have_python" = "xno"], [AC_MSG_ERROR([sdbus++ requires python])])])
25
26AM_CONDITIONAL([WANT_SDBUSPP], [test "x$enable_sdbuspp" != "xno"])
27
Brad Bishop14275cf2016-11-10 16:24:48 -050028# setup libsdbusplus
Brad Bishop5e703892017-02-10 11:52:48 -050029AX_PKG_CHECK_MODULES(
30 [SYSTEMD],
31 [libsystemd >= 221],
32 [],
33 [have_systemd=yes],
34 [have_systemd=no])
Brad Bishop14275cf2016-11-10 16:24:48 -050035AC_ARG_ENABLE([libsdbusplus],
36 AS_HELP_STRING([--disable-libsdbusplus], [Disable libsdbusplus]))
37
38AS_IF([test "x$enable_libsdbusplus" != "xno"],
39 [AS_IF([test "x$have_systemd" = "xno"], [AC_MSG_ERROR([libsdbusplus requires systemd])])])
40
41AM_CONDITIONAL([WANT_LIBSDBUSPLUS], [test "x$enable_libsdbusplus" != "xno"])
Patrick Williams5e0b6812016-11-04 16:45:33 -050042
Adriana Kobylakfd43ef72017-02-12 09:12:37 -060043# setup transaction
44AC_ARG_ENABLE([transaction],
45 AS_HELP_STRING([--enable-transaction], [Enable transaction id support.]))
46AC_ARG_VAR(WANT_TRANSACTION, [Enable transaction id support.])
47AS_IF([test "x$enable_transaction" = "xyes"], \
48 [WANT_TRANSACTION="1"], \
49 [WANT_TRANSACTION="0"])
50AM_CONDITIONAL([WANT_TRANSACTION], [test "x$enable_transaction" = "xyes"])
51
Patrick Williams5e0b6812016-11-04 16:45:33 -050052# Checks for header files.
Patrick Williamsab7de322017-01-06 15:14:45 -060053AS_IF([test "x$enable_libsdbusplus" != "xno"],
Brad Bishop14275cf2016-11-10 16:24:48 -050054 [AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])])
Patrick Williams5e0b6812016-11-04 16:45:33 -050055
56# Checks for typedefs, structures, and compiler characteristics.
Patrick Williamsab7de322017-01-06 15:14:45 -060057AS_IF([test "x$enable_libsdbusplus" != "xno"],
Brad Bishop14275cf2016-11-10 16:24:48 -050058 [AX_CXX_COMPILE_STDCXX_14([noext])])
Patrick Williams83a9d0b2016-11-04 17:06:13 -050059AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
60AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
Patrick Williams5e0b6812016-11-04 16:45:33 -050061
62# Checks for library functions.
63LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
64
65# Check/set gtest specific functions.
66AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
67AC_SUBST(GTEST_CPPFLAGS)
68
69AC_ARG_ENABLE([oe-sdk],
70 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
71)
72AC_ARG_VAR(OECORE_TARGET_SYSROOT,
73 [Path to the OE SDK SYSROOT])
74AS_IF([test "x$enable_oe_sdk" == "xyes"],
75 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
76 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
77 )
78 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
79 [
80 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
81 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
82 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
83 ]
84 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
85)
86
87# Create configured output
Brad Bishopbba7f8c2016-11-10 09:32:58 -050088AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile tools/setup.py])
Patrick Williams4edb7852017-07-03 11:50:11 -050089AC_CONFIG_FILES([example/Makefile])
Adriana Kobylaka1fb5e62017-01-30 11:41:19 -060090AC_CONFIG_FILES([sdbusplus.pc])
Adriana Kobylakfd43ef72017-02-12 09:12:37 -060091AC_CONFIG_FILES([sdbusplus/bus.hpp])
92AC_CONFIG_FILES([sdbusplus/server.hpp])
93AC_CONFIG_FILES([tools/sdbusplus/templates/interface.mako.server.cpp])
94AC_CONFIG_FILES([tools/sdbusplus/templates/method.mako.prototype.hpp])
Patrick Williams5e0b6812016-11-04 16:45:33 -050095AC_OUTPUT