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 | 7101f76 | 2019-02-13 15:41:06 -0800 | [diff] [blame] | 20 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221]) |
| 21 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
| 22 | PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus]) |
| 23 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
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 | |
Benjamin Fair | 938c0e4 | 2020-04-01 17:44:46 -0700 | [diff] [blame] | 54 | AC_ARG_ENABLE([7seg], |
| 55 | AS_HELP_STRING([--enable-7seg], [Build daemon to send POST codes to a 7-segment display.]) |
| 56 | ) |
| 57 | AM_CONDITIONAL([ENABLE_7SEG], [test "x$enable_7seg" = "xyes"]) |
| 58 | |
| 59 | AS_IF([test "x$enable_7seg" = "xyes"], [ |
| 60 | PKG_CHECK_VAR([UDEVRULESDIR], [udev], [udevdir]) |
| 61 | AC_MSG_CHECKING([udev rules path]) |
| 62 | AS_IF([test "x$UDEVRULESDIR" = "x"], [ |
| 63 | AC_MSG_FAILURE([Unable to identify udev rules path.]) |
| 64 | ]) |
| 65 | ]) |
| 66 | |
Kun Yi | 2ae207c | 2018-06-11 16:09:46 -0700 | [diff] [blame] | 67 | # Add --enable-oe-sdk flag to configure script |
| 68 | AC_ARG_ENABLE([oe-sdk], |
| 69 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 70 | ) |
| 71 | |
| 72 | # Check for OECORE_TARGET_SYSROOT in the environment. |
| 73 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 74 | [Path to the OE SDK SYSROOT]) |
| 75 | |
| 76 | # Configure OESDK_TESTCASE_FLAGS environment variable, which will be later |
| 77 | # used in test/Makefile.am |
| 78 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 79 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 80 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 81 | ) |
| 82 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 83 | [ |
| 84 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 85 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 86 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 87 | ] |
| 88 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 89 | ) |
| 90 | |
| 91 | # Create configured output |
| 92 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Patrick Venture | ba7d1ec | 2018-10-17 19:04:02 -0700 | [diff] [blame] | 93 | AC_CONFIG_FILES([lpcsnoop.service]) |
Kun Yi | 2ae207c | 2018-06-11 16:09:46 -0700 | [diff] [blame] | 94 | AC_OUTPUT |