1dnl  Copyright 2001-2005 The Apache Software Foundation or its licensors, as
2dnl  applicable.
3dnl  Licensed under the Apache License, Version 2.0 (the "License");
4dnl  you may not use this file except in compliance with the License.
5dnl  You may obtain a copy of the License at
6dnl 
7dnl       http://www.apache.org/licenses/LICENSE-2.0
8dnl 
9dnl  Unless required by applicable law or agreed to in writing, software
10dnl  distributed under the License is distributed on an "AS IS" BASIS,
11dnl  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12dnl  See the License for the specific language governing permissions and
13dnl  limitations under the License.
14
15AC_DEFUN([CHECK_DISTCACHE], [
16  AC_MSG_CHECKING(whether Distcache is required)
17  ap_ssltk_dc="no"
18  tmp_nomessage=""
19  tmp_forced="no"
20  AC_ARG_ENABLE(distcache,
21    APACHE_HELP_STRING(--enable-distcache,Select distcache support in mod_ssl),
22    ap_ssltk_dc="$enableval"
23    tmp_nomessage=""
24    tmp_forced="yes"
25    if test "x$ap_ssltk_dc" = "x"; then
26      ap_ssltk_dc="yes"
27      dnl our "error"s become "tests revealed that..."
28      tmp_forced="no"
29    fi
30    if test "$ap_ssltk_dc" != "yes" -a "$ap_ssltk_dc" != "no"; then
31      tmp_nomessage="--enable-distcache had illegal syntax - disabling"
32      ap_ssltk_dc="no"
33    fi)
34  if test "$tmp_forced" = "no"; then
35    AC_MSG_RESULT($ap_ssltk_dc (default))
36  else
37    AC_MSG_RESULT($ap_ssltk_dc (specified))
38  fi
39  if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno" -a "x$tmp_nomessage" != "x"; then
40    AC_MSG_ERROR(distcache support failed: $tmp_nomessage)
41  fi
42  if test "$ap_ssltk_dc" = "yes"; then
43    AC_CHECK_HEADER(
44      [distcache/dc_client.h],
45      [],
46      [tmp_nomessage="can't include distcache headers"
47      ap_ssltk_dc="no"])
48    if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then
49      AC_MSG_ERROR(distcache support failed: $tmp_nomessage)
50    fi
51  fi
52  if test "$ap_ssltk_dc" = "yes"; then
53    AC_MSG_CHECKING(for Distcache version)
54    AC_TRY_COMPILE(
55[#include <distcache/dc_client.h>],
56[#if DISTCACHE_CLIENT_API != 0x0001
57#error "distcache API version is unrecognised"
58#endif],
59[],
60[tmp_nomessage="distcache has an unsupported API version"
61ap_ssltk_dc="no"])
62    AC_MSG_RESULT($ap_ssltk_dc)
63    if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then
64      AC_MSG_ERROR(distcache support failed: $tmp_nomessage)
65    fi
66  fi
67  if test "$ap_ssltk_dc" = "yes"; then
68    AC_MSG_CHECKING(for Distcache libraries)
69    save_libs=$LIBS
70    LIBS="$LIBS -ldistcache -lnal"
71    AC_TRY_LINK(
72      [#include <distcache/dc_client.h>],
73      [DC_CTX *foo = DC_CTX_new((const char *)0,0);],
74      [],
75      [tmp_no_message="failed to link with distcache libraries"
76      ap_ssltk_dc="no"])
77    LIBS=$save_libs
78    AC_MSG_RESULT($ap_ssltk_dc)
79    if test "$tmp_forced" = "yes" -a "x$ap_ssltk_dc" = "xno"; then
80      AC_MSG_ERROR(distcache support failed: $tmp_nomessage)
81    else
82      APR_ADDTO(MOD_SSL_LDADD, [-ldistcache -lnal])
83      AC_DEFINE(HAVE_DISTCACHE, 1, [Define if distcache support is enabled])
84    fi
85  fi
86])
87
88dnl #  start of module specific part
89APACHE_MODPATH_INIT(ssl)
90
91dnl #  list of module object files
92ssl_objs="dnl
93mod_ssl.lo dnl
94ssl_engine_config.lo dnl
95ssl_engine_dh.lo dnl
96ssl_engine_init.lo dnl
97ssl_engine_io.lo dnl
98ssl_engine_kernel.lo dnl
99ssl_engine_log.lo dnl
100ssl_engine_mutex.lo dnl
101ssl_engine_pphrase.lo dnl
102ssl_engine_rand.lo dnl
103ssl_engine_vars.lo dnl
104ssl_expr.lo dnl
105ssl_expr_eval.lo dnl
106ssl_expr_parse.lo dnl
107ssl_expr_scan.lo dnl
108ssl_scache.lo dnl
109ssl_scache_dbm.lo dnl
110ssl_scache_shmcb.lo dnl
111ssl_scache_dc.lo dnl
112ssl_util.lo dnl
113ssl_util_ssl.lo dnl
114"
115dnl #  hook module into the Autoconf mechanism (--enable-ssl option)
116APACHE_MODULE(ssl, [SSL/TLS support (mod_ssl)], $ssl_objs, , no, [
117    APACHE_CHECK_SSL_TOOLKIT
118    APR_SETVAR(MOD_SSL_LDADD, [\$(SSL_LIBS)])
119    CHECK_DISTCACHE
120    if test "x$enable_ssl" = "xshared"; then
121       # The only symbol which needs to be exported is the module
122       # structure, so ask libtool to hide everything else:
123       APR_ADDTO(MOD_SSL_LDADD, [-export-symbols-regex ssl_module])
124    fi
125])
126
127# Ensure that other modules can pick up mod_ssl.h
128APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current])
129
130dnl #  end of module specific part
131APACHE_MODPATH_FINISH
132
133