Patrick Venture | 3356975 | 2018-03-12 18:56:14 -0700 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-host-postd], [1.0], [https://github.com/openbmc/phosphor-host-postd/issues]) |
| 4 | AC_LANG([C++]) |
| 5 | AC_CONFIG_HEADERS([config.h]) |
| 6 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 7 | AM_SILENT_RULES([yes]) |
| 8 | |
| 9 | # Checks for programs. |
| 10 | AC_PROG_CXX |
| 11 | AM_PROG_AR |
| 12 | AC_PROG_INSTALL |
| 13 | AC_PROG_MAKE_SET |
| 14 | |
| 15 | # Checks for typedefs, structures, and compiler characteristics. |
Patrick Venture | 384bc4c | 2018-09-10 13:10:51 -0700 | [diff] [blame] | 16 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Kun Yi | 2ae207c | 2018-06-11 16:09:46 -0700 | [diff] [blame] | 17 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CXXFLAGS]) |
Patrick Venture | 3356975 | 2018-03-12 18:56:14 -0700 | [diff] [blame] | 18 | |
| 19 | # Checks for libraries. |
Patrick Venture | 3356975 | 2018-03-12 18:56:14 -0700 | [diff] [blame] | 20 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])]) |
| 21 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], ,[AC_MSG_ERROR([The openbmc/sdbusplus package is required])]) |
Kun Yi | 1c16ad8 | 2018-09-12 10:01:49 -0700 | [diff] [blame] | 22 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus], ,[AC_MSG_ERROR([The openbmc/sdeventplus package is required])]) |
Patrick Venture | 3356975 | 2018-03-12 18:56:14 -0700 | [diff] [blame] | 23 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])]) |
Patrick Venture | f8a2083 | 2018-10-11 15:54:51 -0700 | [diff] [blame] | 24 | AC_CHECK_HEADER(experimental/filesystem, ,[AC_MSG_ERROR([Could not find experimental/filesystem...libstdc++fs development package required])]) |
Patrick Venture | 3356975 | 2018-03-12 18:56:14 -0700 | [diff] [blame] | 25 | |
| 26 | # Checks for library functions. |
| 27 | LT_INIT # Required for systemd linking |
| 28 | |
Patrick Venture | ba7d1ec | 2018-10-17 19:04:02 -0700 | [diff] [blame] | 29 | AC_ARG_VAR(SNOOP_DEVICE, "Path to snoop device") |
| 30 | AC_ARG_VAR(POST_CODE_BYTES, "Post code byte size") |
| 31 | AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service") |
Patrick Venture | ba7d1ec | 2018-10-17 19:04:02 -0700 | [diff] [blame] | 32 | |
| 33 | PKG_PROG_PKG_CONFIG |
| 34 | AC_ARG_WITH([systemdsystemunitdir], |
| 35 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, |
| 36 | [with_systemdsystemunitdir=auto]) |
| 37 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ |
| 38 | def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 39 | |
| 40 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 41 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 42 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) |
| 43 | with_systemdsystemunitdir=no], |
| 44 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) |
| 45 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 46 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 47 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 48 | |
Kun Yi | 2ae207c | 2018-06-11 16:09:46 -0700 | [diff] [blame] | 49 | # Check/set gtest specific functions. |
Benjamin Fair | a6c593a | 2018-07-13 16:27:55 -0700 | [diff] [blame] | 50 | PKG_CHECK_MODULES([GTEST], [gtest_main], [], [AC_MSG_NOTICE([gtest not found, tests will not build])]) |
Kun Yi | 2ae207c | 2018-06-11 16:09:46 -0700 | [diff] [blame] | 51 | PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])]) |
| 52 | AX_PTHREAD([GTEST_CFLAGS+=" -DGTEST_HAS_PTHREAD=1 "],[GTEST_CFLAGS+=" -DGTEST_HAS_PTHREAD=0 "]) |
Patrick Venture | 3356975 | 2018-03-12 18:56:14 -0700 | [diff] [blame] | 53 | |
Kun Yi | 2ae207c | 2018-06-11 16:09:46 -0700 | [diff] [blame] | 54 | # Add --enable-oe-sdk flag to configure script |
| 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 | |
| 59 | # Check for OECORE_TARGET_SYSROOT in the environment. |
| 60 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 61 | [Path to the OE SDK SYSROOT]) |
| 62 | |
| 63 | # Configure OESDK_TESTCASE_FLAGS environment variable, which will be later |
| 64 | # used in test/Makefile.am |
| 65 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 66 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 67 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 68 | ) |
| 69 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 70 | [ |
| 71 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 72 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 73 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 74 | ] |
| 75 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 76 | ) |
| 77 | |
| 78 | # Create configured output |
| 79 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Patrick Venture | ba7d1ec | 2018-10-17 19:04:02 -0700 | [diff] [blame] | 80 | AC_CONFIG_FILES([lpcsnoop.service]) |
Kun Yi | 2ae207c | 2018-06-11 16:09:46 -0700 | [diff] [blame] | 81 | AC_OUTPUT |