blob: e7faf705b0711aac436e3431c5a91d467a83360d [file] [log] [blame]
Artem Senichevefd5d742018-10-24 16:14:04 +03001AC_PREREQ([2.69])
2AC_INIT([phosphor-hostlogger],
3 [m4_esyscmd_s([git describe --always --dirty --long])],
Artem Senichev1500f4f2018-11-08 16:14:40 +03004 [https://github.com/openbmc/phosphor-hostlogger/issues])
Artem Senichevefd5d742018-10-24 16:14:04 +03005AC_LANG([C++])
6AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign])
7AM_SILENT_RULES([yes])
8
9# Check for programs
10AC_PROG_CXX
11AC_PROG_INSTALL
12AC_PROG_MAKE_SET
13AC_PROG_MKDIR_P
14AC_HEADER_STDC
15
16# Compiler flags
William A. Kennington IIIaf11f612018-11-06 15:41:31 -080017AX_CXX_COMPILE_STDCXX([17], [noext])
Artem Senichevefd5d742018-10-24 16:14:04 +030018AX_APPEND_COMPILE_FLAGS([-fpic -Wall], [CXXFLAGS])
19
20# Checks for external dependencies
Artem Senichev1500f4f2018-11-08 16:14:40 +030021AC_CHECK_LIB([z], [gzopen], [],
22 [AC_MSG_ERROR([zlib required but not found])])
Patrick Venturef7802882019-02-13 15:20:28 -080023PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
24PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
25PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
Artem Senichevefd5d742018-10-24 16:14:04 +030026AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
Artem Senichev1500f4f2018-11-08 16:14:40 +030027AS_IF([test "x$SDBUSPLUSPLUS" = "x"],
28 [AC_MSG_ERROR([sdbus++ required but not found])])
29
30# systemd unit general configuration
31PKG_PROG_PKG_CONFIG
32AC_ARG_WITH([systemdsystemunitdir],
33 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
34 [Directory for systemd service files])], [],
35 [with_systemdsystemunitdir=auto])
36AS_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"])])
43AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
44 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
45AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
46
47# systemd unit parameters
48AC_ARG_VAR([SYSTEMD_TARGET], [systemd target for starting service, default is multi-user.target])
49AS_IF([test "x$SYSTEMD_TARGET" = "x"], [SYSTEMD_TARGET=multi-user.target])
50AC_ARG_VAR([HOST_TTY], [host teletype (TTY), default is ttyVUART0])
51AS_IF([test "x$HOST_TTY" = "x"], [HOST_TTY=ttyVUART0])
Artem Senichevefd5d742018-10-24 16:14:04 +030052
53# Configuration property: path to the ouput directory of log files
Artem Senichev1500f4f2018-11-08 16:14:40 +030054AC_ARG_VAR([LOG_OUTPUT_PATH], [Path used to store logs, default is /var/lib/obmc/hostlogs])
55AS_IF([test "x$LOG_OUTPUT_PATH" = "x"], [LOG_OUTPUT_PATH="/var/lib/obmc/hostlogs"])
56AC_DEFINE_UNQUOTED([LOG_OUTPUT_PATH], ["${LOG_OUTPUT_PATH}"])
Artem Senichevefd5d742018-10-24 16:14:04 +030057
58# Configuration property: log storage limit (maximum number of messages to store)
59AC_ARG_VAR([LOG_STORAGE_SIZE_LIMIT], [Limit number of messages in store, default is 3000])
Artem Senichev1500f4f2018-11-08 16:14:40 +030060AS_IF([test "x$LOG_STORAGE_SIZE_LIMIT" = "x"], [LOG_STORAGE_SIZE_LIMIT=3000])
Artem Senichevefd5d742018-10-24 16:14:04 +030061AC_DEFINE_UNQUOTED([LOG_STORAGE_SIZE_LIMIT], [${LOG_STORAGE_SIZE_LIMIT}])
62
63# Configuration property: log storage limit (oldest time in hours)
64AC_ARG_VAR([LOG_STORAGE_TIME_LIMIT], [Limit message store by oldest time in hours, default is 0])
Artem Senichev1500f4f2018-11-08 16:14:40 +030065AS_IF([test "x$LOG_STORAGE_TIME_LIMIT" = "x"], [LOG_STORAGE_TIME_LIMIT=0])
Artem Senichevefd5d742018-10-24 16:14:04 +030066AC_DEFINE_UNQUOTED([LOG_STORAGE_TIME_LIMIT], [${LOG_STORAGE_TIME_LIMIT}])
67
68# Configuration property: flush period policy.
69AC_ARG_VAR([LOG_FLUSH_PERIOD], [Set the default flush period time, default is 0])
Artem Senichev1500f4f2018-11-08 16:14:40 +030070AS_IF([test "x$LOG_FLUSH_PERIOD" = "x"], [LOG_FLUSH_PERIOD=0])
Artem Senichevefd5d742018-10-24 16:14:04 +030071AC_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
74AC_ARG_VAR([LOG_ROTATION_LIMIT], [Limit for log rotation, default is 10])
Artem Senichev1500f4f2018-11-08 16:14:40 +030075AS_IF([test "x$LOG_ROTATION_LIMIT" = "x"], [LOG_ROTATION_LIMIT=10])
Artem Senichevefd5d742018-10-24 16:14:04 +030076AC_DEFINE_UNQUOTED([LOG_ROTATION_LIMIT], [${LOG_ROTATION_LIMIT}])
77
Artem Senichev1500f4f2018-11-08 16:14:40 +030078# dreport integration
79AC_ARG_ENABLE([dreport],
Artem Senichev1f332852018-11-12 16:26:46 +030080 [AS_HELP_STRING([--enable-dreport], [create dreport plugin script [no]])],
Artem Senichev1500f4f2018-11-08 16:14:40 +030081 [case "${enableval}" in
82 yes) dreport=true ;;
83 no) dreport=false ;;
84 *) AC_MSG_ERROR([bad value ${enableval} for --enable-dreport]) ;;
85 esac],
Artem Senichev1f332852018-11-12 16:26:46 +030086 [dreport=false])
Artem Senichev1500f4f2018-11-08 16:14:40 +030087AM_CONDITIONAL(HAVE_DREPORT, test "x$dreport" = "xtrue")
88
89# Debug build configuration
90AC_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])
98AM_CONDITIONAL(DEBUG, test "x$debug" = "xtrue")
Artem Senichevefd5d742018-10-24 16:14:04 +030099
100AC_CONFIG_FILES([Makefile])
Artem Senichev1500f4f2018-11-08 16:14:40 +0300101AC_CONFIG_FILES([hostlogger.service])
102AC_CONFIG_FILES([hostlogger.dreport])
Artem Senichevefd5d742018-10-24 16:14:04 +0300103AC_OUTPUT