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 |
| 29 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [have_systemd=yes], [have_systemd=no]) |
| 30 | AC_ARG_ENABLE([libsdbusplus], |
| 31 | AS_HELP_STRING([--disable-libsdbusplus], [Disable libsdbusplus])) |
| 32 | |
| 33 | AS_IF([test "x$enable_libsdbusplus" != "xno"], |
| 34 | [AS_IF([test "x$have_systemd" = "xno"], [AC_MSG_ERROR([libsdbusplus requires systemd])])]) |
| 35 | |
| 36 | AM_CONDITIONAL([WANT_LIBSDBUSPLUS], [test "x$enable_libsdbusplus" != "xno"]) |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 37 | |
| 38 | # Checks for header files. |
Brad Bishop | 14275cf | 2016-11-10 16:24:48 -0500 | [diff] [blame] | 39 | AS_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 Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 41 | |
| 42 | # Checks for typedefs, structures, and compiler characteristics. |
Brad Bishop | 14275cf | 2016-11-10 16:24:48 -0500 | [diff] [blame] | 43 | AS_IF([test "x$enable_libsdbusplus" = "xyes"], |
| 44 | [AX_CXX_COMPILE_STDCXX_14([noext])]) |
Patrick Williams | 83a9d0b | 2016-11-04 17:06:13 -0500 | [diff] [blame] | 45 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS]) |
| 46 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 47 | |
| 48 | # Checks for library functions. |
| 49 | LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot' |
| 50 | |
| 51 | # Check/set gtest specific functions. |
| 52 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 53 | AC_SUBST(GTEST_CPPFLAGS) |
| 54 | |
| 55 | AC_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 | ) |
| 58 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 59 | [Path to the OE SDK SYSROOT]) |
| 60 | AS_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 Bishop | bba7f8c | 2016-11-10 09:32:58 -0500 | [diff] [blame] | 74 | AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile tools/setup.py]) |
Patrick Williams | 5e0b681 | 2016-11-04 16:45:33 -0500 | [diff] [blame] | 75 | AC_OUTPUT |