"Fossies" - the Fresh Open Source Software Archive 
Member "neon-0.31.2/macros/neon.m4" (20 Jun 2020, 38421 Bytes) of package /linux/www/neon-0.31.2.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "neon.m4":
0.31.1_vs_0.31.2.
1 # Copyright (C) 1998-2009 Joe Orton <joe@manyfish.co.uk> -*- autoconf -*-
2 # Copyright (C) 2004 Aleix Conchillo Flaque <aleix@member.fsf.org>
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 <neon@lists.manyfish.co.uk>
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=31
140 NE_VERSION_PATCH=2
141 NE_VERSION_TAG=
142
143 # 0.31.x is backwards-compatible to 0.27.x, so AGE=4
144 NE_LIBTOOL_VERSINFO="31:${NE_VERSION_PATCH}:4"
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 against `-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 sys/uio.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 NE_ADD_ABITAG(LFS)
514 else
515 AC_DEFINE_UNQUOTED([NE_FMT_NE_OFF_T], [NE_FMT_OFF_T])
516 fi
517 ])
518
519 dnl NEON_FORMAT(TYPE[, HEADERS[, [SPECIFIER]])
520 dnl
521 dnl This macro finds out which modifier is needed to create a
522 dnl printf format string suitable for printing integer type TYPE (which
523 dnl may be an int, long, or long long).
524 dnl The default specifier is 'd', if SPECIFIER is not given.
525 dnl TYPE may be defined in HEADERS; sys/types.h is always used first.
526 AC_DEFUN([NEON_FORMAT], [
527
528 AC_REQUIRE([NEON_FORMAT_PREP])
529
530 AC_CHECK_SIZEOF($1,, [AC_INCLUDES_DEFAULT
531 $2])
532
533 dnl Work out which specifier character to use
534 m4_ifdef([ne_spec], [m4_undefine([ne_spec])])
535 m4_if($#, 3, [m4_define(ne_spec,$3)], [m4_define(ne_spec,d)])
536
537 m4_ifdef([ne_cvar], [m4_undefine([ne_cvar])])dnl
538 m4_define([ne_cvar], m4_translit(ne_cv_fmt_[$1], [ ], [_]))dnl
539
540 AC_CACHE_CHECK([how to print $1], [ne_cvar], [
541 ne_cvar=none
542 if test $ne_fmt_trycompile = yes; then
543 oflags="$CPPFLAGS"
544 # Consider format string mismatches as errors
545 CPPFLAGS="$CPPFLAGS -Wformat -Werror"
546 dnl obscured for m4 quoting: "for str in d ld lld; do"
547 for str in ne_spec l]ne_spec[ ll]ne_spec[; do
548 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
549 $2
550 #include <stdio.h>]], [[$1 i = 1; printf("%$str", i);]])],
551 [ne_cvar=$str; break])
552 done
553 CPPFLAGS=$oflags
554 else
555 # Best guess. Don't have to be too precise since we probably won't
556 # get a warning message anyway.
557 case $ac_cv_sizeof_]m4_translit($1, [ ], [_])[ in
558 $ac_cv_sizeof_int) ne_cvar="ne_spec" ;;
559 $ac_cv_sizeof_long) ne_cvar="l]ne_spec[" ;;
560 $ac_cv_sizeof_long_long) ne_cvar="ll]ne_spec[" ;;
561 esac
562 fi
563 ])
564
565 if test "x$ne_cvar" = "xnone"; then
566 AC_MSG_ERROR([format string for $1 not found])
567 fi
568
569 AC_DEFINE_UNQUOTED([NE_FMT_]m4_translit($1, [a-z ], [A-Z_]), "$ne_cvar",
570 [Define to be printf format string for $1])
571 ])
572
573 dnl Wrapper for AC_CHECK_FUNCS; uses libraries from $NEON_LIBS.
574 AC_DEFUN([NE_CHECK_FUNCS], [
575 ne_cf_save_LIBS=$LIBS
576 LIBS="$LIBS $NEON_LIBS"
577 AC_CHECK_FUNCS($@)
578 LIBS=$ne_cf_save_LIBS])
579
580 dnl Checks needed when compiling the neon source.
581 AC_DEFUN([LIBNEON_SOURCE_CHECKS], [
582
583 dnl Run all the normal C language/compiler tests
584 AC_REQUIRE([NEON_COMMON_CHECKS])
585
586 dnl Needed for building the MD5 code.
587 AC_REQUIRE([AC_C_BIGENDIAN])
588 dnl Is strerror_r present; if so, which variant
589 AC_REQUIRE([AC_FUNC_STRERROR_R])
590
591 AC_CHECK_HEADERS([sys/time.h limits.h sys/select.h arpa/inet.h libintl.h \
592 signal.h sys/socket.h netinet/in.h netinet/tcp.h netdb.h sys/poll.h \
593 sys/limits.h fcntl.h iconv.h],,,
594 [AC_INCLUDES_DEFAULT
595 /* netinet/tcp.h requires netinet/in.h on some platforms. */
596 #ifdef HAVE_NETINET_IN_H
597 #include <netinet/in.h>
598 #endif])
599
600 AC_REQUIRE([NE_SNPRINTF])
601
602 AC_CACHE_CHECK([for timezone global], ne_cv_cc_timezone, [
603 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
604 #include <time.h>]],
605 [[time_t t = 0 - timezone; timezone = 1;]])],
606 ne_cv_cc_timezone=yes, ne_cv_cc_timezone=no)])
607
608 if test "$ne_cv_cc_timezone" = "yes"; then
609 AC_DEFINE([HAVE_TIMEZONE], 1, [Define if the timezone global is available])
610 fi
611
612 dnl Check for large file support
613 NE_LARGEFILE
614
615 AC_REPLACE_FUNCS(strcasecmp)
616
617 AC_CHECK_FUNCS(signal setvbuf setsockopt stpcpy poll fcntl getsockopt)
618
619 if test "x${ac_cv_func_poll}${ac_cv_header_sys_poll_h}y" = "xyesyesy"; then
620 AC_DEFINE([NE_USE_POLL], 1, [Define if poll() should be used])
621 fi
622
623 if test "$ac_cv_func_stpcpy" = "yes"; then
624 AC_CHECK_DECLS(stpcpy)
625 fi
626
627 # Modern AIXes with the "Linux-like" libc have an undeclared stpcpy
628 AH_BOTTOM([#if defined(HAVE_STPCPY) && defined(HAVE_DECL_STPCPY) && !HAVE_DECL_STPCPY && !defined(stpcpy)
629 char *stpcpy(char *, const char *);
630 #endif])
631
632 # Unixware 7 can only link gethostbyname with -lnsl -lsocket
633 # Pick up -lsocket first, then the gethostbyname check will work.
634 # Haiku requires -lnetwork for socket functions.
635 NE_SEARCH_LIBS(socket, socket inet ws2_32 network)
636
637 # Enable getaddrinfo support if it, gai_strerror and inet_ntop are
638 # all available.
639 NE_SEARCH_LIBS(getaddrinfo, nsl,,
640 [ne_enable_gai=no],
641 [# HP-UX boxes commonly get into a state where getaddrinfo is present
642 # but borked: http://marc.theaimsgroup.com/?l=apr-dev&m=107730955207120&w=2
643 case x`uname -sr 2>/dev/null`y in
644 xHP-UX*11.[[01]]*y)
645 AC_MSG_NOTICE([getaddrinfo support disabled on HP-UX 11.0x/11.1x]) ;;
646 *)
647 ne_enable_gai=yes
648 NE_CHECK_FUNCS(gai_strerror getnameinfo inet_ntop inet_pton,,
649 [ne_enable_gai=no; break]) ;;
650 esac
651 ])
652
653 if test $ne_enable_gai = yes; then
654 NE_ENABLE_SUPPORT(IPV6, [IPv6 support is enabled])
655 AC_DEFINE(USE_GETADDRINFO, 1, [Define if getaddrinfo() should be used])
656 AC_CACHE_CHECK([for working AI_ADDRCONFIG], [ne_cv_gai_addrconfig], [
657 AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <netdb.h>
658 #include <stdlib.h>],
659 [struct addrinfo hints = {0}, *result;
660 hints.ai_flags = AI_ADDRCONFIG;
661 if (getaddrinfo("localhost", NULL, &hints, &result) != 0) return 1;])],
662 ne_cv_gai_addrconfig=yes, ne_cv_gai_addrconfig=no, ne_cv_gai_addrconfig=no)])
663 if test $ne_cv_gai_addrconfig = yes; then
664 AC_DEFINE(USE_GAI_ADDRCONFIG, 1, [Define if getaddrinfo supports AI_ADDRCONFIG])
665 fi
666 else
667 # Checks for non-getaddrinfo() based resolver interfaces.
668 # QNX has gethostbyname in -lsocket. BeOS only has it in -lbind.
669 # CygWin/Winsock2 has it in -lws2_32, allegedly.
670 # Haiku requires -lnetwork for socket functions.
671 NE_SEARCH_LIBS(gethostbyname, socket nsl bind ws2_32 network)
672 NE_SEARCH_LIBS(hstrerror, resolv,,[:])
673 NE_CHECK_FUNCS(hstrerror)
674 # Older Unixes don't declare h_errno.
675 AC_CHECK_DECLS(h_errno,,,[#include <netdb.h>])
676 AC_CHECK_TYPE(in_addr_t,,[
677 AC_DEFINE([in_addr_t], [unsigned int],
678 [Define if in_addr_t is not available])], [
679 #ifdef HAVE_SYS_TYPES_H
680 # include <sys/types.h>
681 #endif
682 #ifdef HAVE_NETINET_IN_H
683 # include <netinet/in.h>
684 #endif
685 ])
686 fi
687
688 AC_CHECK_TYPES(socklen_t,,
689 # Linux accept(2) says this should be size_t for SunOS 5... gah.
690 [AC_DEFINE([socklen_t], [int],
691 [Define if socklen_t is not available])],[
692 #ifdef HAVE_SYS_TYPES_H
693 # include <sys/types.h>
694 #endif
695 #ifdef HAVE_SYS_SOCKET_H
696 # include <sys/socket.h>
697 #endif
698 ])
699
700 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,
701 [#include <time.h>])
702
703 if test ${ac_cv_member_struct_tm_tm_gmtoff}${ac_cv_member_struct_tm___tm_gmtoff}${ne_cv_cc_timezone} = nonono; then
704 AC_MSG_WARN([no timezone handling in date parsing on this platform])
705 fi
706
707 ifdef([neon_no_zlib],
708 [NE_DISABLE_SUPPORT(ZLIB, [zlib not supported])],
709 [NEON_ZLIB()])
710
711 # Conditionally enable ACL support
712 AC_MSG_CHECKING([whether to enable ACL support in neon])
713 if test "x$neon_no_acl" = "xyes"; then
714 AC_MSG_RESULT(no)
715 else
716 AC_MSG_RESULT(yes)
717 NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_oldacl ne_acl3744"
718 fi
719
720 NEON_SSL()
721 NEON_GSSAPI()
722 NEON_LIBPROXY()
723
724 AC_SUBST(NEON_CFLAGS)
725 AC_SUBST(NEON_LIBS)
726 AC_SUBST(NEON_LTLIBS)
727
728 ])
729
730 dnl Call to put lib/snprintf.o in LIBOBJS and define HAVE_SNPRINTF_H
731 dnl if snprintf isn't in libc.
732
733 AC_DEFUN([NEON_REPLACE_SNPRINTF], [
734 # Check for snprintf
735 AC_CHECK_FUNC(snprintf,,[
736 AC_DEFINE(HAVE_SNPRINTF_H, 1, [Define if need to include snprintf.h])
737 AC_LIBOBJ(lib/snprintf)])
738 ])
739
740 dnl turn off webdav, boo hoo.
741 AC_DEFUN([NEON_WITHOUT_WEBDAV], [
742 neon_no_webdav=yes
743 neon_no_acl=yes
744 NEON_NEED_XML_PARSER=no
745 neon_xml_parser_message="none needed"
746 ])
747
748 dnl Turn off zlib support
749 AC_DEFUN([NEON_WITHOUT_ZLIB], [
750 define(neon_no_zlib, yes)
751 ])
752
753 AC_DEFUN([NEON_WITHOUT_ACL], [
754 # Turn off ACL support
755 neon_no_acl=yes
756 ])
757
758 dnl Common macro to NEON_LIBTOOL_BUILD and NEON_NORMAL_BUILD
759 dnl Sets NEONOBJS appropriately if it has not already been set.
760 dnl
761 dnl NOT FOR EXTERNAL USE: use LIBTOOL_BUILD or NORMAL_BUILD.
762 dnl
763
764 AC_DEFUN([NEON_COMMON_BUILD], [
765
766 # Using the default set of object files to build.
767 # Add the extension to EXTRAOBJS
768 ne="$NEON_EXTRAOBJS"
769 NEON_EXTRAOBJS=
770 for o in $ne; do
771 NEON_EXTRAOBJS="$NEON_EXTRAOBJS $o.$NEON_OBJEXT"
772 done
773
774 # Was DAV support explicitly turned off?
775 if test "x$neon_no_webdav" = "xyes"; then
776 # No WebDAV support
777 NEONOBJS="$NEONOBJS \$(NEON_BASEOBJS)"
778 NE_DISABLE_SUPPORT(DAV, [WebDAV support is not enabled])
779 NE_ADD_ABITAG(NODAV)
780 else
781 # WebDAV support
782 NEONOBJS="$NEONOBJS \$(NEON_DAVOBJS)"
783 NE_ENABLE_SUPPORT(DAV, [WebDAV support is enabled])
784 fi
785
786 AC_SUBST(NEON_TARGET)
787 AC_SUBST(NEON_OBJEXT)
788 AC_SUBST(NEONOBJS)
789 AC_SUBST(NEON_EXTRAOBJS)
790 AC_SUBST(NEON_LINK_FLAGS)
791
792 ])
793
794 # The libtoolized build case:
795 AC_DEFUN([NEON_LIBTOOL_BUILD], [
796
797 NEON_TARGET=libneon.la
798 NEON_OBJEXT=lo
799
800 NEON_COMMON_BUILD($#, $*)
801
802 ])
803
804 dnl Find 'ar' and 'ranlib', fail if ar isn't found.
805 AC_DEFUN([NE_FIND_AR], [
806
807 # Search in /usr/ccs/bin for Solaris
808 ne_PATH=$PATH:/usr/ccs/bin
809 AC_CHECK_TOOL(AR, ar, notfound, $ne_PATH)
810 if test "x$AR" = "xnotfound"; then
811 AC_MSG_ERROR([could not find ar tool])
812 fi
813 AC_CHECK_TOOL(RANLIB, ranlib, :, $ne_PATH)
814
815 ])
816
817 # The non-libtool build case:
818 AC_DEFUN([NEON_NORMAL_BUILD], [
819
820 NEON_TARGET=libneon.a
821 NEON_OBJEXT=o
822
823 AC_REQUIRE([NE_FIND_AR])
824
825 NEON_COMMON_BUILD($#, $*)
826
827 ])
828
829 AC_DEFUN([NE_SNPRINTF], [
830 AC_CHECK_FUNCS(snprintf vsnprintf,,[
831 ne_save_LIBS=$LIBS
832 LIBS="$LIBS -lm" # Always need -lm
833 AC_CHECK_LIB(trio, trio_vsnprintf,
834 [AC_CHECK_HEADERS(trio.h,,
835 AC_MSG_ERROR([trio installation problem? libtrio found but not trio.h]))
836 AC_MSG_NOTICE(using trio printf replacement library)
837 NEON_LIBS="$NEON_LIBS -ltrio -lm"
838 AC_DEFINE(HAVE_TRIO, 1, [Use trio printf replacement library])],
839 [AC_MSG_NOTICE([no vsnprintf/snprintf detected in C library])
840 AC_MSG_ERROR([Install the trio library from http://daniel.haxx.se/projects/trio/])])
841 LIBS=$ne_save_LIBS
842 break
843 ])])
844
845 dnl Usage: NE_CHECK_OPENSSLVER(variable, version-string, version-hex)
846 dnl Define 'variable' to 'yes' if OpenSSL version is >= version-hex
847 AC_DEFUN([NE_CHECK_OPENSSLVER], [
848 AC_CACHE_CHECK([OpenSSL version is >= $2], $1, [
849 AC_EGREP_CPP(good, [#include <openssl/opensslv.h>
850 #if OPENSSL_VERSION_NUMBER >= $3
851 good
852 #endif], [$1=yes], [$1=no])])])
853
854 dnl Less noisy replacement for PKG_CHECK_MODULES
855 AC_DEFUN([NE_PKG_CONFIG], [
856
857 m4_define([ne_cvar], m4_translit(ne_cv_pkg_[$2], [.-], [__]))dnl
858
859 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
860 if test "$PKG_CONFIG" = "no"; then
861 : Not using pkg-config
862 $4
863 else
864 AC_CACHE_CHECK([for $2 pkg-config data], ne_cvar,
865 [if $PKG_CONFIG $2; then
866 ne_cvar=yes
867 else
868 ne_cvar=no
869 fi])
870
871 if test "$ne_cvar" = "yes"; then
872 $1_CFLAGS=`$PKG_CONFIG --cflags $2`
873 $1_LIBS=`$PKG_CONFIG --libs $2`
874 $1_VERSION=`$PKG_CONFIG --modversion $2`
875 : Using provided pkg-config data
876 $3
877 else
878 : No pkg-config for $2 provided
879 $4
880 fi
881 fi
882
883 m4_undefine([ne_cvar])
884 ])
885
886 dnl Check for an SSL library (GNU TLS or OpenSSL)
887 AC_DEFUN([NEON_SSL], [
888
889 AC_ARG_WITH(ssl,
890 AS_HELP_STRING([--with-ssl=openssl|gnutls],
891 [enable SSL support (default OpenSSL)]))
892
893 AC_ARG_WITH(egd,
894 [[ --with-egd[=PATH] enable EGD support [using EGD socket at PATH]]])
895
896 AC_ARG_WITH(pakchois,
897 AS_HELP_STRING([--without-pakchois],
898 [disable support for PKCS#11 using pakchois]))
899
900 case $with_ssl in
901 /*)
902 AC_MSG_NOTICE([to use SSL libraries in non-standard locations, try --with-ssl --with-libs=$with_ssl])
903 AC_MSG_ERROR([--with-ssl does not take a path argument])
904 ;;
905 yes|openssl)
906 NE_PKG_CONFIG(NE_SSL, openssl,
907 [AC_MSG_NOTICE(using OpenSSL $NE_SSL_VERSION library configuration from pkg-config)
908 CPPFLAGS="$CPPFLAGS ${NE_SSL_CFLAGS}"
909 NEON_LIBS="$NEON_LIBS ${NE_SSL_LIBS}"],
910 [# Either OpenSSL library may require -ldl if built with dynamic engine support
911 NE_SEARCH_LIBS(RSA_new, crypto, -ldl)
912 NE_SEARCH_LIBS(SSL_library_init, ssl, -ldl)
913 NE_SSL_VERSION="(0.9.7 or later)"])
914
915 AC_CHECK_HEADERS(openssl/ssl.h openssl/opensslv.h,,
916 [AC_MSG_ERROR([OpenSSL headers not found, cannot enable SSL support])])
917
918 NE_CHECK_OPENSSLVER(ne_cv_lib_ssl097, 0.9.7, 0x00907000L)
919 NE_CHECK_OPENSSLVER(ne_cv_lib_ssl110, 1.1.0, 0x10100000L)
920 if test "$ne_cv_lib_ssl110" = "yes"; then
921 NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using OpenSSL $NE_SSL_VERSION])
922 elif test "$ne_cv_lib_ssl097" = "yes"; then
923 # Enable EGD support if using 0.9.7 or newer
924 AC_MSG_NOTICE([OpenSSL >= 0.9.7; EGD support not needed in neon])
925 NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using OpenSSL $NE_SSL_VERSION])
926 NE_CHECK_FUNCS(CRYPTO_set_idptr_callback SSL_SESSION_cmp)
927 else
928 # Fail if OpenSSL is older than 0.9.6
929 NE_CHECK_OPENSSLVER(ne_cv_lib_ssl096, 0.9.6, 0x00906000L)
930 if test "$ne_cv_lib_ssl096" != "yes"; then
931 AC_MSG_ERROR([OpenSSL 0.9.6 or later is required])
932 fi
933 NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using OpenSSL (0.9.6 or later)])
934
935 case "$with_egd" in
936 yes|no) ne_cv_lib_sslegd=$with_egd ;;
937 /*) ne_cv_lib_sslegd=yes
938 AC_DEFINE_UNQUOTED([EGD_PATH], "$with_egd",
939 [Define to specific EGD socket path]) ;;
940 *) # Guess whether EGD support is needed
941 AC_CACHE_CHECK([whether to enable EGD support], [ne_cv_lib_sslegd],
942 [if test -r /dev/random || test -r /dev/urandom; then
943 ne_cv_lib_sslegd=no
944 else
945 ne_cv_lib_sslegd=yes
946 fi])
947 ;;
948 esac
949 if test "$ne_cv_lib_sslegd" = "yes"; then
950 AC_MSG_NOTICE([EGD support enabled for seeding OpenSSL PRNG])
951 AC_DEFINE([ENABLE_EGD], 1, [Define if EGD should be supported])
952 fi
953 fi
954
955 AC_DEFINE([HAVE_OPENSSL], 1, [Define if OpenSSL support is enabled])
956 NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_openssl"
957
958 AC_DEFINE([HAVE_NTLM], 1, [Define if NTLM is supported])
959 ;;
960 gnutls)
961 NE_PKG_CONFIG(NE_SSL, gnutls,
962 [AC_MSG_NOTICE(using GnuTLS configuration from pkg-config)
963 CPPFLAGS="$CPPFLAGS ${NE_SSL_CFLAGS}"
964 NEON_LIBS="$NEON_LIBS ${NE_SSL_LIBS}"
965 ], [
966 # Fall back on libgnutls-config script
967 AC_PATH_PROG(GNUTLS_CONFIG, libgnutls-config, no)
968
969 if test "$GNUTLS_CONFIG" = "no"; then
970 AC_MSG_ERROR([could not find libgnutls-config in \$PATH])
971 fi
972
973 CPPFLAGS="$CPPFLAGS `$GNUTLS_CONFIG --cflags`"
974 NEON_LIBS="$NEON_LIBS `$GNUTLS_CONFIG --libs`"
975 NE_SSL_VERSION="`$GNUTLS_CONFIG --version`"
976 ])
977
978 AC_CHECK_HEADER([gnutls/gnutls.h],,
979 [AC_MSG_ERROR([could not find gnutls/gnutls.h in include path])])
980
981 NE_ENABLE_SUPPORT(SSL, [SSL support enabled, using GnuTLS $NE_SSL_VERSION])
982 NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_gnutls"
983 AC_DEFINE([HAVE_GNUTLS], 1, [Define if GnuTLS support is enabled])
984
985 # Check for functions in later releases
986 NE_CHECK_FUNCS([gnutls_session_get_data2 gnutls_x509_dn_get_rdn_ava \
987 gnutls_certificate_get_issuer \
988 gnutls_certificate_get_x509_cas \
989 gnutls_x509_crt_sign2 \
990 gnutls_certificate_set_retrieve_function2 \
991 gnutls_privkey_import_ext])
992
993 # fail if gnutls_x509_crt_sign2 is not found (it was introduced in 1.2.0, which is required)
994 if test x${ac_cv_func_gnutls_x509_crt_sign2} != xyes; then
995 AC_MSG_ERROR([GnuTLS version predates gnutls_x509_crt_sign2, newer version required (at least 1.2.0)])
996 fi
997
998 # Check for iconv support if using the new RDN access functions:
999 if test ${ac_cv_func_gnutls_x509_dn_get_rdn_ava}X${ac_cv_header_iconv_h} = yesXyes; then
1000 AC_CHECK_FUNCS(iconv)
1001 fi
1002 ;;
1003 *) # Default to off; only create crypto-enabled binaries if requested.
1004 NE_DISABLE_SUPPORT(SSL, [SSL support is not enabled])
1005 NE_DISABLE_SUPPORT(TS_SSL, [Thread-safe SSL support is not enabled])
1006 NEON_EXTRAOBJS="$NEON_EXTRAOBJS ne_stubssl"
1007 ;;
1008 esac
1009 AC_SUBST(NEON_SUPPORTS_SSL)
1010
1011 AC_ARG_WITH(ca-bundle,
1012 AS_HELP_STRING(--with-ca-bundle, specify filename of an SSL CA root bundle),,
1013 with_ca_bundle=no)
1014
1015 case ${NE_FLAG_SSL}-${with_ca_bundle} in
1016 *-no) ;;
1017 yes-*)
1018 AC_DEFINE_UNQUOTED([NE_SSL_CA_BUNDLE], ["${with_ca_bundle}"],
1019 [Define to be filename of an SSL CA root bundle])
1020 AC_MSG_NOTICE([Using ${with_ca_bundle} as default SSL CA bundle])
1021 ;;
1022 esac
1023
1024 AC_ARG_ENABLE(threadsafe-ssl,
1025 AS_HELP_STRING(--enable-threadsafe-ssl=posix,
1026 [enable SSL library thread-safety using POSIX threads: suitable
1027 CC/CFLAGS/LIBS must be used to make the POSIX library interfaces
1028 available]),,
1029 enable_threadsafe_ssl=no)
1030
1031 case ${enable_threadsafe_ssl}X${ne_cv_lib_ssl110} in
1032 *Xyes)
1033 NE_ENABLE_SUPPORT(TS_SSL, [OpenSSL is natively thread-safe])
1034 ;;
1035 posixX*|yesX*)
1036 ne_pthr_ok=yes
1037 AC_CHECK_FUNCS([pthread_mutex_init pthread_mutex_lock],,[ne_pthr_ok=no])
1038 if test "${ne_pthr_ok}" = "no"; then
1039 AC_MSG_ERROR([could not find POSIX mutex interfaces; (try CC="${CC} -pthread"?)])
1040 fi
1041 NE_ENABLE_SUPPORT(TS_SSL, [Thread-safe SSL supported using POSIX threads])
1042 ;;
1043 *)
1044 NE_DISABLE_SUPPORT(TS_SSL, [Thread-safe SSL not supported])
1045 ;;
1046 esac
1047
1048 case ${with_pakchois}X${ac_cv_func_gnutls_privkey_import_ext}Y${ne_cv_lib_ssl097} in
1049 noX*Y*) ;;
1050 *X*Yyes|*XyesY*)
1051 # PKCS#11... ho!
1052 NE_PKG_CONFIG(NE_PK11, pakchois,
1053 [AC_MSG_NOTICE([[using pakchois $NE_PK11_VERSION for PKCS#11 support]])
1054 AC_DEFINE(HAVE_PAKCHOIS, 1, [Define if pakchois library supported])
1055 CPPFLAGS="$CPPFLAGS ${NE_PK11_CFLAGS}"
1056 NEON_LIBS="${NEON_LIBS} ${NE_PK11_LIBS}"],
1057 [AC_MSG_NOTICE([[pakchois library not found; no PKCS#11 support]])])
1058 ;;
1059 esac
1060 ]) dnl -- end defun NEON_SSL
1061
1062 dnl Check for Kerberos installation
1063 AC_DEFUN([NEON_GSSAPI], [
1064 AC_ARG_WITH(gssapi, AS_HELP_STRING(--without-gssapi, disable GSSAPI support))
1065 if test "$with_gssapi" != "no"; then
1066 AC_PATH_PROG([KRB5_CONFIG], krb5-config, none, $PATH:/usr/kerberos/bin)
1067 else
1068 KRB5_CONFIG=none
1069 fi
1070 if test "x$KRB5_CONFIG" != "xnone"; then
1071 ne_save_CPPFLAGS=$CPPFLAGS
1072 ne_save_LIBS=$NEON_LIBS
1073 NEON_LIBS="$NEON_LIBS `${KRB5_CONFIG} --libs gssapi`"
1074 CPPFLAGS="$CPPFLAGS `${KRB5_CONFIG} --cflags gssapi`"
1075 # MIT and Heimdal put gssapi.h in different places
1076 AC_CHECK_HEADERS(gssapi/gssapi.h gssapi.h, [
1077 NE_CHECK_FUNCS(gss_init_sec_context, [
1078 ne_save_CPPFLAGS=$CPPFLAGS
1079 ne_save_LIBS=$NEON_LIBS
1080 AC_MSG_NOTICE([GSSAPI authentication support enabled])
1081 AC_DEFINE(HAVE_GSSAPI, 1, [Define if GSSAPI support is enabled])
1082 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1083 # Older versions of MIT Kerberos lack GSS_C_NT_HOSTBASED_SERVICE
1084 AC_CHECK_DECL([GSS_C_NT_HOSTBASED_SERVICE],,
1085 [AC_DEFINE([GSS_C_NT_HOSTBASED_SERVICE], gss_nt_service_name,
1086 [Define if GSS_C_NT_HOSTBASED_SERVICE is not defined otherwise])],
1087 [#ifdef HAVE_GSSAPI_GSSAPI_H
1088 #include <gssapi/gssapi.h>
1089 #else
1090 #include <gssapi.h>
1091 #endif])])
1092 break
1093 ])
1094 CPPFLAGS=$ne_save_CPPFLAGS
1095 NEON_LIBS=$ne_save_LIBS
1096 fi])
1097
1098 AC_DEFUN([NEON_LIBPROXY], [
1099 AC_ARG_WITH(libproxy, AS_HELP_STRING(--without-libproxy, disable libproxy support))
1100 if test "x$with_libproxy" != "xno"; then
1101 NE_PKG_CONFIG(NE_PXY, libproxy-1.0,
1102 [AC_DEFINE(HAVE_LIBPROXY, 1, [Define if libproxy is supported])
1103 CPPFLAGS="$CPPFLAGS $NE_PXY_CFLAGS"
1104 NEON_LIBS="$NEON_LIBS ${NE_PXY_LIBS}"
1105 NE_ENABLE_SUPPORT(LIBPXY, [libproxy support enabled using libproxy $NE_PXY_VERSION])],
1106 [NE_DISABLE_SUPPORT(LIBPXY, [libproxy support not enabled])])
1107 else
1108 NE_DISABLE_SUPPORT(LIBPXY, [libproxy support not enabled])
1109 fi
1110 ])
1111
1112 dnl Adds an --enable-warnings argument to configure to allow enabling
1113 dnl compiler warnings
1114 AC_DEFUN([NEON_WARNINGS],[
1115
1116 AC_REQUIRE([AC_PROG_CC]) dnl so that $GCC is set
1117
1118 AC_ARG_ENABLE(warnings,
1119 AS_HELP_STRING(--enable-warnings, [enable compiler warnings]))
1120
1121 if test "$enable_warnings" = "yes"; then
1122 case $GCC:`uname` in
1123 yes:*)
1124 CFLAGS="$CFLAGS -Wall -Wmissing-declarations -Wshadow -Wreturn-type -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wformat-security"
1125 if test -z "$with_ssl" -o "$with_ssl" = "no"; then
1126 # OpenSSL headers fail strict prototypes checks
1127 CFLAGS="$CFLAGS -Wstrict-prototypes"
1128 fi
1129 ;;
1130 no:OSF1) CFLAGS="$CFLAGS -check -msg_disable returnchecks -msg_disable alignment -msg_disable overflow" ;;
1131 no:IRIX) CFLAGS="$CFLAGS -fullwarn" ;;
1132 no:UnixWare) CFLAGS="$CFLAGS -v" ;;
1133 *) AC_MSG_WARN([warning flags unknown for compiler on this platform]) ;;
1134 esac
1135 fi
1136 ])
1137
1138 dnl Adds an --disable-debug argument to configure to allow disabling
1139 dnl debugging messages.
1140 dnl Usage:
1141 dnl NEON_WARNINGS([actions-if-debug-enabled], [actions-if-debug-disabled])
1142 dnl
1143 AC_DEFUN([NEON_DEBUG], [
1144
1145 AC_ARG_ENABLE(debug,
1146 AS_HELP_STRING(--disable-debug,[disable runtime debugging messages]))
1147
1148 # default is to enable debugging
1149 case $enable_debug in
1150 no) AC_MSG_NOTICE([debugging is disabled])
1151 $2 ;;
1152 *) AC_MSG_NOTICE([debugging is enabled])
1153 AC_DEFINE(NE_DEBUGGING, 1, [Define to enable debugging])
1154 $1
1155 ;;
1156 esac])
1157
1158 dnl Macro to optionally enable socks support
1159 AC_DEFUN([NEON_SOCKS], [
1160 ])
1161
1162 AC_DEFUN([NEON_WITH_LIBS], [
1163 AC_ARG_WITH([libs],
1164 [[ --with-libs=DIR[:DIR2...] look for support libraries in DIR/{bin,lib,include}]],
1165 [case $with_libs in
1166 yes|no) AC_MSG_ERROR([--with-libs must be passed a directory argument]) ;;
1167 *) ne_save_IFS=$IFS; IFS=:
1168 for dir in $with_libs; do
1169 ne_add_CPPFLAGS="$ne_add_CPPFLAGS -I${dir}/include"
1170 ne_add_LDFLAGS="$ne_add_LDFLAGS -L${dir}/lib"
1171 ne_add_PATH="${ne_add_PATH}${dir}/bin:"
1172 PKG_CONFIG_PATH=${PKG_CONFIG_PATH}${PKG_CONFIG_PATH+:}${dir}/lib/pkgconfig
1173 done
1174 IFS=$ne_save_IFS
1175 CPPFLAGS="${ne_add_CPPFLAGS} $CPPFLAGS"
1176 LDFLAGS="${ne_add_LDFLAGS} $LDFLAGS"
1177 PATH=${ne_add_PATH}$PATH
1178 export PKG_CONFIG_PATH ;;
1179 esac])])
1180
1181 AC_DEFUN([NEON_I18N], [
1182
1183 dnl Check for NLS iff libintl.h was detected.
1184 AC_ARG_ENABLE(nls,
1185 AS_HELP_STRING(--disable-nls, [disable internationalization support]),,
1186 [enable_nls=${ac_cv_header_libintl_h}])
1187
1188 if test x${enable_nls} = xyes; then
1189 # presume that dgettext() is available if bindtextdomain() is...
1190 # checking for dgettext() itself is awkward because gcc has a
1191 # builtin of that function, which confuses AC_CHECK_FUNCS et al.
1192 NE_SEARCH_LIBS(bindtextdomain, intl, -liconv ,[enable_nls=no])
1193 NE_CHECK_FUNCS(bind_textdomain_codeset)
1194 fi
1195
1196 if test "$enable_nls" = "no"; then
1197 NE_DISABLE_SUPPORT(I18N, [Internationalization support not enabled])
1198 else
1199 NE_ENABLE_SUPPORT(I18N, [Internationalization support enabled])
1200 eval localedir="${datadir}/locale"
1201 AC_DEFINE_UNQUOTED([LOCALEDIR], "$localedir",
1202 [Define to be location of localedir])
1203 fi
1204
1205 ])