blob: 42b33f2d7b1d417fe5c8916100e2f6c6a749b53c [file] [log] [blame]
Jeremy Kerrb2ef62b2019-05-28 09:38:25 +08001# Initialization
2AC_PREREQ([2.69])
3AC_INIT([libmctp], 0.9, [https://github.com/openbmc/libmctp/issues])
4AC_CONFIG_HEADERS([config.h])
5AC_CONFIG_MACRO_DIRS([m4])
Andrew Jefferyd09253f2020-02-26 11:00:37 +10306AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror -Wno-portability foreign dist-xz])
Jeremy Kerrb2ef62b2019-05-28 09:38:25 +08007AM_SILENT_RULES([yes])
8
9# Checks for programs.
10AC_PROG_CC
11AM_PROG_AR
12AC_PROG_INSTALL
13AC_PROG_MAKE_SET
14
15# libtool init
16LT_INIT
17
Andrew Jeffery3286f172020-03-17 23:04:13 +103018AC_CHECK_HEADERS_ONCE([endian.h])
19
Jeremy Kerr80971f82019-08-29 09:57:58 +053020# pkg-config
21PKG_PROG_PKG_CONFIG
22PKG_INSTALLDIR
Xiaochao Ma1e496c82020-01-16 17:19:11 +080023AC_ARG_WITH([systemdsystemunitdir],
24 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],
25 [],
26 [with_systemdsystemunitdir=auto]
27)
28AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
29 [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
30 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
31 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
32 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]
33 )
34 with_systemdsystemunitdir=no],
35 [with_systemdsystemunitdir="$def_systemdsystemunitdir"]
36 )]
37)
38AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
39 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]
40)
41AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
Jeremy Kerr80971f82019-08-29 09:57:58 +053042
Jeremy Kerrc7e764a2019-05-28 16:49:03 +080043# Set defaults for standard library compiles. We may want to
44# AC_ARG_WITH these in the future.
45AC_DEFINE([MCTP_HAVE_SYSLOG], [1], [Define to enable syslog])
46AC_DEFINE([MCTP_HAVE_FILEIO], [1], [Define to enable filesystem functions])
Andrew Jeffery682232e2020-01-13 16:17:45 +103047AC_DEFINE([MCTP_HAVE_STDIO], [1], [Define to enable stdio functions])
Jeremy Kerrc7e764a2019-05-28 16:49:03 +080048AC_DEFINE([MCTP_DEFAULT_ALLOC], [1],
49 [Define to populate allocation functions to defaults (malloc/free)])
50
51# Enable all bindings. AC_ARG_ENABLE in future.
Jeremy Kerrb2ef62b2019-05-28 09:38:25 +080052AM_CONDITIONAL([LIBMCTP_BINDING_serial], [true])
53AM_CONDITIONAL([LIBMCTP_BINDING_astlpc], [true])
54
Andrew Jeffery7344ac22020-01-10 16:13:07 +103055AX_CODE_COVERAGE
56m4_ifdef([_AX_CODE_COVERAGE_RULES],
57 [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])],
58 [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])])
59AX_ADD_AM_MACRO_STATIC([])
60
Jeremy Kerr80971f82019-08-29 09:57:58 +053061AC_CONFIG_FILES([Makefile libmctp.pc])
Jeremy Kerrb2ef62b2019-05-28 09:38:25 +080062AC_OUTPUT