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])]) |
| 23 | PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], |
| 24 | [AC_MSG_ERROR([systemd required but not found])]) |
| 25 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [], |
| 26 | [AC_MSG_ERROR([phosphor-dbus-interfaces required but not found])]) |
| 27 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [], |
| 28 | [AC_MSG_ERROR([sdbusplus required but not found])]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 29 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame^] | 30 | AS_IF([test "x$SDBUSPLUSPLUS" = "x"], |
| 31 | [AC_MSG_ERROR([sdbus++ required but not found])]) |
| 32 | |
| 33 | # systemd unit general configuration |
| 34 | PKG_PROG_PKG_CONFIG |
| 35 | AC_ARG_WITH([systemdsystemunitdir], |
| 36 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], |
| 37 | [Directory for systemd service files])], [], |
| 38 | [with_systemdsystemunitdir=auto]) |
| 39 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], |
| 40 | [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 41 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 42 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 43 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])], |
| 44 | [with_systemdsystemunitdir=no])], |
| 45 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) |
| 46 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 47 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 48 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 49 | |
| 50 | # systemd unit parameters |
| 51 | AC_ARG_VAR([SYSTEMD_TARGET], [systemd target for starting service, default is multi-user.target]) |
| 52 | AS_IF([test "x$SYSTEMD_TARGET" = "x"], [SYSTEMD_TARGET=multi-user.target]) |
| 53 | AC_ARG_VAR([HOST_TTY], [host teletype (TTY), default is ttyVUART0]) |
| 54 | AS_IF([test "x$HOST_TTY" = "x"], [HOST_TTY=ttyVUART0]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 55 | |
| 56 | # Configuration property: path to the ouput directory of log files |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame^] | 57 | AC_ARG_VAR([LOG_OUTPUT_PATH], [Path used to store logs, default is /var/lib/obmc/hostlogs]) |
| 58 | AS_IF([test "x$LOG_OUTPUT_PATH" = "x"], [LOG_OUTPUT_PATH="/var/lib/obmc/hostlogs"]) |
| 59 | AC_DEFINE_UNQUOTED([LOG_OUTPUT_PATH], ["${LOG_OUTPUT_PATH}"]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 60 | |
| 61 | # Configuration property: log storage limit (maximum number of messages to store) |
| 62 | 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^] | 63 | 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] | 64 | AC_DEFINE_UNQUOTED([LOG_STORAGE_SIZE_LIMIT], [${LOG_STORAGE_SIZE_LIMIT}]) |
| 65 | |
| 66 | # Configuration property: log storage limit (oldest time in hours) |
| 67 | 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^] | 68 | 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] | 69 | AC_DEFINE_UNQUOTED([LOG_STORAGE_TIME_LIMIT], [${LOG_STORAGE_TIME_LIMIT}]) |
| 70 | |
| 71 | # Configuration property: flush period policy. |
| 72 | 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^] | 73 | AS_IF([test "x$LOG_FLUSH_PERIOD" = "x"], [LOG_FLUSH_PERIOD=0]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 74 | AC_DEFINE_UNQUOTED([LOG_FLUSH_PERIOD], [${LOG_FLUSH_PERIOD}]) |
| 75 | |
| 76 | # Configuration property: limit for log rotation - maximum number of files to store in the log's directory |
| 77 | 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^] | 78 | AS_IF([test "x$LOG_ROTATION_LIMIT" = "x"], [LOG_ROTATION_LIMIT=10]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 79 | AC_DEFINE_UNQUOTED([LOG_ROTATION_LIMIT], [${LOG_ROTATION_LIMIT}]) |
| 80 | |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame^] | 81 | # dreport integration |
| 82 | AC_ARG_ENABLE([dreport], |
| 83 | [AS_HELP_STRING([--enable-dreport], [enable dreport integration as plugin [yes]])], |
| 84 | [case "${enableval}" in |
| 85 | yes) dreport=true ;; |
| 86 | no) dreport=false ;; |
| 87 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-dreport]) ;; |
| 88 | esac], |
| 89 | [dreport=true]) |
| 90 | AM_CONDITIONAL(HAVE_DREPORT, test "x$dreport" = "xtrue") |
| 91 | |
| 92 | # Debug build configuration |
| 93 | AC_ARG_ENABLE([debug], |
| 94 | [AS_HELP_STRING([--enable-debug], [turn on debugging [no]])], |
| 95 | [case "${enableval}" in |
| 96 | yes) debug=true ;; |
| 97 | no) debug=false ;; |
| 98 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; |
| 99 | esac], |
| 100 | [debug=false]) |
| 101 | AM_CONDITIONAL(DEBUG, test "x$debug" = "xtrue") |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 102 | |
| 103 | AC_CONFIG_FILES([Makefile]) |
Artem Senichev | 1500f4f | 2018-11-08 16:14:40 +0300 | [diff] [blame^] | 104 | AC_CONFIG_FILES([hostlogger.service]) |
| 105 | AC_CONFIG_FILES([hostlogger.dreport]) |
Artem Senichev | efd5d74 | 2018-10-24 16:14:04 +0300 | [diff] [blame] | 106 | AC_OUTPUT |