1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
|
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(libspf2, 1.2.9, libspf2@anarres.org)
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE(libspf2, $PACKAGE_VERSION)
AC_CONFIG_SRCDIR([src/libspf2/spf_server.c])
AM_CONFIG_HEADER(config.h)
# remember the version info for later
KV_MAJOR=`echo $PACKAGE_VERSION | sed 's/^\([[0-9]]*\)\.[[0-9]]*\.[[0-9]]*/\1/'`
KV_MINOR=`echo $PACKAGE_VERSION | sed 's/^[[0-9]]*\.\([[0-9]]*\)\.[[0-9]]*/\1/'`
KV_PATCH=`echo $PACKAGE_VERSION | sed 's/^[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)/\1/'`
AC_SUBST([KV_MAJOR])
AC_SUBST([KV_MINOR])
AC_SUBST([KV_PATCH])
cat >src/include/spf_lib_version.h <<_EOF_VERSION
/**
* @file
* @brief Autogenerated configuration information - do not edit.
*/
#ifndef INC_SPF_VERSION
#define INC_SPF_VERSION
#define SPF_LIB_VERSION_MAJOR $KV_MAJOR
#define SPF_LIB_VERSION_MINOR $KV_MINOR
#define SPF_LIB_VERSION_PATCH $KV_PATCH
#endif
_EOF_VERSION
AX_WITH_PERL
PERL_SUBDIRS=""
AC_SUBST([PERL_SUBDIRS])
AC_ARG_ENABLE(perl,
AC_HELP_STRING([--enable-perl],
[build the Perl/XS interface to libspf2]),
[
PERL_SUBDIRS="perl"
AC_CONFIG_COMMANDS([perl/Makefile], [
# XXX This needs to use $PERL, somehow.
( cd perl && perl Makefile.PL )
])
])
# Checks for programs.
AC_PROG_CC
if test "X$ac_cv_prog_gcc" = "Xyes"; then
gcc_ver=`gcc -v 2>&1 | grep version | sed 's/.*gcc version \([[0-9]][[0-9]]*\)\..*/\1/'`
# echo "GCC version: $gcc_ver"
if test "X$gcc_ver" = "X3"; then
CFLAGS="$CFLAGS -W -Wall -Wmissing-prototypes -Wwrite-strings"
# CFLAGS="$CFLAGS -std=c89 -D_BSD_SOURCE -W -Wall -Wmissing-prototypes -Wwrite-strings"
# CFLAGS="$CFLAGS -std=c99 -W -Wall -Wmissing-prototypes -Wwrite-strings"
# CFLAGS="$CFLAGS -std=gnu99 -W -Wall -Wmissing-prototypes -Wwrite-strings"
else
CFLAGS="$CFLAGS -Wall"
fi
fi
AC_PROG_CPP
AC_SUBST([SUBDIRS])
AC_PROG_MAKE_SET
AC_SUBST([LIBPROGS])
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S
dnl This is obsolete
dnl AC_PROG_RANLIB
# Check if the linker accepts --rpath (for Darwin)
AC_MSG_CHECKING([if ld accepts --rpath])
SAVEDLDFLAGS=$LDFLAGS
LDFLAGS=$LDFLAGS" -Wl,--rpath=/"
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[rpath="--rpath="; ldrpath=yes], [rpath="-L"; ldrpath=no])
LDFLAGS=$SAVEDLDFLAGS
AC_MSG_RESULT([$ldrpath])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_SIZEOF([int])
AC_CHECK_HEADERS([limits.h sys/param.h syslog.h sys/time.h errno.h sys/types.h])
AC_CHECK_HEADERS([fcntl.h malloc.h nmemory.h stddef.h inttypes.h stdlib.h string.h unistd.h stdarg.h])
AC_CHECK_HEADERS([pthread.h pwd.h grp.h libintl.h getopt.h])
AC_CHECK_HEADERS([netdb.h netinet/in.h sys/socket.h arpa/inet.h arpa/nameser.h])
AC_CHECK_HEADERS([resolv.h], [], [], [[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* DNS HEADER struct */
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h> /* DNS HEADER struct */
#endif
]])
dnl XXX This is no longer true.
AC_CHECK_HEADER(pthread.h, , [
echo "pthread.h is required to build this program."
exit 1;
])
dnl Moved to after header checks by Shevek
AC_ARG_WITH(bind,
[ --with-bind=DIR Find BIND resolver in DIR],
[AC_CHECK_FILE([$withval/include/bind/resolv.h],
[CFLAGS="$CFLAGS -I$withval/include/bind"],
[CFLAGS="$CFLAGS -I$withval/include"])
LDFLAGS="$LDFLAGS -L$withval/lib -Wl,$rpath$withval/lib"
AC_CHECK_LIB([bind], [res_query], [LIBS="$LIBS -lbind"],
[AC_CHECK_LIB([resolv],
[res_query],
[LIBS="$LIBS -lresolv"],
[echo "cannot find resolver library"; exit 1;])
])
],
[dnl Have to include resolv.h as res_query is sometimes defined as a macro
AC_MSG_CHECKING([for res_query in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[res_query(0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_res_query=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
])
dnl [AC_CHECK_LIB(resolv, res_query)])
# Checks for libraries.
AC_CHECK_LIB(nsl, inet_pton)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(intl, gettext)
AC_CHECK_LIB(pthread, pthread_create)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_C_VOLATILE
AC_C_BIGENDIAN
AC_C_INLINE
AC_C_CHAR_UNSIGNED
AC_CHECK_TYPES([u_char, u_int8_t, u_int16_t, u_int32_t, uint8_t, uint16_t, uint32_t])
AC_CHECK_TYPES([ns_type], [], [], [[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h> /* DNS HEADER struct */
#endif
]])
AC_CHECK_TYPES([struct in6_addr], [], [], [[
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* inet_ functions / structs */
#endif
]])
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SETPGRP
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
# It is not clear if BIND8 and/or BIND9 require the use of the
# res_ninit() and res_nquery() functions when threading, but it is
# safest to use them.
# Nowadays, I think libspf2 requires this function to be available.
AC_CHECK_DECLS([res_ninit], [], [], [[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h> /* DNS HEADER struct */
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
]])
AC_CHECK_DECLS([res_ndestroy], [], [], [[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h> /* DNS HEADER struct */
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
]])
AC_CHECK_DECLS([ns_t_spf], [], [], [[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h> /* DNS HEADER struct */
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
]])
AC_CHECK_DECLS([ns_t_invalid], [], [], [[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h> /* DNS HEADER struct */
#endif
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif
]])
AC_CHECK_FUNCS([ftruncate gethostname memmove memset socket])
AC_CHECK_FUNCS([strchr strcspn strdup strerror])
AC_CHECK_FUNCS([strcasecmp strncasecmp strspn strtoul])
AC_CHECK_FUNCS([gethostbyname inet_ntoa select strrchr strstr strtol])
AC_REPLACE_FUNCS([getopt_long_only strncasecmp])
AC_REPLACE_FUNCS([__ns_initparse __ns_name_uncompress __ns_msg_getflag])
AC_LIBOBJ(__ns_get16)
AC_CONFIG_FILES([Makefile
Doxyfile
src/Makefile
src/include/Makefile
src/libreplace/Makefile
src/libspf2/Makefile
src/spfquery/Makefile
src/spftest/Makefile
src/spfd/Makefile
src/spf_example/Makefile])
AC_OUTPUT
|