Moved key/cred resolution classes out of xmlsig namespace, start cleaning up configure.
[shibboleth/sp.git] / configure.ac
1 AC_PREREQ([2.50])
2 AC_INIT([shibboleth], [2.0], [shibboleth-users@internet2.edu], [shibboleth])
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE([shibboleth],[2.0])
5
6 sinclude(acx_pthread.m4)
7
8 AC_ARG_ENABLE(debug,
9     AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)
10 ]),
11     enable_debug=$enableval, enable_debug=no)
12
13 if test "$enable_debug" = "yes" ; then
14     GCC_CFLAGS="$CFLAGS -Wall -g -D_DEBUG"
15     GCC_CXXFLAGS="$CXXFLAGS -Wall -g -D_DEBUG"
16 else
17     GCC_CFLAGS="$CFLAGS -Wall -O2 -DNDEBUG"
18     GCC_CXXFLAGS="$CXXFLAGS -Wall -O2 -DNDEBUG"
19 fi
20
21 AC_PROG_CC([gcc gcc3 cc])
22 AC_PROG_CXX([g++ g++3 c++ CC])
23
24 if test "$GCC" = "yes" ; then
25     CFLAGS="$GCC_CFLAGS"
26     CXXFLAGS="$GCC_CXXFLAGS"
27 fi
28
29 AC_DISABLE_STATIC
30 AC_PROG_LIBTOOL
31
32 AC_LANG(C++)
33
34 # C++ requirements
35 AC_CXX_REQUIRE_STL
36 AC_CXX_NAMESPACES
37
38 AC_LANG(C)
39
40 # Checks for typedefs, structures, and compiler characteristics.
41 AC_C_CONST
42 AC_TYPE_SIZE_T
43 AC_STRUCT_TM
44
45 # Checks for library functions.
46 AC_FUNC_STRFTIME
47 AC_FUNC_STRERROR_R
48 AC_CHECK_FUNCS([strchr strdup strstr gmtime_r ctime_r strtok_r strcasecmp])
49
50 # old_LIBS="$LIBS"
51 # AC_SEARCH_LIBS(xdr_uint64_t,nsl,,
52 #       [CFLAGS="$CFLAGS -DNEED_XDR_LONGLONG"
53 #        CXXFLAGS="$CXXFLAGS -DNEED_XDR_LONGLONG"])
54 # LIBS="$old_LIBS"
55
56 # checks for pthreads
57 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
58 if test $enable_threads != "pthread"; then
59     AC_MSG_ERROR([unable to find pthreads, currently this is required])
60 else
61     AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
62     LIBS="$PTHREAD_LIBS $LIBS"
63     CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
64     CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
65 fi
66
67 AC_LANG(C++)
68
69 # log4cpp settings
70 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
71 AC_ARG_WITH(log4cpp,
72             AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp is installed]),
73             [LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"])
74 if test -f "${LOG4CPP_CONFIG}"; then
75     LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
76     CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
77 else
78     AC_MSG_WARN([log4cpp-config not found, guessing at log4cpp build settings])
79     LIBS="-llog4cpp $LIBS"
80 fi
81 AC_CHECK_HEADER([log4cpp/Category.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
82 AC_TRY_LINK(
83         [#include <log4cpp/Category.hh>],
84         [log4cpp::Category::getInstance("foo")],
85         [AC_DEFINE(HAVE_LIBLOG4CPP,1,[Define if log4cpp library was found])],
86         [AC_MSG_ERROR([unable to link with log4cpp])])
87
88 # Xerces settings
89 AC_ARG_WITH(xerces, 
90             AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
91             [if test x_$with_xerces != x_/usr; then
92                 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
93                 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
94             fi])
95 LIBS="-lxerces-c $LIBS"
96 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,
97                 AC_MSG_ERROR([unable to find xerces header files]))
98 AC_MSG_CHECKING([Xerces version])
99 AC_PREPROC_IFELSE(
100     [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
101 [#if  _XERCES_VERSION != 20600
102 int i = 0;
103 #else
104 #error cannot use version 2.6.0
105 #endif])],
106     [AC_MSG_RESULT(OK)],
107     [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
108 AC_TRY_LINK(
109         [#include <xercesc/util/PlatformUtils.hpp>],
110         [xercesc::XMLPlatformUtils::Initialize()],
111         [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
112         [AC_MSG_ERROR([unable to link with Xerces])])
113
114
115 # XML-Security settings
116 AC_ARG_WITH(xmlsec,
117             AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
118             [with_xmlsec=/usr])
119
120 if test x_$with_xmlsec != x_/usr; then
121     LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
122     CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
123 fi        
124 LIBS="-lxml-security-c $LIBS"
125 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
126 AC_MSG_CHECKING([XML-Security version])
127 AC_PREPROC_IFELSE(
128     [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
129     [#if XSEC_VERSION_MAJOR > 1 || XSEC_VERSION_MEDIUM >2 
130 int i = 0;
131 #else
132 #error need version 1.3 or later
133 #endif])],
134     [AC_MSG_RESULT(OK)],
135     [AC_MSG_FAILURE([XML-Security version 1.3 or greater is required.])])
136 AC_TRY_LINK(
137         [#include <xsec/utils/XSECPlatformUtils.hpp>],
138         [XSECPlatformUtils::Initialise()],,
139         [AC_MSG_ERROR([unable to link with XML-Sec])])
140
141 # OpenSAML settings
142 AC_ARG_WITH(saml,
143             AC_HELP_STRING([--with-saml=PATH], [where saml is installed]),
144             [if test x_$with_saml != x_/usr; then
145                 LDFLAGS="-L${with_saml}/lib $LDFLAGS"
146                 CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
147             fi])
148 AC_CHECK_HEADER([saml/saml.h],,
149                 AC_MSG_ERROR([unable to find saml header files]))
150 LIBS="-lsaml $LIBS"
151 AC_TRY_LINK(
152         [#include <saml/saml.h>
153 #include <saml/version.h>],
154         [#if _OPENSAML_VERSION >= 20000
155 opensaml::SAMLConfig::getConfig();
156 #else
157 #error Need OpenSAML version 2.0 or higher
158 #endif],
159         [AC_DEFINE(HAVE_SAML,1,[Define if saml library was found])],
160         [AC_MSG_ERROR([unable to link with OpenSAML, or version was too old])])
161
162 # output the underlying makefiles
163 WANT_SUBDIRS="doc schemas configs shibsp shibd siterefresh test"
164 AC_CONFIG_FILES([Makefile doc/Makefile schemas/Makefile \
165                  configs/Makefile shibsp/Makefile shibd/Makefile siterefresh/Makefile \
166                  util/Makefile selinux/Makefile])
167
168
169 #
170 # Build NSAPI module?
171 #
172 AC_MSG_CHECKING(for NSAPI module option)
173 AC_ARG_WITH(nsapi,
174         AC_HELP_STRING([--with-nsapi=DIR], [Build NSAPI module for Netscape/iPlanet/SunONE]),
175         [WANT_NSAPI=$withval],[WANT_NSAPI=no])
176 AC_MSG_RESULT($WANT_NSAPI)
177
178 if test "$WANT_NSAPI" != "no"; then
179   if test ! -d $WANT_NSAPI/bin ; then
180     AC_MSG_ERROR(Please specify the path to the root of your Netscape/iPlanet/SunONE server using --with-nsapi=DIR)
181   fi
182   AC_MSG_CHECKING(for NSAPI include files)
183   if test -d $WANT_NSAPI/include ; then
184     NSAPI_INCLUDE=$WANT_NSAPI/include
185     AC_MSG_RESULT(Netscape-Enterprise 3.x style)
186     AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
187     NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
188   fi
189   if test -d $WANT_NSAPI/plugins/include ; then
190     test -n "$NSAPI_INCLUDE" && NSAPI_INC_DIR="-I$NSAPI_INCLUDE"
191     NSAPI_INCLUDE="$WANT_NSAPI/plugins/include"
192     AC_MSG_RESULT(iPlanet 4.x / SunONE 6.x style)
193     AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
194     NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
195   fi
196   if test "$NSAPI_INCLUDE" = ""; then
197     AC_MSG_ERROR(Please check you have nsapi.h in either $WANT_NSAPI/include or $WANT_NSAPI/plugins/include)
198   fi
199 fi
200
201 AC_SUBST(NSAPI_INCLUDE)
202
203 # always output the Makefile, even if you don't use it
204 AC_CONFIG_FILES([nsapi_shib/Makefile])
205 AM_CONDITIONAL(BUILD_NSAPI,test ! "$WANT_NSAPI" = "no")
206
207 # add the NSAPI module to the list of wanted subdirs..
208 if test ! "$WANT_NSAPI" = "no" ; then
209     WANT_SUBDIRS="$WANT_SUBDIRS nsapi_shib"
210 fi
211
212
213 # Apache 1.3 (mod_shib_13)
214 #   --enable-apache-13
215 #   --with-apxs      (DSO build, the normal way, uses apxs to derive build flags)
216
217 AC_ARG_ENABLE(apache-13,
218         AC_HELP_STRING([--enable-apache-13], [enable the Apache 1.3 module]),
219         [ if test "x$enableval" = "x" ; then
220               WANT_APACHE_13=yes
221           else
222               WANT_APACHE_13="$enableval"
223           fi
224         ],[ WANT_APACHE_13=no ])
225 AC_MSG_CHECKING(whether to build Apache 1.3 module)
226 if test "$WANT_APACHE_13" != yes && test "$WANT_APACHE_13" != no ; then
227    WANT_APACHE_13=yes
228 fi
229 AC_MSG_RESULT($WANT_APACHE_13)
230
231 if test "$WANT_APACHE_13" = "yes" ; then
232     AC_ARG_WITH(apxs, 
233         AC_HELP_STRING([--with-apxs=FILE], [Specifies where to find the Apache 1.3 apxs script.]),
234         [
235         AC_MSG_CHECKING(for user-specified apxs name/location)
236         if test "$withval" != "no" ; then
237           if test "$withval" != "yes"; then
238             APXS=$withval
239             AC_MSG_RESULT("$withval")
240           fi
241         fi
242         ],
243         [
244         AC_PATH_PROG(APXS, apxs, no)
245         if test "$APXS" = "no" ; then
246           for i in /usr/sbin /usr/local/apache/bin ; do
247             if test "$APXS" = "no" && test -f "$i/apxs"; then
248               APXS="$i/apxs"
249             fi
250           done
251         fi
252         ])
253
254     AC_MSG_CHECKING([to see if apxs was located])
255     if test ! -f "$APXS" ; then
256         AC_MSG_RESULT(no)
257         AC_MSG_ERROR([Unable to locate apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs option.])
258     fi
259     AC_MSG_RESULT($APXS)
260     AC_SUBST(APXS)
261
262     # extract settings we need from APXS -q
263     APXS_CC="`$APXS -q CC`"
264     APXS_CFLAGS="`$APXS -q CPPFLAGS` `$APXS -q CFLAGS` `$APXS -q CFLAGS_SHLIB`"
265     APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
266 fi
267
268 AC_SUBST(APXS_CFLAGS)
269 AC_SUBST(APXS_INCLUDE)
270
271
272 # Apache 2.0 (mod_shib_20)
273 #   --enable-apache-20
274 #   --with-apxs2      (DSO build, the normal way, uses apxs to derive build flags)
275 #       --with-apr        (DSO build, APR development package installed separately)
276
277 AC_ARG_ENABLE(apache-20,
278         AC_HELP_STRING([--enable-apache-20], [enable the Apache 2.0 module]),
279         [ if test "x$enableval" = "x" ; then
280               WANT_APACHE_20=yes
281           else
282               WANT_APACHE_20="$enableval"
283           fi
284         ],[ WANT_APACHE_20=no ])
285 AC_MSG_CHECKING(whether to build Apache 2.0 module)
286 if test "$WANT_APACHE_20" != yes && test "$WANT_APACHE_20" != no ; then
287    WANT_APACHE_20=yes
288 fi
289 AC_MSG_RESULT($WANT_APACHE_20)
290
291 if test "$WANT_APACHE_20" = "yes" ; then
292     AC_ARG_WITH(apxs2, 
293         AC_HELP_STRING([--with-apxs2=FILE], [Specifies where to find the Apache 2.0 apxs script.]),
294         [
295         AC_MSG_CHECKING(for user-specified Apache2 apxs name/location)
296         if test "$withval" != "no" ; then
297           if test "$withval" != "yes"; then
298             APXS2=$withval
299             AC_MSG_RESULT("$withval")
300           fi
301         fi
302         ],
303         [
304         AC_PATH_PROG(APXS2, apxs2, no)
305         if test "$APXS2" = "no" ; then
306             AC_PATH_PROG(APXS2, apxs, no)
307         fi
308         if test "$APXS2" = "no" ; then
309           for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
310             if test "$APXS2" = "no" && test -f "$i/apxs2" ; then
311               APXS2="$i/apxs2"
312             fi
313           done
314           if test "$APXS2" = "no" ; then
315             for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
316               if test "$APXS2" = "no" && test -f "$i/apxs" ; then
317                 APXS2="$i/apxs"
318               fi
319             done
320           fi
321         fi
322         ])
323
324     AC_MSG_CHECKING([to see if Apache2 apxs was located])
325     if test ! -f "$APXS2" ; then
326         AC_MSG_RESULT(no)
327         AC_MSG_ERROR([Unable to locate Apache2 apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs2 option.])
328     fi
329     AC_MSG_RESULT($APXS2)
330     AC_SUBST(APXS2)
331
332     # APR settings
333     AC_ARG_WITH(apr, 
334         AC_HELP_STRING([--with-apr=PATH], [where apr-config is installed]),
335         [
336         AC_MSG_CHECKING(for user-specified apr-config name/location)
337         if test "$withval" != "no" ; then
338             if test "$withval" != "yes"; then
339                 APR_CONFIG=$withval
340                 AC_MSG_RESULT("$withval")
341             fi
342         fi
343         ],
344         [
345         AC_PATH_PROG(APR_CONFIG, apr-config)
346         ])
347         if test -f "${APR_CONFIG}"; then
348         APR_CFLAGS="`${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags` `${APR_CONFIG} --includes`"
349     else
350         AC_MSG_ERROR([Unable to locate apr-config, may need --with-apr option.])
351     fi
352
353     # extract settings we need from APXS2 -q
354     APXS2_CC="`$APXS2 -q CC`"
355     APXS2_CFLAGS="`$APXS2 -q CPPFLAGS` `$APXS2 -q CFLAGS` `$APXS2 -q CFLAGS_SHLIB` $APR_CFLAGS"
356     APXS2_INCLUDE="`$APXS2 -q INCLUDEDIR`"
357 fi
358
359 AC_SUBST(APXS2_CFLAGS)
360 AC_SUBST(APXS2_INCLUDE)
361
362
363 # Apache 2.2 (mod_shib_22)
364 #   --enable-apache-22
365 #   --with-apxs22     (DSO build, the normal way, uses apxs to derive build flags)
366 #       --with-apr1       (DSO build, APR development package installed separately)
367
368 AC_ARG_ENABLE(apache-22,
369         AC_HELP_STRING([--enable-apache-22], [enable the Apache 2.2 module]),
370         [ if test "x$enableval" = "x" ; then
371               WANT_APACHE_22=yes
372           else
373               WANT_APACHE_22="$enableval"
374           fi
375         ],[ WANT_APACHE_22=no ])
376 AC_MSG_CHECKING(whether to build Apache 2.2 module)
377 if test "$WANT_APACHE_22" != yes && test "$WANT_APACHE_22" != no ; then
378    WANT_APACHE_22=yes
379 fi
380 AC_MSG_RESULT($WANT_APACHE_22)
381
382 if test "$WANT_APACHE_22" = "yes" ; then
383     AC_ARG_WITH(apxs22, 
384         AC_HELP_STRING([--with-apxs22=FILE], [Specifies where to find the Apache 2.2 apxs script.]),
385         [
386         AC_MSG_CHECKING(for user-specified Apache2.2 apxs name/location)
387         if test "$withval" != "no" ; then
388           if test "$withval" != "yes"; then
389             APXS22=$withval
390             AC_MSG_RESULT("$withval")
391           fi
392         fi
393         ],
394         [
395         AC_PATH_PROG(APXS22, apxs2, no)
396         if test "$APXS22" = "no" ; then
397             AC_PATH_PROG(APXS22, apxs, no)
398         fi
399         if test "$APXS22" = "no" ; then
400           for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
401             if test "$APXS22" = "no" && test -f "$i/apxs2" ; then
402               APXS22="$i/apxs2"
403             fi
404           done
405           if test "$APXS22" = "no" ; then
406             for i in /usr/sbin /usr/local/apache2/bin /usr/local/apache/bin ; do
407               if test "$APXS22" = "no" && test -f "$i/apxs" ; then
408                 APXS22="$i/apxs"
409               fi
410             done
411           fi
412         fi
413         ])
414
415     AC_MSG_CHECKING([to see if Apache2.2 apxs was located])
416     if test ! -f "$APXS22" ; then
417         AC_MSG_RESULT(no)
418         AC_MSG_ERROR([Unable to locate Apache2.2 apxs script. An Apache development package may be missing from your server, or you may need to use the --with-apxs22 option.])
419     fi
420     AC_MSG_RESULT($APXS22)
421     AC_SUBST(APXS22)
422
423     # APR1 settings
424     AC_ARG_WITH(apr1, 
425         AC_HELP_STRING([--with-apr1=PATH], [where apr-1-config is installed]),
426         [
427         AC_MSG_CHECKING(for user-specified apr-1-config name/location)
428         if test "$withval" != "no" ; then
429             if test "$withval" != "yes"; then
430                 APR1_CONFIG=$withval
431                 AC_MSG_RESULT("$withval")
432             fi
433         fi
434         ],
435         [
436         AC_PATH_PROG(APR1_CONFIG, apr-1-config)
437         ])
438         if test -f "${APR1_CONFIG}"; then
439         APR1_CFLAGS="`${APR1_CONFIG} --cflags` `${APR1_CONFIG} --cppflags` `${APR1_CONFIG} --includes`"
440     else
441         AC_MSG_ERROR([Unable to locate apr-1-config, may need --with-apr1 option.])
442     fi
443
444     # extract settings we need from APXS22 -q
445     APXS22_CC="`$APXS22 -q CC`"
446     APXS22_CFLAGS="`$APXS22 -q CPPFLAGS` `$APXS22 -q CFLAGS` `$APXS22 -q CFLAGS_SHLIB` $APR1_CFLAGS"
447     APXS22_INCLUDE="`$APXS22 -q INCLUDEDIR`"
448 fi
449
450 AC_SUBST(APXS22_CFLAGS)
451 AC_SUBST(APXS22_INCLUDE)
452
453 # always output the Makefile, even if you don't use it
454 AC_CONFIG_FILES([apache/Makefile])
455 AM_CONDITIONAL(BUILD_AP13,test "$WANT_APACHE_13" = "yes")
456 AM_CONDITIONAL(BUILD_AP20,test "$WANT_APACHE_20" = "yes")
457 AM_CONDITIONAL(BUILD_AP22,test "$WANT_APACHE_22" = "yes")
458
459 # add the apache module to the list of wanted subdirs..
460 if test "$WANT_APACHE_13" = "yes" || test "$WANT_APACHE_20" = "yes" || test "$WANT_APACHE_22" = "yes" ; then
461     WANT_SUBDIRS="$WANT_SUBDIRS apache"
462 fi
463
464
465 #
466 # Implement the checks of the ODBC Credential Cache
467 #
468 # 1) Assume the user wants ODBC; if it's not found then just continue without
469 # 2) If the user specifically requested odbc, look for it and ERROR if not found
470 # 3) If the user specifically requested no-odbc, don't build it.
471 #
472
473 AC_CONFIG_FILES([odbc_ccache/Makefile])
474
475 # determine whether we should enable the odbc ccache
476 AC_ARG_ENABLE([odbc],
477         AC_HELP_STRING([--disable-odbc], [disable the ODBC Credential Cache]),
478         [odbc_enabled=$enableval], [odbc_enabled=default])
479
480 if test "x$odbc_enabled" = "x" ; then
481    odbc_enabled=yes
482 fi
483
484 # Are we trying to build ODBC?
485 AC_MSG_CHECKING(whether to build the ODBC ccache)
486 if test "$odbc_enabled" = "yes" ; then
487    build_odbc=yes
488    AC_MSG_RESULT(yes)
489 elif test "$odbc_enabled" = "default" ; then
490    build_odbc=yes
491    AC_MSG_RESULT([yes, if it can be found])
492 else
493    build_odbc=no
494    AC_MSG_RESULT(no)
495 fi
496
497 # If we're trying to build ODBC, try to find the odbc_config program.
498 if test "$build_odbc" = "yes" ; then
499    odbc_dir=""
500    AC_ARG_WITH(odbc,
501         AC_HELP_STRING([--with-odbc=PATH], [directory where odbc is installed]),
502             [if test "$with_odbc" = no ; then
503                AC_MSG_ERROR([Try running --disable-odbc instead.])
504              elif test "$with_odbc" != yes ; then
505                odbc_dir="$with_odbc/bin"
506              fi ])
507
508    # Try to find the mysql_config program
509    AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
510
511    if test "$ODBC_CONFIG" = no ; then
512       if test "$odbc_enabled" = "yes" ; then
513         AC_MSG_ERROR(Cannot find odbc_config)
514       else
515         AC_MSG_WARN(ODBC not found, skipping.)
516       fi
517    fi
518 fi
519
520 if test "$build_odbc" = yes ; then
521    ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
522    ODBC_CFLAGS=`eval echo $ODBC_CFLAGS`
523    ODBC_LIBS=`$ODBC_CONFIG --libs`
524    ODBC_LIBS=`eval echo $ODBC_LIBS`
525
526    save_CPPFLAGS="$CPPFLAGS"
527    CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
528
529    AC_CHECK_HEADER([sql.h], [have_sql_h=yes], [have_sql_h=no])
530    if test "$have_sql_h" = no -a "$odbc_enabled" = "yes" ; then
531      AC_MSG_ERROR(unable to find ODBC header files)
532    fi
533
534    if test "$have_sql_h" = yes ; then
535       save_LIBS="$LIBS"
536       LIBS="$LIBS $ODBC_LIBS"
537       AC_MSG_CHECKING(if we can link againt ODBC)
538       AC_TRY_LINK(
539         [#include <sql.h>
540          #include <sqlext.h>
541          #include <stdio.h>],
542         [SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_ONE_PER_HENV, 0)],
543         [have_odbc_libs=yes],
544         [have_odbc_libs=no])
545       LIBS="$save_LIBS"
546
547       if test "$have_odbc_libs" = no ; then
548          if test "$odbc_enabled" = "yes" ; then
549             AC_MSG_ERROR([unable to link with ODBC Library])
550          else
551             AC_MSG_RESULT(no, skipping ODBC)
552          fi
553       fi
554    fi
555
556    CPPFLAGS="$save_CPPFLAGS"
557 fi
558
559 # if have_odbc_libs=yes then go ahead with building ODBC
560 if test "$have_odbc_libs" = yes ; then
561    # this AC_MSG_RESULT is from above!
562    AC_MSG_RESULT(yes)
563    WANT_SUBDIRS="$WANT_SUBDIRS odbc_ccache"
564    AC_SUBST(ODBC_CFLAGS)
565    AC_SUBST(ODBC_LIBS)
566 fi
567
568
569 AC_SUBST(WANT_SUBDIRS)
570
571 if test -n "$APXS_CC" && test "$APXS_CC" != "$CC" ; then
572   echo "=================================================================="
573   echo "WARNING: You have chosen to compile Apache-1.3 modules with a different"
574   echo "         compiler than the one used to compile Apache."
575   echo ""
576   echo "    Current compiler:      $CC"
577   echo "   Apache's compiler:      $APXS_CC"
578   echo ""
579   echo "This could cause problems."
580   echo "=================================================================="
581 fi
582
583 if test -n "$APXS2_CC" && test "$APXS2_CC" != "$CC" ; then
584   echo "=================================================================="
585   echo "WARNING: You have chosen to compile Apache-2 modules with a different"
586   echo "         compiler than the one used to compile Apache."
587   echo ""
588   echo "    Current compiler:      $CC"
589   echo "   Apache's compiler:      $APXS2_CC"
590   echo ""
591   echo "This could cause problems."
592   echo "=================================================================="
593 fi
594
595 LIBTOOL="$LIBTOOL --silent"
596
597 AC_OUTPUT
598