Jeremy Kerr | b2ef62b | 2019-05-28 09:38:25 +0800 | [diff] [blame] | 1 | # Initialization |
| 2 | AC_PREREQ([2.69]) |
| 3 | AC_INIT([libmctp], 0.9, [https://github.com/openbmc/libmctp/issues]) |
| 4 | AC_CONFIG_HEADERS([config.h]) |
| 5 | AC_CONFIG_MACRO_DIRS([m4]) |
| 6 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 7 | AM_SILENT_RULES([yes]) |
| 8 | |
| 9 | # Checks for programs. |
| 10 | AC_PROG_CC |
| 11 | AM_PROG_AR |
| 12 | AC_PROG_INSTALL |
| 13 | AC_PROG_MAKE_SET |
| 14 | |
| 15 | # libtool init |
| 16 | LT_INIT |
| 17 | |
Jeremy Kerr | 80971f8 | 2019-08-29 09:57:58 +0530 | [diff] [blame] | 18 | # pkg-config |
| 19 | PKG_PROG_PKG_CONFIG |
| 20 | PKG_INSTALLDIR |
Xiaochao Ma | 1e496c8 | 2020-01-16 17:19:11 +0800 | [diff] [blame] | 21 | AC_ARG_WITH([systemdsystemunitdir], |
| 22 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])], |
| 23 | [], |
| 24 | [with_systemdsystemunitdir=auto] |
| 25 | ) |
| 26 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], |
| 27 | [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 28 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 29 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 30 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])] |
| 31 | ) |
| 32 | with_systemdsystemunitdir=no], |
| 33 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"] |
| 34 | )] |
| 35 | ) |
| 36 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 37 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])] |
| 38 | ) |
| 39 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
Jeremy Kerr | 80971f8 | 2019-08-29 09:57:58 +0530 | [diff] [blame] | 40 | |
Jeremy Kerr | c7e764a | 2019-05-28 16:49:03 +0800 | [diff] [blame] | 41 | # Set defaults for standard library compiles. We may want to |
| 42 | # AC_ARG_WITH these in the future. |
| 43 | AC_DEFINE([MCTP_HAVE_SYSLOG], [1], [Define to enable syslog]) |
| 44 | AC_DEFINE([MCTP_HAVE_FILEIO], [1], [Define to enable filesystem functions]) |
Andrew Jeffery | 682232e | 2020-01-13 16:17:45 +1030 | [diff] [blame] | 45 | AC_DEFINE([MCTP_HAVE_STDIO], [1], [Define to enable stdio functions]) |
Jeremy Kerr | c7e764a | 2019-05-28 16:49:03 +0800 | [diff] [blame] | 46 | AC_DEFINE([MCTP_DEFAULT_ALLOC], [1], |
| 47 | [Define to populate allocation functions to defaults (malloc/free)]) |
| 48 | |
| 49 | # Enable all bindings. AC_ARG_ENABLE in future. |
Jeremy Kerr | b2ef62b | 2019-05-28 09:38:25 +0800 | [diff] [blame] | 50 | AM_CONDITIONAL([LIBMCTP_BINDING_serial], [true]) |
| 51 | AM_CONDITIONAL([LIBMCTP_BINDING_astlpc], [true]) |
| 52 | |
Andrew Jeffery | 7344ac2 | 2020-01-10 16:13:07 +1030 | [diff] [blame] | 53 | AX_CODE_COVERAGE |
| 54 | m4_ifdef([_AX_CODE_COVERAGE_RULES], |
| 55 | [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])], |
| 56 | [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])]) |
| 57 | AX_ADD_AM_MACRO_STATIC([]) |
| 58 | |
Jeremy Kerr | 80971f8 | 2019-08-29 09:57:58 +0530 | [diff] [blame] | 59 | AC_CONFIG_FILES([Makefile libmctp.pc]) |
Jeremy Kerr | b2ef62b | 2019-05-28 09:38:25 +0800 | [diff] [blame] | 60 | AC_OUTPUT |