1dnl ProFTPD - mod_auth_otp 2dnl Copyright (c) 2015-2017 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_auth_otp.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 31AC_PROG_MAKE_SET 32 33AC_HEADER_STDC 34 35AC_CHECK_HEADERS(stdlib.h unistd.h limits.h fcntl.h) 36 37UTILS_LIBS="-lsupp -lcrypto" 38 39dnl Need to support/handle the --enable-devel option, to see if coverage 40dnl is being used 41AC_ARG_ENABLE(devel, 42 [AC_HELP_STRING( 43 [--enable-devel], 44 [enable developer-only code (default=no)]) 45 ], 46 [ 47 if test x"$enableval" != xno ; then 48 if test `echo $enableval | grep -c coverage` = "1" ; then 49 UTILS_LIBS="--coverage $UTILS_LIBS" 50 fi 51 fi 52 ]) 53 54dnl Need to support/handle the --with-includes and --with-libraries options 55AC_ARG_WITH(includes, 56 [AC_HELP_STRING( 57 [--with-includes=LIST], 58 [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]) 59 ], 60 [ ac_addl_includes=`echo "$withval" | sed -e 's/:/ /g'` ; 61 for ainclude in $ac_addl_includes; do 62 if test x"$ac_build_addl_includes" = x ; then 63 ac_build_addl_includes="-I$ainclude" 64 else 65 ac_build_addl_includes="-I$ainclude $ac_build_addl_includes" 66 fi 67 done 68 CPPFLAGS="$CPPFLAGS $ac_build_addl_includes" 69 ]) 70 71AC_ARG_WITH(libraries, 72 [AC_HELP_STRING( 73 [--with-libraries=LIST], 74 [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]) 75 ], 76 [ ac_addl_libdirs=`echo "$withval" | sed -e 's/:/ /g'` ; 77 for alibdir in $ac_addl_libdirs; do 78 if test x"$ac_build_addl_libdirs" = x ; then 79 ac_build_addl_libdirs="-L$alibdir" 80 else 81 ac_build_addl_libdirs="-L$alibdir $ac_build_addl_libdirs" 82 fi 83 done 84 LDFLAGS="$LDFLAGS $ac_build_addl_libdirs" 85 ]) 86 87dnl Need to support/handle the --with-modules and --with-shared options, to 88dnl see if mod_sftp will be built 89AC_ARG_WITH(modules, 90 [AC_HELP_STRING( 91 [--with-modules=LIST], 92 [add additional modules to proftpd. LIST is a colon-separated list of modules to add e.g. --with-modules=mod_readme:mod_ifsession]) 93 ], 94 [ 95 if test x"$withval" != x; then 96 if test x"$withval" = xyes; then 97 AC_MSG_ERROR([--with-modules parameter missing required colon-separated list of modules]) 98 fi 99 100 if test x"$withval" != xno; then 101 modules_list=`echo "$withval" | sed -e 's/:/ /g'`; 102 103 for amodule in $modules_list; do 104 if test x"$amodule" = xmod_sftp ; then 105 AC_DEFINE(HAVE_SFTP, 1, [mod_sftp support enabled]) 106 fi 107 done 108 fi 109 fi 110 ]) 111 112AC_ARG_WITH(shared, 113 [AC_HELP_STRING( 114 [--with-shared=LIST], 115 [build DSO modules for proftpd. LIST is a colon-separated list of modules to build as DSOs e.g. --with-shared=mod_rewrite:mod_ifsession]) 116 ], 117 [ 118 if test x"$withval" != x; then 119 if test x"$withval" = xyes; then 120 AC_MSG_ERROR([--with-shared parameter missing required colon-separated list of modules]) 121 fi 122 123 if test x"$withval" != xno; then 124 shared_modules_list=`echo "$withval" | sed -e 's/:/ /g'`; 125 126 for amodule in $shared_modules_list; do 127 if test x"$amodule" = xmod_sftp ; then 128 AC_DEFINE(HAVE_SFTP, 1, [mod_sftp support enabled]) 129 fi 130 done 131 fi 132 fi 133 ]) 134 135saved_libs="$LIBS" 136LIBS="$LIBS -lcrypto" 137 138AC_MSG_CHECKING([whether linking with OpenSSL functions requires -ldl]) 139saved_libs="$LIBS" 140 141dnl Splice out -lsupp, since that library hasn't been built yet 142LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 143LIBS="-lcrypto -ldl $LIBS" 144 145AC_TRY_LINK( 146 [ 147 #include <openssl/evp.h> 148 ], [ 149 SSLeay_add_all_algorithms(); 150 ], [ 151 AC_MSG_RESULT(yes) 152 LIBS="$saved_libs -ldl" 153 UTILS_LIBS="$UTILS_LIBS -ldl" 154 ], [ 155 AC_MSG_RESULT(no) 156 LIBS="$saved_libs" 157 ] 158) 159 160AC_MSG_CHECKING([whether linking with OpenSSL functions requires -lz]) 161saved_libs="$LIBS" 162 163dnl Splice out -lsupp, since that library hasn't been built yet 164LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 165LIBS="-lcrypto -lz $LIBS" 166 167AC_TRY_LINK( 168 [ 169 #include <openssl/evp.h> 170 #include <openssl/bio.h> 171 #include <openssl/comp.h> 172 ], [ 173 BIO *bio; 174 SSLeay_add_all_algorithms(); 175 bio = BIO_new(BIO_f_zlib()); 176 ], [ 177 AC_MSG_RESULT(yes) 178 LIBS="$saved_libs -lz" 179 UTILS_LIBS="$UTILS_LIBS -lz" 180 ], [ 181 AC_MSG_RESULT(no) 182 LIBS="$saved_libs" 183 ] 184) 185 186dnl Splice out -lsupp, since that library hasn't been built yet 187LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 188LIBS="-lcrypto $LIBS" 189 190AC_MSG_CHECKING([whether OpenSSL supports SHA256]) 191AC_TRY_LINK( 192 [ 193 #include <openssl/evp.h> 194 ], 195 [ 196 const EVP_MD *md; 197 md = EVP_sha256(); 198 ], 199 [ 200 AC_MSG_RESULT(yes) 201 AC_DEFINE(HAVE_SHA256_OPENSSL, 1, [OpenSSL supports SHA224/SHA256]) 202 LIBS="$saved_libs" 203 ], 204 [ 205 AC_MSG_RESULT(no) 206 LIBS="$saved_libs" 207 ] 208) 209 210dnl Splice out -lsupp, since that library hasn't been built yet 211LIBS=`echo "$LIBS" | sed -e 's/-lsupp//g'`; 212LIBS="-lcrypto $LIBS" 213 214AC_MSG_CHECKING([whether OpenSSL supports SHA512]) 215AC_TRY_LINK( 216 [ 217 #include <openssl/evp.h> 218 ], 219 [ 220 const EVP_MD *md; 221 md = EVP_sha512(); 222 ], 223 [ 224 AC_MSG_RESULT(yes) 225 AC_DEFINE(HAVE_SHA512_OPENSSL, 1, [OpenSSL supports SHA384/SHA512]) 226 LIBS="$saved_libs" 227 ], 228 [ 229 AC_MSG_RESULT(no) 230 LIBS="$saved_libs" 231 ] 232) 233 234LIBS="$saved_libs" 235 236INCLUDES="$ac_build_addl_includes" 237LIBDIRS="$ac_build_addl_libdirs" 238 239AC_SUBST(INCLUDES) 240AC_SUBST(LDFLAGS) 241AC_SUBST(LIBDIRS) 242AC_SUBST(UTILS_LIBS) 243 244AC_CONFIG_HEADER(mod_auth_otp.h) 245AC_OUTPUT( 246 t/Makefile 247 Makefile 248) 249