blob: cb613b8c9135e071e85eeaa9875f112250c9e1dc [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
29PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [have_systemd=yes], [have_systemd=no])
30AC_ARG_ENABLE([libsdbusplus],
31 AS_HELP_STRING([--disable-libsdbusplus], [Disable libsdbusplus]))
32
33AS_IF([test "x$enable_libsdbusplus" != "xno"],
34 [AS_IF([test "x$have_systemd" = "xno"], [AC_MSG_ERROR([libsdbusplus requires systemd])])])
35
36AM_CONDITIONAL([WANT_LIBSDBUSPLUS], [test "x$enable_libsdbusplus" != "xno"])
Patrick Williams5e0b6812016-11-04 16:45:33 -050037
38# Checks for header files.
Brad Bishop14275cf2016-11-10 16:24:48 -050039AS_IF([test "x$enable_libsdbusplus" = "xyes"],
40 [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 -050041
42# Checks for typedefs, structures, and compiler characteristics.
Brad Bishop14275cf2016-11-10 16:24:48 -050043AS_IF([test "x$enable_libsdbusplus" = "xyes"],
44 [AX_CXX_COMPILE_STDCXX_14([noext])])
Patrick Williams83a9d0b2016-11-04 17:06:13 -050045AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
46AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
Patrick Williams5e0b6812016-11-04 16:45:33 -050047
48# Checks for library functions.
49LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
50
51# Check/set gtest specific functions.
52AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
53AC_SUBST(GTEST_CPPFLAGS)
54
55AC_ARG_ENABLE([oe-sdk],
56 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
57)
58AC_ARG_VAR(OECORE_TARGET_SYSROOT,
59 [Path to the OE SDK SYSROOT])
60AS_IF([test "x$enable_oe_sdk" == "xyes"],
61 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
62 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
63 )
64 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
65 [
66 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
67 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
68 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
69 ]
70 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
71)
72
73# Create configured output
Brad Bishopbba7f8c2016-11-10 09:32:58 -050074AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile tools/setup.py])
Patrick Williams5e0b6812016-11-04 16:45:33 -050075AC_OUTPUT