| 1 |
# Copyright (C) 1998-2010 Joe Orton <[email protected]> -*- autoconf -*- |
| 2 |
# Copyright (C) 2004 Aleix Conchillo Flaque <[email protected]> |
| 3 |
# |
| 4 |
# This file is free software; you may copy and/or distribute it with |
| 5 |
# or without modifications, as long as this notice is preserved. |
| 6 |
# This software is distributed in the hope that it will be useful, but |
| 7 |
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even |
| 8 |
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 9 |
# PURPOSE. |
| 10 |
|
| 11 |
# The above license applies to THIS FILE ONLY, the neon library code |
| 12 |
# itself may be copied and distributed under the terms of the GNU |
| 13 |
# LGPL, see COPYING.LIB for more details |
| 14 |
|
| 15 |
# This file is part of the neon HTTP/WebDAV client library. |
| 16 |
# See http://www.webdav.org/neon/ for the latest version. |
| 17 |
# Please send any feedback to <[email protected]> |
| 18 |
|
| 19 |
# |
| 20 |
# Usage: |
| 21 |
# |
| 22 |
# NEON_LIBRARY |
| 23 |
# or NEON_BUNDLED(srcdir, [ACTIONS-IF-BUNDLED], [ACTIONS-IF-NOT_BUNDLED]) |
| 24 |
# or NEON_VPATH_BUNDLED(srcdir, builddir, |
| 25 |
# [ACTIONS-IF-BUNDLED], [ACTIONS-IF-NOT-BUNDLED]) |
| 26 |
# |
| 27 |
# where srcdir is the location of bundled neon 'src' directory. |
| 28 |
# If using a VPATH-enabled build, builddir is the location of the |
| 29 |
# build directory corresponding to srcdir. |
| 30 |
# |
| 31 |
# If a bundled build *is* being used, ACTIONS-IF-BUNDLED will be |
| 32 |
# evaluated. These actions should ensure that 'make' is run |
| 33 |
# in srcdir, and that one of NEON_NORMAL_BUILD or NEON_LIBTOOL_BUILD |
| 34 |
# is called. |
| 35 |
# |
| 36 |
# After calling one of the above macros, if the NEON_NEED_XML_PARSER |
| 37 |
# variable is set to "yes", then you must configure an XML parser |
| 38 |
# too. You can do this your own way, or do it easily using the |
| 39 |
# NEON_XML_PARSER() macro. Example usage for where we have bundled the |
| 40 |
# neon sources in a directory called libneon, and bundled expat |
| 41 |
# sources in a directory called 'expat'. |
| 42 |
# |
| 43 |
# NEON_BUNDLED(libneon, [ |
| 44 |
# NEON_XML_PARSER(expat) |
| 45 |
# NEON_NORMAL_BUILD |
| 46 |
# ]) |
| 47 |
# |
| 48 |
# Alternatively, for a simple standalone app with neon as a |
| 49 |
# dependancy, use just: |
| 50 |
# |
| 51 |
# NEON_LIBRARY |
| 52 |
# |
| 53 |
# and rely on the user installing neon correctly. |
| 54 |
# |
| 55 |
# You are free to configure an XML parser any other way you like, |
| 56 |
# but the end result must be, either expat or libxml will get linked |
| 57 |
# in, and HAVE_EXPAT or HAVE_LIBXML is defined appropriately. |
| 58 |
# |
| 59 |
# To set up the bundled build environment, call |
| 60 |
# |
| 61 |
# NEON_NORMAL_BUILD |
| 62 |
# or |
| 63 |
# NEON_LIBTOOL_BUILD |
| 64 |
# |
| 65 |
# depending on whether you are using libtool to build, or not. |
| 66 |
# Both these macros take an optional argument specifying the set |
| 67 |
# of object files you wish to build: if the argument is not given, |
| 68 |
# all of neon will be built. |
| 69 |
|
| 70 |
AC_DEFUN([NEON_BUNDLED],[ |
| 71 |
|
| 72 |
neon_bundled_srcdir=$1 |
| 73 |
neon_bundled_builddir=$1 |
| 74 |
|
| 75 |
NEON_COMMON_BUNDLED([$2], [$3]) |
| 76 |
|
| 77 |
]) |
| 78 |
|
| 79 |
AC_DEFUN([NEON_VPATH_BUNDLED],[ |
| 80 |
|
| 81 |
neon_bundled_srcdir=$1 |
| 82 |
neon_bundled_builddir=$2 |
| 83 |
NEON_COMMON_BUNDLED([$3], [$4]) |
| 84 |
|
| 85 |
]) |
| 86 |
|
| 87 |
AC_DEFUN([NEON_COMMON_BUNDLED],[ |
| 88 |
|
| 89 |
AC_PREREQ(2.50) |
| 90 |
|
| 91 |
AC_ARG_WITH(included-neon, |
| 92 |
AS_HELP_STRING([--with-included-neon], [force use of included neon library]), |
| 93 |
[neon_force_included="$withval"], [neon_force_included="no"]) |
| 94 |
|
| 95 |
NEON_COMMON |
| 96 |
|
| 97 |
# The colons are here so there is something to evaluate |
| 98 |
# in case the argument was not passed. |
| 99 |
if test "$neon_force_included" = "yes"; then |
| 100 |
: |
| 101 |
$1 |
| 102 |
else |
| 103 |
: |
| 104 |
$2 |
| 105 |
fi |
| 106 |
|
| 107 |
]) |
| 108 |
|
| 109 |
dnl Not got any bundled sources: |
| 110 |
AC_DEFUN([NEON_LIBRARY],[ |
| 111 |
|
| 112 |
AC_PREREQ(2.50) |
| 113 |
neon_force_included=no |
| 114 |
neon_bundled_srcdir= |
| 115 |
neon_bundled_builddir= |
| 116 |
|
| 117 |
NEON_COMMON |
| 118 |
|
| 119 |
]) |
| 120 |
|
| 121 |
AC_DEFUN([NE_DEFINE_VERSIONS], [ |
| 122 |
|
| 123 |
NEON_VERSION="${NE_VERSION_MAJOR}.${NE_VERSION_MINOR}.${NE_VERSION_PATCH}${NE_VERSION_TAG}" |
| 124 |
|
| 125 |
AC_DEFINE_UNQUOTED([NEON_VERSION], ["${NEON_VERSION}"], |
| 126 |
[Define to be the neon version string]) |
| 127 |
AC_DEFINE_UNQUOTED([NE_VERSION_MAJOR], [(${NE_VERSION_MAJOR})], |
| 128 |
[Define to be neon library major version]) |
| 129 |
AC_DEFINE_UNQUOTED([NE_VERSION_MINOR], [(${NE_VERSION_MINOR})], |
| 130 |
[Define to be neon library minor version]) |
| 131 |
AC_DEFINE_UNQUOTED([NE_VERSION_PATCH], [(${NE_VERSION_PATCH})], |
| 132 |
[Define to be neon library patch version]) |
| 133 |
]) |
| 134 |
|
| 135 |
AC_DEFUN([NE_VERSIONS_BUNDLED], [ |
| 136 |
|
| 137 |
# Define the current versions. |
| 138 |
NE_VERSION_MAJOR=0 |
| 139 |
NE_VERSION_MINOR=29 |
| 140 |
NE_VERSION_PATCH=6 |
| 141 |
NE_VERSION_TAG= |
| 142 |
|
| 143 |
# 0.29.x is backwards-compatible to 0.27.x, so AGE=2 |
| 144 |
NE_LIBTOOL_VERSINFO="29:${NE_VERSION_PATCH}:2" |
| 145 |
|
| 146 |
NE_DEFINE_VERSIONS |
| 147 |
|
| 148 |
]) |
| 149 |
|
| 150 |
dnl Adds an ABI variation tag which will be added to the SONAME of |
| 151 |
dnl a shared library. e.g. NE_ADD_ABITAG(FOO) |
| 152 |
AC_DEFUN([NE_ADD_ABITAG], [ |
| 153 |
if test "x${NE_LIBTOOL_RELEASE}y" = "xy"; then |
| 154 |
NE_LIBTOOL_RELEASE="$1" |
| 155 |
else |
| 156 |
NE_LIBTOOL_RELEASE="${NE_LIBTOOL_RELEASE}-$1" |
| 157 |
fi |
| 158 |
]) |
| 159 |
|
| 160 |
dnl Define the minimum required versions, usage: |
| 161 |
dnl NE_REQUIRE_VERSIONS([major-version], [minor-versions]) |
| 162 |
dnl e.g. |
| 163 |
dnl NE_REQUIRE_VERSIONS([0], [24 25]) |
| 164 |
dnl to require neon 0.24.x or neon 0.25.x. |
| 165 |
AC_DEFUN([NE_REQUIRE_VERSIONS], [ |
| 166 |
m4_define([ne_require_major], [$1]) |
| 167 |
m4_define([ne_require_minor], [$2]) |
| 168 |
]) |
| 169 |
|
| 170 |
dnl Check that the external library found in a given location |
| 171 |
dnl matches the min. required version (if any). Requires that |
| 172 |
dnl NEON_CONFIG be set the the full path of a valid neon-config |
| 173 |
dnl script |
| 174 |
dnl |
| 175 |
dnl Usage: |
| 176 |
dnl NEON_CHECK_VERSION(ACTIONS-IF-OKAY, ACTIONS-IF-FAILURE) |
| 177 |
dnl |
| 178 |
AC_DEFUN([NEON_CHECK_VERSION], [ |
| 179 |
m4_ifdef([ne_require_major], [ |
| 180 |
# Check whether the library is of required version |
| 181 |
ne_save_LIBS="$LIBS" |
| 182 |
ne_save_CFLAGS="$CFLAGS" |
| 183 |
CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" |
| 184 |
LIBS="$LIBS `$NEON_CONFIG --libs`" |
| 185 |
ne_libver=`$NEON_CONFIG --version | sed -e "s/neon //g"` |
| 186 |
# Check whether it's possible to link against neon |
| 187 |
AC_CACHE_CHECK([linking against neon], [ne_cv_lib_neon], |
| 188 |
[AC_LINK_IFELSE( |
| 189 |
[AC_LANG_PROGRAM([[#include <ne_utils.h>]], [[ne_version_match(0, 0);]])], |
| 190 |
[ne_cv_lib_neon=yes], [ne_cv_lib_neon=no])]) |
| 191 |
if test "$ne_cv_lib_neon" = "yes"; then |
| 192 |
ne_cv_lib_neonver=no |
| 193 |
for v in ne_require_minor; do |
| 194 |
case $ne_libver in |
| 195 |
ne_require_major.$v.*) ne_cv_lib_neonver=yes ;; |
| 196 |
esac |
| 197 |
done |
| 198 |
fi |
| 199 |
ne_goodver=$ne_cv_lib_neonver |
| 200 |
LIBS=$ne_save_LIBS |
| 201 |
CFLAGS=$ne_save_CFLAGS |
| 202 |
], [ |
| 203 |
# NE_REQUIRE_VERSIONS not used; presume all versions OK! |
| 204 |
ne_goodver=yes |
| 205 |
ne_libver="(version unknown)" |
| 206 |
]) |
| 207 |
|
| 208 |
if test "$ne_goodver" = "yes"; then |
| 209 |
AC_MSG_NOTICE([using neon library $ne_libver]) |
| 210 |
$1 |
| 211 |
else |
| 212 |
AC_MSG_NOTICE([incompatible neon library version $ne_libver: wanted ne_require_major.ne_require_minor]) |
| 213 |
$2 |
| 214 |
fi]) |
| 215 |
|
| 216 |
dnl NEON_CHECK_SUPPORT(feature, var, name) |
| 217 |
AC_DEFUN([NEON_CHECK_SUPPORT], [ |
| 218 |
if $NEON_CONFIG --support $1 >/dev/null; then |
| 219 |
NE_ENABLE_SUPPORT($2, [$3 is supported by neon]) |
| 220 |
else |
| 221 |
NE_DISABLE_SUPPORT($2, [$3 is not supported by neon]) |
| 222 |
fi |
| 223 |
]) |
| 224 |
|
| 225 |
dnl enable support for feature $1 with define NE_HAVE_$1, message $2 |
| 226 |
AC_DEFUN([NE_ENABLE_SUPPORT], [ |
| 227 |
NE_FLAG_$1=yes |
| 228 |
AC_SUBST(NE_FLAG_$1) |
| 229 |
AC_DEFINE([NE_HAVE_]$1, 1, [Defined if $1 is supported]) |
| 230 |
m4_if([$2], [], |
| 231 |
[ne_$1_message="support enabled" |
| 232 |
AC_MSG_NOTICE([$1 support is enabled])], |
| 233 |
[ne_$1_message="$2" |
| 234 |
AC_MSG_NOTICE([$2])]) |
| 235 |
]) |
| 236 |
|
| 237 |
dnl Disable support for feature $1, giving message $2 |
| 238 |
AC_DEFUN([NE_DISABLE_SUPPORT], [ |
| 239 |
NE_FLAG_$1=no |
| 240 |
AC_SUBST(NE_FLAG_$1) |
| 241 |
m4_if([$2], [], |
| 242 |
[ne_$1_message="not supported" |
| 243 |
AC_MSG_NOTICE([$1 support is not enabled])], |
| 244 |
[ne_$1_message="$2" |
| 245 |
AC_MSG_NOTICE([$2])]) |
| 246 |
]) |
| 247 |
|
| 248 |
AC_DEFUN([NEON_USE_EXTERNAL], [ |
| 249 |
# Configure to use an external neon, given a neon-config script |
| 250 |
# found at $NEON_CONFIG. |
| 251 |
neon_prefix=`$NEON_CONFIG --prefix` |
| 252 |
NEON_CHECK_VERSION([ |
| 253 |
# Pick up CFLAGS and LIBS needed |
| 254 |
CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" |
| 255 |
NEON_LIBS="$NEON_LIBS `$NEON_CONFIG --libs`" |
| 256 |
# Pick up library version |
| 257 |
set dummy `$NEON_CONFIG --version | sed 's/\./ /g'` |
| 258 |
NE_VERSION_MAJOR=[$]3; NE_VERSION_MINOR=[$]4; NE_VERSION_PATCH=[$]5 |
| 259 |
NE_DEFINE_VERSIONS |
| 260 |
neon_library_message="library in ${neon_prefix} (${NEON_VERSION})" |
| 261 |
neon_xml_parser_message="using whatever neon uses" |
| 262 |
NEON_CHECK_SUPPORT([ssl], [SSL], [SSL]) |
| 263 |
NEON_CHECK_SUPPORT([zlib], [ZLIB], [zlib]) |
| 264 |
NEON_CHECK_SUPPORT([ipv6], [IPV6], [IPv6]) |
| 265 |
NEON_CHECK_SUPPORT([lfs], [LFS], [LFS]) |
| 266 |
NEON_CHECK_SUPPORT([ts_ssl], [TS_SSL], [thread-safe SSL]) |
| 267 |
neon_got_library=yes |
| 268 |
if test $NE_FLAG_LFS = yes; then |
| 269 |
NEON_FORMAT(off64_t) |
| 270 |
AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF64_T], |
| 271 |
[Define to be printf format string for ne_off_t]) |
| 272 |
else |
| 273 |
AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF_T]) |
| 274 |
fi |
| 275 |
], [neon_got_library=no]) |
| 276 |
]) |
| 277 |
|
| 278 |
AC_DEFUN([NEON_COMMON],[ |
| 279 |
|
| 280 |
AC_REQUIRE([NEON_COMMON_CHECKS]) |
| 281 |
|
| 282 |
AC_ARG_WITH(neon, |
| 283 |
[ --with-neon[[=DIR]] specify location of neon library], |
| 284 |
[case $withval in |
| 285 |
yes|no) neon_force_external=$withval; neon_ext_path= ;; |
| 286 |
*) neon_force_external=yes; neon_ext_path=$withval ;; |
| 287 |
esac;], [ |
| 288 |
neon_force_external=no |
| 289 |
neon_ext_path= |
| 290 |
]) |
| 291 |
|
| 292 |
if test "$neon_force_included" = "no"; then |
| 293 |
# There is no included neon source directory, or --with-included-neon |
| 294 |
# wasn't given (so we're not forced to use it). |
| 295 |
|
| 296 |
# Default to no external neon. |
| 297 |
neon_got_library=no |
| 298 |
if test "x$neon_ext_path" = "x"; then |
| 299 |
AC_PATH_PROG([NEON_CONFIG], neon-config, none) |
| 300 |
if test "x${NEON_CONFIG}" = "xnone"; then |
| 301 |
AC_MSG_NOTICE([no external neon library found]) |
| 302 |
elif test -x "${NEON_CONFIG}"; then |
| 303 |
NEON_USE_EXTERNAL |
| 304 |
else |
| 305 |
AC_MSG_NOTICE([ignoring non-executable ${NEON_CONFIG}]) |
| 306 |
fi |
| 307 |
else |
| 308 |
AC_MSG_CHECKING([for neon library in $neon_ext_path]) |
| 309 |
NEON_CONFIG="$neon_ext_path/bin/neon-config" |
| 310 |
if test -x ${NEON_CONFIG}; then |
| 311 |
AC_MSG_RESULT([found]) |
| 312 |
NEON_USE_EXTERNAL |
| 313 |
else |
| 314 |
AC_MSG_RESULT([not found]) |
| 315 |
# ...will fail since force_external=yes |
| 316 |
fi |
| 317 |
fi |
| 318 |
|
| 319 |
if test "$neon_got_library" = "no"; then |
| 320 |
if test $neon_force_external = yes; then |
| 321 |
AC_MSG_ERROR([could not use external neon library]) |
| 322 |
elif test -n "$neon_bundled_srcdir"; then |
| 323 |
# Couldn't find external neon, forced to use bundled sources |
| 324 |
neon_force_included="yes" |
| 325 |
else |
| 326 |
# Couldn't find neon, and don't have bundled sources |
| 327 |
AC_MSG_ERROR(could not find neon) |
| 328 |
fi |
| 329 |
fi |
| 330 |
fi |
| 331 |
|
| 332 |
if test "$neon_force_included" = "yes"; then |
| 333 |
NE_VERSIONS_BUNDLED |
| 334 |
AC_MSG_NOTICE([using bundled neon ($NEON_VERSION)]) |
| 335 |
NEON_BUILD_BUNDLED="yes" |
| 336 |
LIBNEON_SOURCE_CHECKS |
| 337 |
CFLAGS="$CFLAGS -I$neon_bundled_srcdir" |
| 338 |
NEON_LIBS="-L$neon_bundled_builddir -lneon $NEON_LIBS" |
| 339 |
NEON_NEED_XML_PARSER=yes |
| 340 |
neon_library_message="included libneon (${NEON_VERSION})" |
| 341 |
else |
| 342 |
# Don't need to configure an XML parser |
| 343 |
NEON_NEED_XML_PARSER=no |
| 344 |
NEON_BUILD_BUNDLED=no |
| 345 |
fi |
| 346 |
|
| 347 |
AC_SUBST(NEON_BUILD_BUNDLED) |
| 348 |
|
| 349 |
]) |
| 350 |
|
| 351 |
dnl AC_SEARCH_LIBS done differently. Usage: |
| 352 |
dnl NE_SEARCH_LIBS(function, libnames, [extralibs], [actions-if-not-found], |
| 353 |
dnl [actions-if-found]) |
| 354 |
dnl Tries to find 'function' by linking againt `-lLIB $NEON_LIBS' for each |
| 355 |
dnl LIB in libnames. If link fails and 'extralibs' is given, will also |
| 356 |
dnl try linking against `-lLIB extralibs $NEON_LIBS`. |
| 357 |
dnl Once link succeeds, `-lLIB [extralibs]` is prepended to $NEON_LIBS, and |
| 358 |
dnl `actions-if-found' are executed, if given. |
| 359 |
dnl If link never succeeds, run `actions-if-not-found', if given, else |
| 360 |
dnl give an error and fail configure. |
| 361 |
AC_DEFUN([NE_SEARCH_LIBS], [ |
| 362 |
|
| 363 |
AC_REQUIRE([NE_CHECK_OS]) |
| 364 |
|
| 365 |
AC_CACHE_CHECK([for library containing $1], [ne_cv_libsfor_$1], [ |
| 366 |
AC_LINK_IFELSE( |
| 367 |
[AC_LANG_PROGRAM([], [[$1();]])], |
| 368 |
[ne_cv_libsfor_$1="none needed"], [ |
| 369 |
ne_sl_save_LIBS=$LIBS |
| 370 |
ne_cv_libsfor_$1="not found" |
| 371 |
for lib in $2; do |
| 372 |
# The w32api libraries link using the stdcall calling convention. |
| 373 |
case ${lib}-${ne_cv_os_uname} in |
| 374 |
ws2_32-MINGW*) ne__code="__stdcall $1();" ;; |
| 375 |
*) ne__code="$1();" ;; |
| 376 |
esac |
| 377 |
|
| 378 |
LIBS="$ne_sl_save_LIBS -l$lib $NEON_LIBS" |
| 379 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$ne__code])], |
| 380 |
[ne_cv_libsfor_$1="-l$lib"; break]) |
| 381 |
m4_if($3, [], [], dnl If $3 is specified, then... |
| 382 |
[LIBS="$ne_sl_save_LIBS -l$lib $3 $NEON_LIBS" |
| 383 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [$ne__code])], |
| 384 |
[ne_cv_libsfor_$1="-l$lib $3"; break])]) |
| 385 |
done |
| 386 |
LIBS=$ne_sl_save_LIBS])]) |
| 387 |
|
| 388 |
if test "$ne_cv_libsfor_$1" = "not found"; then |
| 389 |
m4_if([$4], [], [AC_MSG_ERROR([could not find library containing $1])], [$4]) |
| 390 |
elif test "$ne_cv_libsfor_$1" = "none needed"; then |
| 391 |
m4_if([$5], [], [:], [$5]) |
| 392 |
else |
| 393 |
NEON_LIBS="$ne_cv_libsfor_$1 $NEON_LIBS" |
| 394 |
$5 |
| 395 |
fi]) |
| 396 |
|
| 397 |
dnl Check for presence and suitability of zlib library |
| 398 |
AC_DEFUN([NEON_ZLIB], [ |
| 399 |
|
| 400 |
AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib], [disable zlib support]), |
| 401 |
ne_use_zlib=$withval, ne_use_zlib=yes) |
| 402 |
|
| 403 |
if test "$ne_use_zlib" = "yes"; then |
| 404 |
AC_CHECK_HEADER(zlib.h, [ |
| 405 |
AC_CHECK_LIB(z, inflate, [ |
| 406 |
NEON_LIBS="$NEON_LIBS -lz" |
| 407 |
NE_ENABLE_SUPPORT(ZLIB, [zlib support enabled, using -lz]) |
| 408 |
], [NE_DISABLE_SUPPORT(ZLIB, [zlib library not found])]) |
| 409 |
], [NE_DISABLE_SUPPORT(ZLIB, [zlib header not found])]) |
| 410 |
else |
| 411 |
NE_DISABLE_SUPPORT(ZLIB, [zlib not enabled]) |
| 412 |
fi |
| 413 |
]) |
| 414 |
|
| 415 |
AC_DEFUN([NE_CHECK_OS], [ |
| 416 |
# Check for Darwin, which needs extra cpp and linker flags. |
| 417 |
AC_CACHE_CHECK([for uname], ne_cv_os_uname, [ |
| 418 |
ne_cv_os_uname=`uname -s 2>/dev/null` |
| 419 |
]) |
| 420 |
|
| 421 |
if test "$ne_cv_os_uname" = "Darwin"; then |
| 422 |
CPPFLAGS="$CPPFLAGS -no-cpp-precomp" |
| 423 |
LDFLAGS="$LDFLAGS -flat_namespace" |
| 424 |
# poll has various issues in various Darwin releases |
| 425 |
if test x${ac_cv_func_poll+set} != xset; then |
| 426 |
ac_cv_func_poll=no |
| 427 |
fi |
| 428 |
fi |
| 429 |
]) |
| 430 |
|
| 431 |
AC_DEFUN([NEON_COMMON_CHECKS], [ |
| 432 |
|
| 433 |
# These checks are done whether or not the bundled neon build |
| 434 |
# is used. |
| 435 |
|
| 436 |
ifdef([AC_USE_SYSTEM_EXTENSIONS], |
| 437 |
[AC_USE_SYSTEM_EXTENSIONS], |
| 438 |
[AC_ISC_POSIX]) |
| 439 |
AC_REQUIRE([AC_PROG_CC]) |
| 440 |
AC_REQUIRE([AC_C_INLINE]) |
| 441 |
AC_REQUIRE([AC_C_CONST]) |
| 442 |
AC_REQUIRE([AC_TYPE_SIZE_T]) |
| 443 |
AC_REQUIRE([AC_TYPE_OFF_T]) |
| 444 |
|
| 445 |
AC_REQUIRE([NE_CHECK_OS]) |
| 446 |
|
| 447 |
AC_REQUIRE([AC_PROG_MAKE_SET]) |
| 448 |
|
| 449 |
AC_REQUIRE([AC_HEADER_STDC]) |
| 450 |
|
| 451 |
AC_CHECK_HEADERS([errno.h stdarg.h string.h stdlib.h]) |
| 452 |
|
| 453 |
NEON_FORMAT(size_t,,u) dnl size_t is unsigned; use %u formats |
| 454 |
NEON_FORMAT(off_t) |
| 455 |
NEON_FORMAT(ssize_t) |
| 456 |
|
| 457 |
]) |
| 458 |
|
| 459 |
AC_DEFUN([NEON_FORMAT_PREP], [ |
| 460 |
AC_CHECK_SIZEOF(int) |
| 461 |
AC_CHECK_SIZEOF(long) |
| 462 |
AC_CHECK_SIZEOF(long long) |
| 463 |
if test "$GCC" = "yes"; then |
| 464 |
AC_CACHE_CHECK([for gcc -Wformat -Werror sanity], ne_cv_cc_werror, [ |
| 465 |
# See whether a simple test program will compile without errors. |
| 466 |
ne_save_CPPFLAGS=$CPPFLAGS |
| 467 |
CPPFLAGS="$CPPFLAGS -Wformat -Werror" |
| 468 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| 469 |
#include <stdio.h>]], [[int i = 42; printf("%d", i);]])], |
| 470 |
[ne_cv_cc_werror=yes], [ne_cv_cc_werror=no]) |
| 471 |
CPPFLAGS=$ne_save_CPPFLAGS]) |
| 472 |
ne_fmt_trycompile=$ne_cv_cc_werror |
| 473 |
else |
| 474 |
ne_fmt_trycompile=no |
| 475 |
fi |
| 476 |
]) |
| 477 |
|
| 478 |
dnl Check for LFS support |
| 479 |
AC_DEFUN([NE_LARGEFILE], [ |
| 480 |
dnl Need the size of off_t |
| 481 |
AC_REQUIRE([NEON_COMMON_CHECKS]) |
| 482 |
|
| 483 |
if test -z "$ac_cv_sizeof_off_t"; then |
| 484 |
NE_DISABLE_SUPPORT(LFS, [LFS support omitted: off_t size unknown!]) |
| 485 |
elif test $ac_cv_sizeof_off_t != 4; then |
| 486 |
NE_DISABLE_SUPPORT(LFS, [LFS support unnecessary, off_t is not 32-bit]) |
| 487 |
AC_CHECK_FUNCS([strtoll strtoq], [break]) |
| 488 |
elif test -z "$ac_cv_sizeof_long_long"; then |
| 489 |
NE_DISABLE_SUPPORT(LFS, [LFS support omitted: long long size unknown]) |
| 490 |
elif test $ac_cv_sizeof_long_long != 8; then |
| 491 |
NE_DISABLE_SUPPORT(LFS, [LFS support omitted: long long not 64-bit]) |
| 492 |
else |
| 493 |
ne_save_CPPFLAGS=$CPPFLAGS |
| 494 |
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" |
| 495 |
AC_CHECK_TYPE(off64_t, [ |
| 496 |
NEON_FORMAT(off64_t) |
| 497 |
ne_lfsok=no |
| 498 |
AC_CHECK_FUNCS([strtoll strtoq], [ne_lfsok=yes; break]) |
| 499 |
AC_CHECK_FUNCS([lseek64 fstat64], [], [ne_lfsok=no; break]) |
| 500 |
if test x$ne_lfsok = xyes; then |
| 501 |
NE_ENABLE_SUPPORT(LFS, [LFS (large file) support enabled]) |
| 502 |
NEON_CFLAGS="$NEON_CFLAGS -D_LARGEFILE64_SOURCE -DNE_LFS" |
| 503 |
ne_save_CPPFLAGS="$CPPFLAGS -DNE_LFS" |
| 504 |
else |
| 505 |
NE_DISABLE_SUPPORT(LFS, |
| 506 |
[LFS support omitted: 64-bit support functions not found]) |
| 507 |
fi], [NE_DISABLE_SUPPORT(LFS, [LFS support omitted: off64_t type not found])]) |
| 508 |
CPPFLAGS=$ne_save_CPPFLAGS |
| 509 |
fi |
| 510 |
if test "$NE_FLAG_LFS" = "yes"; then |
| 511 |
AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF64_T], |
| 512 |
[Define to be printf format string for ne_off_t]) |
| 513 |
else |
| 514 |
AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF_T]) |
| 515 |
fi |
| 516 |
]) |
| 517 |
|
| 518 |
dnl NEON_FORMAT(TYPE[, HEADERS[, [SPECIFIER]]) |
| 519 |
dnl |
| 520 |
dnl This macro finds out which modifier is needed to create a |
| 521 |
dnl printf format string suitable for printing integer type TYPE (which |
| 522 |
dnl may be an int, long, or long long). |
| 523 |
dnl The default specifier is 'd', if SPECIFIER is not given. |
| 524 |
dnl TYPE may be defined in HEADERS; sys/types.h is always used first. |
| 525 |
AC_DEFUN([NEON_FORMAT], [ |
| 526 |
|
| 527 |
AC_REQUIRE([NEON_FORMAT_PREP]) |
| 528 |
|
| 529 |
AC_CHECK_SIZEOF($1,, [AC_INCLUDES_DEFAULT |
| 530 |
$2]) |
| 531 |
|
| 532 |
dnl Work out which specifier character to use |
| 533 |
m4_ifdef([ne_spec], [m4_undefine([ne_spec])]) |
| 534 |
m4_if($#, 3, [m4_define(ne_spec,$3)], [m4_define(ne_spec,d)]) |
| 535 |
|
| 536 |
m4_ifdef([ne_cvar], [m4_undefine([ne_cvar])])dnl |
| 537 |
m4_define([ne_cvar], m4_translit(ne_cv_fmt_[$1], [ ], [_]))dnl |
| 538 |
|
| 539 |
AC_CACHE_CHECK([how to print $1], [ne_cvar], [ |
| 540 |
ne_cvar=none |
| 541 |
if test $ne_fmt_trycompile = yes; then |
| 542 |
oflags="$CPPFLAGS" |
| 543 |
# Consider format string mismatches as errors |
| 544 |
CPPFLAGS="$CPPFLAGS -Wformat -Werror" |
| 545 |
dnl obscured for m4 quoting: "for str in d ld lld; do" |
| 546 |
for str in ne_spec l]ne_spec[ ll]ne_spec[; do |
| 547 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| 548 |
$2 |
| 549 |
#include <stdio.h>]], [[$1 i = 1; printf("%$str", i);]])], |
| 550 |
[ne_cvar=$str; break]) |
| 551 |
done |
| 552 |
CPPFLAGS=$oflags |
| 553 |
else |
| 554 |
# Best guess. Don't have to be too precise since we probably won't |
| 555 |
# get a warning message anyway. |
| 556 |
case $ac_cv_sizeof_]m4_translit($1, [ ], [_])[ in |
| 557 |
$ac_cv_sizeof_int) ne_cvar="ne_spec" ;; |
| 558 |
$ac_cv_sizeof_long) ne_cvar="l]ne_spec[" ;; |
| 559 |
$ac_cv_sizeof_long_long) ne_cvar="ll]ne_spec[" ;; |
| 560 |
esac |
| 561 |
fi |
| 562 |
]) |
| 563 |
|
| 564 |
if test "x$ne_cvar" = "xnone"; then |
| 565 |
AC_MSG_ERROR([format string for $1 not found]) |
| 566 |
fi |
| 567 |
|
| 568 |
AC_DEFINE_UNQUOTED([NE_FMT_]m4_translit($1, [a-z ], [A-Z_]), "$ne_cvar", |
| 569 |
[Define to be printf format string for $1]) |
| 570 |
]) |
| 571 |
|
| 572 |
dnl Wrapper for AC_CHECK_FUNCS; uses libraries from $NEON_LIBS. |
| 573 |
AC_DEFUN([NE_CHECK_FUNCS], [ |
| 574 |
ne_cf_save_LIBS=$LIBS |
| 575 |
LIBS="$LIBS $NEON_LIBS" |
| 576 |
AC_CHECK_FUNCS($@) |
| 577 |
LIBS=$ne_cf_save_LIBS]) |
| 578 |
|
| 579 |
dnl Checks needed when compiling the neon source. |
| 580 |
AC_DEFUN([LIBNEON_SOURCE_CHECKS], [ |
| 581 |
|
| 582 |
dnl Run all the normal C language/compiler tests |
| 583 |
AC_REQUIRE([NEON_COMMON_CHECKS]) |
| 584 |
|
| 585 |
dnl Needed for building the MD5 code. |
| 586 |
AC_REQUIRE([AC_C_BIGENDIAN]) |
| 587 |
dnl Is strerror_r present; if so, which variant |
| 588 |
AC_REQUIRE([AC_FUNC_STRERROR_R]) |
| 589 |
|
| 590 |
AC_CHECK_HEADERS([sys/time.h limits.h sys/select.h arpa/inet.h libintl.h \ |
| 591 |
signal.h sys/socket.h netinet/in.h netinet/tcp.h netdb.h sys/poll.h \ |
| 592 |
sys/limits.h fcntl.h iconv.h],,, |
| 593 |
[AC_INCLUDES_DEFAULT |
| 594 |
/* netinet/tcp.h requires netinet/in.h on some platforms. */ |
| 595 |
#ifdef HAVE_NETINET_IN_H |
| 596 |
#include <netinet/in.h> |
| 597 |
#endif]) |
| 598 |
|
| 599 |
AC_REQUIRE([NE_SNPRINTF]) |
| 600 |
|
| 601 |
AC_CACHE_CHECK([for timezone global], ne_cv_cc_timezone, [ |
| 602 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| 603 |
#include <time.h>]], |
| 604 |
[[time_t t = 0 - timezone; timezone = 1;]])], |
| 605 |
ne_cv_cc_timezone=yes, ne_cv_cc_timezone=no)]) |
| 606 |
|
| 607 |
if test "$ne_cv_cc_timezone" = "yes"; then |
| 608 |
AC_DEFINE([HAVE_TIMEZONE], 1, [Define if the timezone global is available]) |
| 609 |
fi |
| 610 |
|
| 611 |
dnl Check for large file support |
| 612 |
NE_LARGEFILE |
| 613 |
|
| 614 |
AC_REPLACE_FUNCS(strcasecmp) |
| 615 |
|
| 616 |
AC_CHECK_FUNCS(signal setvbuf setsockopt stpcpy poll fcntl getsockopt) |
| 617 |
|
| 618 |
if test "x${ac_cv_func_poll}${ac_cv_header_sys_poll_h}y" = "xyesyesy"; then |
| 619 |
AC_DEFINE([NE_USE_POLL], 1, [Define if poll() should be used]) |
| 620 |
fi |
| 621 |
|
| 622 |
if test "$ac_cv_func_stpcpy" = "yes"; then |
| 623 |
AC_CHECK_DECLS(stpcpy) |
| 624 |
fi |
| 625 |
|
| 626 |
# Modern AIXes with the "Linux-like" libc have an undeclared stpcpy |
| 627 |
AH_BOTTOM([#if defined(HAVE_STPCPY) && defined(HAVE_DECL_STPCPY) && !HAVE_DECL_STPCPY && !defined(stpcpy) |
| 628 |
char *stpcpy(char *, const char *); |
| 629 |
#endif]) |
| 630 |
|
| 631 |
# Unixware 7 can only link gethostbyname with -lnsl -lsocket |
| 632 |
# Pick up -lsocket first, then the gethostbyname check will work. |
| 633 |
# Haiku requires -lnetwork for socket functions. |
| 634 |
NE_SEARCH_LIBS(socket, socket inet ws2_32 network) |
| 635 |
|
| 636 |
# Enable getaddrinfo support if it, gai_strerror and inet_ntop are |
| 637 |
# all available. |
| 638 |
NE_SEARCH_LIBS(getaddrinfo, nsl,, |
| 639 |
[ne_enable_gai=no], |
| 640 |
[# HP-UX boxes commonly get into a state where getaddrinfo is present |
| 641 |
# but borked: http://marc.theaimsgroup.com/?l=apr-dev&m=107730955207120&w=2 |
| 642 |
case x`uname -sr 2>/dev/null`y in |
| 643 |
xHP-UX*11.[[01]]*y) |
| 644 |
AC_MSG_NOTICE([getaddrinfo support disabled on HP-UX 11.0x/11.1x]) ;; |
| 645 |
*) |
| 646 |
ne_enable_gai=yes |
| 647 |
NE_CHECK_FUNCS(gai_strerror getnameinfo inet_ntop inet_pton,, |
| 648 |
[ne_enable_gai=no; break]) ;; |
| 649 |
esac |
| 650 |
]) |
| 651 |
|
| 652 |
if test $ne_enable_gai = yes; then |
| 653 |
NE_ENABLE_SUPPORT(IPV6, [IPv6 support is enabled]) |
| 654 |
AC_DEFINE(USE_GETADDRINFO, 1, [Define if getaddrinfo() should be used]) |
| 655 |
AC_CACHE_CHECK([for working AI_ADDRCONFIG], [ne_cv_gai_addrconfig], [ |
| 656 |
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <netdb.h> |
| 657 |
#include <stdlib.h>], |
| 658 |
[struct addrinfo hints = {0}, *result; |
| 659 |
hints.ai_flags = AI_ADDRCONFIG; |
| 660 |
if (getaddrinfo("localhost", NULL, &hints, &result) != 0) return 1;])], |
| 661 |
ne_cv_gai_addrconfig=yes, ne_cv_gai_addrconfig=no, ne_cv_gai_addrconfig=no)]) |
| 662 |
if test $ne_cv_gai_addrconfig = yes; then |
| 663 |
AC_DEFINE(USE_GAI_ADDRCONFIG, 1, [Define if getaddrinfo supports AI_ADDRCONFIG]) |
| 664 |
fi |
| 665 |
else |
| 666 |
# Checks for non-getaddrinfo() based resolver interfaces. |
| 667 |
# QNX has gethostbyname in -lsocket. BeOS only has it in -lbind. |
| 668 |
# CygWin/Winsock2 has it in -lws2_32, allegedly. |
| 669 |
# Haiku requires -lnetwork for socket functions. |
| 670 |
NE_SEARCH_LIBS(gethostbyname, socket nsl bind ws2_32 network) |
| 671 |
NE_SEARCH_LIBS(hstrerror, resolv,,[:]) |
| 672 |
NE_CHECK_FUNCS(hstrerror) |
| 673 |
# Older Unixes don't declare h_errno. |
| 674 |
AC_CHECK_DECLS(h_errno,,,[#include <netdb.h>]) |
| 675 |
AC_CHECK_TYPE(in_addr_t,,[ |
| 676 |
AC_DEFINE([in_addr_t], [unsigned int], |
| 677 |
[Define if in_addr_t is not available])], [ |
| 678 |
#ifdef HAVE_SYS_TYPES_H |
| 679 |
# include <sys/types.h> |
| 680 |
#endif |
| 681 |
#ifdef HAVE_NETINET_IN_H |
| 682 |
# include <netinet/in.h> |
| 683 |
#endif |
| 684 |
]) |
| 685 |
fi |
| 686 |
|
| 687 |
AC_CHECK_TYPES(socklen_t,, |
| 688 |
# Linux accept(2) says this should be size_t for SunOS 5... gah. |
| 689 |
[AC_DEFINE([socklen_t], [int], |
| 690 |
[Define if socklen_t is not available])],[ |
| 691 |
#ifdef HAVE_SYS_TYPES_H |
| 692 |
# include <sys/types.h> |
| 693 |
#endif |
| 694 |
#ifdef HAVE_SYS_SOCKET_H |
| 695 |
# include <sys/socket.h> |
| 696 |
#endif |
| 697 |
]) |
| 698 |
|
| 699 |
AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, |
| 700 |
[#include <time.h>]) |
| 701 |
|
| 702 |
if test ${ac_cv_member_struct_tm_tm_gmtoff}${ac_cv_member_struct_tm___tm_gmtoff}${ne_cv_cc_timezone} = nonono; then |
| 703 |
AC_MSG_WARN([no timezone handling in date parsing on this platform]) |
| 704 |
fi |
| 705 |
|
| 706 |
ifdef([neon_no_zlib], |
| 707 |
[NE_DISABLE_SUPPORT(ZLIB, [zlib not supported])], |
| 708 |
[NEON_ZLIB()]) |
| 709 |
|
| 710 |
# Conditionally enable ACL support |
| 711 |
AC_MSG_CHECKING([whether to enable ACL support in neon]) |
| 712 |
if test "x$neon_no_acl" = "xyes"; then |
| 713 |
AC_MSG_RESULT(no) |
| 714 |
else |
| 715 |
AC_MSG_RESULT(yes) |
| 716 |
NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_oldacl ne_acl3744" |
| 717 |
fi |
| 718 |
|
| 719 |
NEON_SSL() |
| 720 |
NEON_GSSAPI() |
| 721 |
NEON_LIBPROXY() |
| 722 |
|
| 723 |
AC_SUBST(NEON_CFLAGS) |
| 724 |
AC_SUBST(NEON_LIBS) |
| 725 |
AC_SUBST(NEON_LTLIBS) |
| 726 |
|
| 727 |
]) |
| 728 |
|
| 729 |
dnl Call to put lib/snprintf.o in LIBOBJS and define HAVE_SNPRINTF_H |
| 730 |
dnl if snprintf isn't in libc. |
| 731 |
|
| 732 |
AC_DEFUN([NEON_REPLACE_SNPRINTF], [ |
| 733 |
# Check for snprintf |
| 734 |
AC_CHECK_FUNC(snprintf,,[ |
| 735 |
AC_DEFINE(HAVE_SNPRINTF_H, 1, [Define if need to include snprintf.h]) |
| 736 |
AC_LIBOBJ(lib/snprintf)]) |
| 737 |
]) |
| 738 |
|
| 739 |
dnl turn off webdav, boo hoo. |
| 740 |
AC_DEFUN([NEON_WITHOUT_WEBDAV], [ |
| 741 |
neon_no_webdav=yes |
| 742 |
neon_no_acl=yes |
| 743 |
NEON_NEED_XML_PARSER=no |
| 744 |
neon_xml_parser_message="none needed" |
| 745 |
]) |
| 746 |
|
| 747 |
dnl Turn off zlib support |
| 748 |
AC_DEFUN([NEON_WITHOUT_ZLIB], [ |
| 749 |
define(neon_no_zlib, yes) |
| 750 |
]) |
| 751 |
|
| 752 |
AC_DEFUN([NEON_WITHOUT_ACL], [ |
| 753 |
# Turn off ACL support |
| 754 |
neon_no_acl=yes |
| 755 |
]) |
| 756 |
|
| 757 |
dnl Common macro to NEON_LIBTOOL_BUILD and NEON_NORMAL_BUILD |
| 758 |
dnl Sets NEONOBJS appropriately if it has not already been set. |
| 759 |
dnl |
| 760 |
dnl NOT FOR EXTERNAL USE: use LIBTOOL_BUILD or NORMAL_BUILD. |
| 761 |
dnl |
| 762 |
|
| 763 |
AC_DEFUN([NEON_COMMON_BUILD], [ |
| 764 |
|
| 765 |
# Using the default set of object files to build. |
| 766 |
# Add the extension to EXTRAOBJS |
| 767 |
ne="$NEON_EXTRAOBJS" |
| 768 |
NEON_EXTRAOBJS= |
| 769 |
for o in $ne; do |
| 770 |
NEON_EXTRAOBJS="$NEON_EXTRAOBJS $o.$NEON_OBJEXT" |
| 771 |
done |
| 772 |
|
| 773 |
# Was DAV support explicitly turned off? |
| 774 |
if test "x$neon_no_webdav" = "xyes"; then |
| 775 |
# No WebDAV support |
| 776 |
NEONOBJS="$NEONOBJS \$(NEON_BASEOBJS)" |
| 777 |
NE_DISABLE_SUPPORT(DAV, [WebDAV support is not enabled]) |
| 778 |
NE_ADD_ABITAG(NODAV) |
| 779 |
else |
| 780 |
# WebDAV support |
| 781 |
NEONOBJS="$NEONOBJS \$(NEON_DAVOBJS)" |
| 782 |
NE_ENABLE_SUPPORT(DAV, [WebDAV support is enabled]) |
| 783 |
fi |
| 784 |
|
| 785 |
AC_SUBST(NEON_TARGET) |
| 786 |
AC_SUBST(NEON_OBJEXT) |
| 787 |
AC_SUBST(NEONOBJS) |
| 788 |
AC_SUBST(NEON_EXTRAOBJS) |
| 789 |
AC_SUBST(NEON_LINK_FLAGS) |
| 790 |
|
| 791 |
]) |
| 792 |
|
| 793 |
# The libtoolized build case: |
| 794 |
AC_DEFUN([NEON_LIBTOOL_BUILD], [ |
| 795 |
|
| 796 |
NEON_TARGET=libneon.la |
| 797 |
NEON_OBJEXT=lo |
| 798 |
|
| 799 |
NEON_COMMON_BUILD($#, $*) |
| 800 |
|
| 801 |
]) |
| 802 |
|
| 803 |
dnl Find 'ar' and 'ranlib', fail if ar isn't found. |
| 804 |
AC_DEFUN([NE_FIND_AR], [ |
| 805 |
|
| 806 |
# Search in /usr/ccs/bin for Solaris |
| 807 |
ne_PATH=$PATH:/usr/ccs/bin |
| 808 |
AC_PATH_TOOL(AR, ar, notfound, $ne_PATH) |
| 809 |
if test "x$AR" = "xnotfound"; then |
| 810 |
AC_MSG_ERROR([could not find ar tool]) |
| 811 |
fi |
| 812 |
AC_PATH_TOOL(RANLIB, ranlib, :, $ne_PATH) |
| 813 |
|
| 814 |
]) |
| 815 |
|
| 816 |
# The non-libtool build case: |
| 817 |
AC_DEFUN([NEON_NORMAL_BUILD], [ |
| 818 |
|
| 819 |
NEON_TARGET=libneon.a |
| 820 |
NEON_OBJEXT=o |
| 821 |
|
| 822 |
AC_REQUIRE([NE_FIND_AR]) |
| 823 |
|
| 824 |
NEON_COMMON_BUILD($#, $*) |
| 825 |
|
| 826 |
]) |
| 827 |
|
| 828 |
AC_DEFUN([NE_SNPRINTF], [ |
| 829 |
AC_CHECK_FUNCS(snprintf vsnprintf,,[ |
| 830 |
ne_save_LIBS=$LIBS |
| 831 |
LIBS="$LIBS -lm" # Always need -lm |
| 832 |
AC_CHECK_LIB(trio, trio_vsnprintf, |
| 833 |
[AC_CHECK_HEADERS(trio.h,, |
| 834 |
AC_MSG_ERROR([trio installation problem? libtrio found but not trio.h])) |
| 835 |
AC_MSG_NOTICE(using trio printf replacement library) |
| 836 |
NEON_LIBS="$NEON_LIBS -ltrio -lm" |
| 837 |
AC_DEFINE(HAVE_TRIO, 1, [Use trio printf replacement library])], |
| 838 |
[AC_MSG_NOTICE([no vsnprintf/snprintf detected in C library]) |
| 839 |
AC_MSG_ERROR([Install the trio library from http://daniel.haxx.se/projects/trio/])]) |
| 840 |
LIBS=$ne_save_LIBS |
| 841 |
break |
| 842 |
])]) |
| 843 |
|
| 844 |
dnl Usage: NE_CHECK_OPENSSLVER(variable, version-string, version-hex) |
| 845 |
dnl Define 'variable' to 'yes' if OpenSSL version is >= version-hex |
| 846 |
AC_DEFUN([NE_CHECK_OPENSSLVER], [ |
| 847 |
AC_CACHE_CHECK([OpenSSL version is >= $2], $1, [ |
| 848 |
AC_EGREP_CPP(good, [#include <openssl/opensslv.h> |
| 849 |
#if OPENSSL_VERSION_NUMBER >= $3 |
| 850 |
good |
| 851 |
#endif], [$1=yes], [$1=no])])]) |
| 852 |
|
| 853 |
dnl Less noisy replacement for PKG_CHECK_MODULES |
| 854 |
AC_DEFUN([NE_PKG_CONFIG], [ |
| 855 |
|
| 856 |
m4_define([ne_cvar], m4_translit(ne_cv_pkg_[$2], [.-], [__]))dnl |
| 857 |
|
| 858 |
AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
| 859 |
if test "$PKG_CONFIG" = "no"; then |
| 860 |
: Not using pkg-config |
| 861 |
$4 |
| 862 |
else |
| 863 |
AC_CACHE_CHECK([for $2 pkg-config data], ne_cvar, |
| 864 |
[if $PKG_CONFIG $2; then |
| 865 |
ne_cvar=yes |
| 866 |
else |
| 867 |
ne_cvar=no |
| 868 |
fi]) |
| 869 |
|
| 870 |
if test "$ne_cvar" = "yes"; then |
| 871 |
$1_CFLAGS=`$PKG_CONFIG --cflags $2` |
| 872 |
$1_LIBS=`$PKG_CONFIG --libs $2` |
| 873 |
: Using provided pkg-config data |
| 874 |
$3 |
| 875 |
else |
| 876 |
: No pkg-config for $2 provided |
| 877 |
$4 |
| 878 |
fi |
| 879 |
fi |
| 880 |
|
| 881 |
m4_undefine([ne_cvar]) |
| 882 |
]) |
| 883 |
|
| 884 |
dnl Check for an SSL library (GNU TLS or OpenSSL) |
| 885 |
AC_DEFUN([NEON_SSL], [ |
| 886 |
|
| 887 |
AC_ARG_WITH(ssl, |
| 888 |
AS_HELP_STRING([--with-ssl=openssl|gnutls], |
| 889 |
[enable SSL support (default OpenSSL)])) |
| 890 |
|
| 891 |
AC_ARG_WITH(egd, |
| 892 |
[[ --with-egd[=PATH] enable EGD support [using EGD socket at PATH]]]) |
| 893 |
|
| 894 |
AC_ARG_WITH(pakchois, |
| 895 |
AS_HELP_STRING([--without-pakchois], |
| 896 |
[disable support for PKCS#11 using pakchois])) |
| 897 |
|
| 898 |
case $with_ssl in |
| 899 |
/*) |
| 900 |
AC_MSG_NOTICE([to use SSL libraries in non-standard locations, try --with-ssl --with-libs=$with_ssl]) |
| 901 |
AC_MSG_ERROR([--with-ssl does not take a path argument]) |
| 902 |
;; |
| 903 |
yes|openssl) |
| 904 |
NE_PKG_CONFIG(NE_SSL, openssl, |
| 905 |
[AC_MSG_NOTICE(using SSL library configuration from pkg-config) |
| 906 |
CPPFLAGS="$CPPFLAGS ${NE_SSL_CFLAGS}" |
| 907 |
NEON_LIBS="$NEON_LIBS ${NE_SSL_LIBS}"], |
| 908 |
[# Either OpenSSL library may require -ldl if built with dynamic engine support |
| 909 |
NE_SEARCH_LIBS(RSA_new, crypto, -ldl) |
| 910 |
NE_SEARCH_LIBS(SSL_library_init, ssl, -ldl)]) |
| 911 |
|
| 912 |
AC_CHECK_HEADERS(openssl/ssl.h openssl/opensslv.h,, |
| 913 |
[AC_MSG_ERROR([OpenSSL headers not found, cannot enable SSL support])]) |
| 914 |
|
| 915 |
# Enable EGD support if using 0.9.7 or newer |
| 916 |
NE_CHECK_OPENSSLVER(ne_cv_lib_ssl097, 0.9.7, 0x00907000L) |
| 917 |
if test "$ne_cv_lib_ssl097" = "yes"; then |
| 918 |
AC_MSG_NOTICE([OpenSSL >= 0.9.7; EGD support not needed in neon]) |
| 919 |
NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using OpenSSL (0.9.7 or later)]) |
| 920 |
NE_CHECK_FUNCS(CRYPTO_set_idptr_callback SSL_SESSION_cmp) |
| 921 |
else |
| 922 |
# Fail if OpenSSL is older than 0.9.6 |
| 923 |
NE_CHECK_OPENSSLVER(ne_cv_lib_ssl096, 0.9.6, 0x00906000L) |
| 924 |
if test "$ne_cv_lib_ssl096" != "yes"; then |
| 925 |
AC_MSG_ERROR([OpenSSL 0.9.6 or later is required]) |
| 926 |
fi |
| 927 |
NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using OpenSSL (0.9.6 or later)]) |
| 928 |
|
| 929 |
case "$with_egd" in |
| 930 |
yes|no) ne_cv_lib_sslegd=$with_egd ;; |
| 931 |
/*) ne_cv_lib_sslegd=yes |
| 932 |
AC_DEFINE_UNQUOTED([EGD_PATH], "$with_egd", |
| 933 |
[Define to specific EGD socket path]) ;; |
| 934 |
*) # Guess whether EGD support is needed |
| 935 |
AC_CACHE_CHECK([whether to enable EGD support], [ne_cv_lib_sslegd], |
| 936 |
[if test -r /dev/random || test -r /dev/urandom; then |
| 937 |
ne_cv_lib_sslegd=no |
| 938 |
else |
| 939 |
ne_cv_lib_sslegd=yes |
| 940 |
fi]) |
| 941 |
;; |
| 942 |
esac |
| 943 |
if test "$ne_cv_lib_sslegd" = "yes"; then |
| 944 |
AC_MSG_NOTICE([EGD support enabled for seeding OpenSSL PRNG]) |
| 945 |
AC_DEFINE([ENABLE_EGD], 1, [Define if EGD should be supported]) |
| 946 |
fi |
| 947 |
fi |
| 948 |
|
| 949 |
AC_DEFINE([HAVE_OPENSSL], 1, [Define if OpenSSL support is enabled]) |
| 950 |
NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_openssl" |
| 951 |
|
| 952 |
AC_DEFINE([HAVE_NTLM], 1, [Define if NTLM is supported]) |
| 953 |
;; |
| 954 |
gnutls) |
| 955 |
NE_PKG_CONFIG(NE_SSL, gnutls, |
| 956 |
[AC_MSG_NOTICE(using GnuTLS configuration from pkg-config) |
| 957 |
CPPFLAGS="$CPPFLAGS ${NE_SSL_CFLAGS}" |
| 958 |
NEON_LIBS="$NEON_LIBS ${NE_SSL_LIBS}" |
| 959 |
|
| 960 |
ne_gnutls_ver=`$PKG_CONFIG --modversion gnutls` |
| 961 |
], [ |
| 962 |
# Fall back on libgnutls-config script |
| 963 |
AC_PATH_PROG(GNUTLS_CONFIG, libgnutls-config, no) |
| 964 |
|
| 965 |
if test "$GNUTLS_CONFIG" = "no"; then |
| 966 |
AC_MSG_ERROR([could not find libgnutls-config in \$PATH]) |
| 967 |
fi |
| 968 |
|
| 969 |
CPPFLAGS="$CPPFLAGS `$GNUTLS_CONFIG --cflags`" |
| 970 |
NEON_LIBS="$NEON_LIBS `$GNUTLS_CONFIG --libs`" |
| 971 |
|
| 972 |
ne_gnutls_ver=`$GNUTLS_CONFIG --version` |
| 973 |
]) |
| 974 |
|
| 975 |
AC_CHECK_HEADER([gnutls/gnutls.h],, |
| 976 |
[AC_MSG_ERROR([could not find gnutls/gnutls.h in include path])]) |
| 977 |
|
| 978 |
NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using GnuTLS $ne_gnutls_ver]) |
| 979 |
NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_gnutls" |
| 980 |
AC_DEFINE([HAVE_GNUTLS], 1, [Define if GnuTLS support is enabled]) |
| 981 |
|
| 982 |
# Check for functions in later releases |
| 983 |
NE_CHECK_FUNCS([gnutls_session_get_data2 gnutls_x509_dn_get_rdn_ava \ |
| 984 |
gnutls_sign_callback_set \ |
| 985 |
gnutls_certificate_get_x509_cas \ |
| 986 |
gnutls_certificate_verify_peers2]) |
| 987 |
|
| 988 |
# fail if gnutls_certificate_verify_peers2 is not found |
| 989 |
if test x${ac_cv_func_gnutls_certificate_verify_peers2} != xyes; then |
| 990 |
AC_MSG_ERROR([GnuTLS version predates gnutls_certificate_verify_peers2, newer version required]) |
| 991 |
fi |
| 992 |
|
| 993 |
# Check for iconv support if using the new RDN access functions: |
| 994 |
if test ${ac_cv_func_gnutls_x509_dn_get_rdn_ava}X${ac_cv_header_iconv_h} = yesXyes; then |
| 995 |
AC_CHECK_FUNCS(iconv) |
| 996 |
fi |
| 997 |
;; |
| 998 |
*) # Default to off; only create crypto-enabled binaries if requested. |
| 999 |
NE_DISABLE_SUPPORT(SSL, [SSL support is not enabled]) |
| 1000 |
NE_DISABLE_SUPPORT(TS_SSL, [Thread-safe SSL support is not enabled]) |
| 1001 |
NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_stubssl" |
| 1002 |
;; |
| 1003 |
esac |
| 1004 |
AC_SUBST(NEON_SUPPORTS_SSL) |
| 1005 |
|
| 1006 |
AC_ARG_WITH(ca-bundle, |
| 1007 |
AS_HELP_STRING(--with-ca-bundle, specify filename of an SSL CA root bundle),, |
| 1008 |
with_ca_bundle=no) |
| 1009 |
|
| 1010 |
case ${NE_FLAG_SSL}-${with_ca_bundle} in |
| 1011 |
*-no) ;; |
| 1012 |
yes-*) |
| 1013 |
AC_DEFINE_UNQUOTED([NE_SSL_CA_BUNDLE], ["${with_ca_bundle}"], |
| 1014 |
[Define to be filename of an SSL CA root bundle]) |
| 1015 |
AC_MSG_NOTICE([Using ${with_ca_bundle} as default SSL CA bundle]) |
| 1016 |
;; |
| 1017 |
esac |
| 1018 |
|
| 1019 |
AC_ARG_ENABLE(threadsafe-ssl, |
| 1020 |
AS_HELP_STRING(--enable-threadsafe-ssl=posix, |
| 1021 |
[enable SSL library thread-safety using POSIX threads: suitable |
| 1022 |
CC/CFLAGS/LIBS must be used to make the POSIX library interfaces |
| 1023 |
available]),, |
| 1024 |
enable_threadsafe_ssl=no) |
| 1025 |
|
| 1026 |
case $enable_threadsafe_ssl in |
| 1027 |
posix|yes) |
| 1028 |
ne_pthr_ok=yes |
| 1029 |
AC_CHECK_FUNCS([pthread_mutex_init pthread_mutex_lock],,[ne_pthr_ok=no]) |
| 1030 |
if test "${ne_pthr_ok}" = "no"; then |
| 1031 |
AC_MSG_ERROR([could not find POSIX mutex interfaces; (try CC="${CC} -pthread"?)]) |
| 1032 |
fi |
| 1033 |
NE_ENABLE_SUPPORT(TS_SSL, [Thread-safe SSL supported using POSIX threads]) |
| 1034 |
;; |
| 1035 |
*) |
| 1036 |
NE_DISABLE_SUPPORT(TS_SSL, [Thread-safe SSL not supported]) |
| 1037 |
;; |
| 1038 |
esac |
| 1039 |
|
| 1040 |
case ${with_pakchois}X${ac_cv_func_gnutls_sign_callback_set}Y${ne_cv_lib_ssl097} in |
| 1041 |
noX*Y*) ;; |
| 1042 |
*X*Yyes|*XyesY*) |
| 1043 |
# PKCS#11... ho! |
| 1044 |
NE_PKG_CONFIG(NE_PK11, pakchois, |
| 1045 |
[AC_MSG_NOTICE([[using pakchois for PKCS#11 support]]) |
| 1046 |
AC_DEFINE(HAVE_PAKCHOIS, 1, [Define if pakchois library supported]) |
| 1047 |
CPPFLAGS="$CPPFLAGS ${NE_PK11_CFLAGS}" |
| 1048 |
NEON_LIBS="${NEON_LIBS} ${NE_PK11_LIBS}"], |
| 1049 |
[AC_MSG_NOTICE([[pakchois library not found; no PKCS#11 support]])]) |
| 1050 |
;; |
| 1051 |
esac |
| 1052 |
]) dnl -- end defun NEON_SSL |
| 1053 |
|
| 1054 |
dnl Check for Kerberos installation |
| 1055 |
AC_DEFUN([NEON_GSSAPI], [ |
| 1056 |
AC_ARG_WITH(gssapi, AS_HELP_STRING(--without-gssapi, disable GSSAPI support)) |
| 1057 |
if test "$with_gssapi" != "no"; then |
| 1058 |
AC_PATH_PROG([KRB5_CONFIG], krb5-config, none, $PATH:/usr/kerberos/bin) |
| 1059 |
else |
| 1060 |
KRB5_CONFIG=none |
| 1061 |
fi |
| 1062 |
if test "x$KRB5_CONFIG" != "xnone"; then |
| 1063 |
ne_save_CPPFLAGS=$CPPFLAGS |
| 1064 |
ne_save_LIBS=$NEON_LIBS |
| 1065 |
NEON_LIBS="$NEON_LIBS `${KRB5_CONFIG} --libs gssapi`" |
| 1066 |
CPPFLAGS="$CPPFLAGS `${KRB5_CONFIG} --cflags gssapi`" |
| 1067 |
# MIT and Heimdal put gssapi.h in different places |
| 1068 |
AC_CHECK_HEADERS(gssapi/gssapi.h gssapi.h, [ |
| 1069 |
NE_CHECK_FUNCS(gss_init_sec_context, [ |
| 1070 |
ne_save_CPPFLAGS=$CPPFLAGS |
| 1071 |
ne_save_LIBS=$NEON_LIBS |
| 1072 |
AC_MSG_NOTICE([GSSAPI authentication support enabled]) |
| 1073 |
AC_DEFINE(HAVE_GSSAPI, 1, [Define if GSSAPI support is enabled]) |
| 1074 |
AC_CHECK_HEADERS(gssapi/gssapi_generic.h) |
| 1075 |
# Older versions of MIT Kerberos lack GSS_C_NT_HOSTBASED_SERVICE |
| 1076 |
AC_CHECK_DECL([GSS_C_NT_HOSTBASED_SERVICE],, |
| 1077 |
[AC_DEFINE([GSS_C_NT_HOSTBASED_SERVICE], gss_nt_service_name, |
| 1078 |
[Define if GSS_C_NT_HOSTBASED_SERVICE is not defined otherwise])], |
| 1079 |
[#ifdef HAVE_GSSAPI_GSSAPI_H |
| 1080 |
#include <gssapi/gssapi.h> |
| 1081 |
#else |
| 1082 |
#include <gssapi.h> |
| 1083 |
#endif])]) |
| 1084 |
break |
| 1085 |
]) |
| 1086 |
CPPFLAGS=$ne_save_CPPFLAGS |
| 1087 |
NEON_LIBS=$ne_save_LIBS |
| 1088 |
fi]) |
| 1089 |
|
| 1090 |
AC_DEFUN([NEON_LIBPROXY], [ |
| 1091 |
AC_ARG_WITH(libproxy, AS_HELP_STRING(--without-libproxy, disable libproxy support)) |
| 1092 |
if test "x$with_libproxy" != "xno"; then |
| 1093 |
NE_PKG_CONFIG(NE_PXY, libproxy-1.0, |
| 1094 |
[AC_DEFINE(HAVE_LIBPROXY, 1, [Define if libproxy is supported]) |
| 1095 |
CPPFLAGS="$CPPFLAGS $NE_PXY_CFLAGS" |
| 1096 |
NEON_LIBS="$NEON_LIBS ${NE_PXY_LIBS}" |
| 1097 |
NE_ENABLE_SUPPORT(LIBPXY, [libproxy support enabled])], |
| 1098 |
[NE_DISABLE_SUPPORT(LIBPXY, [libproxy support not enabled])]) |
| 1099 |
else |
| 1100 |
NE_DISABLE_SUPPORT(LIBPXY, [libproxy support not enabled]) |
| 1101 |
fi |
| 1102 |
]) |
| 1103 |
|
| 1104 |
dnl Adds an --enable-warnings argument to configure to allow enabling |
| 1105 |
dnl compiler warnings |
| 1106 |
AC_DEFUN([NEON_WARNINGS],[ |
| 1107 |
|
| 1108 |
AC_REQUIRE([AC_PROG_CC]) dnl so that $GCC is set |
| 1109 |
|
| 1110 |
AC_ARG_ENABLE(warnings, |
| 1111 |
AS_HELP_STRING(--enable-warnings, [enable compiler warnings])) |
| 1112 |
|
| 1113 |
if test "$enable_warnings" = "yes"; then |
| 1114 |
case $GCC:`uname` in |
| 1115 |
yes:*) |
| 1116 |
CFLAGS="$CFLAGS -Wall -Wmissing-declarations -Wshadow -Wreturn-type -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wformat-security" |
| 1117 |
if test -z "$with_ssl" -o "$with_ssl" = "no"; then |
| 1118 |
# OpenSSL headers fail strict prototypes checks |
| 1119 |
CFLAGS="$CFLAGS -Wstrict-prototypes" |
| 1120 |
fi |
| 1121 |
;; |
| 1122 |
no:OSF1) CFLAGS="$CFLAGS -check -msg_disable returnchecks -msg_disable alignment -msg_disable overflow" ;; |
| 1123 |
no:IRIX) CFLAGS="$CFLAGS -fullwarn" ;; |
| 1124 |
no:UnixWare) CFLAGS="$CFLAGS -v" ;; |
| 1125 |
*) AC_MSG_WARN([warning flags unknown for compiler on this platform]) ;; |
| 1126 |
esac |
| 1127 |
fi |
| 1128 |
]) |
| 1129 |
|
| 1130 |
dnl Adds an --disable-debug argument to configure to allow disabling |
| 1131 |
dnl debugging messages. |
| 1132 |
dnl Usage: |
| 1133 |
dnl NEON_WARNINGS([actions-if-debug-enabled], [actions-if-debug-disabled]) |
| 1134 |
dnl |
| 1135 |
AC_DEFUN([NEON_DEBUG], [ |
| 1136 |
|
| 1137 |
AC_ARG_ENABLE(debug, |
| 1138 |
AS_HELP_STRING(--disable-debug,[disable runtime debugging messages])) |
| 1139 |
|
| 1140 |
# default is to enable debugging |
| 1141 |
case $enable_debug in |
| 1142 |
no) AC_MSG_NOTICE([debugging is disabled]) |
| 1143 |
$2 ;; |
| 1144 |
*) AC_MSG_NOTICE([debugging is enabled]) |
| 1145 |
AC_DEFINE(NE_DEBUGGING, 1, [Define to enable debugging]) |
| 1146 |
$1 |
| 1147 |
;; |
| 1148 |
esac]) |
| 1149 |
|
| 1150 |
dnl Macro to optionally enable socks support |
| 1151 |
AC_DEFUN([NEON_SOCKS], [ |
| 1152 |
]) |
| 1153 |
|
| 1154 |
AC_DEFUN([NEON_WITH_LIBS], [ |
| 1155 |
AC_ARG_WITH([libs], |
| 1156 |
[[ --with-libs=DIR[:DIR2...] look for support libraries in DIR/{bin,lib,include}]], |
| 1157 |
[case $with_libs in |
| 1158 |
yes|no) AC_MSG_ERROR([--with-libs must be passed a directory argument]) ;; |
| 1159 |
*) ne_save_IFS=$IFS; IFS=: |
| 1160 |
for dir in $with_libs; do |
| 1161 |
ne_add_CPPFLAGS="$ne_add_CPPFLAGS -I${dir}/include" |
| 1162 |
ne_add_LDFLAGS="$ne_add_LDFLAGS -L${dir}/lib" |
| 1163 |
ne_add_PATH="${ne_add_PATH}${dir}/bin:" |
| 1164 |
PKG_CONFIG_PATH=${PKG_CONFIG_PATH}${PKG_CONFIG_PATH+:}${dir}/lib/pkgconfig |
| 1165 |
done |
| 1166 |
IFS=$ne_save_IFS |
| 1167 |
CPPFLAGS="${ne_add_CPPFLAGS} $CPPFLAGS" |
| 1168 |
LDFLAGS="${ne_add_LDFLAGS} $LDFLAGS" |
| 1169 |
PATH=${ne_add_PATH}$PATH |
| 1170 |
export PKG_CONFIG_PATH ;; |
| 1171 |
esac])]) |
| 1172 |
|
| 1173 |
AC_DEFUN([NEON_I18N], [ |
| 1174 |
|
| 1175 |
dnl Check for NLS iff libintl.h was detected. |
| 1176 |
AC_ARG_ENABLE(nls, |
| 1177 |
AS_HELP_STRING(--disable-nls, [disable internationalization support]),, |
| 1178 |
[enable_nls=${ac_cv_header_libintl_h}]) |
| 1179 |
|
| 1180 |
if test x${enable_nls} = xyes; then |
| 1181 |
# presume that dgettext() is available if bindtextdomain() is... |
| 1182 |
# checking for dgettext() itself is awkward because gcc has a |
| 1183 |
# builtin of that function, which confuses AC_CHECK_FUNCS et al. |
| 1184 |
NE_SEARCH_LIBS(bindtextdomain, intl,,[enable_nls=no]) |
| 1185 |
NE_CHECK_FUNCS(bind_textdomain_codeset) |
| 1186 |
fi |
| 1187 |
|
| 1188 |
if test "$enable_nls" = "no"; then |
| 1189 |
NE_DISABLE_SUPPORT(I18N, [Internationalization support not enabled]) |
| 1190 |
else |
| 1191 |
NE_ENABLE_SUPPORT(I18N, [Internationalization support enabled]) |
| 1192 |
eval localedir="${datadir}/locale" |
| 1193 |
AC_DEFINE_UNQUOTED([LOCALEDIR], "$localedir", |
| 1194 |
[Define to be location of localedir]) |
| 1195 |
fi |
| 1196 |
|
| 1197 |
]) |