-
Notifications
You must be signed in to change notification settings - Fork 25
/
configure.ac
166 lines (146 loc) · 5.03 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Initialization
AC_PREREQ([2.71])
AC_INIT([libmctp],[0.11],[https://github.com/openbmc/libmctp/issues])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror -Wno-portability foreign dist-xz])
AM_SILENT_RULES([yes])
# Checks for programs.
AC_PROG_CC
AM_PROG_AR
AC_PROG_INSTALL
AC_PROG_MAKE_SET
# libtool init
LT_INIT
AC_CHECK_HEADERS_ONCE([endian.h])
AC_CHECK_HEADERS_ONCE([unistd.h fcntl.h])
# pkg-config
PKG_PROG_PKG_CONFIG
PKG_INSTALLDIR
AC_ARG_ENABLE([capture],
[AS_HELP_STRING([--enable-capture],[Use libpcap to capture messages and packets])])
AS_IF([test "x$enable_capture" = "xyes"],
[PKG_CHECK_MODULES(pcap, libpcap,
[AC_DEFINE([HAVE_PCAP], [1],
[Define to 1 if you have libpcap])],
[])],
[])
AC_SUBST([pcap_CFLAGS])
AC_SUBST([pcap_LIBS])
AM_CONDITIONAL([HAVE_PCAP], [test "x$enable_capture" = "xyes"])
AC_ARG_WITH([systemdsystemunitdir],
[AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],
[],
[with_systemdsystemunitdir=auto]
)
AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
[def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
AS_IF([test "x$def_systemdsystemunitdir" = "x"],
[AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
[AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]
)
with_systemdsystemunitdir=no],
[with_systemdsystemunitdir="$def_systemdsystemunitdir"]
)]
)
AC_CHECK_HEADER([systemd/sd-daemon.h],
[AC_DEFINE([HAVE_SYSTEMD_SD_DAEMON_H], [1],
[Define to 1 if you have <systemd/sd-daemon.h>.])],
[])
AC_CHECK_LIB([systemd], [sd_listen_fds])
AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
[AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]
)
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
AC_ARG_WITH([syslog],
[AS_HELP_STRING([--with-syslog], [Support logging to syslog])],
[],
[with_syslog=check])
AS_IF([test "x$with_syslog" != "xno"],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdarg.h>
#include <syslog.h>
void check_vsyslog(int level, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vsyslog(0, fmt, ap);
va_end(ap);
}
]],[[
check_vsyslog(0, "\n");
]])],
[AC_DEFINE([MCTP_HAVE_SYSLOG], [1], [Define to enable syslog])],
[])],
[])
AC_ARG_WITH([fileio],
[AS_HELP_STRING([--with-fileio],
[Support interfaces based on file-descriptors])],
[],
[with_fileio=check])
AS_IF([test "x$with_fileio" = "xcheck"],
[AC_DEFINE([MCTP_HAVE_FILEIO], [(HAVE_UNISTD_H && HAVE_FCNTL_H)],
[Support interfaces based on file-descriptors])],
[AS_IF([test "x$with_fileio" = "xyes"],
[AC_DEFINE([MCTP_HAVE_FILEIO], [1],
[Support interfaces based on file-descriptors])],
[])])
AC_ARG_WITH([stdio],
[AS_HELP_STRING([--with-stdio], [Support logging to stdio])],
[],
[with_stdio=check])
AS_IF([test "x$with_stdio" != "xno"],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdarg.h>
#include <stdio.h>
void check_vprintf(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
}
]],[[
check_vprintf("\n");
]])],
[AC_DEFINE([MCTP_HAVE_STDIO], [1], [Define to enable stdio functions])],
[])],
[])
AC_ARG_WITH([default-alloc],
[AS_HELP_STRING([--with-default-alloc],
[Use libc malloc and free for heap memory])],
[],
[with_default_alloc=check])
AS_IF([test "x$with_default_alloc" != "xno"],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdlib.h>
]], [[
free(malloc(4096));
]])],
[AC_DEFINE([MCTP_DEFAULT_ALLOC],
[1],
[Define to use libc malloc and free for heap memory])],
[])],
[])
# Enable all bindings. AC_ARG_ENABLE in future.
AM_CONDITIONAL([LIBMCTP_BINDING_serial], [true])
AM_CONDITIONAL([LIBMCTP_BINDING_astlpc], [true])
# Check for valgrind
AS_IF([test "x$enable_tests" = "xno"], [enable_valgrind=no])
m4_foreach([vgtool], [valgrind_tool_list],
[AX_VALGRIND_DFLT(vgtool, [off])])
AX_VALGRIND_DFLT([memcheck], [on])
AX_VALGRIND_CHECK
AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
m4_foreach([vgtool], [valgrind_tool_list],
[AM_EXTRA_RECURSIVE_TARGETS([check-valgrind-]vgtool)])
AX_CODE_COVERAGE
m4_ifdef([_AX_CODE_COVERAGE_RULES],
[AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])],
[AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])])
AX_ADD_AM_MACRO_STATIC([])
AC_CONFIG_FILES([Makefile libmctp.pc])
AC_OUTPUT