forked from mavlink-router/mavlink-router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
204 lines (178 loc) · 5.62 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
AC_PREREQ(2.64)
AC_INIT([mavlink-router],
[2],
[],
[mavlink-router],
[https://github.com/01org/mavlink-router])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_AUX_DIR([build-aux])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AC_PREFIX_DEFAULT([/usr])
PKG_PROG_PKG_CONFIG
AM_MAINTAINER_MODE([enable])
AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules tar-pax no-dist-gzip dist-xz subdir-objects color-tests parallel-tests])
AM_SILENT_RULES([yes])
#####################################################################
# Program checks and configurations
#####################################################################
AC_PROG_CC_C99
AX_CXX_COMPILE_STDCXX([11], [ext], [mandatory])
AM_PATH_PYTHON([2.7])
#####################################################################
LT_INIT([disable-static pic-only])
#####################################################################
# Function and structure checks
#####################################################################
AC_CHECK_DECLS([aio_init], [], [], [#include <aio.h>])
AC_MSG_CHECKING([whether _Static_assert() is supported])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[_Static_assert(1, "Test");]])],
[AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define if _Static_assert() is available])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([whether _Noreturn is supported])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[_Noreturn int foo(void) { exit(0); }]])],
[AC_DEFINE([HAVE_NORETURN], [1], [Define if _Noreturn is available])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
PKG_CHECK_MODULES([GTEST], [gtest_main], [HAVE_GTEST=true], [
# Fallback to try linking it directly (required on some installations).
# This assumes that having "gtest_main" implies we also have "gtest"
# which seems reasonable.
AC_CHECK_LIB(
[gtest_main], [main],
[HAVE_GTEST=true] [GTEST_LIBS="-lgtest_main -lgtest"],
[HAVE_GTEST=false])
])
AM_CONDITIONAL([HAVE_GTEST], [test x$HAVE_GTEST = xtrue])
AC_SUBST([GTEST_LIBS])
AC_SUBST([GTEST_CFLAGS])
#####################################################################
# --with-
#####################################################################
AC_ARG_WITH([rootlibdir],
AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
[], [with_rootlibdir=$libdir])
AC_SUBST([rootlibdir], [$with_rootlibdir])
AC_ARG_WITH([systemdsystemunitdir],
AC_HELP_STRING([--with-systemdsystemunitdir=DIR],
[path to systemd system unit directory]),
[path_systemunitdir=${withval}])
if (test "${enable_systemd}" != "no" && test -z "${path_systemunitdir}"); then
AC_MSG_CHECKING([systemd system unit dir])
path_systemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
if (test -z "${path_systemunitdir}"); then
AC_MSG_ERROR([systemd system unit directory is required])
fi
AC_MSG_RESULT([${path_systemunitdir}])
fi
#####################################################################
# --enable-
#####################################################################
AC_ARG_ENABLE(systemd, AC_HELP_STRING([--disable-systemd],
[disable systemd integration]), [enable_systemd=${enableval}])
AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" != "no")
#####################################################################
# Default CFLAGS and LDFLAGS
#####################################################################
# Check C compiler flag
AC_LANG_PUSH([C])
CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [ \
-Wall \
-W \
-Wextra \
-Wno-inline \
-Wundef \
-Wformat=2 \
-Wlogical-op \
-Wsign-compare \
-Wformat-security \
-Wmissing-include-dirs \
-Wformat-nonliteral \
-Wold-style-definition \
-Wpointer-arith \
-Winit-self \
-Wdeclaration-after-statement \
-Wfloat-equal \
-Wmissing-prototypes \
-Wstrict-prototypes \
-Wredundant-decls \
-Wmissing-declarations \
-Wmissing-noreturn \
-Wshadow \
-Wendif-labels \
-Wstrict-aliasing=3 \
-Wwrite-strings \
-Wno-long-long \
-Wno-overlength-strings \
-Wno-unused-parameter \
-Wno-missing-field-initializers \
-Wno-unused-result \
-Wnested-externs \
-Wchar-subscripts \
-Wtype-limits \
-Wuninitialized])
AC_SUBST([OUR_CFLAGS], "$with_cflags")
AC_LANG_POP([C])
# Check C++ compiler flags
AC_LANG_PUSH([C++])
CC_CHECK_FLAGS_APPEND(with_cxxflags, [CXXFLAGS], [ \
-Wall \
-W \
-Waddress-of-packed-member \
-Wextra \
-Wno-inline \
-Wundef \
-Wformat=2 \
-Wlogical-op \
-Wsign-compare \
-Wformat-security \
-Wmissing-include-dirs \
-Wformat-nonliteral \
-Wpointer-arith \
-Winit-self \
-Wfloat-equal \
-Wredundant-decls \
-Wmissing-declarations \
-Wmissing-noreturn \
-Wshadow \
-Wendif-labels \
-Wstrict-aliasing=3 \
-Wwrite-strings \
-Wno-long-long \
-Wno-overlength-strings \
-Wno-unused-parameter \
-Wno-missing-field-initializers \
-Wno-unused-result \
-Wchar-subscripts \
-Wtype-limits \
-Wuninitialized])
AC_LANG_POP([C++])
AS_VAR_IF([cc_cv_CXXFLAGS__Waddress_of_packed_member], [yes],
[with_cxxflags="$with_cxxflags -DHAVE_WADDRESS_OF_PACKED_MEMBER"])
AC_SUBST([OUR_CXXFLAGS], "$with_cxxflags")
#####################################################################
# Generate files from *.in
#####################################################################
AC_CONFIG_FILES([
Makefile
])
#####################################################################
AC_SUBST(SYSTEMD_SYSTEMUNITDIR, [${path_systemunitdir}])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE $VERSION
================
prefix: ${prefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
rootlibdir: ${rootlibdir}
includedir: ${includedir}
bindir: ${bindir}
C compiler: ${CC}
C++ compiler: ${CXX}
])