Debian Codegraph @

contrib/mod_sftp/configure.in

raw
1 dnl ProFTPD - mod_sftp
2 dnl Copyright (c) 2012-2023 TJ Saunders <[email protected]>
3 dnl
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 2 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17 dnl
18 dnl Process this file with autoconf to produce a configure script.
19
20 AC_INIT(./mod_sftp.c)
21
22 AC_CANONICAL_SYSTEM
23
24 ostype=`echo $build_os | sed 's/\..*$//g' | sed 's/-.*//g' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
25
26 AC_PROG_CC
27 AC_PROG_CPP
28 AC_AIX
29 AC_ISC_POSIX
30 AC_MINIX
31
32 dnl Need to support/handle the --with-includes and --with-libraries options
33 AC_ARG_WITH(includes,
34 [AC_HELP_STRING(
35 [--with-includes=LIST],
36 [add additional include paths to proftpd. LIST is a colon-separated list of include paths to add e.g. --with-includes=/some/mysql/include:/my/include])
37 ],
38 [ ac_addl_includes=`echo "$withval" | sed -e 's/:/ /g'` ;
39 for ainclude in $ac_addl_includes; do
40 if test x"$ac_build_addl_includes" = x ; then
41 ac_build_addl_includes="-I$ainclude"
42 else
43 ac_build_addl_includes="-I$ainclude $ac_build_addl_includes"
44 fi
45 done
46 CPPFLAGS="$CPPFLAGS $ac_build_addl_includes"
47 ])
48
49 AC_ARG_WITH(libraries,
50 [AC_HELP_STRING(
51 [--with-libraries=LIST],
52 [add additional library paths to proftpd. LIST is a colon-separated list of include paths to add e.g. --with-libraries=/some/mysql/libdir:/my/libs])
53 ],
54 [ ac_addl_libdirs=`echo "$withval" | sed -e 's/:/ /g'` ;
55 for alibdir in $ac_addl_libdirs; do
56 if test x"$ac_build_addl_libdirs" = x ; then
57 ac_build_addl_libdirs="-L$alibdir"
58 else
59 ac_build_addl_libdirs="-L$alibdir $ac_build_addl_libdirs"
60 fi
61 done
62 LDFLAGS="$LDFLAGS $ac_build_addl_libdirs"
63 ])
64
65 AC_HEADER_STDC
66 AC_CHECK_HEADERS(stdlib.h unistd.h limits.h fcntl.h)
67 AC_CHECK_HEADER(zlib.h,
68 [AC_DEFINE(HAVE_ZLIB_H, 1, [Define if zlib.h is present.])
69 MODULE_LIBS="$MODULE_LIBS -lz"
70 ])
71
72 dnl Check for a crippled OpenSSL library (e.g. Solaris 10). More details
73 dnl can be found in:
74 dnl
75 dnl http://fixunix.com/ssh/73273-openssh-solaris-10-amd64.html
76 dnl http://marc.info/?l=openssh-unix-dev&m=113245772008292&w=2
77 dnl http://opensolaris.org/os/project/crypto/Documentation/sunwcry/
78 dnl
79 dnl So for those users stuck using the Solaris 10 whose OpenSSL does
80 dnl not provide support for AES ciphers longer than 128 bits, we need to
81 dnl check and disable those symbols. Otherwise mod_sftp fails to build due
82 dnl to linker errors.
83
84 AC_MSG_CHECKING([whether linking with OpenSSL functions requires -ldl])
85 saved_libs="$LIBS"
86 LIBS="-lcrypto -ldl $LIBS"
87
88 AC_TRY_LINK(
89 [
90 #include <openssl/evp.h>
91 ], [
92 SSLeay_add_all_algorithms();
93 ], [
94 AC_MSG_RESULT(yes)
95 LIBS="$saved_libs -ldl"
96 ], [
97 AC_MSG_RESULT(no)
98 LIBS="$saved_libs"
99 ]
100 )
101
102 AC_MSG_CHECKING([whether linking with OpenSSL functions requires -lz])
103 saved_libs="$LIBS"
104 LIBS="-lcrypto -lz $LIBS"
105
106 AC_TRY_LINK(
107 [
108 #include <openssl/evp.h>
109 #include <openssl/bio.h>
110 #include <openssl/comp.h>
111 ], [
112 BIO *bio;
113 SSLeay_add_all_algorithms();
114 bio = BIO_new(BIO_f_zlib());
115 ], [
116 AC_MSG_RESULT(yes)
117 LIBS="$saved_libs -lz"
118 ], [
119 AC_MSG_RESULT(no)
120 LIBS="$saved_libs"
121 ]
122 )
123
124 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
125 LIBS="-lcrypto $LIBS"
126
127 AC_TRY_LINK(
128 [ #ifdef HAVE_STRING_H
129 # include <string.h>
130 #endif
131 #include <openssl/evp.h>
132 ],
133 [
134 EVP_CIPHER *c;
135 c = EVP_aes_192_cbc();
136 c = EVP_aes_256_cbc();
137 ],
138 [
139 AC_MSG_RESULT(no)
140 LIBS="$saved_libs"
141 ],
142 [
143 AC_MSG_RESULT(yes)
144 AC_DEFINE(HAVE_AES_CRIPPLED_OPENSSL, 1, [OpenSSL is missing AES192 and AES256 support])
145 LIBS="$saved_libs"
146 ]
147 )
148
149 AC_MSG_CHECKING([whether OpenSSL supports SHA256])
150 LIBS="-lcrypto $LIBS"
151
152 AC_TRY_LINK(
153 [
154 #include <openssl/evp.h>
155 ],
156 [
157 const EVP_MD *md;
158 md = EVP_sha256();
159 ],
160 [
161 AC_MSG_RESULT(yes)
162 AC_DEFINE(HAVE_SHA256_OPENSSL, 1, [OpenSSL supports SHA224/SHA256])
163 LIBS="$saved_libs"
164 ],
165 [
166 AC_MSG_RESULT(no)
167 LIBS="$saved_libs"
168 ]
169 )
170
171 AC_MSG_CHECKING([whether OpenSSL supports SHA512])
172 LIBS="-lcrypto $LIBS"
173
174 AC_TRY_LINK(
175 [
176 #include <openssl/evp.h>
177 ],
178 [
179 const EVP_MD *md;
180 md = EVP_sha512();
181 ],
182 [
183 AC_MSG_RESULT(yes)
184 AC_DEFINE(HAVE_SHA512_OPENSSL, 1, [OpenSSL supports SHA384/SHA512])
185 LIBS="$saved_libs"
186 ],
187 [
188 AC_MSG_RESULT(no)
189 LIBS="$saved_libs"
190 ]
191 )
192
193 AC_MSG_CHECKING([whether OpenSSL supports EVP_aes_128_ctr])
194 LIBS="-lcrypto $LIBS"
195
196 AC_TRY_LINK(
197 [
198 #include <openssl/evp.h>
199 ],
200 [
201 EVP_CIPHER *cipher;
202 cipher = EVP_aes_128_ctr();
203 ],
204 [
205 AC_MSG_RESULT(yes)
206 AC_DEFINE(HAVE_EVP_AES_128_CTR_OPENSSL, 1, [OpenSSL supports EVP_aes_128_ctr])
207 LIBS="$saved_libs"
208 ],
209 [
210 AC_MSG_RESULT(no)
211 LIBS="$saved_libs"
212 ]
213 )
214
215 AC_MSG_CHECKING([whether OpenSSL supports EVP_aes_192_ctr])
216 LIBS="-lcrypto $LIBS"
217
218 AC_TRY_LINK(
219 [
220 #include <openssl/evp.h>
221 ],
222 [
223 EVP_CIPHER *cipher;
224 cipher = EVP_aes_192_ctr();
225 ],
226 [
227 AC_MSG_RESULT(yes)
228 AC_DEFINE(HAVE_EVP_AES_192_CTR_OPENSSL, 1, [OpenSSL supports EVP_aes_192_ctr])
229 LIBS="$saved_libs"
230 ],
231 [
232 AC_MSG_RESULT(no)
233 LIBS="$saved_libs"
234 ]
235 )
236
237 AC_MSG_CHECKING([whether OpenSSL supports EVP_aes_256_ctr])
238 LIBS="-lcrypto $LIBS"
239
240 AC_TRY_LINK(
241 [
242 #include <openssl/evp.h>
243 ],
244 [
245 EVP_CIPHER *cipher;
246 cipher = EVP_aes_256_ctr();
247 ],
248 [
249 AC_MSG_RESULT(yes)
250 AC_DEFINE(HAVE_EVP_AES_256_CTR_OPENSSL, 1, [OpenSSL supports EVP_aes_256_ctr])
251 LIBS="$saved_libs"
252 ],
253 [
254 AC_MSG_RESULT(no)
255 LIBS="$saved_libs"
256 ]
257 )
258
259 AC_MSG_CHECKING([whether OpenSSL supports EVP_aes_256_gcm])
260 LIBS="-lcrypto $LIBS"
261
262 AC_TRY_LINK(
263 [
264 #include <openssl/evp.h>
265 ],
266 [
267 EVP_CIPHER *cipher;
268 cipher = EVP_aes_256_gcm();
269 ],
270 [
271 AC_MSG_RESULT(yes)
272 AC_DEFINE(HAVE_EVP_AES_256_GCM_OPENSSL, 1, [OpenSSL supports EVP_aes_256_gcm])
273 LIBS="$saved_libs"
274 ],
275 [
276 AC_MSG_RESULT(no)
277 LIBS="$saved_libs"
278 ]
279 )
280
281 AC_MSG_CHECKING([whether OpenSSL supports EVP_chacha20])
282 LIBS="-lcrypto $LIBS"
283
284 AC_TRY_LINK(
285 [
286 #include <openssl/evp.h>
287 ],
288 [
289 EVP_CIPHER *cipher;
290 cipher = EVP_chacha20();
291 ],
292 [
293 AC_MSG_RESULT(yes)
294 AC_DEFINE(HAVE_EVP_CHACHA20_OPENSSL, 1, [OpenSSL supports EVP_chacha20])
295 LIBS="$saved_libs"
296 ],
297 [
298 AC_MSG_RESULT(no)
299 LIBS="$saved_libs"
300 ]
301 )
302
303 AC_MSG_CHECKING([whether OpenSSL supports OSSL_PROVIDER_load])
304 LIBS="-lcrypto $LIBS"
305
306 AC_TRY_LINK(
307 [
308 #include <openssl/provider.h>
309 ],
310 [
311 OSSL_PROVIDER *provider;
312 provider = OSSL_PROVIDER_load(NULL, "default");
313 ],
314 [
315 AC_MSG_RESULT(yes)
316 AC_DEFINE(HAVE_OSSL_PROVIDER_LOAD_OPENSSL, 1, [OpenSSL supports OSSL_PROVIDER_load])
317 LIBS="$saved_libs"
318 ],
319 [
320 AC_MSG_RESULT(no)
321 LIBS="$saved_libs"
322 ]
323 )
324
325 AC_MSG_CHECKING([whether OpenSSL supports X448 algorithm])
326 LIBS="-lcrypto $LIBS"
327
328 AC_TRY_LINK(
329 [
330 #include <openssl/evp.h>
331 ],
332 [
333 EVP_PKEY *pkey;
334 EVP_PKEY_CTX *pctx;
335
336 pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_X448, NULL, NULL, 0);
337 pctx = EVP_PKEY_CTX_new_id(NID_X448, NULL);
338 ],
339 [
340 AC_MSG_RESULT(yes)
341 AC_DEFINE(HAVE_X448_OPENSSL, 1, [OpenSSL supports X448 algorithm])
342 LIBS="$saved_libs"
343 ],
344 [
345 AC_MSG_RESULT(no)
346 LIBS="$saved_libs"
347 ]
348 )
349
350 LIBS="$saved_libs"
351
352 INCLUDES="$ac_build_addl_includes"
353 LIBDIRS="$ac_build_addl_libdirs"
354
355 AC_SUBST(INCLUDES)
356 AC_SUBST(LDFLAGS)
357 AC_SUBST(LIBDIRS)
358 AC_SUBST(MODULE_LIBS)
359
360 AC_CONFIG_HEADER(mod_sftp.h)
361 AC_OUTPUT(Makefile)
362
363 dnl After everything has been generated, we need to ensure that our API
364 dnl headers are in the include/ directory, for use by other modules' build
365 dnl systems.
366 builddir=../..
367 if test ! -d $builddir/include/mod_sftp ; then
368 mkdir $builddir/include/mod_sftp
369 fi
370
371 for h in $(ls *.h); do
372 if test ! -e $builddir/include/mod_sftp/$h ; then
373 olddir=`pwd`
374 cd $builddir/include/mod_sftp
375 ln -s ../../contrib/mod_sftp/$h .
376 cd $olddir
377 fi
378 done