]>
Commit | Line | Data |
---|---|---|
6fbf66fa JY |
1 | dnl OpenVPN -- An application to securely tunnel IP networks |
2 | dnl over a single UDP port, with support for SSL/TLS-based | |
3 | dnl session authentication and key exchange, | |
4 | dnl packet encryption, packet authentication, and | |
5 | dnl packet compression. | |
6 | dnl | |
58716979 | 7 | dnl Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net> |
51bd56f4 | 8 | dnl Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com> |
6fbf66fa JY |
9 | dnl |
10 | dnl This program is free software; you can redistribute it and/or modify | |
11 | dnl it under the terms of the GNU General Public License as published by | |
12 | dnl the Free Software Foundation; either version 2 of the License, or | |
13 | dnl (at your option) any later version. | |
14 | dnl | |
15 | dnl This program is distributed in the hope that it will be useful, | |
16 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | dnl GNU General Public License for more details. | |
19 | dnl | |
caa54ac3 DS |
20 | dnl You should have received a copy of the GNU General Public License along |
21 | dnl with this program; if not, write to the Free Software Foundation, Inc., | |
22 | dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
6fbf66fa JY |
23 | |
24 | dnl Process this file with autoconf to produce a configure script. | |
25 | ||
51bd56f4 | 26 | AC_PREREQ(2.59) |
6fbf66fa | 27 | |
ce351583 | 28 | m4_include(version.m4) |
51bd56f4 ABL |
29 | AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME]) |
30 | m4_include(compat.m4) | |
98bc1a3e | 31 | AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format]) |
9de35d46 DS |
32 | AC_SUBST([OPENVPN_VERSION_MAJOR], [PRODUCT_VERSION_MAJOR], [OpenVPN major version]) |
33 | AC_SUBST([OPENVPN_VERSION_MINOR], [PRODUCT_VERSION_MINOR], [OpenVPN minor version]) | |
34 | AC_SUBST([OPENVPN_VERSION_PATCH], [PRODUCT_VERSION_PATCH], [OpenVPN patch level - may be a string or integer]) | |
6a40276c DS |
35 | AC_DEFINE([OPENVPN_VERSION_MAJOR], [PRODUCT_VERSION_MAJOR], [OpenVPN major version - integer]) |
36 | AC_DEFINE([OPENVPN_VERSION_MINOR], [PRODUCT_VERSION_MINOR], [OpenVPN minor version - integer]) | |
37 | AC_DEFINE([OPENVPN_VERSION_PATCH], ["PRODUCT_VERSION_PATCH"], [OpenVPN patch level - may be a string or integer]) | |
98bc1a3e | 38 | |
51bd56f4 | 39 | AC_CONFIG_AUX_DIR([.]) |
631812fe | 40 | AC_CONFIG_HEADERS([config.h include/openvpn-plugin.h]) |
34cb9132 | 41 | AC_CONFIG_SRCDIR([src/openvpn/syshead.h]) |
0fc5b8b3 | 42 | AC_CONFIG_MACRO_DIR([m4]) |
c615835a GD |
43 | |
44 | dnl Initialize automake. automake < 1.12 didn't have serial-tests and | |
45 | dnl gives an error if it sees this, but for automake >= 1.13 | |
46 | dnl serial-tests is required so we have to include it. Solution is to | |
47 | dnl test for the version of automake (by running an external command) | |
48 | dnl and provide it if necessary. Note we have to do this entirely using | |
49 | dnl m4 macros since automake queries this macro by running | |
50 | dnl 'autoconf --trace ...'. | |
51 | m4_define([serial_tests], [ | |
52 | m4_esyscmd([automake --version | | |
53 | head -1 | | |
54 | awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}' | |
55 | ]) | |
56 | ]) | |
57 | AM_INIT_AUTOMAKE(foreign serial_tests) dnl NB: Do not [quote] this parameter. | |
51bd56f4 ABL |
58 | AC_CANONICAL_HOST |
59 | AC_USE_SYSTEM_EXTENSIONS | |
6fbf66fa | 60 | |
51bd56f4 ABL |
61 | AC_ARG_ENABLE( |
62 | [lzo], | |
40a56e79 | 63 | [AS_HELP_STRING([--disable-lzo], [disable LZO compression support @<:@default=yes@:>@])], |
51bd56f4 | 64 | , |
40a56e79 | 65 | [enable_lzo="yes"] |
6c34e74f JY |
66 | ) |
67 | ||
40efb635 GD |
68 | AC_ARG_ENABLE(lz4, |
69 | [ --disable-lz4 Disable LZ4 compression support], | |
70 | [enable_lz4="$enableval"], | |
71 | [enable_lz4="yes"] | |
72 | ) | |
73 | ||
38d96bd7 JY |
74 | AC_ARG_ENABLE(comp-stub, |
75 | [ --enable-comp-stub Don't compile compression support but still allow limited interoperability with compression-enabled peers], | |
76 | [enable_comp_stub="$enableval"], | |
77 | [enable_comp_stub="no"] | |
6fbf66fa JY |
78 | ) |
79 | ||
51bd56f4 ABL |
80 | AC_ARG_ENABLE( |
81 | [crypto], | |
709f7a1f | 82 | [AS_HELP_STRING([--disable-crypto], [disable crypto support @<:@default=yes@:>@])], |
51bd56f4 ABL |
83 | , |
84 | [enable_crypto="yes"] | |
6fbf66fa JY |
85 | ) |
86 | ||
c353af2f SK |
87 | AC_ARG_ENABLE( |
88 | [ofb-cfb], | |
104360b4 | 89 | [AS_HELP_STRING([--disable-ofb-cfb], [disable support for OFB and CFB cipher modes @<:@default=yes@:>@])], |
c353af2f SK |
90 | , |
91 | [enable_crypto_ofb_cfb="yes"] | |
92 | ) | |
93 | ||
51bd56f4 ABL |
94 | AC_ARG_ENABLE( |
95 | [x509-alt-username], | |
709f7a1f | 96 | [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature @<:@default=no@:>@])], |
51bd56f4 ABL |
97 | , |
98 | [enable_x509_alt_username="no"] | |
6fbf66fa JY |
99 | ) |
100 | ||
51bd56f4 ABL |
101 | AC_ARG_ENABLE( |
102 | [multi], | |
709f7a1f | 103 | [AS_HELP_STRING([--disable-multi], [disable client/server support (--mode server + client mode) @<:@default=yes@:>@])], |
51bd56f4 ABL |
104 | , |
105 | [enable_multi="yes"] | |
6fbf66fa JY |
106 | ) |
107 | ||
51bd56f4 ABL |
108 | AC_ARG_ENABLE( |
109 | [server], | |
709f7a1f | 110 | [AS_HELP_STRING([--disable-server], [disable server support only (but retain client support) @<:@default=yes@:>@])], |
51bd56f4 ABL |
111 | , |
112 | [enable_server="yes"] | |
6fbf66fa JY |
113 | ) |
114 | ||
51bd56f4 ABL |
115 | AC_ARG_ENABLE( |
116 | [plugins], | |
709f7a1f | 117 | [AS_HELP_STRING([--disable-plugins], [disable plug-in support @<:@default=yes@:>@])], |
51bd56f4 ABL |
118 | , |
119 | [enable_plugins="yes"] | |
0c1f7ad5 DS |
120 | ) |
121 | ||
51bd56f4 ABL |
122 | AC_ARG_ENABLE( |
123 | [management], | |
709f7a1f | 124 | [AS_HELP_STRING([--disable-management], [disable management server support @<:@default=yes@:>@])], |
51bd56f4 ABL |
125 | , |
126 | [enable_management="yes"] | |
ce98fd24 JY |
127 | ) |
128 | ||
51bd56f4 ABL |
129 | AC_ARG_ENABLE( |
130 | [pkcs11], | |
709f7a1f | 131 | [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support @<:@default=no@:>@])], |
51bd56f4 | 132 | , |
18b5fbdf | 133 | [enable_pkcs11="no"] |
6fbf66fa JY |
134 | ) |
135 | ||
51bd56f4 ABL |
136 | AC_ARG_ENABLE( |
137 | [fragment], | |
709f7a1f | 138 | [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])], |
51bd56f4 ABL |
139 | , |
140 | [enable_fragment="yes"] | |
8bc93d7f JY |
141 | ) |
142 | ||
51bd56f4 ABL |
143 | AC_ARG_ENABLE( |
144 | [multihome], | |
709f7a1f | 145 | [AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome) @<:@default=yes@:>@])], |
51bd56f4 ABL |
146 | , |
147 | [enable_multihome="yes"] | |
6add6b2f JY |
148 | ) |
149 | ||
51bd56f4 ABL |
150 | AC_ARG_ENABLE( |
151 | [port-share], | |
709f7a1f | 152 | [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share) @<:@default=yes@:>@])], |
51bd56f4 ABL |
153 | , |
154 | [enable_port_share="yes"] | |
6fbf66fa JY |
155 | ) |
156 | ||
51bd56f4 ABL |
157 | AC_ARG_ENABLE( |
158 | [debug], | |
709f7a1f | 159 | [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages) @<:@default=yes@:>@])], |
51bd56f4 ABL |
160 | , |
161 | [enable_debug="yes"] | |
6fbf66fa JY |
162 | ) |
163 | ||
51bd56f4 ABL |
164 | AC_ARG_ENABLE( |
165 | [small], | |
104360b4 | 166 | [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=no@:>@])], |
51bd56f4 ABL |
167 | , |
168 | [enable_small="no"] | |
6fbf66fa JY |
169 | ) |
170 | ||
51bd56f4 ABL |
171 | AC_ARG_ENABLE( |
172 | [iproute2], | |
709f7a1f | 173 | [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 @<:@default=no@:>@])], |
51bd56f4 ABL |
174 | , |
175 | [enable_iproute2="no"] | |
fb7aa54a JY |
176 | ) |
177 | ||
51bd56f4 ABL |
178 | AC_ARG_ENABLE( |
179 | [def-auth], | |
709f7a1f | 180 | [AS_HELP_STRING([--disable-def-auth], [disable deferred authentication @<:@default=yes@:>@])], |
51bd56f4 ABL |
181 | , |
182 | [enable_def_auth="yes"] | |
fb7aa54a JY |
183 | ) |
184 | ||
51bd56f4 ABL |
185 | AC_ARG_ENABLE( |
186 | [pf], | |
709f7a1f | 187 | [AS_HELP_STRING([--disable-pf], [disable internal packet filter @<:@default=yes@:>@])], |
51bd56f4 ABL |
188 | , |
189 | [enable_pf="yes"] | |
6fbf66fa JY |
190 | ) |
191 | ||
ce8271f5 ABL |
192 | AC_ARG_ENABLE( |
193 | [plugin-auth-pam], | |
5a57e201 | 194 | [AS_HELP_STRING([--disable-plugin-auth-pam], [disable auth-pam plugin @<:@default=platform specific@:>@])], |
ce8271f5 | 195 | , |
5a57e201 ABL |
196 | [ |
197 | case "$host" in | |
198 | *-*-openbsd*) enable_plugin_auth_pam="no";; | |
199 | *-mingw*) enable_plugin_auth_pam="no";; | |
200 | *) enable_plugin_auth_pam="yes";; | |
201 | esac | |
202 | ] | |
ce8271f5 ABL |
203 | ) |
204 | ||
205 | AC_ARG_ENABLE( | |
206 | [plugin-down-root], | |
5a57e201 ABL |
207 | [AS_HELP_STRING([--disable-plugin-down-root], [disable down-root plugin @<:@default=platform specific@:>@])], |
208 | , | |
209 | [ | |
210 | case "$host" in | |
211 | *-mingw*) enable_plugin_down_root="no";; | |
212 | *) enable_plugin_down_root="yes";; | |
213 | esac | |
214 | ] | |
ce8271f5 ABL |
215 | ) |
216 | ||
217 | AC_ARG_ENABLE( | |
218 | [pam-dlopen], | |
219 | [AS_HELP_STRING([--enable-pam-dlopen], [dlopen libpam @<:@default=no@:>@])], | |
220 | , | |
221 | [enable_pam_dlopen="no"] | |
222 | ) | |
223 | ||
51bd56f4 ABL |
224 | AC_ARG_ENABLE( |
225 | [strict], | |
709f7a1f | 226 | [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])], |
51bd56f4 ABL |
227 | , |
228 | [enable_strict="no"] | |
6fbf66fa JY |
229 | ) |
230 | ||
51bd56f4 ABL |
231 | AC_ARG_ENABLE( |
232 | [pedantic], | |
709f7a1f | 233 | [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option) @<:@default=no@:>@])], |
51bd56f4 ABL |
234 | , |
235 | [enable_pedantic="no"] | |
6fbf66fa JY |
236 | ) |
237 | ||
51194ffd SK |
238 | AC_ARG_ENABLE( |
239 | [werror], | |
240 | [AS_HELP_STRING([--enable-werror], [promote compiler warnings to errors, will cause builds to fail is the compiler issues warnings (debugging option) @<:@default=no@:>@])], | |
241 | , | |
242 | [enable_werror="no"] | |
243 | ) | |
244 | ||
51bd56f4 ABL |
245 | AC_ARG_ENABLE( |
246 | [strict-options], | |
709f7a1f | 247 | [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option) @<:@default=no@:>@])], |
51bd56f4 ABL |
248 | , |
249 | [enable_strict_options="no"] | |
6fbf66fa JY |
250 | ) |
251 | ||
51bd56f4 ABL |
252 | AC_ARG_ENABLE( |
253 | [selinux], | |
709f7a1f | 254 | [AS_HELP_STRING([--enable-selinux], [enable SELinux support @<:@default=no@:>@])], |
51bd56f4 ABL |
255 | , |
256 | [enable_selinux="no"] | |
99385447 JY |
257 | ) |
258 | ||
51bd56f4 ABL |
259 | AC_ARG_ENABLE( |
260 | [systemd], | |
709f7a1f | 261 | [AS_HELP_STRING([--enable-systemd], [enable systemd suppport @<:@default=no@:>@])], |
51bd56f4 ABL |
262 | , |
263 | [enable_systemd="no"] | |
9449e6a9 FC |
264 | ) |
265 | ||
0d1a75bf LS |
266 | AC_ARG_ENABLE( |
267 | [async-push], | |
1a8f6b91 | 268 | [AS_HELP_STRING([--enable-async-push], [enable async-push support for plugins providing deferred authentication @<:@default=no@:>@])], |
e62eccf0 | 269 | , |
0d1a75bf LS |
270 | [enable_async_push="no"] |
271 | ) | |
272 | ||
10b4b65e ABL |
273 | AC_ARG_WITH( |
274 | [special-build], | |
275 | [AS_HELP_STRING([--with-special-build=STRING], [specify special build string])], | |
276 | [test -n "${withval}" && AC_DEFINE_UNQUOTED([CONFIGURE_SPECIAL_BUILD], ["${withval}"], [special build string])] | |
277 | ) | |
278 | ||
51bd56f4 ABL |
279 | AC_ARG_WITH( |
280 | [mem-check], | |
709f7a1f | 281 | [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|dmalloc|valgrind|ssl @<:@default=no@:>@])], |
51bd56f4 ABL |
282 | [ |
283 | case "${withval}" in | |
284 | dmalloc|valgrind|ssl|no) ;; | |
285 | *) AC_MSG_ERROR([bad value ${withval} for --mem-check]) ;; | |
286 | esac | |
287 | ], | |
288 | [with_mem_check="no"] | |
6fbf66fa JY |
289 | ) |
290 | ||
51bd56f4 | 291 | AC_ARG_WITH( |
9b33b5a4 | 292 | [crypto-library], |
86d8cd68 | 293 | [AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|mbedtls @<:@default=openssl@:>@])], |
51bd56f4 | 294 | [ |
86d8cd68 SK |
295 | case "${withval}" in |
296 | openssl|mbedtls) ;; | |
9b33b5a4 | 297 | *) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;; |
51bd56f4 ABL |
298 | esac |
299 | ], | |
9b33b5a4 | 300 | [with_crypto_library="openssl"] |
0a180174 | 301 | ) |
0a180174 | 302 | |
4590c383 CH |
303 | AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@]) |
304 | if test -n "${PLUGINDIR}"; then | |
305 | plugindir="${PLUGINDIR}" | |
306 | else | |
307 | plugindir="\${libdir}/openvpn/plugins" | |
308 | fi | |
ce8271f5 | 309 | |
6440083e | 310 | AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host]) |
86715242 | 311 | case "$host" in |
51bd56f4 ABL |
312 | *-*-linux*) |
313 | AC_DEFINE([TARGET_LINUX], [1], [Are we running on Linux?]) | |
314 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["L"], [Target prefix]) | |
315 | ;; | |
316 | *-*-solaris*) | |
317 | AC_DEFINE([TARGET_SOLARIS], [1], [Are we running on Solaris?]) | |
318 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["S"], [Target prefix]) | |
4e2038ed | 319 | CPPFLAGS="$CPPFLAGS -D_XPG4_2" |
51bd56f4 ABL |
320 | ;; |
321 | *-*-openbsd*) | |
322 | AC_DEFINE([TARGET_OPENBSD], [1], [Are we running on OpenBSD?]) | |
323 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["O"], [Target prefix]) | |
324 | ;; | |
325 | *-*-freebsd*) | |
326 | AC_DEFINE([TARGET_FREEBSD], [1], [Are we running on FreeBSD?]) | |
327 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["F"], [Target prefix]) | |
328 | ;; | |
329 | *-*-netbsd*) | |
330 | AC_DEFINE([TARGET_NETBSD], [1], [Are we running NetBSD?]) | |
331 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["N"], [Target prefix]) | |
332 | ;; | |
333 | *-*-darwin*) | |
334 | AC_DEFINE([TARGET_DARWIN], [1], [Are we running on Mac OS X?]) | |
335 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["M"], [Target prefix]) | |
05f16e84 | 336 | have_tap_header="yes" |
51bd56f4 ABL |
337 | dnl some Mac OS X tendering (we use vararg macros...) |
338 | CPPFLAGS="$CPPFLAGS -no-cpp-precomp" | |
e7303ace | 339 | ac_cv_type_struct_in_pktinfo=no |
51bd56f4 ABL |
340 | ;; |
341 | *-mingw*) | |
342 | AC_DEFINE([TARGET_WIN32], [1], [Are we running WIN32?]) | |
343 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix]) | |
4b1a82db | 344 | CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN" |
5fcd4933 | 345 | CPPFLAGS="${CPPFLAGS} -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA" |
51bd56f4 | 346 | WIN32=yes |
51bd56f4 ABL |
347 | ;; |
348 | *-*-dragonfly*) | |
349 | AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?]) | |
350 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["D"], [Target prefix]) | |
351 | ;; | |
42f13dc0 GD |
352 | *-aix*) |
353 | AC_DEFINE([TARGET_AIX], [1], [Are we running AIX?]) | |
354 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["A"], [Target prefix]) | |
355 | ROUTE="/usr/sbin/route" | |
356 | have_tap_header="yes" | |
357 | ac_cv_header_net_if_h="no" # exists, but breaks things | |
358 | ;; | |
51bd56f4 ABL |
359 | *) |
360 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix]) | |
05f16e84 | 361 | have_tap_header="yes" |
51bd56f4 | 362 | ;; |
6fbf66fa JY |
363 | esac |
364 | ||
51bd56f4 ABL |
365 | PKG_PROG_PKG_CONFIG |
366 | AC_PROG_CPP | |
6fbf66fa | 367 | AC_PROG_INSTALL |
51bd56f4 | 368 | AC_PROG_LN_S |
7046ff20 | 369 | AC_PROG_SED |
51bd56f4 | 370 | AC_PROG_MAKE_SET |
6fbf66fa | 371 | |
c3fc703d ABL |
372 | AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility]) |
373 | AC_ARG_VAR([ROUTE], [full path to route utility]) | |
374 | AC_ARG_VAR([IPROUTE], [full path to ip utility]) | |
375 | AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests | |
376 | AC_ARG_VAR([MAN2HTML], [path to man2html utility]) | |
7046ff20 | 377 | AC_ARG_VAR([GIT], [path to git utility]) |
ba79c71d | 378 | AC_ARG_VAR([SYSTEMD_ASK_PASSWORD], [path to systemd-ask-password utility]) |
ca5b4c2a | 379 | AC_ARG_VAR([SYSTEMD_UNIT_DIR], [Path of systemd unit directory @<:@default=LIBDIR/systemd/system@:>@]) |
3de7be7b | 380 | AC_ARG_VAR([TMPFILES_DIR], [Path of tmpfiles directory @<:@default=LIBDIR/tmpfiles.d@:>@]) |
c3fc703d ABL |
381 | AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) |
382 | AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) | |
383 | AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) | |
ba79c71d | 384 | AC_PATH_PROGS([SYSTEMD_ASK_PASSWORD], [systemd-ask-password],, [$PATH:/usr/local/bin:/usr/bin:/bin]) |
c3fc703d ABL |
385 | AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests |
386 | AC_CHECK_PROGS([MAN2HTML], [man2html]) | |
7046ff20 | 387 | AC_CHECK_PROGS([GIT], [git]) # optional |
c3fc703d ABL |
388 | AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) |
389 | AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) | |
390 | AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) | |
ba79c71d | 391 | AC_DEFINE_UNQUOTED([SYSTEMD_ASK_PASSWORD_PATH], ["$SYSTEMD_ASK_PASSWORD"], [Path to systemd-ask-password tool]) |
c3fc703d | 392 | |
9223336a SK |
393 | # Set -std=c99 unless user already specified a -std= |
394 | case "${CFLAGS}" in | |
395 | *-std=*) ;; | |
396 | *) CFLAGS="${CFLAGS} -std=c99" ;; | |
397 | esac | |
398 | ||
98bc1a3e ABL |
399 | # |
400 | # Libtool | |
401 | # | |
402 | ifdef( | |
403 | [LT_INIT], | |
404 | [ | |
405 | LT_INIT([win32-dll]) | |
406 | LT_LANG([Windows Resource]) | |
407 | ], | |
408 | [ | |
409 | AC_LIBTOOL_WIN32_DLL | |
410 | AC_LIBTOOL_RC | |
411 | AC_PROG_LIBTOOL | |
412 | ] | |
413 | ) | |
414 | ||
6fbf66fa JY |
415 | AC_C_CONST |
416 | AC_C_INLINE | |
417 | AC_C_VOLATILE | |
418 | AC_TYPE_OFF_T | |
419 | AC_TYPE_PID_T | |
420 | AC_TYPE_SIZE_T | |
421 | AC_TYPE_UID_T | |
51bd56f4 ABL |
422 | AC_TYPE_INT8_T |
423 | AC_TYPE_INT16_T | |
424 | AC_TYPE_INT32_T | |
425 | AC_TYPE_INT64_T | |
426 | AC_TYPE_UINT8_T | |
427 | AC_TYPE_UINT16_T | |
428 | AC_TYPE_UINT32_T | |
429 | AC_TYPE_UINT64_T | |
430 | AC_TYPE_SIGNAL | |
6fbf66fa JY |
431 | AX_CPP_VARARG_MACRO_ISO |
432 | AX_CPP_VARARG_MACRO_GCC | |
0dbd45db | 433 | AX_TYPE_SOCKLEN_T |
6fbf66fa | 434 | AX_EMPTY_ARRAY |
51bd56f4 ABL |
435 | AC_CHECK_SIZEOF([unsigned int]) |
436 | AC_CHECK_SIZEOF([unsigned long]) | |
437 | AC_CHECK_HEADERS([ \ | |
e5fc56a7 | 438 | stdio.h stdarg.h limits.h \ |
51bd56f4 ABL |
439 | time.h errno.h fcntl.h io.h direct.h \ |
440 | ctype.h sys/types.h sys/socket.h \ | |
bdae4110 | 441 | signal.h unistd.h dlfcn.h \ |
51bd56f4 ABL |
442 | netinet/in.h netinet/in_systm.h \ |
443 | netinet/tcp.h arpa/inet.h netdb.h \ | |
444 | windows.h winsock2.h ws2tcpip.h \ | |
cdc65ea0 | 445 | versionhelpers.h \ |
51bd56f4 | 446 | ]) |
cab53332 | 447 | AC_CHECK_HEADERS([ \ |
a2d747bb | 448 | sys/time.h sys/ioctl.h sys/stat.h \ |
f641637a | 449 | sys/mman.h sys/file.h sys/wait.h \ |
7cacdfd4 | 450 | unistd.h signal.h libgen.h stropts.h \ |
cab53332 | 451 | syslog.h pwd.h grp.h \ |
7cacdfd4 | 452 | sys/sockio.h sys/uio.h linux/sockios.h \ |
cab53332 ABL |
453 | linux/types.h sys/poll.h sys/epoll.h err.h \ |
454 | ]) | |
6fbf66fa | 455 | |
51bd56f4 ABL |
456 | SOCKET_INCLUDES=" |
457 | #ifdef HAVE_STDLIB_H | |
458 | #include <stdlib.h> | |
459 | #endif | |
460 | #ifdef HAVE_SYS_TYPES_H | |
461 | #include <sys/types.h> | |
462 | #endif | |
463 | #ifdef HAVE_SYS_SOCKET_H | |
464 | #include <sys/socket.h> | |
465 | #endif | |
7efa60d9 GD |
466 | #ifdef HAVE_NET_IF_H |
467 | #include <net/if.h> | |
468 | #endif | |
51bd56f4 ABL |
469 | #ifdef HAVE_NETINET_IN_H |
470 | #include <netinet/in.h> | |
471 | #endif | |
472 | #ifdef HAVE_WINDOWS_H | |
473 | #include <windows.h> | |
474 | #endif | |
475 | #ifdef HAVE_WINSOCK2_H | |
476 | #include <winsock2.h> | |
477 | #endif | |
478 | #ifdef HAVE_WS2TCPIP_H | |
479 | #include <ws2tcpip.h> | |
480 | #endif | |
2a744891 ABL |
481 | #ifdef HAVE_NETINET_IN_SYSTM_H |
482 | #include <netinet/in_systm.h> | |
483 | #endif | |
4025a595 ABL |
484 | #ifdef HAVE_NETINET_IP_H |
485 | #include <netinet/ip.h> | |
486 | #endif | |
51bd56f4 | 487 | " |
1bda73a7 | 488 | |
cab53332 | 489 | AC_CHECK_HEADERS( |
ddb1f20a | 490 | [net/if.h netinet/ip.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h], |
51bd56f4 | 491 | , |
51bd56f4 | 492 | , |
cab53332 | 493 | [[${SOCKET_INCLUDES}]] |
51bd56f4 ABL |
494 | ) |
495 | ||
496 | AC_CHECK_TYPES( | |
6fbf66fa | 497 | [in_addr_t], |
51bd56f4 ABL |
498 | , |
499 | [AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])], | |
500 | [[${SOCKET_INCLUDES}]] | |
501 | ) | |
dd6714ae GD |
502 | AC_CHECK_TYPES( |
503 | [in_port_t], | |
504 | , | |
505 | [AC_DEFINE([in_port_t], [uint16_t], [Workaround missing in_port_t])], | |
506 | [[${SOCKET_INCLUDES}]] | |
507 | ) | |
6fbf66fa JY |
508 | AC_CHECK_TYPE( |
509 | [struct iphdr], | |
7c0a2b5f | 510 | [AC_DEFINE([HAVE_IPHDR], [1], [struct iphdr needed for IPv6 support])], |
51bd56f4 ABL |
511 | , |
512 | [[${SOCKET_INCLUDES}]] | |
513 | ) | |
6fbf66fa JY |
514 | AC_CHECK_TYPE( |
515 | [struct sock_extended_err], | |
7c0a2b5f | 516 | [AC_DEFINE([HAVE_SOCK_EXTENDED_ERR], [1], [struct sock_extended_err needed for extended socket error support])], |
51bd56f4 ABL |
517 | , |
518 | [[${SOCKET_INCLUDES}]] | |
519 | ) | |
6fbf66fa JY |
520 | AC_CHECK_TYPE( |
521 | [struct msghdr], | |
7c0a2b5f | 522 | [AC_DEFINE([HAVE_MSGHDR], [1], [struct msghdr needed for extended socket error support])], |
51bd56f4 ABL |
523 | , |
524 | [[${SOCKET_INCLUDES}]] | |
525 | ) | |
6fbf66fa JY |
526 | AC_CHECK_TYPE( |
527 | [struct cmsghdr], | |
7c0a2b5f | 528 | [AC_DEFINE([HAVE_CMSGHDR], [1], [struct cmsghdr needed for extended socket error support])], |
51bd56f4 ABL |
529 | , |
530 | [[${SOCKET_INCLUDES}]] | |
531 | ) | |
8bc93d7f JY |
532 | AC_CHECK_TYPE( |
533 | [struct in_pktinfo], | |
7c0a2b5f | 534 | [AC_DEFINE([HAVE_IN_PKTINFO], [1], [struct in_pktinfo needed for IP_PKTINFO support])], |
51bd56f4 ABL |
535 | , |
536 | [[${SOCKET_INCLUDES}]] | |
537 | ) | |
87b468d4 HH |
538 | AC_CHECK_TYPE( |
539 | [sa_family_t], | |
540 | [AC_DEFINE([HAVE_SA_FAMILY_T], [1], [sa_family_t, needed to hold AF_* info])], | |
541 | , | |
542 | [[${SOCKET_INCLUDES}]] | |
543 | ) | |
7efa60d9 GD |
544 | AC_CHECK_MEMBER( |
545 | [struct in_pktinfo.ipi_spec_dst], | |
546 | [AC_DEFINE([HAVE_IPI_SPEC_DST], [1], [struct in_pktinfo.ipi_spec_dst needed for IP_PKTINFO support])], | |
547 | , | |
548 | [[${SOCKET_INCLUDES}]] | |
549 | ) | |
51bd56f4 ABL |
550 | AC_CHECK_TYPE( |
551 | [struct sockaddr_in6], | |
552 | , | |
553 | [AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])], | |
554 | [[${SOCKET_INCLUDES}]] | |
555 | ) | |
cab53332 ABL |
556 | AC_CHECK_DECLS( |
557 | [SO_MARK], | |
558 | , | |
559 | , | |
560 | [[${SOCKET_INCLUDES}]] | |
561 | ) | |
9223336a SK |
562 | AC_CHECKING([anonymous union support]) |
563 | AC_COMPILE_IFELSE( | |
564 | [AC_LANG_PROGRAM( | |
565 | [[ | |
566 | struct mystruct { | |
567 | union { | |
568 | int m1; | |
569 | char m2; | |
570 | }; | |
571 | }; | |
572 | ]], | |
573 | [[ | |
574 | struct mystruct s; | |
575 | s.m1 = 1; s.m2 = 2; | |
576 | ]] | |
577 | )], | |
578 | [ | |
579 | AC_MSG_RESULT([yes]) | |
580 | AC_DEFINE([HAVE_ANONYMOUS_UNION_SUPPORT], [], [Compiler supports anonymous unions]) | |
581 | ], | |
582 | [AC_MSG_RESULT([no])] | |
583 | ) | |
51bd56f4 | 584 | |
f91ab283 SN |
585 | saved_LDFLAGS="$LDFLAGS" |
586 | LDFLAGS="$LDFLAGS -Wl,--wrap=exit" | |
587 | AC_MSG_CHECKING([linker supports --wrap]) | |
588 | AC_LINK_IFELSE( | |
589 | [AC_LANG_PROGRAM( | |
590 | [[ | |
591 | void exit(int); | |
592 | void __real_exit(int); | |
593 | void __wrap_exit(int i) { | |
594 | __real_exit(i); | |
595 | } | |
596 | ]], | |
597 | [[ | |
598 | exit(0); | |
599 | ]] | |
600 | )], | |
601 | [ | |
602 | AC_MSG_RESULT([yes]) | |
603 | have_ld_wrap_support=yes | |
604 | ], | |
605 | [AC_MSG_RESULT([no])], | |
606 | ) | |
607 | LDFLAGS="$saved_LDFLAGS" | |
608 | ||
cab53332 ABL |
609 | dnl We emulate signals in Windows |
610 | AC_CHECK_DECLS( | |
611 | [SIGHUP], | |
51bd56f4 | 612 | , |
cab53332 ABL |
613 | [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])], |
614 | [[ | |
615 | #ifdef HAVE_SIGNAL_H | |
616 | #include <signal.h> | |
617 | #endif | |
618 | ]] | |
51bd56f4 | 619 | ) |
cab53332 ABL |
620 | AC_CHECK_DECLS( |
621 | [SIGINT], | |
622 | , | |
623 | [AC_DEFINE([SIGINT], [2], [SIGINT replacement])], | |
624 | [[ | |
625 | #ifdef HAVE_SIGNAL_H | |
626 | #include <signal.h> | |
627 | #endif | |
628 | ]] | |
629 | ) | |
630 | AC_CHECK_DECLS( | |
631 | [SIGUSR1], | |
632 | , | |
633 | [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])], | |
634 | [[ | |
635 | #ifdef HAVE_SIGNAL_H | |
636 | #include <signal.h> | |
637 | #endif | |
638 | ]] | |
639 | ) | |
640 | AC_CHECK_DECLS( | |
641 | [SIGUSR2], | |
642 | , | |
643 | [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])], | |
644 | [[ | |
645 | #ifdef HAVE_SIGNAL_H | |
646 | #include <signal.h> | |
647 | #endif | |
648 | ]] | |
649 | ) | |
650 | AC_CHECK_DECLS( | |
651 | [SIGTERM], | |
652 | , | |
653 | [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])], | |
654 | [[ | |
655 | #ifdef HAVE_SIGNAL_H | |
656 | #include <signal.h> | |
657 | #endif | |
658 | ]] | |
659 | ) | |
660 | ||
661 | AC_FUNC_FORK | |
662 | ||
51bd56f4 ABL |
663 | AC_CHECK_FUNCS([ \ |
664 | daemon chroot getpwnam setuid nice system getpid dup dup2 \ | |
fd2a29ab | 665 | getpass syslog openlog mlockall getgrnam setgid \ |
51bd56f4 | 666 | setgroups stat flock readv writev time gettimeofday \ |
cab53332 | 667 | ctime memset vsnprintf strdup \ |
51bd56f4 ABL |
668 | setsid chdir putenv getpeername unlink \ |
669 | chsize ftruncate execve getpeereid umask basename dirname access \ | |
670 | epoll_create \ | |
671 | ]) | |
aee7428c ABL |
672 | |
673 | AC_CHECK_LIB( | |
674 | [dl], | |
675 | [dlopen], | |
676 | [DL_LIBS="-ldl"] | |
677 | ) | |
678 | AC_SUBST([DL_LIBS]) | |
679 | ||
680 | AC_CHECK_LIB( | |
681 | [nsl], | |
682 | [inet_ntoa], | |
683 | [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"] | |
684 | ) | |
685 | AC_CHECK_LIB( | |
686 | [socket], | |
687 | [socket], | |
688 | [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"] | |
689 | ) | |
690 | AC_CHECK_LIB( | |
691 | [resolv], | |
692 | [gethostbyname], | |
693 | [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"] | |
694 | ) | |
695 | AC_SUBST([SOCKETS_LIBS]) | |
696 | ||
697 | old_LIBS="${LIBS}" | |
698 | LIBS="${LIBS} ${SOCKETS_LIBS}" | |
f96baabc | 699 | AC_CHECK_FUNCS([sendmsg recvmsg]) |
0eb2ee14 | 700 | # Windows use stdcall for winsock so we cannot auto detect these |
51bd56f4 ABL |
701 | m4_define( |
702 | [SOCKET_FUNCS], | |
703 | [socket recv recvfrom send sendto listen dnl | |
704 | accept connect bind select gethostbyname inet_ntoa]dnl | |
705 | ) | |
706 | m4_define( | |
707 | [SOCKET_OPT_FUNCS], | |
708 | [setsockopt getsockopt getsockname poll]dnl | |
709 | ) | |
1bda73a7 | 710 | if test "${WIN32}" = "yes"; then |
f96baabc GD |
711 | # normal autoconf function checking does not find inet_ntop/inet_pton |
712 | # because they need to include the actual header file and link ws2_32.dll | |
713 | LIBS="${LIBS} -lws2_32" | |
714 | AC_MSG_CHECKING([for MinGW inet_ntop()/inet_pton()]) | |
715 | AC_LINK_IFELSE( | |
716 | [AC_LANG_PROGRAM( | |
717 | [[ | |
718 | #include <ws2tcpip.h> | |
719 | ]], | |
720 | [[ | |
721 | int r = (int) inet_ntop (0, NULL, NULL, 0); | |
722 | r += inet_pton(AF_INET, NULL, NULL); | |
723 | return r; | |
724 | ]] | |
725 | )], | |
726 | [AC_MSG_RESULT([OK]) | |
727 | AC_DEFINE([HAVE_INET_NTOP],[1],[MinGW inet_ntop]) | |
728 | AC_DEFINE([HAVE_INET_PTON],[1],[MinGW inet_pton]) | |
729 | ], | |
730 | [AC_MSG_RESULT([not found])] | |
731 | ) | |
51bd56f4 ABL |
732 | m4_foreach( |
733 | [F], | |
734 | m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS), | |
735 | m4_define([UF], [[m4_join([_], [HAVE], m4_toupper(F))]]) | |
736 | AC_DEFINE([UF], [1], [Win32 builtin]) | |
737 | ) | |
1bda73a7 | 738 | else |
f96baabc | 739 | AC_CHECK_FUNCS([inet_ntop inet_pton]) |
51bd56f4 ABL |
740 | AC_CHECK_FUNCS( |
741 | SOCKET_FUNCS, | |
742 | , | |
743 | [AC_MSG_ERROR([Required library function not found])] | |
744 | ) | |
745 | AC_CHECK_FUNCS(SOCKET_OPT_FUNCS) | |
746 | fi | |
aee7428c | 747 | LIBS="${old_LIBS}" |
7647a48c | 748 | |
403dc434 GD |
749 | # we assume res_init() always exist, but need to find out *where*... |
750 | AC_SEARCH_LIBS(__res_init, resolv bind, , | |
751 | AC_SEARCH_LIBS(res_9_init, resolv bind, , | |
752 | AC_SEARCH_LIBS(res_init, resolv bind, , ))) | |
753 | ||
7cacdfd4 ABL |
754 | AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap]) |
755 | old_CFLAGS="${CFLAGS}" | |
756 | CFLAGS="${CFLAGS} ${TAP_CFLAGS}" | |
757 | AC_CHECK_HEADERS( | |
758 | [ \ | |
759 | net/if_tun.h net/tun/if_tun.h \ | |
760 | linux/if_tun.h \ | |
761 | tap-windows.h \ | |
762 | ], | |
763 | [have_tap_header="yes"] | |
764 | ) | |
88f3a402 ABL |
765 | AC_CHECK_DECLS( |
766 | [TUNSETPERSIST], | |
767 | [AC_DEFINE([ENABLE_FEATURE_TUN_PERSIST], [1], [We have persist tun capability])], | |
768 | , | |
769 | [[ | |
770 | #ifdef HAVE_LINUX_IF_TUN_H | |
771 | #include <linux/if_tun.h> | |
772 | #endif | |
773 | ]] | |
774 | ) | |
7cacdfd4 ABL |
775 | CFLAGS="${old_CFLAGS}" |
776 | test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found]) | |
777 | ||
cd5990e0 ABL |
778 | AC_CHECK_LIB( |
779 | [selinux], | |
780 | [setcon], | |
781 | [SELINUX_LIBS="-lselinux"] | |
782 | ) | |
783 | AC_SUBST([SELINUX_LIBS]) | |
784 | ||
ce8271f5 ABL |
785 | AC_ARG_VAR([LIBPAM_CFLAGS], [C compiler flags for libpam]) |
786 | AC_ARG_VAR([LIBPAM_LIBS], [linker flags for libpam]) | |
787 | if test -z "${LIBPAM_LIBS}"; then | |
788 | AC_CHECK_LIB( | |
789 | [pam], | |
790 | [pam_start], | |
791 | [LIBPAM_LIBS="-lpam"] | |
792 | ) | |
793 | fi | |
794 | ||
51bd56f4 ABL |
795 | case "${with_mem_check}" in |
796 | valgrind) | |
fb69bfd0 | 797 | AC_CHECK_HEADERS( |
51bd56f4 ABL |
798 | [valgrind/memcheck.h], |
799 | [ | |
800 | CFLAGS="${CFLAGS} -g -fno-inline" | |
801 | AC_DEFINE( | |
802 | [USE_VALGRIND], | |
803 | [1], | |
804 | [Use valgrind memory debugging library] | |
805 | ) | |
806 | ], | |
807 | [AC_MSG_ERROR([valgrind headers not found.])] | |
808 | ) | |
809 | ;; | |
810 | dmalloc) | |
fb69bfd0 | 811 | AC_CHECK_HEADERS( |
51bd56f4 ABL |
812 | [dmalloc.h], |
813 | [AC_CHECK_LIB( | |
814 | [dmalloc], | |
815 | [malloc], | |
816 | [ | |
e02570fd | 817 | LIBS="${LIBS} -ldmalloc" |
51bd56f4 ABL |
818 | AC_DEFINE( |
819 | [DMALLOC], | |
820 | [1], | |
821 | [Use dmalloc memory debugging library] | |
822 | ) | |
823 | ], | |
824 | [AC_MSG_ERROR([dmalloc library not found.])] | |
825 | )], | |
826 | [AC_MSG_ERROR([dmalloc headers not found.])] | |
827 | ) | |
828 | ;; | |
829 | ssl) | |
830 | AC_CHECK_LIB( | |
831 | [ssl], | |
832 | [CRYPTO_mem_ctrl], | |
833 | [ | |
834 | AC_DEFINE( | |
835 | [CRYPTO_MDEBUG], | |
836 | [1], | |
837 | [Use memory debugging function in OpenSSL] | |
838 | ) | |
839 | AC_MSG_NOTICE([NOTE: OpenSSL library must be compiled with CRYPTO_MDEBUG]) | |
840 | ], | |
841 | [AC_MSG_ERROR([Memory Debugging function in OpenSSL library not found.])] | |
842 | ) | |
843 | ;; | |
844 | esac | |
6fbf66fa | 845 | |
9a3f6702 SK |
846 | PKG_CHECK_MODULES( |
847 | [PKCS11_HELPER], | |
6575ad48 | 848 | [libpkcs11-helper-1 >= 1.11], |
9a3f6702 SK |
849 | [have_pkcs11_helper="yes"], |
850 | [] | |
851 | ) | |
852 | ||
d13a40a4 | 853 | if test "${enable_crypto}" = "yes" -a "${with_crypto_library}" = "openssl"; then |
31b0bebe SK |
854 | AC_ARG_VAR([OPENSSL_CFLAGS], [C compiler flags for OpenSSL]) |
855 | AC_ARG_VAR([OPENSSL_LIBS], [linker flags for OpenSSL]) | |
856 | ||
857 | if test -z "${OPENSSL_CFLAGS}" -a -z "${OPENSSL_LIBS}"; then | |
858 | # if the user did not explicitly specify flags, try to autodetect | |
859 | PKG_CHECK_MODULES( | |
860 | [OPENSSL], | |
79ea67f7 DS |
861 | [openssl >= 1.0.1], |
862 | [have_openssl="yes"], | |
863 | [] # If this fails, we will do another test next | |
31b0bebe | 864 | ) |
31b0bebe SK |
865 | OPENSSL_LIBS=${OPENSSL_LIBS:--lssl -lcrypto} |
866 | fi | |
9b33b5a4 | 867 | |
9b33b5a4 ABL |
868 | saved_CFLAGS="${CFLAGS}" |
869 | saved_LIBS="${LIBS}" | |
31b0bebe SK |
870 | CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}" |
871 | LIBS="${LIBS} ${OPENSSL_LIBS}" | |
872 | ||
79ea67f7 DS |
873 | # If pkgconfig check failed or OPENSSL_CFLAGS/OPENSSL_LIBS env vars |
874 | # are used, check the version directly in the OpenSSL include file | |
875 | if test "${have_openssl}" != "yes"; then | |
876 | AC_MSG_CHECKING([additionally if OpenSSL is available and version >= 1.0.1]) | |
877 | AC_COMPILE_IFELSE( | |
878 | [AC_LANG_PROGRAM( | |
879 | [[ | |
880 | #include <openssl/opensslv.h> | |
881 | ]], | |
882 | [[ | |
883 | /* Version encoding: MNNFFPPS - see opensslv.h for details */ | |
884 | #if OPENSSL_VERSION_NUMBER < 0x10001000L | |
885 | #error OpenSSL too old | |
886 | #endif | |
887 | ]] | |
888 | )], | |
889 | [AC_MSG_RESULT([ok])], | |
890 | [AC_MSG_ERROR([OpenSSL version too old])] | |
891 | ) | |
892 | fi | |
893 | ||
31b0bebe SK |
894 | AC_CHECK_FUNCS([SSL_CTX_new EVP_CIPHER_CTX_set_key_length], |
895 | , | |
896 | [AC_MSG_ERROR([openssl check failed])] | |
897 | ) | |
898 | ||
9b33b5a4 ABL |
899 | have_openssl_engine="yes" |
900 | AC_CHECK_FUNCS( | |
901 | [ \ | |
902 | ENGINE_load_builtin_engines \ | |
903 | ENGINE_register_all_complete \ | |
904 | ENGINE_cleanup \ | |
905 | ], | |
906 | , | |
907 | [have_openssl_engine="no"; break] | |
908 | ) | |
31b0bebe SK |
909 | if test "${have_openssl_engine}" = "yes"; then |
910 | AC_DEFINE([HAVE_OPENSSL_ENGINE], [1], [OpenSSL engine support available]) | |
911 | fi | |
9b33b5a4 | 912 | |
66407e11 SK |
913 | have_crypto_aead_modes="yes" |
914 | AC_CHECK_FUNCS( | |
915 | [EVP_aes_256_gcm], | |
916 | , | |
917 | [have_crypto_aead_modes="no"; break] | |
918 | ) | |
919 | ||
6554ac9f ED |
920 | AC_CHECK_FUNCS( |
921 | [ \ | |
aba98e90 ED |
922 | HMAC_CTX_new \ |
923 | HMAC_CTX_free \ | |
924 | HMAC_CTX_reset \ | |
c481ef00 ED |
925 | EVP_MD_CTX_new \ |
926 | EVP_MD_CTX_free \ | |
927 | EVP_MD_CTX_reset \ | |
6554ac9f ED |
928 | SSL_CTX_get_default_passwd_cb \ |
929 | SSL_CTX_get_default_passwd_cb_userdata \ | |
17d1ab90 | 930 | X509_get0_pubkey \ |
f05665df | 931 | X509_STORE_get0_objects \ |
47191f49 ED |
932 | X509_OBJECT_free \ |
933 | X509_OBJECT_get_type \ | |
b8ca5bc3 ED |
934 | EVP_PKEY_id \ |
935 | EVP_PKEY_get0_RSA \ | |
936 | EVP_PKEY_get0_DSA \ | |
bb23eca8 | 937 | EVP_PKEY_get0_EC_KEY \ |
f7780af6 ED |
938 | RSA_set_flags \ |
939 | RSA_bits \ | |
940 | RSA_get0_key \ | |
941 | RSA_set0_key \ | |
c07c0358 ED |
942 | DSA_get0_pqg \ |
943 | DSA_bits \ | |
09776c5b ED |
944 | RSA_meth_new \ |
945 | RSA_meth_free \ | |
946 | RSA_meth_set_pub_enc \ | |
947 | RSA_meth_set_pub_dec \ | |
948 | RSA_meth_set_priv_enc \ | |
949 | RSA_meth_set_priv_dec \ | |
950 | RSA_meth_set_init \ | |
951 | RSA_meth_set_finish \ | |
952 | RSA_meth_set0_app_data \ | |
bb23eca8 | 953 | EC_GROUP_order_bits |
07372a0f | 954 | ] |
6554ac9f ED |
955 | ) |
956 | ||
9b33b5a4 ABL |
957 | CFLAGS="${saved_CFLAGS}" |
958 | LIBS="${saved_LIBS}" | |
9b33b5a4 | 959 | |
31b0bebe SK |
960 | have_crypto="yes" |
961 | AC_DEFINE([ENABLE_CRYPTO_OPENSSL], [1], [Use OpenSSL library]) | |
962 | CRYPTO_CFLAGS="${OPENSSL_CFLAGS}" | |
963 | CRYPTO_LIBS="${OPENSSL_LIBS}" | |
d13a40a4 | 964 | elif test "${enable_crypto}" = "yes" -a "${with_crypto_library}" = "mbedtls"; then |
86d8cd68 SK |
965 | AC_ARG_VAR([MBEDTLS_CFLAGS], [C compiler flags for mbedtls]) |
966 | AC_ARG_VAR([MBEDTLS_LIBS], [linker flags for mbedtls]) | |
31b0bebe | 967 | |
417fe4a7 SK |
968 | saved_CFLAGS="${CFLAGS}" |
969 | saved_LIBS="${LIBS}" | |
970 | ||
86d8cd68 | 971 | if test -z "${MBEDTLS_CFLAGS}" -a -z "${MBEDTLS_LIBS}"; then |
e860059b | 972 | # if the user did not explicitly specify flags, try to autodetect |
1ae17b7e | 973 | LIBS="${LIBS} -lmbedtls -lmbedx509 -lmbedcrypto" |
86d8cd68 SK |
974 | AC_CHECK_LIB( |
975 | [mbedtls], | |
976 | [mbedtls_ssl_init], | |
1ae17b7e | 977 | [MBEDTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"], |
86d8cd68 | 978 | [AC_MSG_ERROR([Could not find mbed TLS.])], |
31b0bebe SK |
979 | [${PKCS11_HELPER_LIBS}] |
980 | ) | |
981 | fi | |
9b33b5a4 | 982 | |
86d8cd68 SK |
983 | CFLAGS="${MBEDTLS_CFLAGS} ${PKCS11_HELPER_CFLAGS} ${CFLAGS}" |
984 | LIBS="${MBEDTLS_LIBS} ${PKCS11_HELPER_LIBS} ${LIBS}" | |
417fe4a7 | 985 | |
86d8cd68 | 986 | AC_MSG_CHECKING([mbedtls version]) |
13b38eb0 ABL |
987 | AC_COMPILE_IFELSE( |
988 | [AC_LANG_PROGRAM( | |
989 | [[ | |
86d8cd68 | 990 | #include <mbedtls/version.h> |
13b38eb0 ABL |
991 | ]], |
992 | [[ | |
86d8cd68 | 993 | #if MBEDTLS_VERSION_NUMBER < 0x02000000 || MBEDTLS_VERSION_NUMBER >= 0x03000000 |
9a3f6702 | 994 | #error invalid version |
13b38eb0 ABL |
995 | #endif |
996 | ]] | |
997 | )], | |
998 | [AC_MSG_RESULT([ok])], | |
86d8cd68 | 999 | [AC_MSG_ERROR([mbed TLS 2.y.z required])] |
13b38eb0 | 1000 | ) |
9a3f6702 | 1001 | |
86d8cd68 | 1002 | mbedtls_with_pkcs11="no" |
9a3f6702 SK |
1003 | AC_COMPILE_IFELSE( |
1004 | [AC_LANG_PROGRAM( | |
1005 | [[ | |
86d8cd68 | 1006 | #include <mbedtls/config.h> |
9a3f6702 SK |
1007 | ]], |
1008 | [[ | |
86d8cd68 | 1009 | #ifndef MBEDTLS_PKCS11_C |
9a3f6702 SK |
1010 | #error pkcs11 wrapper missing |
1011 | #endif | |
1012 | ]] | |
1013 | )], | |
86d8cd68 | 1014 | mbedtls_with_pkcs11="yes") |
9a3f6702 | 1015 | |
86d8cd68 | 1016 | AC_MSG_CHECKING([mbedtls pkcs11 support]) |
9a3f6702 | 1017 | if test "${enable_pkcs11}" = "yes"; then |
86d8cd68 | 1018 | if test "${mbedtls_with_pkcs11}" = "yes"; then |
9a3f6702 SK |
1019 | AC_MSG_RESULT([ok]) |
1020 | else | |
86d8cd68 | 1021 | AC_MSG_ERROR([mbedtls has no pkcs11 wrapper compiled in]) |
9a3f6702 SK |
1022 | fi |
1023 | else | |
86d8cd68 | 1024 | if test "${mbedtls_with_pkcs11}" != "yes"; then |
9a3f6702 SK |
1025 | AC_MSG_RESULT([ok]) |
1026 | else | |
86d8cd68 | 1027 | AC_MSG_ERROR([mbed TLS compiled with PKCS11, while OpenVPN is not]) |
9a3f6702 SK |
1028 | fi |
1029 | fi | |
66407e11 SK |
1030 | |
1031 | have_crypto_aead_modes="yes" | |
1032 | AC_CHECK_FUNCS( | |
1033 | [ \ | |
86d8cd68 SK |
1034 | mbedtls_cipher_write_tag \ |
1035 | mbedtls_cipher_check_tag \ | |
66407e11 SK |
1036 | ], |
1037 | , | |
1038 | [have_crypto_aead_modes="no"; break] | |
1039 | ) | |
1040 | ||
31b0bebe SK |
1041 | CFLAGS="${saved_CFLAGS}" |
1042 | LIBS="${saved_LIBS}" | |
31b0bebe | 1043 | have_crypto="yes" |
86d8cd68 SK |
1044 | AC_DEFINE([ENABLE_CRYPTO_MBEDTLS], [1], [Use mbed TLS library]) |
1045 | CRYPTO_CFLAGS="${MBEDTLS_CFLAGS}" | |
1046 | CRYPTO_LIBS="${MBEDTLS_LIBS}" | |
d13a40a4 | 1047 | elif test "${enable_crypto}" = "yes"; then |
31b0bebe | 1048 | AC_MSG_ERROR([Invalid crypto library: ${with_crypto_library}]) |
13b38eb0 ABL |
1049 | fi |
1050 | ||
74bbc71b ABL |
1051 | AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo]) |
1052 | AC_ARG_VAR([LZO_LIBS], [linker flags for lzo]) | |
1053 | have_lzo="yes" | |
1054 | if test -z "${LZO_LIBS}"; then | |
1055 | AC_CHECK_LIB( | |
1056 | [lzo2], | |
1057 | [lzo1x_1_15_compress], | |
1058 | [LZO_LIBS="-llzo2"], | |
1059 | [AC_CHECK_LIB( | |
1060 | [lzo], | |
1061 | [lzo1x_1_15_compress], | |
1062 | [LZO_LIBS="-llzo"], | |
1063 | [have_lzo="no"] | |
1064 | )] | |
1065 | ) | |
1066 | fi | |
1067 | if test "${have_lzo}" = "yes"; then | |
1068 | saved_CFLAGS="${CFLAGS}" | |
1069 | CFLAGS="${CFLAGS} ${LZO_CFLAGS}" | |
1070 | AC_CHECK_HEADERS( | |
1071 | [lzo/lzoutil.h], | |
1072 | , | |
1073 | [AC_CHECK_HEADERS( | |
1074 | [lzoutil.h], | |
1075 | , | |
1076 | [AC_MSG_ERROR([lzoutil.h is missing])] | |
1077 | )] | |
1078 | ) | |
1079 | AC_CHECK_HEADERS( | |
1080 | [lzo/lzo1x.h], | |
1081 | , | |
1082 | [AC_CHECK_HEADERS( | |
1083 | [lzo1x.h], | |
1084 | , | |
1085 | [AC_MSG_ERROR([lzo1x.h is missing])] | |
1086 | )] | |
1087 | ) | |
1088 | CFLAGS="${saved_CFLAGS}" | |
6fbf66fa JY |
1089 | fi |
1090 | ||
40efb635 GD |
1091 | dnl |
1092 | dnl check for LZ4 library | |
1093 | dnl | |
1094 | ||
1095 | AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4]) | |
1096 | AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4]) | |
1097 | if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then | |
1098 | AC_CHECKING([for LZ4 Library and Header files]) | |
1099 | havelz4lib=1 | |
1100 | ||
1101 | # if LZ4_LIBS is set, we assume it will work, otherwise test | |
1102 | if test -z "${LZ4_LIBS}"; then | |
1103 | AC_CHECK_LIB(lz4, LZ4_compress, | |
1104 | [ LZ4_LIBS="-llz4" ], | |
1105 | [ | |
1106 | AC_MSG_RESULT([LZ4 library not found.]) | |
1107 | havelz4lib=0 | |
1108 | ]) | |
1109 | fi | |
1110 | ||
1111 | saved_CFLAGS="${CFLAGS}" | |
1112 | CFLAGS="${CFLAGS} ${LZ4_CFLAGS}" | |
fb69bfd0 | 1113 | AC_CHECK_HEADERS(lz4.h, |
40efb635 GD |
1114 | , |
1115 | [ | |
1116 | AC_MSG_RESULT([LZ4 headers not found.]) | |
1117 | havelz4lib=0 | |
1118 | ]) | |
1119 | ||
1120 | if test $havelz4lib = 0 ; then | |
4308f237 GD |
1121 | AC_MSG_RESULT([LZ4 library or header not found, using version in src/compat/compat-lz4.*]) |
1122 | AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/]) | |
1123 | LZ4_LIBS="" | |
40efb635 GD |
1124 | fi |
1125 | OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}" | |
1126 | OPTIONAL_LZ4_LIBS="${LZ4_LIBS}" | |
1127 | AC_DEFINE(ENABLE_LZ4, 1, [Enable LZ4 compression library]) | |
1128 | CFLAGS="${saved_CFLAGS}" | |
1129 | fi | |
1130 | ||
1131 | ||
f33ee6bc DS |
1132 | dnl |
1133 | dnl Check for systemd | |
1134 | dnl | |
3280d8c8 | 1135 | AM_CONDITIONAL([ENABLE_SYSTEMD], [test "${enable_systemd}" = "yes"]) |
f33ee6bc DS |
1136 | if test "$enable_systemd" = "yes" ; then |
1137 | PKG_CHECK_MODULES([libsystemd], [systemd libsystemd], | |
1138 | [], | |
1139 | [PKG_CHECK_MODULES([libsystemd], [libsystemd-daemon])] | |
1140 | ) | |
8ba3e258 DS |
1141 | |
1142 | PKG_CHECK_EXISTS( [libsystemd > 216], | |
1143 | [AC_DEFINE([SYSTEMD_NEWER_THAN_216], [1], | |
1144 | [systemd is newer than v216])] | |
1145 | ) | |
1146 | ||
f33ee6bc DS |
1147 | AC_CHECK_HEADERS(systemd/sd-daemon.h, |
1148 | , | |
1149 | [ | |
1150 | AC_MSG_ERROR([systemd development headers not found.]) | |
1151 | ]) | |
1152 | ||
1153 | saved_LIBS="${LIBS}" | |
1154 | LIBS="${LIBS} ${libsystemd_LIBS}" | |
1155 | AC_CHECK_FUNCS([sd_booted], [], [AC_MSG_ERROR([systemd library is missing sd_booted()])]) | |
1156 | OPTIONAL_SYSTEMD_LIBS="${libsystemd_LIBS}" | |
1157 | AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd integration]) | |
1158 | LIBS="${saved_LIBS}" | |
ca5b4c2a CH |
1159 | |
1160 | if test -n "${SYSTEMD_UNIT_DIR}"; then | |
1161 | systemdunitdir="${SYSTEMD_UNIT_DIR}" | |
1162 | else | |
1163 | systemdunitdir="\${libdir}/systemd/system" | |
1164 | fi | |
3de7be7b CH |
1165 | |
1166 | if test -n "${TMPFILES_DIR}"; then | |
1167 | tmpfilesdir="${TMPFILES_DIR}" | |
1168 | else | |
1169 | tmpfilesdir="\${libdir}/tmpfiles.d" | |
1170 | fi | |
f33ee6bc | 1171 | fi |
40efb635 | 1172 | |
38d96bd7 | 1173 | |
7046ff20 ABL |
1174 | AC_MSG_CHECKING([git checkout]) |
1175 | GIT_CHECKOUT="no" | |
1176 | if test -n "${GIT}" -a -d "${srcdir}/.git"; then | |
1177 | AC_DEFINE([HAVE_CONFIG_VERSION_H], [1], [extra version available in config-version.h]) | |
1178 | GIT_CHECKOUT="yes" | |
1179 | fi | |
1180 | AC_MSG_RESULT([${GIT_CHECKOUT}]) | |
1181 | ||
51bd56f4 ABL |
1182 | if test -n "${SP_PLATFORM_WINDOWS}"; then |
1183 | AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #" | |
1184 | AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #" | |
1185 | else | |
1186 | AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['/'], [Path separator]) | |
1187 | AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["/"], [Path separator]) | |
1188 | fi | |
1189 | ||
1190 | dnl enable --x509-username-field feature if requested | |
1191 | if test "${enable_x509_alt_username}" = "yes"; then | |
86d8cd68 SK |
1192 | if test "${with_crypto_library}" = "mbedtls" ; then |
1193 | AC_MSG_ERROR([mbed TLS does not support the --x509-username-field feature]) | |
51bd56f4 ABL |
1194 | fi |
1195 | ||
1196 | AC_DEFINE([ENABLE_X509ALTUSERNAME], [1], [Enable --x509-username-field feature]) | |
1197 | fi | |
1198 | ||
1199 | test "${ac_cv_header_sys_uio_h}" = "yes" && AC_DEFINE([HAVE_IOVEC], [1], [struct iovec needed for IPv6 support]) | |
1200 | test "${enable_multi}" = "yes" && AC_DEFINE([ENABLE_CLIENT_SERVER], [1], [Enable client/server capability]) | |
1201 | test "${enable_server}" = "no" && AC_DEFINE([ENABLE_CLIENT_ONLY], [1], [Enable client capability only]) | |
1202 | test "${enable_management}" = "yes" && AC_DEFINE([ENABLE_MANAGEMENT], [1], [Enable management server capability]) | |
51bd56f4 ABL |
1203 | test "${enable_multihome}" = "yes" && AC_DEFINE([ENABLE_MULTIHOME], [1], [Enable multi-homed UDP server capability]) |
1204 | test "${enable_debug}" = "yes" && AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging support]) | |
1205 | test "${enable_small}" = "yes" && AC_DEFINE([ENABLE_SMALL], [1], [Enable smaller executable size]) | |
1206 | test "${enable_fragment}" = "yes" && AC_DEFINE([ENABLE_FRAGMENT], [1], [Enable internal fragmentation support]) | |
1207 | test "${enable_port_share}" = "yes" && AC_DEFINE([ENABLE_PORT_SHARE], [1], [Enable TCP Server port sharing]) | |
1208 | test "${enable_def_auth}" = "yes" && AC_DEFINE([ENABLE_DEF_AUTH], [1], [Enable deferred authentication]) | |
1209 | test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal packet filter]) | |
1210 | test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers]) | |
c3fc703d | 1211 | |
9b33b5a4 | 1212 | if test "${enable_crypto}" = "yes"; then |
31b0bebe | 1213 | test "${have_crypto}" != "yes" && AC_MSG_ERROR([${with_crypto_library} crypto is required but missing]) |
c353af2f | 1214 | test "${enable_crypto_ofb_cfb}" = "yes" && AC_DEFINE([ENABLE_OFB_CFB_MODE], [1], [Enable OFB and CFB cipher modes]) |
66407e11 | 1215 | test "${have_crypto_aead_modes}" = "yes" && AC_DEFINE([HAVE_AEAD_CIPHER_MODES], [1], [Use crypto library]) |
31b0bebe SK |
1216 | OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_CFLAGS}" |
1217 | OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_LIBS}" | |
9b33b5a4 ABL |
1218 | AC_DEFINE([ENABLE_CRYPTO], [1], [Enable crypto library]) |
1219 | fi | |
1220 | ||
bdae4110 | 1221 | if test "${enable_plugins}" = "yes"; then |
bdae4110 | 1222 | OPTIONAL_DL_LIBS="${DL_LIBS}" |
8065cd1c | 1223 | AC_DEFINE([ENABLE_PLUGIN], [1], [Enable plug-in support]) |
ce8271f5 ABL |
1224 | else |
1225 | enable_plugin_auth_pam="no" | |
1226 | enable_plugin_down_root="no" | |
bdae4110 ABL |
1227 | fi |
1228 | ||
c3fc703d ABL |
1229 | if test "${enable_iproute2}" = "yes"; then |
1230 | test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing]) | |
1231 | AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) | |
1232 | else | |
1233 | if test "${WIN32}" != "yes"; then | |
1234 | test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing]) | |
1235 | test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing]) | |
1236 | fi | |
1237 | fi | |
51bd56f4 | 1238 | |
cd5990e0 ABL |
1239 | if test "${enable_selinux}" = "yes"; then |
1240 | test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing]) | |
1241 | OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}" | |
1242 | AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support]) | |
1243 | fi | |
1244 | ||
74bbc71b ABL |
1245 | if test "${enable_lzo}" = "yes"; then |
1246 | test "${have_lzo}" != "yes" && AC_MSG_ERROR([lzo enabled but missing]) | |
1247 | OPTIONAL_LZO_CFLAGS="${LZO_CFLAGS}" | |
1248 | OPTIONAL_LZO_LIBS="${LZO_LIBS}" | |
1249 | AC_DEFINE([ENABLE_LZO], [1], [Enable LZO compression library]) | |
1250 | fi | |
38d96bd7 JY |
1251 | if test "${enable_comp_stub}" = "yes"; then |
1252 | test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and lzo enabled (use --disable-lzo)]) | |
40efb635 | 1253 | test "${enable_lz4}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and LZ4 enabled (use --disable-lz4)]) |
38d96bd7 | 1254 | AC_DEFINE([ENABLE_COMP_STUB], [1], [Enable compression stub capability]) |
07084261 ABL |
1255 | fi |
1256 | ||
18b5fbdf ABL |
1257 | if test "${enable_pkcs11}" = "yes"; then |
1258 | test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing]) | |
ec828db6 | 1259 | test "${enable_crypto}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if crypto is enabled]) |
18b5fbdf ABL |
1260 | OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}" |
1261 | OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}" | |
1262 | AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11]) | |
3c6d3220 DW |
1263 | PKG_CHECK_MODULES( |
1264 | [P11KIT], | |
1265 | [p11-kit-1], | |
1266 | [proxy_module="`$PKG_CONFIG --variable=proxy_module p11-kit-1`" | |
1267 | AC_DEFINE_UNQUOTED([DEFAULT_PKCS11_MODULE], "${proxy_module}", [p11-kit proxy])], | |
1268 | [] | |
1269 | ) | |
18b5fbdf ABL |
1270 | fi |
1271 | ||
51bd56f4 ABL |
1272 | if test "${enable_pedantic}" = "yes"; then |
1273 | enable_strict="yes" | |
31444111 | 1274 | CFLAGS="${CFLAGS} -pedantic" |
058f0efd | 1275 | AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode]) |
51bd56f4 ABL |
1276 | fi |
1277 | if test "${enable_strict}" = "yes"; then | |
1278 | CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" | |
99385447 | 1279 | fi |
51194ffd SK |
1280 | if test "${enable_werror}" = "yes"; then |
1281 | CFLAGS="${CFLAGS} -Werror" | |
1282 | fi | |
99385447 | 1283 | |
c3fc703d ABL |
1284 | if test "${WIN32}" = "yes"; then |
1285 | test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) | |
1286 | fi | |
1287 | ||
ce8271f5 ABL |
1288 | if test "${enable_plugin_auth_pam}" = "yes"; then |
1289 | PLUGIN_AUTH_PAM_CFLAGS="${LIBPAM_CFLAGS}" | |
1290 | if test "${enable_pam_dlopen}" = "yes"; then | |
1291 | AC_DEFINE([USE_PAM_DLOPEN], [1], [dlopen libpam]) | |
1292 | PLUGIN_AUTH_PAM_LIBS="${DL_LIBS}" | |
1293 | else | |
1294 | test -z "${LIBPAM_LIBS}" && AC_MSG_ERROR([libpam required but missing]) | |
1295 | PLUGIN_AUTH_PAM_LIBS="${LIBPAM_LIBS}" | |
1296 | fi | |
1297 | fi | |
1298 | ||
0d1a75bf LS |
1299 | if test "${enable_async_push}" = "yes"; then |
1300 | AC_CHECK_HEADERS( | |
1301 | [sys/inotify.h], | |
1302 | AC_DEFINE([ENABLE_ASYNC_PUSH], [1], [Enable async push]), | |
1303 | AC_MSG_ERROR([inotify.h not found.]) | |
1304 | ) | |
1305 | fi | |
1306 | ||
fcff80aa ABL |
1307 | CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" |
1308 | AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings]) | |
1309 | ||
ac2447cd ABL |
1310 | TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID" |
1311 | TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR" | |
1312 | TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR" | |
1313 | AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id]) | |
1314 | AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN]) | |
1315 | AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN]) | |
1316 | AC_SUBST([TAP_WIN_COMPONENT_ID]) | |
1317 | AC_SUBST([TAP_WIN_MIN_MAJOR]) | |
1318 | AC_SUBST([TAP_WIN_MIN_MINOR]) | |
1bda73a7 | 1319 | |
bdae4110 | 1320 | AC_SUBST([OPTIONAL_DL_LIBS]) |
cd5990e0 | 1321 | AC_SUBST([OPTIONAL_SELINUX_LIBS]) |
9b33b5a4 ABL |
1322 | AC_SUBST([OPTIONAL_CRYPTO_CFLAGS]) |
1323 | AC_SUBST([OPTIONAL_CRYPTO_LIBS]) | |
74bbc71b ABL |
1324 | AC_SUBST([OPTIONAL_LZO_CFLAGS]) |
1325 | AC_SUBST([OPTIONAL_LZO_LIBS]) | |
40efb635 GD |
1326 | AC_SUBST([OPTIONAL_LZ4_CFLAGS]) |
1327 | AC_SUBST([OPTIONAL_LZ4_LIBS]) | |
f33ee6bc | 1328 | AC_SUBST([OPTIONAL_SYSTEMD_LIBS]) |
18b5fbdf ABL |
1329 | AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS]) |
1330 | AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS]) | |
bdae4110 | 1331 | |
ce8271f5 ABL |
1332 | AC_SUBST([PLUGIN_AUTH_PAM_CFLAGS]) |
1333 | AC_SUBST([PLUGIN_AUTH_PAM_LIBS]) | |
1334 | ||
51bd56f4 | 1335 | AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) |
7046ff20 | 1336 | AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"]) |
ce8271f5 ABL |
1337 | AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "yes"]) |
1338 | AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"]) | |
a85ba0e0 | 1339 | AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"]) |
f91ab283 | 1340 | AM_CONDITIONAL([HAVE_LD_WRAP_SUPPORT], [test "${have_ld_wrap_support}" = "yes"]) |
1bda73a7 | 1341 | |
880a2ae9 | 1342 | sampledir="\$(docdir)/sample" |
ce8271f5 | 1343 | AC_SUBST([plugindir]) |
880a2ae9 ABL |
1344 | AC_SUBST([sampledir]) |
1345 | ||
ca5b4c2a | 1346 | AC_SUBST([systemdunitdir]) |
3de7be7b | 1347 | AC_SUBST([tmpfilesdir]) |
ca5b4c2a | 1348 | |
40cb4cfc JN |
1349 | VENDOR_SRC_ROOT="\$(abs_top_srcdir)/vendor/" |
1350 | VENDOR_DIST_ROOT="\$(abs_top_builddir)/vendor/dist" | |
1351 | VENDOR_BUILD_ROOT="\$(abs_top_builddir)/vendor/.build" | |
1352 | AC_SUBST([VENDOR_SRC_ROOT]) | |
1353 | AC_SUBST([VENDOR_BUILD_ROOT]) | |
1354 | AC_SUBST([VENDOR_DIST_ROOT]) | |
1355 | ||
1356 | TEST_LDFLAGS="-lcmocka -L\$(abs_top_builddir)/vendor/dist/lib -Wl,-rpath,\$(abs_top_builddir)/vendor/dist/lib" | |
1357 | TEST_CFLAGS="-I\$(top_srcdir)/include -I\$(abs_top_builddir)/vendor/dist/include" | |
1358 | ||
1359 | AC_SUBST([TEST_LDFLAGS]) | |
1360 | AC_SUBST([TEST_CFLAGS]) | |
1361 | ||
45f6e799 DS |
1362 | # Check if cmake is available and cmocka git submodule is initialized, |
1363 | # needed for unit testing | |
1364 | AC_CHECK_PROGS([CMAKE], [cmake]) | |
1365 | if test -n "${CMAKE}"; then | |
ee4f37c3 | 1366 | if test -f "${srcdir}/vendor/cmocka/CMakeLists.txt"; then |
45f6e799 DS |
1367 | AM_CONDITIONAL([CMOCKA_INITIALIZED], [true]) |
1368 | else | |
1369 | AM_CONDITIONAL([CMOCKA_INITIALIZED], [false]) | |
1370 | AC_MSG_RESULT([!! WARNING !! The cmoka git submodule has not been initialized or updated. Unit testing cannot be performed.]) | |
1371 | fi | |
1372 | else | |
1373 | AC_MSG_RESULT([!! WARNING !! CMake is NOT available. Unit testing cannot be performed.]) | |
1374 | AM_CONDITIONAL([CMOCKA_INITIALIZED], [false]) | |
1375 | fi | |
1376 | ||
1377 | ||
51bd56f4 | 1378 | AC_CONFIG_FILES([ |
6187644b | 1379 | version.sh |
1bda73a7 | 1380 | Makefile |
98bc1a3e | 1381 | build/Makefile |
4b1a82db ABL |
1382 | build/msvc/Makefile |
1383 | build/msvc/msvc-generate/Makefile | |
34cb9132 ABL |
1384 | distro/Makefile |
1385 | distro/rpm/Makefile | |
1386 | distro/rpm/openvpn.spec | |
ca5b4c2a | 1387 | distro/systemd/Makefile |
34cb9132 ABL |
1388 | include/Makefile |
1389 | src/Makefile | |
dc81e743 | 1390 | src/compat/Makefile |
34cb9132 ABL |
1391 | src/openvpn/Makefile |
1392 | src/openvpnserv/Makefile | |
ce8271f5 ABL |
1393 | src/plugins/Makefile |
1394 | src/plugins/auth-pam/Makefile | |
1395 | src/plugins/down-root/Makefile | |
34cb9132 | 1396 | tests/Makefile |
40cb4cfc JN |
1397 | tests/unit_tests/Makefile |
1398 | tests/unit_tests/example_test/Makefile | |
698e268a | 1399 | tests/unit_tests/openvpn/Makefile |
ac42df1a SK |
1400 | tests/unit_tests/plugins/Makefile |
1401 | tests/unit_tests/plugins/auth-pam/Makefile | |
40cb4cfc | 1402 | vendor/Makefile |
34cb9132 ABL |
1403 | sample/Makefile |
1404 | doc/Makefile | |
1bda73a7 | 1405 | ]) |
34cb9132 | 1406 | AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh]) |
51bd56f4 | 1407 | AC_OUTPUT |