Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([sdbusplus], [1.0], [https://github.com/openbmc/sdbusplus/issues]) |
| 4 | AC_CONFIG_HEADERS([config.h]) |
| 5 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 6 | AM_SILENT_RULES([yes]) |
| 7 | |
| 8 | # Checks for programs. |
Patrick Williams | 83a9d0b | 2016-11-04 17:06:13 -0500 | [diff] [blame] | 9 | AC_PROG_CXX |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 10 | AC_PROG_CC |
| 11 | AM_PROG_AR |
| 12 | AC_PROG_INSTALL |
| 13 | AC_PROG_MAKE_SET |
| 14 | |
Brad Bishop | bba7f8c | 2016-11-10 09:32:58 -0500 | [diff] [blame] | 15 | # setup sdbus++ |
| 16 | AM_PATH_PYTHON([2.7], [AC_SUBST([PYTHON], [echo "$PYTHON"])]) |
| 17 | AC_SUBST([PYTHONDIR], ${pythondir}) |
| 18 | AS_IF([test "$PYTHON" != :], [have_python=yes], [have_python=no]) |
| 19 | |
| 20 | AC_ARG_ENABLE([sdbuspp], |
| 21 | AS_HELP_STRING([--disable-sdbuspp], [Disable sdbus++])) |
| 22 | |
| 23 | AS_IF([test "x$enable_sdbuspp" != "xno"], |
| 24 | [AS_IF([test "x$have_python" = "xno"], [AC_MSG_ERROR([sdbus++ requires python])])]) |
| 25 | |
| 26 | AM_CONDITIONAL([WANT_SDBUSPP], [test "x$enable_sdbuspp" != "xno"]) |
| 27 | |
Brad Bishop | 14275cf | 2016-11-10 16:24:48 -0500 | [diff] [blame] | 28 | # setup libsdbusplus |
Brad Bishop | 5e70389 | 2017-02-10 11:52:48 -0500 | [diff] [blame] | 29 | AX_PKG_CHECK_MODULES( |
| 30 | [SYSTEMD], |
| 31 | [libsystemd >= 221], |
| 32 | [], |
| 33 | [have_systemd=yes], |
| 34 | [have_systemd=no]) |
Brad Bishop | 14275cf | 2016-11-10 16:24:48 -0500 | [diff] [blame] | 35 | AC_ARG_ENABLE([libsdbusplus], |
| 36 | AS_HELP_STRING([--disable-libsdbusplus], [Disable libsdbusplus])) |
| 37 | |
| 38 | AS_IF([test "x$enable_libsdbusplus" != "xno"], |
| 39 | [AS_IF([test "x$have_systemd" = "xno"], [AC_MSG_ERROR([libsdbusplus requires systemd])])]) |
| 40 | |
| 41 | AM_CONDITIONAL([WANT_LIBSDBUSPLUS], [test "x$enable_libsdbusplus" != "xno"]) |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 42 | |
Adriana Kobylak | fd43ef7 | 2017-02-12 09:12:37 -0600 | [diff] [blame] | 43 | # setup transaction |
| 44 | AC_ARG_ENABLE([transaction], |
| 45 | AS_HELP_STRING([--enable-transaction], [Enable transaction id support.])) |
| 46 | AC_ARG_VAR(WANT_TRANSACTION, [Enable transaction id support.]) |
| 47 | AS_IF([test "x$enable_transaction" = "xyes"], \ |
| 48 | [WANT_TRANSACTION="1"], \ |
| 49 | [WANT_TRANSACTION="0"]) |
| 50 | AM_CONDITIONAL([WANT_TRANSACTION], [test "x$enable_transaction" = "xyes"]) |
| 51 | |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 52 | # Checks for header files. |
Patrick Williams | ab7de32 | 2017-01-06 15:14:45 -0600 | [diff] [blame] | 53 | AS_IF([test "x$enable_libsdbusplus" != "xno"], |
Brad Bishop | 14275cf | 2016-11-10 16:24:48 -0500 | [diff] [blame] | 54 | [AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])]) |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 55 | |
| 56 | # Checks for typedefs, structures, and compiler characteristics. |
Patrick Williams | ab7de32 | 2017-01-06 15:14:45 -0600 | [diff] [blame] | 57 | AS_IF([test "x$enable_libsdbusplus" != "xno"], |
Brad Bishop | 14275cf | 2016-11-10 16:24:48 -0500 | [diff] [blame] | 58 | [AX_CXX_COMPILE_STDCXX_14([noext])]) |
Patrick Williams | 83a9d0b | 2016-11-04 17:06:13 -0500 | [diff] [blame] | 59 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS]) |
| 60 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 61 | |
| 62 | # Checks for library functions. |
| 63 | LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot' |
| 64 | |
| 65 | # Check/set gtest specific functions. |
| 66 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 67 | AC_SUBST(GTEST_CPPFLAGS) |
| 68 | |
| 69 | AC_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 | ) |
| 72 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 73 | [Path to the OE SDK SYSROOT]) |
| 74 | AS_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 Bishop | bba7f8c | 2016-11-10 09:32:58 -0500 | [diff] [blame] | 88 | AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile tools/setup.py]) |
Adriana Kobylak | a1fb5e6 | 2017-01-30 11:41:19 -0600 | [diff] [blame] | 89 | AC_CONFIG_FILES([sdbusplus.pc]) |
Adriana Kobylak | fd43ef7 | 2017-02-12 09:12:37 -0600 | [diff] [blame] | 90 | AC_CONFIG_FILES([sdbusplus/bus.hpp]) |
| 91 | AC_CONFIG_FILES([sdbusplus/server.hpp]) |
| 92 | AC_CONFIG_FILES([tools/sdbusplus/templates/interface.mako.server.cpp]) |
| 93 | AC_CONFIG_FILES([tools/sdbusplus/templates/method.mako.prototype.hpp]) |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 94 | AC_OUTPUT |