Vishwanatha Subbanna | 835571e | 2016-11-30 11:29:30 +0530 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([phosphor-led-sysfs], [1.0], [https://github.com/openbmc/phosphor-led-sysfs/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 | AC_PROG_INSTALL |
| 12 | AC_PROG_MAKE_SET |
| 13 | |
| 14 | # Checks for libraries. |
| 15 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221]) |
| 16 | |
| 17 | # Checks for typedefs, structures, and compiler characteristics. |
Vernon Mauery | e0844ff | 2018-10-04 10:34:50 -0700 | [diff] [blame] | 18 | AX_CXX_COMPILE_STDCXX_17([noext]) |
Vishwanatha Subbanna | 835571e | 2016-11-30 11:29:30 +0530 | [diff] [blame] | 19 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 20 | |
Vishwanatha Subbanna | 179b671 | 2017-02-17 11:20:38 +0530 | [diff] [blame] | 21 | # For libtools |
| 22 | LT_INIT |
| 23 | |
Vishwanatha Subbanna | 835571e | 2016-11-30 11:29:30 +0530 | [diff] [blame] | 24 | # Checks for header files. |
Vishwanatha Subbanna | 7f6e809 | 2017-03-10 15:17:12 +0530 | [diff] [blame] | 25 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, [AC_MSG_ERROR([Could not find sdbusplus...openbmc/sdbusplus package required])]) |
Vishwanatha Subbanna | e089173 | 2017-03-10 15:27:23 +0530 | [diff] [blame] | 26 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],, [AC_MSG_ERROR([Could not find phosphor-dbus-interfaces...openbmc/phosphor-dbus-interfaces package required])]) |
Vishwanatha Subbanna | 835571e | 2016-11-30 11:29:30 +0530 | [diff] [blame] | 27 | |
| 28 | # Check/set gtest specific functions. |
Andrew Jeffery | a607a0d | 2018-05-23 16:15:26 +0930 | [diff] [blame] | 29 | AS_IF([test "x$enable_tests" != "xno"], [ |
| 30 | PKG_CHECK_MODULES([GTEST], [gtest], [], [true]) |
| 31 | PKG_CHECK_MODULES([GMOCK], [gmock], [], [true]) |
| 32 | AX_PTHREAD |
| 33 | |
| 34 | AX_SAVE_FLAGS_WITH_PREFIX(OLD, [CPPFLAGS]) |
| 35 | AX_APPEND_COMPILE_FLAGS([$GTEST_CFLAGS], [CPPFLAGS]) |
| 36 | AC_LANG_PUSH([C++]) |
| 37 | AC_CHECK_HEADERS([gtest/gtest.h], [ |
| 38 | AS_IF([test "x$GTEST_CFLAGS" = "x"], [ |
| 39 | AS_IF([test "x$PTHREAD_CFLAGS" = "x"], [ |
| 40 | AX_APPEND_COMPILE_FLAGS(["-DGTEST_HAS_PTHREAD=0"], [GTEST_CFLAGS]) |
| 41 | ], [ |
| 42 | AX_APPEND_COMPILE_FLAGS(["-DGTEST_HAS_PTHREAD=1"], [GTEST_CFLAGS]) |
| 43 | AX_APPEND_COMPILE_FLAGS([$PTHREAD_CFLAGS], [GTEST_CFLAGS]) |
| 44 | ]) |
| 45 | ]) |
| 46 | ], [ |
| 47 | AS_IF([test "x$enable_tests" = "xyes"], [ |
| 48 | AC_MSG_ERROR([Testing enabled but could not find gtest/gtest.h]) |
| 49 | ]) |
| 50 | ]) |
| 51 | AC_LANG_POP([C++]) |
| 52 | AX_RESTORE_FLAGS_WITH_PREFIX(OLD, [CPPFLAGS]) |
| 53 | |
| 54 | AX_SAVE_FLAGS_WITH_PREFIX(OLD, [CPPFLAGS]) |
| 55 | AX_APPEND_COMPILE_FLAGS([$GMOCK_CFLAGS], [CPPFLAGS]) |
| 56 | AC_LANG_PUSH([C++]) |
| 57 | AC_CHECK_HEADERS([gmock/gmock.h], [], [ |
| 58 | AS_IF([test "x$enable_tests" = "xyes"], [ |
| 59 | AC_MSG_ERROR([Testing enabled but could not find gmock/gmock.h]) |
| 60 | ]) |
| 61 | ]) |
| 62 | AC_LANG_POP([C++]) |
| 63 | AX_RESTORE_FLAGS_WITH_PREFIX(OLD, [CPPFLAGS]) |
| 64 | |
| 65 | AX_SAVE_FLAGS_WITH_PREFIX(OLD, [LDFLAGS]) |
| 66 | AX_APPEND_COMPILE_FLAGS([$GTEST_LIBS], [LDFLAGS]) |
| 67 | AC_CHECK_LIB([gtest], [main], [ |
| 68 | AS_IF([test "x$GTEST_LIBS" = "x"], [ |
| 69 | AX_APPEND_COMPILE_FLAGS([-lgtest], [GTEST_LIBS]) |
| 70 | ]) |
| 71 | ], [ |
| 72 | AS_IF([test "x$enable_tests" = "xyes"], [ |
| 73 | AC_MSG_ERROR([Testing enabled but couldn't find gtest libs]) |
| 74 | ]) |
| 75 | ]) |
| 76 | AX_RESTORE_FLAGS_WITH_PREFIX(OLD, [LDFLAGS]) |
| 77 | |
| 78 | AX_SAVE_FLAGS_WITH_PREFIX(OLD, [LDFLAGS]) |
| 79 | AX_APPEND_COMPILE_FLAGS([$GMOCK_LIBS], [LDFLAGS]) |
| 80 | AC_CHECK_LIB([gmock], [main], [ |
| 81 | AS_IF([test "x$GMOCK_LIBS" = "x"], [ |
| 82 | AX_APPEND_COMPILE_FLAGS([-lgmock], [GMOCK_LIBS]) |
| 83 | ]) |
| 84 | ], [ |
| 85 | AS_IF([test "x$enable_tests" = "xyes"], [ |
| 86 | AC_MSG_ERROR([Testing enabled but couldn't find gmock libs]) |
| 87 | ]) |
| 88 | ]) |
| 89 | AX_RESTORE_FLAGS_WITH_PREFIX(OLD, [LDFLAGS]) |
| 90 | ]) |
| 91 | |
| 92 | AX_CODE_COVERAGE |
Vishwanatha Subbanna | 835571e | 2016-11-30 11:29:30 +0530 | [diff] [blame] | 93 | |
| 94 | AC_ARG_VAR(BUSNAME, [The Dbus busname to own]) |
Vishwanatha Subbanna | 84ade67 | 2017-02-02 15:02:23 +0530 | [diff] [blame] | 95 | AS_IF([test "x$BUSNAME" == "x"], [BUSNAME="xyz.openbmc_project.LED.Controller"]) |
Vishwanatha Subbanna | 835571e | 2016-11-30 11:29:30 +0530 | [diff] [blame] | 96 | AC_DEFINE_UNQUOTED([BUSNAME], ["$BUSNAME"], [The Dbus busname to own]) |
Vishwanatha Subbanna | 84ade67 | 2017-02-02 15:02:23 +0530 | [diff] [blame] | 97 | AC_ARG_VAR(OBJPATH, [The physical LED controller Dbus root]) |
| 98 | AS_IF([test "x$OBJPATH" == "x"], [OBJPATH="/xyz/openbmc_project/led/physical"]) |
| 99 | AC_DEFINE_UNQUOTED([OBJPATH], ["$OBJPATH"], [The physical LED controller Dbus root]) |
Vishwanatha Subbanna | 835571e | 2016-11-30 11:29:30 +0530 | [diff] [blame] | 100 | |
Vishwanatha Subbanna | f9de54b | 2017-05-25 21:06:33 +0530 | [diff] [blame] | 101 | # Platform device path for led subsystem. |
| 102 | AC_ARG_VAR(DEVPATH, [Physical led device path]) |
| 103 | AS_IF([test "x$DEVPATH" == "x"], [DEVPATH="/sys/class/leds/"]) |
| 104 | AC_DEFINE_UNQUOTED([DEVPATH], ["$DEVPATH"], [Physical led device path]) |
| 105 | |
Vishwanatha Subbanna | 835571e | 2016-11-30 11:29:30 +0530 | [diff] [blame] | 106 | # Create configured output |
| 107 | AC_CONFIG_FILES([Makefile]) |
| 108 | AC_OUTPUT |