blob: 8a0dec167b2f69cf1c888f23b01e11de04cb685b [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])])
23PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [],
24 [AC_MSG_ERROR([systemd required but not found])])
25PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [],
26 [AC_MSG_ERROR([phosphor-dbus-interfaces required but not found])])
27PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], [],
28 [AC_MSG_ERROR([sdbusplus required but not found])])
Artem Senichevefd5d742018-10-24 16:14:04 +030029AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
Artem Senichev1500f4f2018-11-08 16:14:40 +030030AS_IF([test "x$SDBUSPLUSPLUS" = "x"],
31 [AC_MSG_ERROR([sdbus++ required but not found])])
32
33# systemd unit general configuration
34PKG_PROG_PKG_CONFIG
35AC_ARG_WITH([systemdsystemunitdir],
36 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
37 [Directory for systemd service files])], [],
38 [with_systemdsystemunitdir=auto])
39AS_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"])])
46AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
47 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
48AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
49
50# systemd unit parameters
51AC_ARG_VAR([SYSTEMD_TARGET], [systemd target for starting service, default is multi-user.target])
52AS_IF([test "x$SYSTEMD_TARGET" = "x"], [SYSTEMD_TARGET=multi-user.target])
53AC_ARG_VAR([HOST_TTY], [host teletype (TTY), default is ttyVUART0])
54AS_IF([test "x$HOST_TTY" = "x"], [HOST_TTY=ttyVUART0])
Artem Senichevefd5d742018-10-24 16:14:04 +030055
56# Configuration property: path to the ouput directory of log files
Artem Senichev1500f4f2018-11-08 16:14:40 +030057AC_ARG_VAR([LOG_OUTPUT_PATH], [Path used to store logs, default is /var/lib/obmc/hostlogs])
58AS_IF([test "x$LOG_OUTPUT_PATH" = "x"], [LOG_OUTPUT_PATH="/var/lib/obmc/hostlogs"])
59AC_DEFINE_UNQUOTED([LOG_OUTPUT_PATH], ["${LOG_OUTPUT_PATH}"])
Artem Senichevefd5d742018-10-24 16:14:04 +030060
61# Configuration property: log storage limit (maximum number of messages to store)
62AC_ARG_VAR([LOG_STORAGE_SIZE_LIMIT], [Limit number of messages in store, default is 3000])
Artem Senichev1500f4f2018-11-08 16:14:40 +030063AS_IF([test "x$LOG_STORAGE_SIZE_LIMIT" = "x"], [LOG_STORAGE_SIZE_LIMIT=3000])
Artem Senichevefd5d742018-10-24 16:14:04 +030064AC_DEFINE_UNQUOTED([LOG_STORAGE_SIZE_LIMIT], [${LOG_STORAGE_SIZE_LIMIT}])
65
66# Configuration property: log storage limit (oldest time in hours)
67AC_ARG_VAR([LOG_STORAGE_TIME_LIMIT], [Limit message store by oldest time in hours, default is 0])
Artem Senichev1500f4f2018-11-08 16:14:40 +030068AS_IF([test "x$LOG_STORAGE_TIME_LIMIT" = "x"], [LOG_STORAGE_TIME_LIMIT=0])
Artem Senichevefd5d742018-10-24 16:14:04 +030069AC_DEFINE_UNQUOTED([LOG_STORAGE_TIME_LIMIT], [${LOG_STORAGE_TIME_LIMIT}])
70
71# Configuration property: flush period policy.
72AC_ARG_VAR([LOG_FLUSH_PERIOD], [Set the default flush period time, default is 0])
Artem Senichev1500f4f2018-11-08 16:14:40 +030073AS_IF([test "x$LOG_FLUSH_PERIOD" = "x"], [LOG_FLUSH_PERIOD=0])
Artem Senichevefd5d742018-10-24 16:14:04 +030074AC_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
77AC_ARG_VAR([LOG_ROTATION_LIMIT], [Limit for log rotation, default is 10])
Artem Senichev1500f4f2018-11-08 16:14:40 +030078AS_IF([test "x$LOG_ROTATION_LIMIT" = "x"], [LOG_ROTATION_LIMIT=10])
Artem Senichevefd5d742018-10-24 16:14:04 +030079AC_DEFINE_UNQUOTED([LOG_ROTATION_LIMIT], [${LOG_ROTATION_LIMIT}])
80
Artem Senichev1500f4f2018-11-08 16:14:40 +030081# dreport integration
82AC_ARG_ENABLE([dreport],
Artem Senichev1f332852018-11-12 16:26:46 +030083 [AS_HELP_STRING([--enable-dreport], [create dreport plugin script [no]])],
Artem Senichev1500f4f2018-11-08 16:14:40 +030084 [case "${enableval}" in
85 yes) dreport=true ;;
86 no) dreport=false ;;
87 *) AC_MSG_ERROR([bad value ${enableval} for --enable-dreport]) ;;
88 esac],
Artem Senichev1f332852018-11-12 16:26:46 +030089 [dreport=false])
Artem Senichev1500f4f2018-11-08 16:14:40 +030090AM_CONDITIONAL(HAVE_DREPORT, test "x$dreport" = "xtrue")
91
92# Debug build configuration
93AC_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])
101AM_CONDITIONAL(DEBUG, test "x$debug" = "xtrue")
Artem Senichevefd5d742018-10-24 16:14:04 +0300102
103AC_CONFIG_FILES([Makefile])
Artem Senichev1500f4f2018-11-08 16:14:40 +0300104AC_CONFIG_FILES([hostlogger.service])
105AC_CONFIG_FILES([hostlogger.dreport])
Artem Senichevefd5d742018-10-24 16:14:04 +0300106AC_OUTPUT