1dnl ProFTPD - mod_sftp 2dnl Copyright (c) 2012-2019 TJ Saunders <tj@castaglia.org> 3dnl 4dnl This program is free software; you can redistribute it and/or modify 5dnl it under the terms of the GNU General Public License as published by 6dnl the Free Software Foundation; either version 2 of the License, or 7dnl (at your option) any later version. 8dnl 9dnl This program is distributed in the hope that it will be useful, 10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12dnl GNU General Public License for more details. 13dnl 14dnl You should have received a copy of the GNU General Public License 15dnl along with this program; if not, write to the Free Software 16dnl Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 17dnl 18dnl Process this file with autoconf to produce a configure script. 19 20AC_INIT(./mod_sftp.c) 21 22AC_CANONICAL_SYSTEM 23 24ostype=`echo $build_os | sed 's/\..*$//g' | sed 's/-.*//g' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` 25 26AC_PROG_CC 27AC_PROG_CPP 28AC_AIX 29AC_ISC_POSIX 30AC_MINIX 31 32dnl Need to support/handle the --with-includes and --with-libraries options 33AC_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 49AC_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 65AC_HEADER_STDC 66AC_CHECK_HEADERS(stdlib.h unistd.h limits.h fcntl.h) 67AC_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 72dnl Check for a crippled OpenSSL library (e.g. Solaris 10). More details 73dnl can be found in: 74dnl 75dnl http://fixunix.com/ssh/73273-openssh-solaris-10-amd64.html 76dnl http://marc.info/?l=openssh-unix-dev&m=113245772008292&w=2 77dnl http://opensolaris.org/os/project/crypto/Documentation/sunwcry/ 78dnl 79dnl So for those users stuck using the Solaris 10 whose OpenSSL does 80dnl not provide support for AES ciphers longer than 128 bits, we need to 81dnl check and disable those symbols. Otherwise mod_sftp fails to build due 82dnl to linker errors. 83 84AC_MSG_CHECKING([whether linking with OpenSSL functions requires -ldl]) 85saved_libs="$LIBS" 86 87dnl Splice out -lsupp, since that library hasn't been built yet 88LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 89LIBS="-lcrypto -ldl $LIBS" 90 91AC_TRY_LINK( 92 [ 93 #include <openssl/evp.h> 94 ], [ 95 SSLeay_add_all_algorithms(); 96 ], [ 97 AC_MSG_RESULT(yes) 98 LIBS="$saved_libs -ldl" 99 ], [ 100 AC_MSG_RESULT(no) 101 LIBS="$saved_libs" 102 ] 103) 104 105AC_MSG_CHECKING([whether linking with OpenSSL functions requires -lz]) 106saved_libs="$LIBS" 107 108dnl Splice out -lsupp, since that library hasn't been built yet 109LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 110LIBS="-lcrypto -lz $LIBS" 111 112AC_TRY_LINK( 113 [ 114 #include <openssl/evp.h> 115 #include <openssl/bio.h> 116 #include <openssl/comp.h> 117 ], [ 118 BIO *bio; 119 SSLeay_add_all_algorithms(); 120 bio = BIO_new(BIO_f_zlib()); 121 ], [ 122 AC_MSG_RESULT(yes) 123 LIBS="$saved_libs -lz" 124 ], [ 125 AC_MSG_RESULT(no) 126 LIBS="$saved_libs" 127 ] 128) 129 130dnl Splice out -lsupp, since that library hasn't been built yet 131LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 132LIBS="-lcrypto $LIBS" 133 134AC_MSG_CHECKING([whether OpenSSL has crippled AES support]) 135AC_TRY_LINK( 136 [ #ifdef HAVE_STRING_H 137 # include <string.h> 138 #endif 139 #include <openssl/evp.h> 140 ], 141 [ 142 EVP_CIPHER *c; 143 c = EVP_aes_192_cbc(); 144 c = EVP_aes_256_cbc(); 145 ], 146 [ 147 AC_MSG_RESULT(no) 148 LIBS="$saved_libs" 149 ], 150 [ 151 AC_MSG_RESULT(yes) 152 AC_DEFINE(HAVE_AES_CRIPPLED_OPENSSL, 1, [OpenSSL is missing AES192 and AES256 support]) 153 LIBS="$saved_libs" 154 ] 155) 156 157dnl Splice out -lsupp, since that library hasn't been built yet 158LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 159LIBS="-lcrypto $LIBS" 160 161AC_MSG_CHECKING([whether OpenSSL supports SHA256]) 162AC_TRY_LINK( 163 [ 164 #include <openssl/evp.h> 165 ], 166 [ 167 const EVP_MD *md; 168 md = EVP_sha256(); 169 ], 170 [ 171 AC_MSG_RESULT(yes) 172 AC_DEFINE(HAVE_SHA256_OPENSSL, 1, [OpenSSL supports SHA224/SHA256]) 173 LIBS="$saved_libs" 174 ], 175 [ 176 AC_MSG_RESULT(no) 177 LIBS="$saved_libs" 178 ] 179) 180 181dnl Splice out -lsupp, since that library hasn't been built yet 182LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 183LIBS="-lcrypto $LIBS" 184 185AC_MSG_CHECKING([whether OpenSSL supports SHA512]) 186AC_TRY_LINK( 187 [ 188 #include <openssl/evp.h> 189 ], 190 [ 191 const EVP_MD *md; 192 md = EVP_sha512(); 193 ], 194 [ 195 AC_MSG_RESULT(yes) 196 AC_DEFINE(HAVE_SHA512_OPENSSL, 1, [OpenSSL supports SHA384/SHA512]) 197 LIBS="$saved_libs" 198 ], 199 [ 200 AC_MSG_RESULT(no) 201 LIBS="$saved_libs" 202 ] 203) 204 205dnl Splice out -lsupp, since that library hasn't been built yet 206LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 207LIBS="-lcrypto $LIBS" 208 209AC_MSG_CHECKING([whether OpenSSL supports EVP_aes_256_ctr]) 210AC_TRY_LINK( 211 [ 212 #include <openssl/evp.h> 213 ], 214 [ 215 EVP_CIPHER *cipher; 216 cipher = EVP_aes_256_ctr(); 217 ], 218 [ 219 AC_MSG_RESULT(yes) 220 AC_DEFINE(HAVE_EVP_AES_256_CTR_OPENSSL, 1, [OpenSSL supports EVP_aes_256_ctr]) 221 LIBS="$saved_libs" 222 ], 223 [ 224 AC_MSG_RESULT(no) 225 LIBS="$saved_libs" 226 ] 227) 228 229LIBS="$saved_libs" 230 231INCLUDES="$ac_build_addl_includes" 232LIBDIRS="$ac_build_addl_libdirs" 233 234AC_SUBST(INCLUDES) 235AC_SUBST(LDFLAGS) 236AC_SUBST(LIBDIRS) 237AC_SUBST(MODULE_LIBS) 238 239AC_CONFIG_HEADER(mod_sftp.h) 240AC_OUTPUT(Makefile) 241