| 1 |
dnl ProFTPD - mod_auth_otp |
| 2 |
dnl Copyright (c) 2015-2021 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_auth_otp.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 |
AC_PROG_MAKE_SET |
| 32 |
|
| 33 |
AC_HEADER_STDC |
| 34 |
|
| 35 |
AC_CHECK_HEADERS(stdlib.h unistd.h limits.h fcntl.h) |
| 36 |
|
| 37 |
UTILS_LIBS="-lcrypto" |
| 38 |
|
| 39 |
dnl Need to support/handle the --enable-devel option, to see if coverage |
| 40 |
dnl is being used |
| 41 |
AC_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 |
|
| 54 |
dnl Need to support/handle the --with-includes and --with-libraries options |
| 55 |
AC_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 |
|
| 71 |
AC_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 |
|
| 87 |
dnl Need to support/handle the --with-modules and --with-shared options, to |
| 88 |
dnl see if mod_sftp will be built |
| 89 |
AC_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 |
|
| 112 |
AC_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 |
|
| 135 |
saved_libs="$LIBS" |
| 136 |
LIBS="$LIBS -lcrypto" |
| 137 |
|
| 138 |
AC_MSG_CHECKING([whether linking with OpenSSL functions requires -ldl]) |
| 139 |
saved_libs="$LIBS" |
| 140 |
LIBS="-lcrypto -ldl $LIBS" |
| 141 |
|
| 142 |
AC_TRY_LINK( |
| 143 |
[ |
| 144 |
#include <openssl/evp.h> |
| 145 |
], [ |
| 146 |
SSLeay_add_all_algorithms(); |
| 147 |
], [ |
| 148 |
AC_MSG_RESULT(yes) |
| 149 |
LIBS="$saved_libs -ldl" |
| 150 |
UTILS_LIBS="$UTILS_LIBS -ldl" |
| 151 |
], [ |
| 152 |
AC_MSG_RESULT(no) |
| 153 |
LIBS="$saved_libs" |
| 154 |
] |
| 155 |
) |
| 156 |
|
| 157 |
AC_MSG_CHECKING([whether linking with OpenSSL functions requires -lz]) |
| 158 |
saved_libs="$LIBS" |
| 159 |
LIBS="-lcrypto -lz $LIBS" |
| 160 |
|
| 161 |
AC_TRY_LINK( |
| 162 |
[ |
| 163 |
#include <openssl/evp.h> |
| 164 |
#include <openssl/bio.h> |
| 165 |
#include <openssl/comp.h> |
| 166 |
], [ |
| 167 |
BIO *bio; |
| 168 |
SSLeay_add_all_algorithms(); |
| 169 |
bio = BIO_new(BIO_f_zlib()); |
| 170 |
], [ |
| 171 |
AC_MSG_RESULT(yes) |
| 172 |
LIBS="$saved_libs -lz" |
| 173 |
UTILS_LIBS="$UTILS_LIBS -lz" |
| 174 |
], [ |
| 175 |
AC_MSG_RESULT(no) |
| 176 |
LIBS="$saved_libs" |
| 177 |
] |
| 178 |
) |
| 179 |
|
| 180 |
AC_MSG_CHECKING([whether OpenSSL supports SHA256]) |
| 181 |
LIBS="-lcrypto $LIBS" |
| 182 |
|
| 183 |
AC_TRY_LINK( |
| 184 |
[ |
| 185 |
#include <openssl/evp.h> |
| 186 |
], |
| 187 |
[ |
| 188 |
const EVP_MD *md; |
| 189 |
md = EVP_sha256(); |
| 190 |
], |
| 191 |
[ |
| 192 |
AC_MSG_RESULT(yes) |
| 193 |
AC_DEFINE(HAVE_SHA256_OPENSSL, 1, [OpenSSL supports SHA224/SHA256]) |
| 194 |
LIBS="$saved_libs" |
| 195 |
], |
| 196 |
[ |
| 197 |
AC_MSG_RESULT(no) |
| 198 |
LIBS="$saved_libs" |
| 199 |
] |
| 200 |
) |
| 201 |
|
| 202 |
AC_MSG_CHECKING([whether OpenSSL supports SHA512]) |
| 203 |
LIBS="-lcrypto $LIBS" |
| 204 |
|
| 205 |
AC_TRY_LINK( |
| 206 |
[ |
| 207 |
#include <openssl/evp.h> |
| 208 |
], |
| 209 |
[ |
| 210 |
const EVP_MD *md; |
| 211 |
md = EVP_sha512(); |
| 212 |
], |
| 213 |
[ |
| 214 |
AC_MSG_RESULT(yes) |
| 215 |
AC_DEFINE(HAVE_SHA512_OPENSSL, 1, [OpenSSL supports SHA384/SHA512]) |
| 216 |
LIBS="$saved_libs" |
| 217 |
], |
| 218 |
[ |
| 219 |
AC_MSG_RESULT(no) |
| 220 |
LIBS="$saved_libs" |
| 221 |
] |
| 222 |
) |
| 223 |
|
| 224 |
LIBS="$saved_libs" |
| 225 |
|
| 226 |
INCLUDES="$ac_build_addl_includes" |
| 227 |
LIBDIRS="$ac_build_addl_libdirs" |
| 228 |
|
| 229 |
AC_SUBST(INCLUDES) |
| 230 |
AC_SUBST(LDFLAGS) |
| 231 |
AC_SUBST(LIBDIRS) |
| 232 |
AC_SUBST(UTILS_LIBS) |
| 233 |
|
| 234 |
AC_CONFIG_HEADER(mod_auth_otp.h) |
| 235 |
AC_OUTPUT( |
| 236 |
t/Makefile |
| 237 |
Makefile |
| 238 |
) |