Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 1 | AC_PREREQ([2.69]) |
| 2 | AC_INIT([phosphor-hostlogger], |
| 3 | [m4_esyscmd_s([git describe --always --dirty --long])], |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 4 | [https://github.com/openbmc/phosphor-hostlogger/issues]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 5 | AC_LANG([C++]) |
| 6 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign]) |
| 7 | AM_SILENT_RULES([yes]) |
| 8 | |
| 9 | # Check for programs |
| 10 | AC_PROG_CXX |
| 11 | AC_PROG_INSTALL |
| 12 | AC_PROG_MAKE_SET |
| 13 | AC_PROG_MKDIR_P |
| 14 | AC_HEADER_STDC |
| 15 | |
| 16 | # Compiler flags |
William A. Kennington III | af11f61 | 2018-11-06 15:41:31 -0800 | [diff] [blame] | 17 | AX_CXX_COMPILE_STDCXX([17], [noext]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 18 | AX_APPEND_COMPILE_FLAGS([-fpic -Wall], [CXXFLAGS]) |
| 19 | |
| 20 | # Checks for external dependencies |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 21 | AC_CHECK_LIB([z], [gzopen], [], |
| 22 | [AC_MSG_ERROR([zlib required but not found])]) |
Patrick Venture | f780288 | 2019-02-13 15:20:28 -0800 | [diff] [blame^] | 23 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221]) |
| 24 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces]) |
| 25 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 26 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 27 | AS_IF([test "x$SDBUSPLUSPLUS" = "x"], |
| 28 | [AC_MSG_ERROR([sdbus++ required but not found])]) |
| 29 | |
| 30 | # systemd unit general configuration |
| 31 | PKG_PROG_PKG_CONFIG |
| 32 | AC_ARG_WITH([systemdsystemunitdir], |
| 33 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], |
| 34 | [Directory for systemd service files])], [], |
| 35 | [with_systemdsystemunitdir=auto]) |
| 36 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], |
| 37 | [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 38 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 39 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 40 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])], |
| 41 | [with_systemdsystemunitdir=no])], |
| 42 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) |
| 43 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 44 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 45 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 46 | |
| 47 | # systemd unit parameters |
| 48 | AC_ARG_VAR([SYSTEMD_TARGET], [systemd target for starting service, default is multi-user.target]) |
| 49 | AS_IF([test "x$SYSTEMD_TARGET" = "x"], [SYSTEMD_TARGET=multi-user.target]) |
| 50 | AC_ARG_VAR([HOST_TTY], [host teletype (TTY), default is ttyVUART0]) |
| 51 | AS_IF([test "x$HOST_TTY" = "x"], [HOST_TTY=ttyVUART0]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 52 | |
| 53 | # Configuration property: path to the ouput directory of log files |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 54 | AC_ARG_VAR([LOG_OUTPUT_PATH], [Path used to store logs, default is /var/lib/obmc/hostlogs]) |
| 55 | AS_IF([test "x$LOG_OUTPUT_PATH" = "x"], [LOG_OUTPUT_PATH="/var/lib/obmc/hostlogs"]) |
| 56 | AC_DEFINE_UNQUOTED([LOG_OUTPUT_PATH], ["${LOG_OUTPUT_PATH}"]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 57 | |
| 58 | # Configuration property: log storage limit (maximum number of messages to store) |
| 59 | AC_ARG_VAR([LOG_STORAGE_SIZE_LIMIT], [Limit number of messages in store, default is 3000]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 60 | AS_IF([test "x$LOG_STORAGE_SIZE_LIMIT" = "x"], [LOG_STORAGE_SIZE_LIMIT=3000]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 61 | AC_DEFINE_UNQUOTED([LOG_STORAGE_SIZE_LIMIT], [${LOG_STORAGE_SIZE_LIMIT}]) |
| 62 | |
| 63 | # Configuration property: log storage limit (oldest time in hours) |
| 64 | AC_ARG_VAR([LOG_STORAGE_TIME_LIMIT], [Limit message store by oldest time in hours, default is 0]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 65 | AS_IF([test "x$LOG_STORAGE_TIME_LIMIT" = "x"], [LOG_STORAGE_TIME_LIMIT=0]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 66 | AC_DEFINE_UNQUOTED([LOG_STORAGE_TIME_LIMIT], [${LOG_STORAGE_TIME_LIMIT}]) |
| 67 | |
| 68 | # Configuration property: flush period policy. |
| 69 | AC_ARG_VAR([LOG_FLUSH_PERIOD], [Set the default flush period time, default is 0]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 70 | AS_IF([test "x$LOG_FLUSH_PERIOD" = "x"], [LOG_FLUSH_PERIOD=0]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 71 | AC_DEFINE_UNQUOTED([LOG_FLUSH_PERIOD], [${LOG_FLUSH_PERIOD}]) |
| 72 | |
| 73 | # Configuration property: limit for log rotation - maximum number of files to store in the log's directory |
| 74 | AC_ARG_VAR([LOG_ROTATION_LIMIT], [Limit for log rotation, default is 10]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 75 | AS_IF([test "x$LOG_ROTATION_LIMIT" = "x"], [LOG_ROTATION_LIMIT=10]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 76 | AC_DEFINE_UNQUOTED([LOG_ROTATION_LIMIT], [${LOG_ROTATION_LIMIT}]) |
| 77 | |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 78 | # dreport integration |
| 79 | AC_ARG_ENABLE([dreport], |
Artem Senichev | 1f33285 | 2018-11-12 16:26:46 +0300 | [diff] [blame] | 80 | [AS_HELP_STRING([--enable-dreport], [create dreport plugin script [no]])], |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 81 | [case "${enableval}" in |
| 82 | yes) dreport=true ;; |
| 83 | no) dreport=false ;; |
| 84 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-dreport]) ;; |
| 85 | esac], |
Artem Senichev | 1f33285 | 2018-11-12 16:26:46 +0300 | [diff] [blame] | 86 | [dreport=false]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 87 | AM_CONDITIONAL(HAVE_DREPORT, test "x$dreport" = "xtrue") |
| 88 | |
| 89 | # Debug build configuration |
| 90 | AC_ARG_ENABLE([debug], |
| 91 | [AS_HELP_STRING([--enable-debug], [turn on debugging [no]])], |
| 92 | [case "${enableval}" in |
| 93 | yes) debug=true ;; |
| 94 | no) debug=false ;; |
| 95 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; |
| 96 | esac], |
| 97 | [debug=false]) |
| 98 | AM_CONDITIONAL(DEBUG, test "x$debug" = "xtrue") |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 99 | |
| 100 | AC_CONFIG_FILES([Makefile]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame] | 101 | AC_CONFIG_FILES([hostlogger.service]) |
| 102 | AC_CONFIG_FILES([hostlogger.dreport]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 103 | AC_OUTPUT |