]>
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 | |
ccf9d572 | 7 | dnl Copyright (C) 2002-2023 OpenVPN 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 | ]) | |
8b915c48 SN |
57 | |
58 | dnl Automake 1.14+ warns if sources are in sub-directories but subdir-objects | |
59 | dnl options is not enabled. However, automake before 1.15a has a bug that causes | |
60 | dnl variable expansion to fail in foo_SOURCES when this option is used. | |
61 | dnl As most of our build systems are now likely to use automake 1.16+ add a | |
62 | dnl work around to conditionally add subdir-objects option. | |
63 | m4_define([subdir_objects], [ | |
64 | m4_esyscmd([automake --version | | |
65 | head -1 | | |
66 | awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 16) { print "subdir-objects" }}' | |
67 | ]) | |
68 | ]) | |
69 | ||
83d6da50 MA |
70 | # This foreign option prevents autoreconf from overriding our COPYING and |
71 | # INSTALL targets: | |
8b915c48 | 72 | AM_INIT_AUTOMAKE(foreign serial_tests subdir_objects 1.9) dnl NB: Do not [quote] this parameter. |
51bd56f4 ABL |
73 | AC_CANONICAL_HOST |
74 | AC_USE_SYSTEM_EXTENSIONS | |
6fbf66fa | 75 | |
51bd56f4 ABL |
76 | AC_ARG_ENABLE( |
77 | [lzo], | |
40a56e79 | 78 | [AS_HELP_STRING([--disable-lzo], [disable LZO compression support @<:@default=yes@:>@])], |
51bd56f4 | 79 | , |
40a56e79 | 80 | [enable_lzo="yes"] |
6c34e74f JY |
81 | ) |
82 | ||
40efb635 GD |
83 | AC_ARG_ENABLE(lz4, |
84 | [ --disable-lz4 Disable LZ4 compression support], | |
85 | [enable_lz4="$enableval"], | |
86 | [enable_lz4="yes"] | |
87 | ) | |
88 | ||
38d96bd7 JY |
89 | AC_ARG_ENABLE(comp-stub, |
90 | [ --enable-comp-stub Don't compile compression support but still allow limited interoperability with compression-enabled peers], | |
91 | [enable_comp_stub="$enableval"], | |
92 | [enable_comp_stub="no"] | |
6fbf66fa JY |
93 | ) |
94 | ||
c353af2f SK |
95 | AC_ARG_ENABLE( |
96 | [ofb-cfb], | |
104360b4 | 97 | [AS_HELP_STRING([--disable-ofb-cfb], [disable support for OFB and CFB cipher modes @<:@default=yes@:>@])], |
c353af2f SK |
98 | , |
99 | [enable_crypto_ofb_cfb="yes"] | |
100 | ) | |
101 | ||
51bd56f4 ABL |
102 | AC_ARG_ENABLE( |
103 | [x509-alt-username], | |
709f7a1f | 104 | [AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature @<:@default=no@:>@])], |
51bd56f4 ABL |
105 | , |
106 | [enable_x509_alt_username="no"] | |
6fbf66fa JY |
107 | ) |
108 | ||
51bd56f4 ABL |
109 | AC_ARG_ENABLE( |
110 | [plugins], | |
709f7a1f | 111 | [AS_HELP_STRING([--disable-plugins], [disable plug-in support @<:@default=yes@:>@])], |
51bd56f4 ABL |
112 | , |
113 | [enable_plugins="yes"] | |
0c1f7ad5 DS |
114 | ) |
115 | ||
51bd56f4 ABL |
116 | AC_ARG_ENABLE( |
117 | [management], | |
709f7a1f | 118 | [AS_HELP_STRING([--disable-management], [disable management server support @<:@default=yes@:>@])], |
51bd56f4 ABL |
119 | , |
120 | [enable_management="yes"] | |
ce98fd24 JY |
121 | ) |
122 | ||
51bd56f4 ABL |
123 | AC_ARG_ENABLE( |
124 | [pkcs11], | |
709f7a1f | 125 | [AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support @<:@default=no@:>@])], |
51bd56f4 | 126 | , |
18b5fbdf | 127 | [enable_pkcs11="no"] |
6fbf66fa JY |
128 | ) |
129 | ||
51bd56f4 ABL |
130 | AC_ARG_ENABLE( |
131 | [fragment], | |
709f7a1f | 132 | [AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])], |
51bd56f4 ABL |
133 | , |
134 | [enable_fragment="yes"] | |
8bc93d7f JY |
135 | ) |
136 | ||
51bd56f4 ABL |
137 | AC_ARG_ENABLE( |
138 | [port-share], | |
709f7a1f | 139 | [AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share) @<:@default=yes@:>@])], |
51bd56f4 ABL |
140 | , |
141 | [enable_port_share="yes"] | |
6fbf66fa JY |
142 | ) |
143 | ||
51bd56f4 ABL |
144 | AC_ARG_ENABLE( |
145 | [debug], | |
709f7a1f | 146 | [AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages) @<:@default=yes@:>@])], |
51bd56f4 ABL |
147 | , |
148 | [enable_debug="yes"] | |
6fbf66fa JY |
149 | ) |
150 | ||
51bd56f4 ABL |
151 | AC_ARG_ENABLE( |
152 | [small], | |
104360b4 | 153 | [AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=no@:>@])], |
51bd56f4 ABL |
154 | , |
155 | [enable_small="no"] | |
6fbf66fa JY |
156 | ) |
157 | ||
e34437c2 AQ |
158 | AC_ARG_ENABLE( |
159 | [dco], | |
2a1a21e3 | 160 | [AS_HELP_STRING([--disable-dco], [disable data channel offload support using the ovpn-dco kernel module @<:@default=yes@:>@ on Linux/FreeBSD, can't disable on Windows])], |
e34437c2 | 161 | , |
2a1a21e3 FL |
162 | [ |
163 | case "$host" in | |
164 | *-*-linux*) | |
165 | enable_dco="auto" | |
166 | ;; | |
167 | *-*-freebsd*) | |
168 | enable_dco="auto" | |
169 | ;; | |
170 | *) | |
171 | # note that this does not disable it for Windows | |
172 | enable_dco="no" | |
173 | ;; | |
174 | esac | |
175 | ] | |
e34437c2 AQ |
176 | ) |
177 | ||
51bd56f4 ABL |
178 | AC_ARG_ENABLE( |
179 | [iproute2], | |
2a1a21e3 | 180 | [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 (disables DCO) @<:@default=no@:>@])], |
51bd56f4 ABL |
181 | , |
182 | [enable_iproute2="no"] | |
fb7aa54a JY |
183 | ) |
184 | ||
ce8271f5 ABL |
185 | AC_ARG_ENABLE( |
186 | [plugin-auth-pam], | |
5a57e201 | 187 | [AS_HELP_STRING([--disable-plugin-auth-pam], [disable auth-pam plugin @<:@default=platform specific@:>@])], |
ce8271f5 | 188 | , |
5a57e201 ABL |
189 | [ |
190 | case "$host" in | |
191 | *-*-openbsd*) enable_plugin_auth_pam="no";; | |
192 | *-mingw*) enable_plugin_auth_pam="no";; | |
193 | *) enable_plugin_auth_pam="yes";; | |
194 | esac | |
195 | ] | |
ce8271f5 ABL |
196 | ) |
197 | ||
198 | AC_ARG_ENABLE( | |
199 | [plugin-down-root], | |
5a57e201 ABL |
200 | [AS_HELP_STRING([--disable-plugin-down-root], [disable down-root plugin @<:@default=platform specific@:>@])], |
201 | , | |
202 | [ | |
203 | case "$host" in | |
204 | *-mingw*) enable_plugin_down_root="no";; | |
205 | *) enable_plugin_down_root="yes";; | |
206 | esac | |
207 | ] | |
ce8271f5 ABL |
208 | ) |
209 | ||
210 | AC_ARG_ENABLE( | |
211 | [pam-dlopen], | |
212 | [AS_HELP_STRING([--enable-pam-dlopen], [dlopen libpam @<:@default=no@:>@])], | |
213 | , | |
214 | [enable_pam_dlopen="no"] | |
215 | ) | |
216 | ||
51bd56f4 ABL |
217 | AC_ARG_ENABLE( |
218 | [strict], | |
709f7a1f | 219 | [AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])], |
51bd56f4 ABL |
220 | , |
221 | [enable_strict="no"] | |
6fbf66fa JY |
222 | ) |
223 | ||
51bd56f4 ABL |
224 | AC_ARG_ENABLE( |
225 | [pedantic], | |
709f7a1f | 226 | [AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option) @<:@default=no@:>@])], |
51bd56f4 ABL |
227 | , |
228 | [enable_pedantic="no"] | |
6fbf66fa JY |
229 | ) |
230 | ||
51194ffd SK |
231 | AC_ARG_ENABLE( |
232 | [werror], | |
42d9f324 | 233 | [AS_HELP_STRING([--enable-werror], [promote compiler warnings to errors, will cause builds to fail if the compiler issues warnings (debugging option) @<:@default=no@:>@])], |
51194ffd SK |
234 | , |
235 | [enable_werror="no"] | |
236 | ) | |
237 | ||
51bd56f4 ABL |
238 | AC_ARG_ENABLE( |
239 | [strict-options], | |
709f7a1f | 240 | [AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option) @<:@default=no@:>@])], |
51bd56f4 ABL |
241 | , |
242 | [enable_strict_options="no"] | |
6fbf66fa JY |
243 | ) |
244 | ||
51bd56f4 ABL |
245 | AC_ARG_ENABLE( |
246 | [selinux], | |
709f7a1f | 247 | [AS_HELP_STRING([--enable-selinux], [enable SELinux support @<:@default=no@:>@])], |
51bd56f4 ABL |
248 | , |
249 | [enable_selinux="no"] | |
99385447 JY |
250 | ) |
251 | ||
51bd56f4 ABL |
252 | AC_ARG_ENABLE( |
253 | [systemd], | |
ccb636c7 | 254 | [AS_HELP_STRING([--enable-systemd], [enable systemd support @<:@default=no@:>@])], |
51bd56f4 ABL |
255 | , |
256 | [enable_systemd="no"] | |
9449e6a9 FC |
257 | ) |
258 | ||
0d1a75bf LS |
259 | AC_ARG_ENABLE( |
260 | [async-push], | |
1a8f6b91 | 261 | [AS_HELP_STRING([--enable-async-push], [enable async-push support for plugins providing deferred authentication @<:@default=no@:>@])], |
e62eccf0 | 262 | , |
0d1a75bf LS |
263 | [enable_async_push="no"] |
264 | ) | |
265 | ||
10b4b65e ABL |
266 | AC_ARG_WITH( |
267 | [special-build], | |
268 | [AS_HELP_STRING([--with-special-build=STRING], [specify special build string])], | |
269 | [test -n "${withval}" && AC_DEFINE_UNQUOTED([CONFIGURE_SPECIAL_BUILD], ["${withval}"], [special build string])] | |
270 | ) | |
271 | ||
51bd56f4 ABL |
272 | AC_ARG_WITH( |
273 | [mem-check], | |
709f7a1f | 274 | [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|dmalloc|valgrind|ssl @<:@default=no@:>@])], |
51bd56f4 ABL |
275 | [ |
276 | case "${withval}" in | |
277 | dmalloc|valgrind|ssl|no) ;; | |
278 | *) AC_MSG_ERROR([bad value ${withval} for --mem-check]) ;; | |
279 | esac | |
280 | ], | |
281 | [with_mem_check="no"] | |
6fbf66fa JY |
282 | ) |
283 | ||
51bd56f4 | 284 | AC_ARG_WITH( |
9b33b5a4 | 285 | [crypto-library], |
f6dca235 | 286 | [AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|mbedtls|wolfssl @<:@default=openssl@:>@])], |
51bd56f4 | 287 | [ |
86d8cd68 | 288 | case "${withval}" in |
f6dca235 | 289 | openssl|mbedtls|wolfssl) ;; |
9b33b5a4 | 290 | *) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;; |
51bd56f4 ABL |
291 | esac |
292 | ], | |
9b33b5a4 | 293 | [with_crypto_library="openssl"] |
0a180174 | 294 | ) |
0a180174 | 295 | |
f6dca235 JS |
296 | AC_ARG_ENABLE( |
297 | [wolfssl-options-h], | |
298 | [AS_HELP_STRING([--disable-wolfssl-options-h], [Disable including options.h in wolfSSL @<:@default=yes@:>@])], | |
299 | , | |
300 | [enable_wolfssl_options_h="yes"] | |
301 | ) | |
302 | ||
0df2261d AS |
303 | AC_ARG_WITH( |
304 | [openssl-engine], | |
305 | [AS_HELP_STRING([--with-openssl-engine], [enable engine support with OpenSSL. Default enabled for OpenSSL < 3.0, auto,yes,no @<:@default=auto@:>@])], | |
306 | [ | |
307 | case "${withval}" in | |
308 | auto|yes|no) ;; | |
309 | *) AC_MSG_ERROR([bad value ${withval} for --with-engine]) ;; | |
310 | esac | |
311 | ], | |
312 | [with_openssl_engine="auto"] | |
313 | ) | |
314 | ||
4590c383 CH |
315 | AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@]) |
316 | if test -n "${PLUGINDIR}"; then | |
317 | plugindir="${PLUGINDIR}" | |
318 | else | |
319 | plugindir="\${libdir}/openvpn/plugins" | |
320 | fi | |
ce8271f5 | 321 | |
6440083e | 322 | AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host]) |
c4d5bcd7 | 323 | AM_CONDITIONAL([TARGET_LINUX], [false]) |
86715242 | 324 | case "$host" in |
51bd56f4 ABL |
325 | *-*-linux*) |
326 | AC_DEFINE([TARGET_LINUX], [1], [Are we running on Linux?]) | |
c4d5bcd7 | 327 | AM_CONDITIONAL([TARGET_LINUX], [true]) |
51bd56f4 | 328 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["L"], [Target prefix]) |
c6542257 | 329 | have_sitnl="yes" |
51bd56f4 ABL |
330 | ;; |
331 | *-*-solaris*) | |
332 | AC_DEFINE([TARGET_SOLARIS], [1], [Are we running on Solaris?]) | |
333 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["S"], [Target prefix]) | |
4e2038ed | 334 | CPPFLAGS="$CPPFLAGS -D_XPG4_2" |
9c490c26 | 335 | test -x /bin/bash && SHELL="/bin/bash" |
51bd56f4 ABL |
336 | ;; |
337 | *-*-openbsd*) | |
338 | AC_DEFINE([TARGET_OPENBSD], [1], [Are we running on OpenBSD?]) | |
339 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["O"], [Target prefix]) | |
340 | ;; | |
341 | *-*-freebsd*) | |
342 | AC_DEFINE([TARGET_FREEBSD], [1], [Are we running on FreeBSD?]) | |
343 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["F"], [Target prefix]) | |
344 | ;; | |
345 | *-*-netbsd*) | |
346 | AC_DEFINE([TARGET_NETBSD], [1], [Are we running NetBSD?]) | |
347 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["N"], [Target prefix]) | |
348 | ;; | |
349 | *-*-darwin*) | |
350 | AC_DEFINE([TARGET_DARWIN], [1], [Are we running on Mac OS X?]) | |
351 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["M"], [Target prefix]) | |
05f16e84 | 352 | have_tap_header="yes" |
e7303ace | 353 | ac_cv_type_struct_in_pktinfo=no |
51bd56f4 ABL |
354 | ;; |
355 | *-mingw*) | |
356 | AC_DEFINE([TARGET_WIN32], [1], [Are we running WIN32?]) | |
8b80cbc3 | 357 | AC_DEFINE([ENABLE_DCO], [1], [DCO is always enabled on Windows]) |
51bd56f4 | 358 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix]) |
4b1a82db | 359 | CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN" |
5fcd4933 | 360 | CPPFLAGS="${CPPFLAGS} -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA" |
51bd56f4 | 361 | WIN32=yes |
51bd56f4 ABL |
362 | ;; |
363 | *-*-dragonfly*) | |
364 | AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?]) | |
365 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["D"], [Target prefix]) | |
366 | ;; | |
42f13dc0 GD |
367 | *-aix*) |
368 | AC_DEFINE([TARGET_AIX], [1], [Are we running AIX?]) | |
369 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["A"], [Target prefix]) | |
370 | ROUTE="/usr/sbin/route" | |
371 | have_tap_header="yes" | |
372 | ac_cv_header_net_if_h="no" # exists, but breaks things | |
373 | ;; | |
51bd56f4 ABL |
374 | *) |
375 | AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix]) | |
05f16e84 | 376 | have_tap_header="yes" |
51bd56f4 | 377 | ;; |
6fbf66fa JY |
378 | esac |
379 | ||
e3ad1fc4 SN |
380 | AM_CONDITIONAL([CROSS_COMPILING], test "${cross_compiling}" = "yes") |
381 | ||
51bd56f4 ABL |
382 | PKG_PROG_PKG_CONFIG |
383 | AC_PROG_CPP | |
6fbf66fa | 384 | AC_PROG_INSTALL |
51bd56f4 | 385 | AC_PROG_LN_S |
7046ff20 | 386 | AC_PROG_SED |
51bd56f4 | 387 | AC_PROG_MAKE_SET |
6fbf66fa | 388 | |
c3fc703d ABL |
389 | AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility]) |
390 | AC_ARG_VAR([ROUTE], [full path to route utility]) | |
391 | AC_ARG_VAR([IPROUTE], [full path to ip utility]) | |
392 | AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests | |
7046ff20 | 393 | AC_ARG_VAR([GIT], [path to git utility]) |
ba79c71d | 394 | AC_ARG_VAR([SYSTEMD_ASK_PASSWORD], [path to systemd-ask-password utility]) |
ca5b4c2a | 395 | AC_ARG_VAR([SYSTEMD_UNIT_DIR], [Path of systemd unit directory @<:@default=LIBDIR/systemd/system@:>@]) |
3de7be7b | 396 | AC_ARG_VAR([TMPFILES_DIR], [Path of tmpfiles directory @<:@default=LIBDIR/tmpfiles.d@:>@]) |
c3fc703d ABL |
397 | AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) |
398 | AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) | |
399 | AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) | |
ba79c71d | 400 | AC_PATH_PROGS([SYSTEMD_ASK_PASSWORD], [systemd-ask-password],, [$PATH:/usr/local/bin:/usr/bin:/bin]) |
c3fc703d | 401 | AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests |
7046ff20 | 402 | AC_CHECK_PROGS([GIT], [git]) # optional |
c3fc703d ABL |
403 | AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) |
404 | AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) | |
405 | AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) | |
ba79c71d | 406 | AC_DEFINE_UNQUOTED([SYSTEMD_ASK_PASSWORD_PATH], ["$SYSTEMD_ASK_PASSWORD"], [Path to systemd-ask-password tool]) |
c3fc703d | 407 | |
f500c49c DS |
408 | # |
409 | # man page generation - based on python-docutils | |
410 | # | |
411 | AC_ARG_VAR([RST2MAN], [path to rst2man utility]) | |
412 | AC_ARG_VAR([RST2HTML], [path to rst2html utility]) | |
b61d1988 AQ |
413 | AC_CHECK_PROGS([RST2MAN], [rst2man rst2man.py]) |
414 | AC_CHECK_PROGS([RST2HTML], [rst2html rst2html.py]) | |
f500c49c DS |
415 | AM_CONDITIONAL([HAVE_PYDOCUTILS], [test "${RST2MAN}" -a "${RST2HTML}"]) |
416 | ||
9223336a SK |
417 | # Set -std=c99 unless user already specified a -std= |
418 | case "${CFLAGS}" in | |
419 | *-std=*) ;; | |
420 | *) CFLAGS="${CFLAGS} -std=c99" ;; | |
421 | esac | |
422 | ||
98bc1a3e ABL |
423 | # |
424 | # Libtool | |
425 | # | |
426 | ifdef( | |
427 | [LT_INIT], | |
428 | [ | |
429 | LT_INIT([win32-dll]) | |
430 | LT_LANG([Windows Resource]) | |
431 | ], | |
432 | [ | |
433 | AC_LIBTOOL_WIN32_DLL | |
434 | AC_LIBTOOL_RC | |
435 | AC_PROG_LIBTOOL | |
436 | ] | |
437 | ) | |
438 | ||
6fbf66fa JY |
439 | AC_C_CONST |
440 | AC_C_INLINE | |
441 | AC_C_VOLATILE | |
442 | AC_TYPE_OFF_T | |
443 | AC_TYPE_PID_T | |
444 | AC_TYPE_SIZE_T | |
445 | AC_TYPE_UID_T | |
51bd56f4 | 446 | AC_TYPE_SIGNAL |
0dbd45db | 447 | AX_TYPE_SOCKLEN_T |
51bd56f4 ABL |
448 | AC_CHECK_SIZEOF([unsigned int]) |
449 | AC_CHECK_SIZEOF([unsigned long]) | |
450 | AC_CHECK_HEADERS([ \ | |
8c18d7c9 | 451 | fcntl.h io.h \ |
b8510baa AS |
452 | sys/types.h sys/socket.h \ |
453 | unistd.h dlfcn.h \ | |
51bd56f4 ABL |
454 | netinet/in.h netinet/in_systm.h \ |
455 | netinet/tcp.h arpa/inet.h netdb.h \ | |
cdc65ea0 | 456 | versionhelpers.h \ |
51bd56f4 | 457 | ]) |
cab53332 | 458 | AC_CHECK_HEADERS([ \ |
a2d747bb | 459 | sys/time.h sys/ioctl.h sys/stat.h \ |
f641637a | 460 | sys/mman.h sys/file.h sys/wait.h \ |
b8510baa | 461 | unistd.h libgen.h stropts.h \ |
76ccc62d | 462 | syslog.h pwd.h grp.h termios.h \ |
7cacdfd4 | 463 | sys/sockio.h sys/uio.h linux/sockios.h \ |
4225114b | 464 | linux/types.h linux/errqueue.h poll.h sys/epoll.h err.h \ |
cab53332 | 465 | ]) |
6fbf66fa | 466 | |
51bd56f4 | 467 | SOCKET_INCLUDES=" |
51bd56f4 | 468 | #include <stdlib.h> |
51bd56f4 ABL |
469 | #ifdef HAVE_SYS_TYPES_H |
470 | #include <sys/types.h> | |
471 | #endif | |
472 | #ifdef HAVE_SYS_SOCKET_H | |
473 | #include <sys/socket.h> | |
474 | #endif | |
7efa60d9 GD |
475 | #ifdef HAVE_NET_IF_H |
476 | #include <net/if.h> | |
477 | #endif | |
51bd56f4 ABL |
478 | #ifdef HAVE_NETINET_IN_H |
479 | #include <netinet/in.h> | |
480 | #endif | |
ba49c9a7 | 481 | #ifdef _WIN32 |
51bd56f4 ABL |
482 | #include <windows.h> |
483 | #endif | |
ba49c9a7 | 484 | #ifdef _WIN32 |
51bd56f4 ABL |
485 | #include <winsock2.h> |
486 | #endif | |
ba49c9a7 | 487 | #ifdef _WIN32 |
51bd56f4 ABL |
488 | #include <ws2tcpip.h> |
489 | #endif | |
2a744891 ABL |
490 | #ifdef HAVE_NETINET_IN_SYSTM_H |
491 | #include <netinet/in_systm.h> | |
492 | #endif | |
4025a595 ABL |
493 | #ifdef HAVE_NETINET_IP_H |
494 | #include <netinet/ip.h> | |
495 | #endif | |
51bd56f4 | 496 | " |
1bda73a7 | 497 | |
cab53332 | 498 | AC_CHECK_HEADERS( |
ddb1f20a | 499 | [net/if.h netinet/ip.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h], |
51bd56f4 | 500 | , |
51bd56f4 | 501 | , |
cab53332 | 502 | [[${SOCKET_INCLUDES}]] |
51bd56f4 ABL |
503 | ) |
504 | ||
505 | AC_CHECK_TYPES( | |
6fbf66fa | 506 | [in_addr_t], |
51bd56f4 ABL |
507 | , |
508 | [AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])], | |
509 | [[${SOCKET_INCLUDES}]] | |
510 | ) | |
dd6714ae GD |
511 | AC_CHECK_TYPES( |
512 | [in_port_t], | |
513 | , | |
514 | [AC_DEFINE([in_port_t], [uint16_t], [Workaround missing in_port_t])], | |
515 | [[${SOCKET_INCLUDES}]] | |
516 | ) | |
6fbf66fa JY |
517 | AC_CHECK_TYPE( |
518 | [struct iphdr], | |
7c0a2b5f | 519 | [AC_DEFINE([HAVE_IPHDR], [1], [struct iphdr needed for IPv6 support])], |
51bd56f4 ABL |
520 | , |
521 | [[${SOCKET_INCLUDES}]] | |
522 | ) | |
6fbf66fa JY |
523 | AC_CHECK_TYPE( |
524 | [struct msghdr], | |
7c0a2b5f | 525 | [AC_DEFINE([HAVE_MSGHDR], [1], [struct msghdr needed for extended socket error support])], |
51bd56f4 ABL |
526 | , |
527 | [[${SOCKET_INCLUDES}]] | |
528 | ) | |
6fbf66fa JY |
529 | AC_CHECK_TYPE( |
530 | [struct cmsghdr], | |
7c0a2b5f | 531 | [AC_DEFINE([HAVE_CMSGHDR], [1], [struct cmsghdr needed for extended socket error support])], |
51bd56f4 ABL |
532 | , |
533 | [[${SOCKET_INCLUDES}]] | |
534 | ) | |
8bc93d7f JY |
535 | AC_CHECK_TYPE( |
536 | [struct in_pktinfo], | |
7c0a2b5f | 537 | [AC_DEFINE([HAVE_IN_PKTINFO], [1], [struct in_pktinfo needed for IP_PKTINFO support])], |
51bd56f4 ABL |
538 | , |
539 | [[${SOCKET_INCLUDES}]] | |
540 | ) | |
87b468d4 HH |
541 | AC_CHECK_TYPE( |
542 | [sa_family_t], | |
543 | [AC_DEFINE([HAVE_SA_FAMILY_T], [1], [sa_family_t, needed to hold AF_* info])], | |
544 | , | |
545 | [[${SOCKET_INCLUDES}]] | |
546 | ) | |
7efa60d9 GD |
547 | AC_CHECK_MEMBER( |
548 | [struct in_pktinfo.ipi_spec_dst], | |
549 | [AC_DEFINE([HAVE_IPI_SPEC_DST], [1], [struct in_pktinfo.ipi_spec_dst needed for IP_PKTINFO support])], | |
550 | , | |
551 | [[${SOCKET_INCLUDES}]] | |
552 | ) | |
51bd56f4 ABL |
553 | AC_CHECK_TYPE( |
554 | [struct sockaddr_in6], | |
555 | , | |
556 | [AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])], | |
557 | [[${SOCKET_INCLUDES}]] | |
558 | ) | |
cab53332 ABL |
559 | AC_CHECK_DECLS( |
560 | [SO_MARK], | |
561 | , | |
562 | , | |
563 | [[${SOCKET_INCLUDES}]] | |
564 | ) | |
2a1a21e3 | 565 | AC_MSG_CHECKING([anonymous union support]) |
9223336a SK |
566 | AC_COMPILE_IFELSE( |
567 | [AC_LANG_PROGRAM( | |
568 | [[ | |
569 | struct mystruct { | |
570 | union { | |
571 | int m1; | |
572 | char m2; | |
573 | }; | |
574 | }; | |
575 | ]], | |
576 | [[ | |
577 | struct mystruct s; | |
578 | s.m1 = 1; s.m2 = 2; | |
579 | ]] | |
580 | )], | |
581 | [ | |
582 | AC_MSG_RESULT([yes]) | |
583 | AC_DEFINE([HAVE_ANONYMOUS_UNION_SUPPORT], [], [Compiler supports anonymous unions]) | |
584 | ], | |
585 | [AC_MSG_RESULT([no])] | |
586 | ) | |
51bd56f4 | 587 | |
f91ab283 SN |
588 | saved_LDFLAGS="$LDFLAGS" |
589 | LDFLAGS="$LDFLAGS -Wl,--wrap=exit" | |
590 | AC_MSG_CHECKING([linker supports --wrap]) | |
591 | AC_LINK_IFELSE( | |
592 | [AC_LANG_PROGRAM( | |
593 | [[ | |
594 | void exit(int); | |
595 | void __real_exit(int); | |
596 | void __wrap_exit(int i) { | |
597 | __real_exit(i); | |
598 | } | |
599 | ]], | |
600 | [[ | |
601 | exit(0); | |
602 | ]] | |
603 | )], | |
604 | [ | |
605 | AC_MSG_RESULT([yes]) | |
606 | have_ld_wrap_support=yes | |
607 | ], | |
608 | [AC_MSG_RESULT([no])], | |
609 | ) | |
610 | LDFLAGS="$saved_LDFLAGS" | |
611 | ||
cab53332 ABL |
612 | dnl We emulate signals in Windows |
613 | AC_CHECK_DECLS( | |
614 | [SIGHUP], | |
51bd56f4 | 615 | , |
cab53332 ABL |
616 | [AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])], |
617 | [[ | |
cab53332 | 618 | #include <signal.h> |
cab53332 | 619 | ]] |
51bd56f4 | 620 | ) |
cab53332 ABL |
621 | AC_CHECK_DECLS( |
622 | [SIGINT], | |
623 | , | |
624 | [AC_DEFINE([SIGINT], [2], [SIGINT replacement])], | |
625 | [[ | |
cab53332 | 626 | #include <signal.h> |
cab53332 ABL |
627 | ]] |
628 | ) | |
629 | AC_CHECK_DECLS( | |
630 | [SIGUSR1], | |
631 | , | |
632 | [AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])], | |
633 | [[ | |
cab53332 | 634 | #include <signal.h> |
cab53332 ABL |
635 | ]] |
636 | ) | |
637 | AC_CHECK_DECLS( | |
638 | [SIGUSR2], | |
639 | , | |
640 | [AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])], | |
641 | [[ | |
cab53332 | 642 | #include <signal.h> |
cab53332 ABL |
643 | ]] |
644 | ) | |
645 | AC_CHECK_DECLS( | |
646 | [SIGTERM], | |
647 | , | |
648 | [AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])], | |
649 | [[ | |
cab53332 | 650 | #include <signal.h> |
cab53332 ABL |
651 | ]] |
652 | ) | |
653 | ||
654 | AC_FUNC_FORK | |
655 | ||
51bd56f4 | 656 | AC_CHECK_FUNCS([ \ |
84e14209 | 657 | daemon chroot getpwnam setuid nice system dup dup2 \ |
76ccc62d | 658 | syslog openlog mlockall getrlimit getgrnam setgid \ |
b8510baa | 659 | setgroups flock readv writev time gettimeofday \ |
84e14209 | 660 | setsid chdir \ |
ba49c9a7 | 661 | chsize ftruncate execve getpeereid basename dirname access \ |
0a88ef8c | 662 | epoll_create strsep \ |
51bd56f4 | 663 | ]) |
aee7428c ABL |
664 | |
665 | AC_CHECK_LIB( | |
666 | [dl], | |
667 | [dlopen], | |
668 | [DL_LIBS="-ldl"] | |
669 | ) | |
670 | AC_SUBST([DL_LIBS]) | |
671 | ||
672 | AC_CHECK_LIB( | |
673 | [nsl], | |
674 | [inet_ntoa], | |
675 | [SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"] | |
676 | ) | |
677 | AC_CHECK_LIB( | |
678 | [socket], | |
679 | [socket], | |
680 | [SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"] | |
681 | ) | |
682 | AC_CHECK_LIB( | |
683 | [resolv], | |
684 | [gethostbyname], | |
685 | [SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"] | |
686 | ) | |
687 | AC_SUBST([SOCKETS_LIBS]) | |
688 | ||
689 | old_LIBS="${LIBS}" | |
690 | LIBS="${LIBS} ${SOCKETS_LIBS}" | |
f96baabc | 691 | AC_CHECK_FUNCS([sendmsg recvmsg]) |
17f91332 | 692 | |
aee7428c | 693 | LIBS="${old_LIBS}" |
7647a48c | 694 | |
403dc434 GD |
695 | # we assume res_init() always exist, but need to find out *where*... |
696 | AC_SEARCH_LIBS(__res_init, resolv bind, , | |
697 | AC_SEARCH_LIBS(res_9_init, resolv bind, , | |
698 | AC_SEARCH_LIBS(res_init, resolv bind, , ))) | |
699 | ||
7cacdfd4 ABL |
700 | AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap]) |
701 | old_CFLAGS="${CFLAGS}" | |
702 | CFLAGS="${CFLAGS} ${TAP_CFLAGS}" | |
703 | AC_CHECK_HEADERS( | |
704 | [ \ | |
705 | net/if_tun.h net/tun/if_tun.h \ | |
706 | linux/if_tun.h \ | |
707 | tap-windows.h \ | |
708 | ], | |
709 | [have_tap_header="yes"] | |
710 | ) | |
88f3a402 ABL |
711 | AC_CHECK_DECLS( |
712 | [TUNSETPERSIST], | |
713 | [AC_DEFINE([ENABLE_FEATURE_TUN_PERSIST], [1], [We have persist tun capability])], | |
714 | , | |
715 | [[ | |
716 | #ifdef HAVE_LINUX_IF_TUN_H | |
717 | #include <linux/if_tun.h> | |
718 | #endif | |
719 | ]] | |
720 | ) | |
7cacdfd4 ABL |
721 | CFLAGS="${old_CFLAGS}" |
722 | test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found]) | |
723 | ||
cd5990e0 ABL |
724 | AC_CHECK_LIB( |
725 | [selinux], | |
726 | [setcon], | |
727 | [SELINUX_LIBS="-lselinux"] | |
728 | ) | |
729 | AC_SUBST([SELINUX_LIBS]) | |
730 | ||
ce8271f5 ABL |
731 | AC_ARG_VAR([LIBPAM_CFLAGS], [C compiler flags for libpam]) |
732 | AC_ARG_VAR([LIBPAM_LIBS], [linker flags for libpam]) | |
733 | if test -z "${LIBPAM_LIBS}"; then | |
734 | AC_CHECK_LIB( | |
735 | [pam], | |
736 | [pam_start], | |
737 | [LIBPAM_LIBS="-lpam"] | |
738 | ) | |
739 | fi | |
740 | ||
51bd56f4 ABL |
741 | case "${with_mem_check}" in |
742 | valgrind) | |
fb69bfd0 | 743 | AC_CHECK_HEADERS( |
51bd56f4 ABL |
744 | [valgrind/memcheck.h], |
745 | [ | |
746 | CFLAGS="${CFLAGS} -g -fno-inline" | |
747 | AC_DEFINE( | |
748 | [USE_VALGRIND], | |
749 | [1], | |
750 | [Use valgrind memory debugging library] | |
751 | ) | |
752 | ], | |
753 | [AC_MSG_ERROR([valgrind headers not found.])] | |
754 | ) | |
755 | ;; | |
756 | dmalloc) | |
fb69bfd0 | 757 | AC_CHECK_HEADERS( |
51bd56f4 ABL |
758 | [dmalloc.h], |
759 | [AC_CHECK_LIB( | |
760 | [dmalloc], | |
761 | [malloc], | |
762 | [ | |
e02570fd | 763 | LIBS="${LIBS} -ldmalloc" |
51bd56f4 ABL |
764 | AC_DEFINE( |
765 | [DMALLOC], | |
766 | [1], | |
767 | [Use dmalloc memory debugging library] | |
768 | ) | |
769 | ], | |
770 | [AC_MSG_ERROR([dmalloc library not found.])] | |
771 | )], | |
772 | [AC_MSG_ERROR([dmalloc headers not found.])] | |
773 | ) | |
774 | ;; | |
775 | ssl) | |
776 | AC_CHECK_LIB( | |
777 | [ssl], | |
778 | [CRYPTO_mem_ctrl], | |
779 | [ | |
780 | AC_DEFINE( | |
781 | [CRYPTO_MDEBUG], | |
782 | [1], | |
783 | [Use memory debugging function in OpenSSL] | |
784 | ) | |
785 | AC_MSG_NOTICE([NOTE: OpenSSL library must be compiled with CRYPTO_MDEBUG]) | |
786 | ], | |
787 | [AC_MSG_ERROR([Memory Debugging function in OpenSSL library not found.])] | |
788 | ) | |
789 | ;; | |
790 | esac | |
6fbf66fa | 791 | |
9a3f6702 SK |
792 | PKG_CHECK_MODULES( |
793 | [PKCS11_HELPER], | |
6575ad48 | 794 | [libpkcs11-helper-1 >= 1.11], |
9a3f6702 SK |
795 | [have_pkcs11_helper="yes"], |
796 | [] | |
797 | ) | |
798 | ||
e34437c2 | 799 | |
2a1a21e3 FL |
800 | if test "$enable_dco" != "no"; then |
801 | enable_dco_arg="$enable_dco" | |
802 | if test "${enable_iproute2}" = "yes"; then | |
803 | AC_MSG_WARN([DCO cannot be enabled when using iproute2]) | |
804 | enable_dco="no" | |
805 | fi | |
e34437c2 AQ |
806 | case "$host" in |
807 | *-*-linux*) | |
2a1a21e3 FL |
808 | if test "$enable_dco" = "no"; then |
809 | if test "$enable_dco_arg" = "auto"; then | |
810 | AC_MSG_WARN([DCO support disabled]) | |
811 | else | |
812 | AC_MSG_ERROR([DCO support can't be enabled]) | |
813 | fi | |
814 | else | |
815 | dnl | |
816 | dnl Include generic netlink library used to talk to ovpn-dco | |
817 | dnl | |
818 | PKG_CHECK_MODULES([LIBNL_GENL], | |
e34437c2 AQ |
819 | [libnl-genl-3.0 >= 3.4.0], |
820 | [have_libnl="yes"], | |
2a1a21e3 FL |
821 | [ |
822 | AC_MSG_ERROR([libnl-genl-3.0 package not found or too old. Is the development package and pkg-config installed? Must be version 3.4.0 or newer for DCO]) | |
823 | ] | |
824 | ) | |
825 | CFLAGS="${CFLAGS} ${LIBNL_GENL_CFLAGS}" | |
826 | LIBS="${LIBS} ${LIBNL_GENL_LIBS}" | |
e34437c2 | 827 | |
2a1a21e3 FL |
828 | AC_DEFINE(ENABLE_DCO, 1, [Enable shared data channel offload]) |
829 | AC_MSG_NOTICE([Enabled ovpn-dco support for Linux]) | |
830 | fi | |
e34437c2 | 831 | ;; |
f08fcc2f | 832 | *-*-freebsd*) |
2a1a21e3 FL |
833 | AC_CHECK_LIB( |
834 | [nv], | |
835 | [nvlist_create], | |
836 | [ | |
837 | LIBS="${LIBS} -lnv" | |
838 | AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for FreeBSD]) | |
839 | AC_MSG_NOTICE([Enabled ovpn-dco support for FreeBSD]) | |
840 | ], | |
841 | [ | |
842 | enable_dco="no" | |
843 | AC_MSG_WARN([Name/Value pair library not found.]) | |
844 | ] | |
845 | ) | |
846 | if test "$enable_dco" = "no"; then | |
847 | if test "$enable_dco_arg" = "auto"; then | |
848 | AC_MSG_WARN([DCO support disabled]) | |
849 | else | |
850 | AC_MSG_ERROR([DCO support can't be enabled]) | |
851 | fi | |
852 | fi | |
f08fcc2f | 853 | ;; |
8b80cbc3 AQ |
854 | *-mingw*) |
855 | AC_MSG_NOTICE([NOTE: --enable-dco ignored on Windows because it's always enabled]) | |
856 | ;; | |
e34437c2 | 857 | *) |
8b80cbc3 | 858 | AC_MSG_NOTICE([Ignoring --enable-dco on non supported platform]) |
e34437c2 AQ |
859 | ;; |
860 | esac | |
861 | fi | |
862 | ||
2e359a08 TR |
863 | dnl |
864 | dnl Depend on libcap-ng on Linux | |
865 | dnl | |
866 | case "$host" in | |
867 | *-*-linux*) | |
868 | PKG_CHECK_MODULES([LIBCAPNG], | |
869 | [libcap-ng], | |
870 | [], | |
871 | [AC_MSG_ERROR([libcap-ng package not found. Is the development package and pkg-config installed?])] | |
872 | ) | |
873 | AC_CHECK_HEADER([sys/prctl.h],,[AC_MSG_ERROR([sys/prctl.h not found!])]) | |
874 | ||
875 | CFLAGS="${CFLAGS} ${LIBCAPNG_CFALGS}" | |
876 | LIBS="${LIBS} ${LIBCAPNG_LIBS}" | |
877 | AC_DEFINE(HAVE_LIBCAPNG, 1, [Enable libcap-ng support]) | |
878 | ;; | |
879 | esac | |
880 | ||
881 | ||
cf49ff50 | 882 | if test "${with_crypto_library}" = "openssl"; then |
31b0bebe SK |
883 | AC_ARG_VAR([OPENSSL_CFLAGS], [C compiler flags for OpenSSL]) |
884 | AC_ARG_VAR([OPENSSL_LIBS], [linker flags for OpenSSL]) | |
885 | ||
886 | if test -z "${OPENSSL_CFLAGS}" -a -z "${OPENSSL_LIBS}"; then | |
887 | # if the user did not explicitly specify flags, try to autodetect | |
888 | PKG_CHECK_MODULES( | |
889 | [OPENSSL], | |
ec7d0e8e | 890 | [openssl >= 1.0.2], |
79ea67f7 DS |
891 | [have_openssl="yes"], |
892 | [] # If this fails, we will do another test next | |
31b0bebe | 893 | ) |
31b0bebe SK |
894 | OPENSSL_LIBS=${OPENSSL_LIBS:--lssl -lcrypto} |
895 | fi | |
9b33b5a4 | 896 | |
9b33b5a4 ABL |
897 | saved_CFLAGS="${CFLAGS}" |
898 | saved_LIBS="${LIBS}" | |
31b0bebe SK |
899 | CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}" |
900 | LIBS="${LIBS} ${OPENSSL_LIBS}" | |
901 | ||
79ea67f7 DS |
902 | # If pkgconfig check failed or OPENSSL_CFLAGS/OPENSSL_LIBS env vars |
903 | # are used, check the version directly in the OpenSSL include file | |
904 | if test "${have_openssl}" != "yes"; then | |
ec7d0e8e | 905 | AC_MSG_CHECKING([additionally if OpenSSL is available and version >= 1.0.2]) |
79ea67f7 DS |
906 | AC_COMPILE_IFELSE( |
907 | [AC_LANG_PROGRAM( | |
908 | [[ | |
909 | #include <openssl/opensslv.h> | |
910 | ]], | |
911 | [[ | |
912 | /* Version encoding: MNNFFPPS - see opensslv.h for details */ | |
ec7d0e8e | 913 | #if OPENSSL_VERSION_NUMBER < 0x10002000L |
79ea67f7 DS |
914 | #error OpenSSL too old |
915 | #endif | |
916 | ]] | |
917 | )], | |
918 | [AC_MSG_RESULT([ok])], | |
919 | [AC_MSG_ERROR([OpenSSL version too old])] | |
920 | ) | |
921 | fi | |
922 | ||
6ea62d50 | 923 | AC_CHECK_FUNCS([SSL_CTX_new], |
31b0bebe SK |
924 | , |
925 | [AC_MSG_ERROR([openssl check failed])] | |
926 | ) | |
927 | ||
0df2261d AS |
928 | if test "${with_openssl_engine}" = "auto"; then |
929 | AC_COMPILE_IFELSE( | |
930 | [AC_LANG_PROGRAM( | |
931 | [[ | |
932 | #include <openssl/opensslv.h> | |
933 | ]], | |
934 | [[ | |
935 | /* Version encoding: MNNFFPPS - see opensslv.h for details */ | |
936 | #if OPENSSL_VERSION_NUMBER >= 0x30000000L | |
937 | #error Engine supported disabled by default in OpenSSL 3.0+ | |
938 | #endif | |
939 | ]] | |
940 | )], | |
941 | [have_openssl_engine="yes"], | |
942 | [have_openssl_engine="no"] | |
943 | ) | |
944 | if test "${have_openssl_engine}" = "yes"; then | |
945 | AC_CHECK_FUNCS( | |
946 | [ \ | |
9b33b5a4 ABL |
947 | ENGINE_load_builtin_engines \ |
948 | ENGINE_register_all_complete \ | |
0df2261d AS |
949 | ], |
950 | , | |
951 | [have_openssl_engine="no"; break] | |
952 | ) | |
953 | fi | |
954 | else | |
955 | have_openssl_engine="${with_openssl_engine}" | |
956 | if test "${have_openssl_engine}" = "yes"; then | |
957 | AC_CHECK_FUNCS( | |
958 | [ \ | |
959 | ENGINE_load_builtin_engines \ | |
960 | ENGINE_register_all_complete \ | |
961 | ], | |
962 | , | |
963 | [AC_MSG_ERROR([OpenSSL engine support not found])] | |
6b5dbf6c | 964 | ) |
0df2261d | 965 | fi |
6b5dbf6c | 966 | fi |
31b0bebe SK |
967 | if test "${have_openssl_engine}" = "yes"; then |
968 | AC_DEFINE([HAVE_OPENSSL_ENGINE], [1], [OpenSSL engine support available]) | |
969 | fi | |
9b33b5a4 | 970 | |
91d84530 | 971 | AC_CHECK_FUNC( |
66407e11 SK |
972 | [EVP_aes_256_gcm], |
973 | , | |
94edc7c5 | 974 | [AC_MSG_ERROR([OpenSSL check for AES-256-GCM support failed])] |
66407e11 SK |
975 | ) |
976 | ||
ec7d0e8e AS |
977 | # All supported OpenSSL version (>= 1.0.2) |
978 | # have this feature | |
5defbba4 | 979 | have_export_keying_material="yes" |
5defbba4 | 980 | |
9b33b5a4 ABL |
981 | CFLAGS="${saved_CFLAGS}" |
982 | LIBS="${saved_LIBS}" | |
9b33b5a4 | 983 | |
31b0bebe SK |
984 | AC_DEFINE([ENABLE_CRYPTO_OPENSSL], [1], [Use OpenSSL library]) |
985 | CRYPTO_CFLAGS="${OPENSSL_CFLAGS}" | |
986 | CRYPTO_LIBS="${OPENSSL_LIBS}" | |
cf49ff50 | 987 | elif test "${with_crypto_library}" = "mbedtls"; then |
86d8cd68 SK |
988 | AC_ARG_VAR([MBEDTLS_CFLAGS], [C compiler flags for mbedtls]) |
989 | AC_ARG_VAR([MBEDTLS_LIBS], [linker flags for mbedtls]) | |
31b0bebe | 990 | |
417fe4a7 SK |
991 | saved_CFLAGS="${CFLAGS}" |
992 | saved_LIBS="${LIBS}" | |
993 | ||
86d8cd68 | 994 | if test -z "${MBEDTLS_CFLAGS}" -a -z "${MBEDTLS_LIBS}"; then |
e860059b | 995 | # if the user did not explicitly specify flags, try to autodetect |
1ae17b7e | 996 | LIBS="${LIBS} -lmbedtls -lmbedx509 -lmbedcrypto" |
86d8cd68 SK |
997 | AC_CHECK_LIB( |
998 | [mbedtls], | |
999 | [mbedtls_ssl_init], | |
1ae17b7e | 1000 | [MBEDTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"], |
86d8cd68 | 1001 | [AC_MSG_ERROR([Could not find mbed TLS.])], |
31b0bebe SK |
1002 | [${PKCS11_HELPER_LIBS}] |
1003 | ) | |
1004 | fi | |
9b33b5a4 | 1005 | |
86d8cd68 SK |
1006 | CFLAGS="${MBEDTLS_CFLAGS} ${PKCS11_HELPER_CFLAGS} ${CFLAGS}" |
1007 | LIBS="${MBEDTLS_LIBS} ${PKCS11_HELPER_LIBS} ${LIBS}" | |
417fe4a7 | 1008 | |
86d8cd68 | 1009 | AC_MSG_CHECKING([mbedtls version]) |
13b38eb0 ABL |
1010 | AC_COMPILE_IFELSE( |
1011 | [AC_LANG_PROGRAM( | |
1012 | [[ | |
86d8cd68 | 1013 | #include <mbedtls/version.h> |
13b38eb0 ABL |
1014 | ]], |
1015 | [[ | |
86d8cd68 | 1016 | #if MBEDTLS_VERSION_NUMBER < 0x02000000 || MBEDTLS_VERSION_NUMBER >= 0x03000000 |
9a3f6702 | 1017 | #error invalid version |
13b38eb0 ABL |
1018 | #endif |
1019 | ]] | |
1020 | )], | |
1021 | [AC_MSG_RESULT([ok])], | |
86d8cd68 | 1022 | [AC_MSG_ERROR([mbed TLS 2.y.z required])] |
13b38eb0 | 1023 | ) |
9a3f6702 | 1024 | |
66407e11 SK |
1025 | AC_CHECK_FUNCS( |
1026 | [ \ | |
86d8cd68 SK |
1027 | mbedtls_cipher_write_tag \ |
1028 | mbedtls_cipher_check_tag \ | |
66407e11 SK |
1029 | ], |
1030 | , | |
94edc7c5 | 1031 | [AC_MSG_ERROR([mbed TLS check for AEAD support failed])] |
66407e11 SK |
1032 | ) |
1033 | ||
5defbba4 | 1034 | have_export_keying_material="yes" |
91d84530 | 1035 | AC_CHECK_FUNC( |
5defbba4 SK |
1036 | [mbedtls_ssl_conf_export_keys_ext_cb], |
1037 | , | |
91d84530 | 1038 | [have_export_keying_material="no"] |
5defbba4 SK |
1039 | ) |
1040 | ||
2b9bbaad AQ |
1041 | AC_CHECK_FUNC( |
1042 | [mbedtls_ctr_drbg_update_ret], | |
1043 | AC_DEFINE([HAVE_CTR_DRBG_UPDATE_RET], [1], | |
1044 | [Use mbedtls_ctr_drbg_update_ret from mbed TLS]), | |
1045 | ) | |
1046 | ||
31b0bebe SK |
1047 | CFLAGS="${saved_CFLAGS}" |
1048 | LIBS="${saved_LIBS}" | |
86d8cd68 SK |
1049 | AC_DEFINE([ENABLE_CRYPTO_MBEDTLS], [1], [Use mbed TLS library]) |
1050 | CRYPTO_CFLAGS="${MBEDTLS_CFLAGS}" | |
1051 | CRYPTO_LIBS="${MBEDTLS_LIBS}" | |
f6dca235 JS |
1052 | |
1053 | elif test "${with_crypto_library}" = "wolfssl"; then | |
1054 | AC_ARG_VAR([WOLFSSL_CFLAGS], [C compiler flags for wolfssl. The include directory should | |
1055 | contain the regular wolfSSL header files but also the | |
1056 | wolfSSL OpenSSL header files. Ex: -I/usr/local/include | |
1057 | -I/usr/local/include/wolfssl]) | |
1058 | AC_ARG_VAR([WOLFSSL_LIBS], [linker flags for wolfssl]) | |
1059 | ||
1060 | saved_CFLAGS="${CFLAGS}" | |
1061 | saved_LIBS="${LIBS}" | |
1062 | ||
1063 | if test -z "${WOLFSSL_CFLAGS}" -a -z "${WOLFSSL_LIBS}"; then | |
1064 | # if the user did not explicitly specify flags, try to autodetect | |
1065 | PKG_CHECK_MODULES( | |
1066 | [WOLFSSL], | |
1067 | [wolfssl], | |
1068 | [], | |
1069 | [AC_MSG_ERROR([Could not find wolfSSL.])] | |
1070 | ) | |
1071 | PKG_CHECK_VAR( | |
1072 | [WOLFSSL_INCLUDEDIR], | |
1073 | [wolfssl], | |
1074 | [includedir], | |
1075 | [], | |
1076 | [AC_MSG_ERROR([Could not find wolfSSL includedir variable.])] | |
1077 | ) | |
1078 | WOLFSSL_CFLAGS="${WOLFSSL_CFLAGS} -I${WOLFSSL_INCLUDEDIR}/wolfssl" | |
1079 | fi | |
1080 | saved_CFLAGS="${CFLAGS}" | |
1081 | saved_LIBS="${LIBS}" | |
1082 | CFLAGS="${CFLAGS} ${WOLFSSL_CFLAGS}" | |
1083 | LIBS="${LIBS} ${WOLFSSL_LIBS}" | |
1084 | ||
1085 | AC_CHECK_LIB( | |
1086 | [wolfssl], | |
1087 | [wolfSSL_Init], | |
1088 | [], | |
1089 | [AC_MSG_ERROR([Could not link wolfSSL library.])] | |
1090 | ) | |
1091 | AC_CHECK_HEADER([wolfssl/options.h],,[AC_MSG_ERROR([wolfSSL header wolfssl/options.h not found!])]) | |
1092 | ||
1093 | # wolfSSL signal EKM support | |
1094 | have_export_keying_material="yes" | |
1095 | ||
f6dca235 JS |
1096 | if test "${enable_wolfssl_options_h}" = "yes"; then |
1097 | AC_DEFINE([EXTERNAL_OPTS_OPENVPN], [1], [Include options.h from wolfSSL library]) | |
1098 | else | |
1099 | AC_DEFINE([WOLFSSL_USER_SETTINGS], [1], [Use custom user_settings.h file for wolfSSL library]) | |
1100 | fi | |
1101 | ||
1102 | have_export_keying_material="yes" | |
1103 | ||
1104 | CFLAGS="${saved_CFLAGS}" | |
1105 | LIBS="${saved_LIBS}" | |
1106 | ||
1107 | AC_DEFINE([ENABLE_CRYPTO_WOLFSSL], [1], [Use wolfSSL crypto library]) | |
1108 | AC_DEFINE([ENABLE_CRYPTO_OPENSSL], [1], [Use wolfSSL openssl compatibility layer]) | |
1109 | CRYPTO_CFLAGS="${WOLFSSL_CFLAGS}" | |
1110 | CRYPTO_LIBS="${WOLFSSL_LIBS}" | |
cf49ff50 | 1111 | else |
31b0bebe | 1112 | AC_MSG_ERROR([Invalid crypto library: ${with_crypto_library}]) |
13b38eb0 ABL |
1113 | fi |
1114 | ||
74bbc71b ABL |
1115 | AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo]) |
1116 | AC_ARG_VAR([LZO_LIBS], [linker flags for lzo]) | |
1117 | have_lzo="yes" | |
1118 | if test -z "${LZO_LIBS}"; then | |
1119 | AC_CHECK_LIB( | |
1120 | [lzo2], | |
1121 | [lzo1x_1_15_compress], | |
1122 | [LZO_LIBS="-llzo2"], | |
1123 | [AC_CHECK_LIB( | |
1124 | [lzo], | |
1125 | [lzo1x_1_15_compress], | |
1126 | [LZO_LIBS="-llzo"], | |
1127 | [have_lzo="no"] | |
1128 | )] | |
1129 | ) | |
1130 | fi | |
1131 | if test "${have_lzo}" = "yes"; then | |
1132 | saved_CFLAGS="${CFLAGS}" | |
1133 | CFLAGS="${CFLAGS} ${LZO_CFLAGS}" | |
1134 | AC_CHECK_HEADERS( | |
1135 | [lzo/lzoutil.h], | |
1136 | , | |
1137 | [AC_CHECK_HEADERS( | |
1138 | [lzoutil.h], | |
1139 | , | |
1140 | [AC_MSG_ERROR([lzoutil.h is missing])] | |
1141 | )] | |
1142 | ) | |
1143 | AC_CHECK_HEADERS( | |
1144 | [lzo/lzo1x.h], | |
1145 | , | |
1146 | [AC_CHECK_HEADERS( | |
1147 | [lzo1x.h], | |
1148 | , | |
1149 | [AC_MSG_ERROR([lzo1x.h is missing])] | |
1150 | )] | |
1151 | ) | |
1152 | CFLAGS="${saved_CFLAGS}" | |
6fbf66fa JY |
1153 | fi |
1154 | ||
40efb635 GD |
1155 | dnl |
1156 | dnl check for LZ4 library | |
1157 | dnl | |
1158 | ||
1159 | AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4]) | |
1160 | AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4]) | |
1161 | if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then | |
5f6225c3 DS |
1162 | if test -z "${LZ4_CFLAGS}" -a -z "${LZ4_LIBS}"; then |
1163 | # if the user did not explicitly specify flags, try to autodetect | |
1164 | PKG_CHECK_MODULES([LZ4], | |
f91e4863 | 1165 | [liblz4 >= 1.7.1 liblz4 < 100], |
5f6225c3 | 1166 | [have_lz4="yes"], |
e5b279f1 DS |
1167 | [LZ4_LIBS="-llz4"] # If this fails, we will do another test next. |
1168 | # We also add set LZ4_LIBS otherwise the | |
1169 | # linker will not know about the lz4 library | |
5f6225c3 DS |
1170 | ) |
1171 | fi | |
1172 | ||
1173 | saved_CFLAGS="${CFLAGS}" | |
1174 | saved_LIBS="${LIBS}" | |
1175 | CFLAGS="${CFLAGS} ${LZ4_CFLAGS}" | |
1176 | LIBS="${LIBS} ${LZ4_LIBS}" | |
1177 | ||
1178 | # If pkgconfig check failed or LZ4_CFLAGS/LZ4_LIBS env vars | |
1179 | # are used, check the version directly in the LZ4 include file | |
1180 | if test "${have_lz4}" != "yes"; then | |
1181 | AC_CHECK_HEADERS([lz4.h], | |
1182 | [have_lz4h="yes"], | |
1183 | []) | |
1184 | ||
1185 | if test "${have_lz4h}" = "yes" ; then | |
1186 | AC_MSG_CHECKING([additionally if system LZ4 version >= 1.7.1]) | |
1187 | AC_COMPILE_IFELSE( | |
1188 | [AC_LANG_PROGRAM([[ | |
1189 | #include <lz4.h> | |
1190 | ]], | |
1191 | [[ | |
1192 | /* Version encoding: MMNNPP (Major miNor Patch) - see lz4.h for details */ | |
1193 | #if LZ4_VERSION_NUMBER < 10701L | |
1194 | #error LZ4 is too old | |
1195 | #endif | |
1196 | ]] | |
1197 | )], | |
1198 | [ | |
1199 | AC_MSG_RESULT([ok]) | |
1200 | have_lz4="yes" | |
1201 | ], | |
24596b25 | 1202 | [AC_MSG_ERROR([system LZ4 library is too old])] |
5f6225c3 DS |
1203 | ) |
1204 | fi | |
1205 | fi | |
40efb635 | 1206 | |
f91e4863 DS |
1207 | # Double check we have a few needed functions |
1208 | if test "${have_lz4}" = "yes" ; then | |
5f6225c3 | 1209 | AC_CHECK_LIB([lz4], |
f91e4863 DS |
1210 | [LZ4_compress_default], |
1211 | [], | |
1212 | [have_lz4="no"]) | |
1213 | AC_CHECK_LIB([lz4], | |
1214 | [LZ4_decompress_safe], | |
1215 | [], | |
5f6225c3 | 1216 | [have_lz4="no"]) |
40efb635 GD |
1217 | fi |
1218 | ||
5f6225c3 | 1219 | if test "${have_lz4}" != "yes" ; then |
24596b25 | 1220 | AC_MSG_ERROR([No compatible LZ4 compression library found. Consider --disable-lz4]) |
4308f237 | 1221 | LZ4_LIBS="" |
40efb635 GD |
1222 | fi |
1223 | OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}" | |
1224 | OPTIONAL_LZ4_LIBS="${LZ4_LIBS}" | |
5f6225c3 | 1225 | AC_DEFINE(ENABLE_LZ4, [1], [Enable LZ4 compression library]) |
40efb635 | 1226 | CFLAGS="${saved_CFLAGS}" |
5f6225c3 | 1227 | LIBS="${saved_LIBS}" |
40efb635 GD |
1228 | fi |
1229 | ||
1230 | ||
f33ee6bc DS |
1231 | dnl |
1232 | dnl Check for systemd | |
1233 | dnl | |
3280d8c8 | 1234 | AM_CONDITIONAL([ENABLE_SYSTEMD], [test "${enable_systemd}" = "yes"]) |
f33ee6bc DS |
1235 | if test "$enable_systemd" = "yes" ; then |
1236 | PKG_CHECK_MODULES([libsystemd], [systemd libsystemd], | |
1237 | [], | |
1238 | [PKG_CHECK_MODULES([libsystemd], [libsystemd-daemon])] | |
1239 | ) | |
8ba3e258 DS |
1240 | |
1241 | PKG_CHECK_EXISTS( [libsystemd > 216], | |
1242 | [AC_DEFINE([SYSTEMD_NEWER_THAN_216], [1], | |
1243 | [systemd is newer than v216])] | |
1244 | ) | |
1245 | ||
f33ee6bc DS |
1246 | AC_CHECK_HEADERS(systemd/sd-daemon.h, |
1247 | , | |
1248 | [ | |
1249 | AC_MSG_ERROR([systemd development headers not found.]) | |
1250 | ]) | |
1251 | ||
1252 | saved_LIBS="${LIBS}" | |
1253 | LIBS="${LIBS} ${libsystemd_LIBS}" | |
1254 | AC_CHECK_FUNCS([sd_booted], [], [AC_MSG_ERROR([systemd library is missing sd_booted()])]) | |
1255 | OPTIONAL_SYSTEMD_LIBS="${libsystemd_LIBS}" | |
1256 | AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd integration]) | |
1257 | LIBS="${saved_LIBS}" | |
ca5b4c2a CH |
1258 | |
1259 | if test -n "${SYSTEMD_UNIT_DIR}"; then | |
1260 | systemdunitdir="${SYSTEMD_UNIT_DIR}" | |
1261 | else | |
1262 | systemdunitdir="\${libdir}/systemd/system" | |
1263 | fi | |
3de7be7b CH |
1264 | |
1265 | if test -n "${TMPFILES_DIR}"; then | |
1266 | tmpfilesdir="${TMPFILES_DIR}" | |
1267 | else | |
1268 | tmpfilesdir="\${libdir}/tmpfiles.d" | |
1269 | fi | |
f33ee6bc | 1270 | fi |
40efb635 | 1271 | |
38d96bd7 | 1272 | |
7046ff20 ABL |
1273 | AC_MSG_CHECKING([git checkout]) |
1274 | GIT_CHECKOUT="no" | |
1275 | if test -n "${GIT}" -a -d "${srcdir}/.git"; then | |
1276 | AC_DEFINE([HAVE_CONFIG_VERSION_H], [1], [extra version available in config-version.h]) | |
1277 | GIT_CHECKOUT="yes" | |
1278 | fi | |
1279 | AC_MSG_RESULT([${GIT_CHECKOUT}]) | |
1280 | ||
51bd56f4 ABL |
1281 | dnl enable --x509-username-field feature if requested |
1282 | if test "${enable_x509_alt_username}" = "yes"; then | |
86d8cd68 SK |
1283 | if test "${with_crypto_library}" = "mbedtls" ; then |
1284 | AC_MSG_ERROR([mbed TLS does not support the --x509-username-field feature]) | |
51bd56f4 ABL |
1285 | fi |
1286 | ||
1287 | AC_DEFINE([ENABLE_X509ALTUSERNAME], [1], [Enable --x509-username-field feature]) | |
1288 | fi | |
1289 | ||
51bd56f4 | 1290 | test "${enable_management}" = "yes" && AC_DEFINE([ENABLE_MANAGEMENT], [1], [Enable management server capability]) |
51bd56f4 ABL |
1291 | test "${enable_debug}" = "yes" && AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging support]) |
1292 | test "${enable_small}" = "yes" && AC_DEFINE([ENABLE_SMALL], [1], [Enable smaller executable size]) | |
1293 | test "${enable_fragment}" = "yes" && AC_DEFINE([ENABLE_FRAGMENT], [1], [Enable internal fragmentation support]) | |
1294 | test "${enable_port_share}" = "yes" && AC_DEFINE([ENABLE_PORT_SHARE], [1], [Enable TCP Server port sharing]) | |
c3fc703d | 1295 | |
cf49ff50 | 1296 | test "${enable_crypto_ofb_cfb}" = "yes" && AC_DEFINE([ENABLE_OFB_CFB_MODE], [1], [Enable OFB and CFB cipher modes]) |
5defbba4 SK |
1297 | if test "${have_export_keying_material}" = "yes"; then |
1298 | AC_DEFINE( | |
1299 | [HAVE_EXPORT_KEYING_MATERIAL], [1], | |
1300 | [Crypto library supports keying material exporter] | |
1301 | ) | |
1302 | fi | |
cf49ff50 AQ |
1303 | OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_CFLAGS}" |
1304 | OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_LIBS}" | |
9b33b5a4 | 1305 | |
bdae4110 | 1306 | if test "${enable_plugins}" = "yes"; then |
bdae4110 | 1307 | OPTIONAL_DL_LIBS="${DL_LIBS}" |
8065cd1c | 1308 | AC_DEFINE([ENABLE_PLUGIN], [1], [Enable plug-in support]) |
ce8271f5 ABL |
1309 | else |
1310 | enable_plugin_auth_pam="no" | |
1311 | enable_plugin_down_root="no" | |
bdae4110 ABL |
1312 | fi |
1313 | ||
1e894662 AQ |
1314 | AM_CONDITIONAL([HAVE_SITNL], [false]) |
1315 | ||
c3fc703d | 1316 | if test "${enable_iproute2}" = "yes"; then |
e34437c2 | 1317 | test "${enable_dco}" = "yes" && AC_MSG_ERROR([iproute2 support cannot be enabled when using DCO]) |
c3fc703d ABL |
1318 | test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing]) |
1319 | AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) | |
c6542257 AQ |
1320 | else if test "${have_sitnl}" = "yes"; then |
1321 | AC_DEFINE([ENABLE_SITNL], [1], [enable sitnl support]) | |
1e894662 | 1322 | AM_CONDITIONAL([HAVE_SITNL], [true]) |
c6542257 AQ |
1323 | else if test "${WIN32}" != "yes" -a "${have_sitnl}" != "yes"; then |
1324 | test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing]) | |
1325 | test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing]) | |
1326 | fi | |
1327 | fi | |
c3fc703d | 1328 | fi |
51bd56f4 | 1329 | |
cd5990e0 ABL |
1330 | if test "${enable_selinux}" = "yes"; then |
1331 | test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing]) | |
1332 | OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}" | |
1333 | AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support]) | |
1334 | fi | |
1335 | ||
74bbc71b ABL |
1336 | if test "${enable_lzo}" = "yes"; then |
1337 | test "${have_lzo}" != "yes" && AC_MSG_ERROR([lzo enabled but missing]) | |
1338 | OPTIONAL_LZO_CFLAGS="${LZO_CFLAGS}" | |
1339 | OPTIONAL_LZO_LIBS="${LZO_LIBS}" | |
1340 | AC_DEFINE([ENABLE_LZO], [1], [Enable LZO compression library]) | |
1341 | fi | |
38d96bd7 JY |
1342 | if test "${enable_comp_stub}" = "yes"; then |
1343 | test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and lzo enabled (use --disable-lzo)]) | |
40efb635 | 1344 | test "${enable_lz4}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and LZ4 enabled (use --disable-lz4)]) |
38d96bd7 | 1345 | AC_DEFINE([ENABLE_COMP_STUB], [1], [Enable compression stub capability]) |
07084261 ABL |
1346 | fi |
1347 | ||
18b5fbdf ABL |
1348 | if test "${enable_pkcs11}" = "yes"; then |
1349 | test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing]) | |
18b5fbdf ABL |
1350 | OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}" |
1351 | OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}" | |
1352 | AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11]) | |
3c6d3220 DW |
1353 | PKG_CHECK_MODULES( |
1354 | [P11KIT], | |
1355 | [p11-kit-1], | |
1356 | [proxy_module="`$PKG_CONFIG --variable=proxy_module p11-kit-1`" | |
1357 | AC_DEFINE_UNQUOTED([DEFAULT_PKCS11_MODULE], "${proxy_module}", [p11-kit proxy])], | |
1358 | [] | |
1359 | ) | |
18b5fbdf ABL |
1360 | fi |
1361 | ||
fb8033d4 SN |
1362 | # When testing a compiler option, we add -Werror to force |
1363 | # an error when the option is unsupported. This is not | |
1364 | # required for gcc, but some compilers such as clang needs it. | |
6a5d10e9 SK |
1365 | AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [ |
1366 | old_cflags="$CFLAGS" | |
fb8033d4 SN |
1367 | CFLAGS="$1 -Werror $CFLAGS" |
1368 | AC_MSG_CHECKING([whether the compiler accepts $1]) | |
1369 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$1 $old_cflags", | |
6a5d10e9 | 1370 | [AC_MSG_RESULT([no]); CFLAGS="$old_cflags"])] |
adbf68c0 | 1371 | ) |
6a5d10e9 | 1372 | |
46d09607 | 1373 | ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-stringop-truncation]) |
6a5d10e9 | 1374 | ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) |
adbf68c0 | 1375 | |
51bd56f4 ABL |
1376 | if test "${enable_pedantic}" = "yes"; then |
1377 | enable_strict="yes" | |
31444111 | 1378 | CFLAGS="${CFLAGS} -pedantic" |
058f0efd | 1379 | AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode]) |
51bd56f4 ABL |
1380 | fi |
1381 | if test "${enable_strict}" = "yes"; then | |
adbf68c0 | 1382 | CFLAGS="${CFLAGS} -Wsign-compare -Wuninitialized" |
99385447 | 1383 | fi |
51194ffd SK |
1384 | if test "${enable_werror}" = "yes"; then |
1385 | CFLAGS="${CFLAGS} -Werror" | |
1386 | fi | |
99385447 | 1387 | |
ce8271f5 ABL |
1388 | if test "${enable_plugin_auth_pam}" = "yes"; then |
1389 | PLUGIN_AUTH_PAM_CFLAGS="${LIBPAM_CFLAGS}" | |
1390 | if test "${enable_pam_dlopen}" = "yes"; then | |
1391 | AC_DEFINE([USE_PAM_DLOPEN], [1], [dlopen libpam]) | |
1392 | PLUGIN_AUTH_PAM_LIBS="${DL_LIBS}" | |
1393 | else | |
1394 | test -z "${LIBPAM_LIBS}" && AC_MSG_ERROR([libpam required but missing]) | |
1395 | PLUGIN_AUTH_PAM_LIBS="${LIBPAM_LIBS}" | |
1396 | fi | |
1397 | fi | |
1398 | ||
0d1a75bf | 1399 | if test "${enable_async_push}" = "yes"; then |
e1eb630d LS |
1400 | case "$host" in |
1401 | *-*-freebsd*) | |
1402 | PKG_CHECK_MODULES( | |
1403 | [OPTIONAL_INOTIFY], | |
1404 | [libinotify], | |
1405 | [ | |
1406 | AC_DEFINE([HAVE_SYS_INOTIFY_H]) | |
1407 | AC_DEFINE([ENABLE_ASYNC_PUSH], [1], [Enable async push]) | |
1408 | ] | |
1409 | ) | |
1410 | ;; | |
1411 | *) | |
1412 | AC_CHECK_HEADERS( | |
1413 | [sys/inotify.h], | |
1414 | AC_DEFINE([ENABLE_ASYNC_PUSH], [1], [Enable async push]), | |
1415 | AC_MSG_ERROR([inotify.h not found.]) | |
1416 | ) | |
1417 | ;; | |
1418 | esac | |
0d1a75bf LS |
1419 | fi |
1420 | ||
fcff80aa ABL |
1421 | CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" |
1422 | AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings]) | |
1423 | ||
ac2447cd ABL |
1424 | TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID" |
1425 | TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR" | |
1426 | TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR" | |
1427 | AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id]) | |
1428 | AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN]) | |
1429 | AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN]) | |
1430 | AC_SUBST([TAP_WIN_COMPONENT_ID]) | |
1431 | AC_SUBST([TAP_WIN_MIN_MAJOR]) | |
1432 | AC_SUBST([TAP_WIN_MIN_MINOR]) | |
1bda73a7 | 1433 | |
bdae4110 | 1434 | AC_SUBST([OPTIONAL_DL_LIBS]) |
cd5990e0 | 1435 | AC_SUBST([OPTIONAL_SELINUX_LIBS]) |
9b33b5a4 ABL |
1436 | AC_SUBST([OPTIONAL_CRYPTO_CFLAGS]) |
1437 | AC_SUBST([OPTIONAL_CRYPTO_LIBS]) | |
74bbc71b ABL |
1438 | AC_SUBST([OPTIONAL_LZO_CFLAGS]) |
1439 | AC_SUBST([OPTIONAL_LZO_LIBS]) | |
40efb635 GD |
1440 | AC_SUBST([OPTIONAL_LZ4_CFLAGS]) |
1441 | AC_SUBST([OPTIONAL_LZ4_LIBS]) | |
f33ee6bc | 1442 | AC_SUBST([OPTIONAL_SYSTEMD_LIBS]) |
18b5fbdf ABL |
1443 | AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS]) |
1444 | AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS]) | |
e1eb630d LS |
1445 | AC_SUBST([OPTIONAL_INOTIFY_CFLAGS]) |
1446 | AC_SUBST([OPTIONAL_INOTIFY_LIBS]) | |
bdae4110 | 1447 | |
ce8271f5 ABL |
1448 | AC_SUBST([PLUGIN_AUTH_PAM_CFLAGS]) |
1449 | AC_SUBST([PLUGIN_AUTH_PAM_LIBS]) | |
1450 | ||
51bd56f4 | 1451 | AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) |
7046ff20 | 1452 | AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"]) |
ce8271f5 ABL |
1453 | AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "yes"]) |
1454 | AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"]) | |
f91ab283 | 1455 | AM_CONDITIONAL([HAVE_LD_WRAP_SUPPORT], [test "${have_ld_wrap_support}" = "yes"]) |
542c69c3 | 1456 | AM_CONDITIONAL([OPENSSL_ENGINE], [test "${have_openssl_engine}" = "yes"]) |
1bda73a7 | 1457 | |
880a2ae9 | 1458 | sampledir="\$(docdir)/sample" |
ce8271f5 | 1459 | AC_SUBST([plugindir]) |
880a2ae9 ABL |
1460 | AC_SUBST([sampledir]) |
1461 | ||
ca5b4c2a | 1462 | AC_SUBST([systemdunitdir]) |
3de7be7b | 1463 | AC_SUBST([tmpfilesdir]) |
ca5b4c2a | 1464 | |
222e6917 GD |
1465 | AC_ARG_ENABLE( |
1466 | [unit-tests], | |
1467 | [AS_HELP_STRING([--disable-unit-tests], | |
1468 | [Disables building and running the unit tests suite])], | |
1469 | [], | |
1470 | [enable_unit_tests="yes"] | |
1471 | ) | |
1472 | ||
1473 | # Check if cmocka is available - needed for unit testing | |
1474 | PKG_CHECK_MODULES( | |
1475 | [CMOCKA], [cmocka], | |
1476 | [have_cmocka="yes"], | |
1477 | [AC_MSG_WARN([cmocka.pc not found on the system. Unit tests disabled])] | |
1478 | ) | |
1479 | AM_CONDITIONAL([ENABLE_UNITTESTS], [test "${enable_unit_tests}" = "yes" -a "${have_cmocka}" = "yes" ]) | |
1480 | AC_SUBST([ENABLE_UNITTESTS]) | |
1481 | ||
7473f326 | 1482 | TEST_LDFLAGS="${OPTIONAL_CRYPTO_LIBS} ${OPTIONAL_PKCS11_HELPER_LIBS}" |
222e6917 | 1483 | TEST_LDFLAGS="${TEST_LDFLAGS} ${OPTIONAL_LZO_LIBS} ${CMOCKA_LIBS}" |
7473f326 SK |
1484 | TEST_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${OPTIONAL_PKCS11_HELPER_CFLAGS}" |
1485 | TEST_CFLAGS="${TEST_CFLAGS} ${OPTIONAL_LZO_CFLAGS}" | |
222e6917 | 1486 | TEST_CFLAGS="${TEST_CFLAGS} -I\$(top_srcdir)/include ${CMOCKA_CFLAGS}" |
40cb4cfc JN |
1487 | |
1488 | AC_SUBST([TEST_LDFLAGS]) | |
1489 | AC_SUBST([TEST_CFLAGS]) | |
1490 | ||
51bd56f4 | 1491 | AC_CONFIG_FILES([ |
6187644b | 1492 | version.sh |
1bda73a7 | 1493 | Makefile |
98bc1a3e | 1494 | build/Makefile |
4b1a82db ABL |
1495 | build/msvc/Makefile |
1496 | build/msvc/msvc-generate/Makefile | |
34cb9132 | 1497 | distro/Makefile |
ca5b4c2a | 1498 | distro/systemd/Makefile |
66bf378e SK |
1499 | doc/Makefile |
1500 | doc/doxygen/Makefile | |
1501 | doc/doxygen/openvpn.doxyfile | |
34cb9132 | 1502 | include/Makefile |
0b5141d8 | 1503 | sample/sample-plugins/Makefile |
34cb9132 | 1504 | src/Makefile |
dc81e743 | 1505 | src/compat/Makefile |
34cb9132 | 1506 | src/openvpn/Makefile |
ce68686f | 1507 | src/openvpnmsica/Makefile |
34cb9132 | 1508 | src/openvpnserv/Makefile |
ce8271f5 ABL |
1509 | src/plugins/Makefile |
1510 | src/plugins/auth-pam/Makefile | |
1511 | src/plugins/down-root/Makefile | |
ce68686f | 1512 | src/tapctl/Makefile |
34cb9132 | 1513 | tests/Makefile |
40cb4cfc JN |
1514 | tests/unit_tests/Makefile |
1515 | tests/unit_tests/example_test/Makefile | |
698e268a | 1516 | tests/unit_tests/openvpn/Makefile |
ac42df1a SK |
1517 | tests/unit_tests/plugins/Makefile |
1518 | tests/unit_tests/plugins/auth-pam/Makefile | |
542c69c3 | 1519 | tests/unit_tests/engine-key/Makefile |
34cb9132 | 1520 | sample/Makefile |
1bda73a7 | 1521 | ]) |
34cb9132 | 1522 | AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh]) |
51bd56f4 | 1523 | AC_OUTPUT |