| 1 |
dnl ProFTPD - mod_dnsbl |
| 2 |
dnl Copyright (c) 2012-2017 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_dnsbl.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 |
|
| 68 |
dnl Check whether libc provides the DNS resolver symbols (e.g. *BSD/Mac OSX) |
| 69 |
dnl or not. And if not, check whether we need to link directly with |
| 70 |
dnl /usr/lib/libresolv.a (32-bit) or /usr/lib64/libresolv.a (64-bit). |
| 71 |
dnl |
| 72 |
dnl Ideally we would link with libresolv using -lresolv. However, it seems |
| 73 |
dnl that many Linux distributions shipped a broken version of libresolv.so |
| 74 |
dnl which did not export the necessary ns_initparse/ns_parserr symbols. The |
| 75 |
dnl static version of libresolv shipped DOES provide those symbols (probably |
| 76 |
dnl for use by libc). For these cases, we link againt the static library. |
| 77 |
|
| 78 |
ac_dnsbl_libs="" |
| 79 |
AC_MSG_CHECKING([for resolver symbols in libc]) |
| 80 |
AC_TRY_LINK( |
| 81 |
[ #include <stdlib.h> |
| 82 |
#include <sys/types.h> |
| 83 |
#include <arpa/nameser.h> |
| 84 |
#include <resolv.h> |
| 85 |
], |
| 86 |
[ |
| 87 |
int res; |
| 88 |
res = res_query(NULL, ns_c_in, ns_t_txt, NULL, 0); |
| 89 |
res = ns_initparse(NULL, 0, NULL); |
| 90 |
res = ns_parserr(NULL, ns_s_an, 0, NULL); |
| 91 |
], |
| 92 |
[ |
| 93 |
AC_MSG_RESULT(yes) |
| 94 |
], |
| 95 |
[ |
| 96 |
AC_MSG_RESULT(no) |
| 97 |
|
| 98 |
AC_MSG_CHECKING([for resolver symbols in libresolv]) |
| 99 |
saved_libs="$LIBS" |
| 100 |
LIBS="$LIBS -lresolv" |
| 101 |
|
| 102 |
AC_TRY_LINK( |
| 103 |
[ #include <stdlib.h> |
| 104 |
#include <sys/types.h> |
| 105 |
#include <arpa/nameser.h> |
| 106 |
#include <resolv.h> |
| 107 |
], |
| 108 |
[ |
| 109 |
int res; |
| 110 |
res = res_query(NULL, ns_c_in, ns_t_txt, NULL, 0); |
| 111 |
res = ns_initparse(NULL, 0, NULL); |
| 112 |
res = ns_parserr(NULL, ns_s_an, 0, NULL); |
| 113 |
], |
| 114 |
[ |
| 115 |
AC_MSG_RESULT(yes) |
| 116 |
LIBS="$saved_libs" |
| 117 |
ac_dnsbl_libs="-lresolv" |
| 118 |
], |
| 119 |
[ |
| 120 |
AC_MSG_RESULT(no) |
| 121 |
LIBS="$saved_libs" |
| 122 |
|
| 123 |
AC_MSG_CHECKING([for resolver symbols in /usr/lib64/libresolv.a]) |
| 124 |
saved_libs="$LIBS" |
| 125 |
LIBS="$LIBS /usr/lib64/libresolv.a" |
| 126 |
|
| 127 |
AC_TRY_LINK( |
| 128 |
[ #include <stdlib.h> |
| 129 |
#include <sys/types.h> |
| 130 |
#include <arpa/nameser.h> |
| 131 |
#include <resolv.h> |
| 132 |
], |
| 133 |
[ |
| 134 |
int res; |
| 135 |
res = res_query(NULL, ns_c_in, ns_t_txt, NULL, 0); |
| 136 |
res = ns_initparse(NULL, 0, NULL); |
| 137 |
res = ns_parserr(NULL, ns_s_an, 0, NULL); |
| 138 |
], |
| 139 |
[ |
| 140 |
AC_MSG_RESULT(yes) |
| 141 |
LIBS="$saved_libs" |
| 142 |
ac_dnsbl_libs="/usr/lib64/libresolv.a" |
| 143 |
], |
| 144 |
[ |
| 145 |
AC_MSG_RESULT(no) |
| 146 |
LIBS="$saved_libs" |
| 147 |
|
| 148 |
AC_MSG_CHECKING([for resolver symbols in /usr/lib/libresolv.a]) |
| 149 |
saved_libs="$LIBS" |
| 150 |
LIBS="$LIBS /usr/lib/libresolv.a" |
| 151 |
|
| 152 |
AC_TRY_LINK( |
| 153 |
[ #include <stdlib.h> |
| 154 |
#include <sys/types.h> |
| 155 |
#include <arpa/nameser.h> |
| 156 |
#include <resolv.h> |
| 157 |
], |
| 158 |
[ |
| 159 |
int res; |
| 160 |
res = res_query(NULL, ns_c_in, ns_t_txt, NULL, 0); |
| 161 |
res = ns_initparse(NULL, 0, NULL); |
| 162 |
res = ns_parserr(NULL, ns_s_an, 0, NULL); |
| 163 |
], |
| 164 |
[ |
| 165 |
AC_MSG_RESULT(yes) |
| 166 |
LIBS="$saved_libs" |
| 167 |
ac_dnsbl_libs="/usr/lib/libresolv.a" |
| 168 |
], |
| 169 |
[ |
| 170 |
AC_MSG_RESULT(no) |
| 171 |
LIBS="$saved_libs" |
| 172 |
] |
| 173 |
) |
| 174 |
] |
| 175 |
) |
| 176 |
] |
| 177 |
) |
| 178 |
] |
| 179 |
) |
| 180 |
|
| 181 |
INCLUDES="$ac_build_addl_includes" |
| 182 |
LIBDIRS="$ac_build_addl_libdirs" |
| 183 |
MODULE_LIBS="$ac_dnsbl_libs" |
| 184 |
|
| 185 |
AC_SUBST(INCLUDES) |
| 186 |
AC_SUBST(LDFLAGS) |
| 187 |
AC_SUBST(LIBDIRS) |
| 188 |
AC_SUBST(MODULE_LIBS) |
| 189 |
|
| 190 |
AC_CONFIG_HEADER(mod_dnsbl.h) |
| 191 |
AC_OUTPUT(Makefile) |