Fix memory leak.
[gnutls.git] / configure.in
blob6f26244012b8178077dfcca69016b5fd1a9e7bbb
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
3 #    Free Software Foundation, Inc.
5 # Author: Nikos Mavrogiannopoulos
7 # This file is part of GNUTLS.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22 # USA
24 AC_PREREQ(2.61)
25 AC_INIT([GnuTLS], [2.3.13], [bug-gnutls@gnu.org])
26 AC_CONFIG_AUX_DIR([build-aux])
28 AC_CANONICAL_TARGET
30 AM_INIT_AUTOMAKE([1.10 dist-bzip2])
31 AM_CONFIG_HEADER(config.h)
33 AB_INIT
35 # Library code modified:                              REVISION++
36 # Interfaces changed/added/removed:   CURRENT++       REVISION=0
37 # Interfaces added:                             AGE++
38 # Interfaces removed:                           AGE=0
39 AC_SUBST(LT_CURRENT, 30)
40 AC_SUBST(LT_REVISION, 1)
41 AC_SUBST(LT_AGE, 4)
42 ac_full=1
44 # Used when creating the Windows libgnutls-XX.def files.
45 SOVERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
46 AC_SUBST(SOVERSION)
48 GNUTLS_GCRYPT_VERSION=1:1.2.4
49 GNUTLS_LIBTASN1_VERSION=0.3.4
50 AC_DEFINE_UNQUOTED(GNUTLS_GCRYPT_VERSION, "$GNUTLS_GCRYPT_VERSION", [version of gcrypt])
51 AC_DEFINE_UNQUOTED(GNUTLS_LIBTASN1_VERSION, "$GNUTLS_LIBTASN1_VERSION", [version of libtasn1])
53 # Compute numeric versions, used in includes/gnutls/gnutls.h.in.
54 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
55 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
56 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
57 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
59 opt_dmalloc_mode=no
60 AC_MSG_CHECKING([whether in dmalloc mode])
61 AC_ARG_ENABLE(dmalloc-mode,
62         AS_HELP_STRING([--enable-dmalloc-mode], [enable dmalloc mode]),
63         opt_dmalloc_mode=$enableval)
64 AC_MSG_RESULT($opt_dmalloc_mode)
66 opt_efence_mode=no
67 AC_MSG_CHECKING([whether in electric fence mode])
68 AC_ARG_ENABLE(efence-mode,
69         AS_HELP_STRING([--enable-efence-mode], [enable electric fence mode]),
70 opt_efence_mode=$enableval)
71 AC_MSG_RESULT($opt_efence_mode)
73 opt_developer_mode=no
74 AC_MSG_CHECKING([whether in developer mode])
75 AC_ARG_ENABLE(developer-mode,
76         AS_HELP_STRING([--enable-developer-mode], [enable developer mode]),
77 opt_developer_mode=$enableval)
78 AC_MSG_RESULT($opt_developer_mode)
80 AC_MSG_RESULT([***
81 *** Checking for compilation programs...
84 dnl Checks for programs.
85 AC_PROG_CC
86 AC_PROG_CXX
87 AC_PROG_LN_S
88 GTK_DOC_CHECK(1.1)
89 AC_PATH_PROG([GAA], [gaa])
90 if test "x$GAA" = "x"; then
91    AC_MSG_WARN([[***
92 *** GAA was not found.  It is only needed if you wish to modify
93 *** the source code or command-line description files.  In this case,
94 *** you may want to get it from http://gaa.sourceforge.net/
95 ***]])
97 AM_CONDITIONAL(HAVE_GCC,   test "x$GCC" = "xyes")
100 AC_MSG_RESULT([***
101 *** Detecting compiler options...
104 gl_EARLY
105 lgl_EARLY
106 AC_C_CONST
107 AC_C_INLINE
109 AM_GNU_GETTEXT([external])
110 AM_GNU_GETTEXT_VERSION([0.17])
112 AC_ARG_ENABLE(cxx,
113        AS_HELP_STRING([--disable-cxx],
114                [unconditionally disable the C++ library]),
115        use_cxx=$enableval, use_cxx=yes)
116 if test "$use_cxx" != "no"; then
117   AC_LANG_PUSH(C++)
118   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
119   AC_LANG_POP(C++)
121 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
122 AC_MSG_CHECKING([whether to build C++ library])
123 AC_MSG_RESULT($use_cxx)
125 AC_MSG_CHECKING([whether C99 macros are supported])
126 AC_TRY_COMPILE(,[ 
127 #define test_mac(...) 
128 int z,y,x;
129 test_mac(x,y,z);
130 return 0;
131 ], 
132         dnl ***** OK
133         AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
134         AC_MSG_RESULT(yes),
135         dnl ***** NOT FOUND
136         AC_MSG_RESULT(no)
137         AC_MSG_WARN([C99 macros not supported. This may affect compiling.]))
139 if test $ac_cv_c_compiler_gnu != no; then
140         if test x$opt_developer_mode = xyes; then
141           AM_CFLAGS="${AM_CFLAGS} -g -Wall -Wcast-align -W -Wpointer-arith -Wchar-subscripts -Wformat-security -Wno-format-y2k -Wmissing-braces -Winline -Wstrict-prototypes -Wno-unused-parameter"
142 #         AM_CFLAGS="${AM_CFLAGS} -g -W -Wall -Wcast-align -Wpointer-arith -Wchar-subscripts -Wformat-security -Wno-format-y2k -Wmissing-braces -Winline -Wstrict-prototypes -Wshadow -Wno-unused-parameter -Wimplicit -fno-common -Wno-sign-compare -Wbad-function-cast -Wendif-labels -Wmissing-declarations -Wno-missing-format-attribute -Wmissing-prototypes -Wnested-externs -Wpointer-arith -pedantic -Wlong-long -Wcast-qual -Wcast-align -Winline -Wredundant-decls -Wstrict-prototypes -Wwrite-strings -Wparentheses -Wsequence-point -Wpacked -Waggregate-return -Wfloat-equal -Wmultichar -Wunknown-pragmas -Wtrigraphs -Wswitch -Wreturn-type -Wmain -Wchar-subscripts -Wcomment -Wno-missing-noreturn"
143         fi
145         AC_MSG_CHECKING([whether gcc supports -Wno-pointer-sign])
146         _gcc_cflags_save=$CFLAGS
147         CFLAGS="${CFLAGS} -Wno-pointer-sign"
148         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
149         AC_MSG_RESULT($_gcc_psign)
150         if test x"$_gcc_psign" != xyes ; then
151           CFLAGS=$_gcc_cflags_save;
152         fi
154         AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
155         _gcc_cflags_save="$CFLAGS"
156         CFLAGS="${CFLAGS} -fgnu89-inline"
157         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
158           _gcc_gnu89_inline=yes, _gcc_gnu89_inline=no)
159         AC_MSG_RESULT($_gcc_gnu89_inline)
160         CFLAGS=$_gcc_cflags_save;
162         AC_MSG_CHECKING([if gcc/ld supports -Wl,--output-def])
163         if test "$enable_shared" = no; then
164           output_def=no
165           AC_MSG_RESULT([no need, since shared libraries are disabled])
166         else
167           _gcc_ldflags_save=$LDFLAGS
168           LDFLAGS="-Wl,--output-def,foo.def"
169           AC_LINK_IFELSE(AC_LANG_PROGRAM([]),output_def=yes,output_def=no)
170           AC_MSG_RESULT($output_def)
171           LDFLAGS="$_gcc_ldflags_save"
172         fi
174         if test x$opt_dmalloc_mode = xyes; then
175           AC_CHECK_LIB(dmalloc, main)
176           AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
177         else
178                 if test x$opt_efence_mode = xyes; then
179                   AC_CHECK_LIB(efence, main)
180                   AC_DEFINE(USE_EFENCE, 1, [use electric fence])
181                 fi
182         fi
184         AC_MSG_CHECKING([whether we have GNU assembler])
185         GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
186         if test "$GAS"; then
187           AM_CFLAGS="${AM_CFLAGS} -pipe"
188           AC_MSG_RESULT(yes)
189         else
190           AC_MSG_RESULT(no)
191         fi
194 # Needs to be called outside of 'if' clause.
195 AM_CONDITIONAL(HAVE_LD_OUTPUT_DEF, test "$output_def" = "yes")
196 AM_CONDITIONAL([HAVE_GCC_GNU89_INLINE_OPTION],
197                [test "$_gcc_gnu89_inline" = "yes"])
199 AC_MSG_RESULT([***
200 *** Detecting C library capabilities...
203 AC_HEADER_STDC
204 AC_CHECK_HEADERS(netdb.h)
205 AC_CHECK_FUNCS(fork,,)
206 AC_DEFINE([HAVE_STRINGS_H], 1, [Hard-code for src/cfg/.])
207 AC_DEFINE([HAVE_FLOAT_H], 1, [Hard-code for src/cfg/.])
208 AC_DEFINE([HAVE_LIMITS_H], 1, [Hard-code for src/cfg/.])
209 AC_DEFINE([HAVE_MATH_H], 1, [Hard-code for src/cfg/.])
210 AC_DEFINE([HAVE_CTYPE_H], 1, [Hard-code for src/cfg/.])
211 AC_DEFINE([HAVE_ERRNO_H], 1, [Hard-code for src/cfg/.])
213 # No fork on MinGW, disable some self-tests until we fix them.
214 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
216 AC_MSG_RESULT([***
217 *** Detecting system's parameters...
220 # Run self-tests under valgrind?
221 if test "$cross_compiling" = no; then
222   AC_CHECK_PROGS(VALGRIND, valgrind)
224 if test -n "$VALGRIND" && $VALGRIND true > /dev/null 2>&1; then
225   opt_valgrind_tests=yes
226 else
227   opt_valgrind_tests=no
228   VALGRIND=
229 fi 
230 AC_MSG_CHECKING([whether self tests are run under valgrind])
231 AC_ARG_ENABLE(valgrind-tests,
232         AS_HELP_STRING([--enable-valgrind-tests],
233                        [run self tests under valgrind]),
234   opt_valgrind_tests=$enableval)
235 AC_MSG_RESULT($opt_valgrind_tests)
237 # For minitasn1.
238 AC_CHECK_SIZEOF(unsigned long int, 4)
239 AC_CHECK_SIZEOF(unsigned int, 4)
241 # For storing integers in pointers without warnings
242 # http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
243 AC_CHECK_SIZEOF(void *)
244 AC_CHECK_SIZEOF(long)
245 AC_CHECK_SIZEOF(int)
246 case $ac_cv_sizeof_void_p in
247   $ac_cv_sizeof_long)
248     AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [(long)],
249               [Additional cast to bring void* to a type castable to int.])
250     ;;
251   *)
252     AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [])
253     ;;
254 esac
256 # For some systems we know that we have ld_version scripts.
257 # Use it then as default.
258 have_ld_version_script=no
259 case "${host}" in
260     *-*-linux*)
261         have_ld_version_script=yes
262         ;;
263     *-*-gnu*)
264         have_ld_version_script=yes
265         ;;
266 esac
267 AC_ARG_ENABLE([ld-version-script],
268               AC_HELP_STRING([--enable-ld-version-script],
269                              [enable/disable use of linker version script.
270                               (default is system dependent)]),
271               [have_ld_version_script=$enableval],
272               [ : ] )
273 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
275 AC_CHECK_TYPES(uint,,, [
276 # include <sys/types.h>
279 # Check for and replace ssize_t.
280 AC_CHECK_TYPE(ssize_t,
281         [DEFINE_SSIZE_T="#include <sys/types.h>"
282         AC_SUBST(DEFINE_SSIZE_T)],
283         [AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
284         DEFINE_SSIZE_T="typedef int ssize_t;"
285         AC_SUBST(DEFINE_SSIZE_T)],
286         [#include <sys/types.h>])
288 AC_C_BIGENDIAN
290 AC_MSG_RESULT([***
291 *** Checking for external libraries...
294 # For Guile bindings.
296 opt_guile_bindings=yes
297 AC_MSG_CHECKING([whether building Guile bindings])
298 AC_ARG_ENABLE(guile,
299         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
300 opt_guile_bindings=$enableval)
301 AC_MSG_RESULT($opt_guile_bindings)
303 AC_ARG_WITH([--with-guile-site-dir],
304   [AS_HELP_STRING([--with-guile-site-dir],
305      [use the given directory as the Guile site (use with care)])])
307 if test "x$opt_guile_bindings" = "xyes"; then
308    AC_MSG_RESULT([***
309 *** Detecting GNU Guile...
312    AC_PATH_PROG([guile_snarf], [guile-snarf])
313    if test "x$guile_snarf" = "x"; then
314       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
315       opt_guile_bindings=no
316    else
317       GUILE_PROGS
318       GUILE_FLAGS
320       save_CFLAGS="$CFLAGS"
321       save_LIBS="$LIBS"
322       CFLAGS="$CFLAGS $GUILE_CFLAGS"
323       LIBS="$LIBS $GUILE_LDFLAGS"
324       AC_MSG_CHECKING([whether GNU Guile is recent enough])
325       AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
326         [], [opt_guile_bindings=no])
327       CFLAGS="$save_CFLAGS"
328       LIBS="$save_LIBS"
330       if test "x$opt_guile_bindings" = "xyes"; then
331         AC_MSG_RESULT([yes])
332         case "x$with_guile_site_dir" in 
333              xno)
334                 # Use the default $(GUILE_SITE).
335                 GUILE_SITE_DIR
336                 ;;
337              x|xyes)
338                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
339                 # hack is used to allow `distcheck' to work (see
340                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
341                 GUILE_SITE="\$(datadir)/guile/site"
342                 AC_SUBST(GUILE_SITE)
343                 ;;
344              *)
345                 # Use the user-specified directory as $(GUILE_SITE).
346                 GUILE_SITE="$with_guile_site_dir"
347                 AC_SUBST(GUILE_SITE)
348                 ;;
349         esac
350       else
351         AC_MSG_RESULT([no])
352         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
353         opt_guile_bindings=no
354       fi
355    fi
357 AM_CONDITIONAL(HAVE_GUILE, test "x$opt_guile_bindings" = "xyes")
359 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
360 dnl Can't disable - gnutls depends on gcrypt
361         AC_MSG_ERROR([[
362 ***  
363 *** libgcrypt was not found. You may want to get it from
364 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
366 ]]))
367 libgcrypt=yes
369 # Hard-wire the gl/m4/gc.m4 test.
370 AC_ARG_WITH(builtin-crypto,
371         AS_HELP_STRING([--with-builtin-crypto],
372                 [use internal crypto instead of libgcrypt (EXPERIMENTAL)]),
373         ac_cv_libgcrypt=no,
374         ac_cv_libgcrypt=yes)
375 LTLIBGCRYPT=$LIBGCRYPT_LIBS
377 AC_MSG_CHECKING([whether to enable Opaque PRF input support])
378 AC_ARG_ENABLE(opaque-prf-input,
379         AS_HELP_STRING([--enable-opaque-prf-input=DD],
380                 [enable Opaque PRF input using DD as extension type]),
381         ac_opaque_prf_input=$enableval, ac_opaque_prf_input=no)
382 if test "$ac_opaque_prf_input" != "no"; then
383   if ! echo $ac_opaque_prf_input | egrep -q '^[[0-9]]+$'; then
384     ac_opaque_prf_input=no
385     AC_MSG_WARN([[
386 *** Could not parse Opaque PRF Input extension type.
387 *** Use --enable-opaque-prf-input=XX where XX is decimal, for example
388 *** to use extension value 42 use --enable-opqaue-prf-input=42]])
389   fi
391 if test "$ac_opaque_prf_input" != "no"; then
392  AC_MSG_RESULT([yes (extension value $ac_opaque_prf_input)])
393  AC_DEFINE_UNQUOTED(ENABLE_OPRFI, $ac_opaque_prf_input,
394                     [enable Opaque PRF Input])
395 else
396  AC_MSG_RESULT(no)
398 AM_CONDITIONAL(ENABLE_OPRFI, test "$ac_opaque_prf_input" != "no")
400 AC_MSG_CHECKING([whether to disable SRP authentication support])
401 AC_ARG_ENABLE(srp-authentication,
402         AS_HELP_STRING([--disable-srp-authentication],
403                 [disable the SRP authentication support]),
404         ac_enable_srp=no)
405 if test x$ac_enable_srp != xno; then
406  AC_MSG_RESULT(no)
407  AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
408 else
409  ac_full=0
410  AC_MSG_RESULT(yes)
412 AM_CONDITIONAL(ENABLE_SRP, test "$ac_enable_srp" != "no")
414 AC_MSG_CHECKING([whether to disable PSK authentication support])
415 AC_ARG_ENABLE(psk-authentication,
416        AS_HELP_STRING([--disable-psk-authentication],
417                [disable the PSK authentication support]),
418        ac_enable_psk=no)
419 if test x$ac_enable_psk != xno; then
420  AC_MSG_RESULT(no)
421  AC_DEFINE(ENABLE_PSK, 1, [enable PSK authentication])
422 else
423  ac_full=0
424  AC_MSG_RESULT(yes)
427 AC_MSG_CHECKING([whether to disable anonymous authentication support])
428 AC_ARG_ENABLE(anon-authentication,
429         AS_HELP_STRING([--disable-anon-authentication],
430                 [disable the anonymous authentication support]),
431         ac_enable_anon=no)
432 if test x$ac_enable_anon != xno; then
433  AC_MSG_RESULT(no)
434  AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
435 else
436  ac_full=0
437  AC_MSG_RESULT(yes)
439 AM_CONDITIONAL(ENABLE_ANON, test "$ac_enable_anon" != "no")
441 dnl Check for Camellia support
443 AC_ARG_ENABLE(camellia,
444         AS_HELP_STRING([--disable-camellia], [disable Camellia cipher]),
445         ac_enable_camellia=no)
446 if test "$ac_enable_camellia" != "no"; then
447   AC_MSG_CHECKING([for Camellia support in libgcrypt])
448   if test -n "`$LIBGCRYPT_CONFIG --algorithms | grep -i camellia`"; then
449     AC_MSG_RESULT([yes])
450     ac_enable_camellia=yes
451   else
452     AC_MSG_RESULT([no])
453     ac_enable_camellia=no
454   fi
456 AC_MSG_CHECKING([whether to disable Camellia cipher])
457 if test "$ac_enable_camellia" = "yes"; then
458  AC_MSG_RESULT([no])
459  AC_DEFINE(ENABLE_CAMELLIA, 1, [enable camellia block cipher])
460 else
461  AC_MSG_RESULT([yes])
464 AC_MSG_CHECKING([whether to disable extra PKI stuff])
465 AC_ARG_ENABLE(extra-pki,
466         AS_HELP_STRING([--disable-extra-pki],
467                 [only enable the basic PKI stuff]),
468         disable_pki=$enableval, disable_pki=no)
469 if test "$disable_pki" != "no"; then
470  ac_full=0
471  AC_MSG_RESULT(yes)
472 else
473  AC_MSG_RESULT(no)
474  AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS/PKI stuff])
476 AM_CONDITIONAL(ENABLE_PKI, test "$disable_pki" = "no")
478 ac_enable_openpgp=yes
479 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
480 AC_ARG_ENABLE(openpgp-authentication,
481         AS_HELP_STRING([--disable-openpgp-authentication],
482                 [disable the OpenPGP authentication support]),
483         ac_enable_openpgp=no)
484 if test x$ac_enable_openpgp = xno; then
485  AC_MSG_RESULT(yes)
486  ac_full=0
487 else
488  AC_DEFINE(ENABLE_OPENPGP, 1, [use openpgp authentication])
489  AC_MSG_RESULT(no)
491 AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
493 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
494 AC_ARG_ENABLE(openssl-compatibility,
495         AS_HELP_STRING([--disable-openssl-compatibility],
496                 [disable the OpenSSL compatibility support]),
497         ac_enable_openssl=$withval,
498         ac_enable_openssl=yes)
499 if test x$ac_enable_openssl != xno; then
500  AC_MSG_RESULT(no)
501 else
502  AC_MSG_RESULT(yes)
505 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
508 AC_ARG_WITH(included-libtasn1,
509         AS_HELP_STRING([--with-included-libtasn1],
510                 [use the included libtasn1]),
511         minitasn1_enabled=$withval,
512         minitasn1_enabled=no)
514 if test x$minitasn1_enabled = xno; then
515 AM_PATH_LIBTASN1($GNUTLS_LIBTASN1_VERSION,,
516  minitasn1_enabled=yes
517  AC_MSG_WARN([[
518 *** 
519 *** LibtASN1 ${GNUTLS_LIBTASN1_VERSION} was not found. Will use the included one.
520 ]]))
523 AC_MSG_CHECKING([whether to use the included minitasn1])
524 AC_MSG_RESULT($minitasn1_enabled)
526 AM_CONDITIONAL(ENABLE_MINITASN1, test "$minitasn1_enabled" = "yes")
528 dnl Check for libcfg+
530 SAVED_LIBS=$LIBS
531 AC_ARG_WITH(included-libcfg,
532         AS_HELP_STRING([--with-included-libcfg],
533                 [use the included libcfg+ (certtool only)]),
534         libcfg_enabled=$withval, 
535         libcfg_enabled=no
536 dnl We search for libcfg+ which is used by certtool
538         AC_CHECK_LIB(cfg+, cfg_get_context,:,
539                      libcfg_enabled=yes
540                      AC_MSG_WARN([[
541 *** 
542 *** Libcfg+ was not found. Will use the included one.]])))
544 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
545 LIBS=$SAVED_LIBS
547 AC_MSG_CHECKING([whether to use the included libcfg])
548 AC_MSG_RESULT($libcfg_enabled)
551 dnl CHECK FOR ZLIB SUPPORT
554 AC_MSG_CHECKING([whether to include zlib compression support])
556 AC_ARG_WITH(zlib,
557         AS_HELP_STRING([--without-zlib], [disable zlib compression support]),
558         ac_zlib=$withval,
559         ac_zlib=yes)
561 if test x$ac_zlib != xno; then
562  AC_MSG_RESULT(yes)
563  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
564  if test "$ac_cv_libz" != yes; then
565    AC_MSG_WARN(
566 *** 
567 *** ZLIB was not found. You will not be able to use ZLIB compression.)
568  fi
569 else
570  AC_MSG_RESULT(no)
574 dnl CHECK FOR LZO SUPPORT
577 AC_ARG_WITH(lzo,
578         AS_HELP_STRING([--with-lzo], [use experimental LZO compression]),
579         use_lzo=$withval,
580         use_lzo=no)
581 AC_MSG_CHECKING([whether to include LZO compression support])
582 AC_MSG_RESULT($use_lzo)
584 LZO_LIBS=
585 if test "$use_lzo" = "yes"; then
586   AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LIBS=-llzo2)
587   if test "$LZO_LIBS" = ""; then
588     AC_CHECK_LIB(lzo, lzo1x_1_compress, LZO_LIBS=-llzo, [
589       use_lzo=no
590       AC_MSG_WARN(
592 *** Could not find liblzo or liblzo2.  Disabling LZO compression.
594       ])
595   fi
597 AC_SUBST(LZO_LIBS)
599 if test "$use_lzo" = "yes"; then
600   AC_DEFINE(USE_LZO, 1, [whether to use the LZO compression])
601   if test "$LZO_LIBS" = "-llzo"; then
602     AC_CHECK_HEADERS(lzo1x.h)
603   elif test "$LZO_LIBS" = "-llzo2"; then
604     AC_CHECK_HEADERS(lzo/lzo1x.h)
605   fi
608 AM_CONDITIONAL(USE_LZO, test "$use_lzo" = "yes")
610 # Windows hacks.
612 AC_DEFINE([WINVER], [0x0501], [Windows 2000 or before not supported.])
613 save_LIBS="$LIBS"
614 LIBS="$LIBS -lws2_32"
615 AC_TRY_LINK([#include <winsock2.h>], [
616   WORD wVersionRequested = MAKEWORD(2, 2);
617   WSADATA wsaData;
618   int err = WSAStartup(wVersionRequested, &wsaData);
619   WSACleanup ();], wsastartup=yes, wsastartup=no)
620 LIBS="$save_LIBS"
621 if test "$wsastartup" = "yes"; then
622   AC_DEFINE(HAVE_WINSOCK, 1, [Call WSAStartup in gnutls_global_init])
624 AM_CONDITIONAL(NEED_WS2_32, test "$wsastartup" = "yes")
625 AC_MSG_CHECKING([if we have Windows and WSAStartup/WSACleanup in -lws2_32])
626 AC_MSG_RESULT($wsastartup)
628 dnl Gnulib files
631 AC_MSG_RESULT([***
632 *** Setting up gnulib compatibility files...
634 gl_INIT
635 lgl_INIT
637 AC_MSG_RESULT([***
638 *** Detecting options for shared libraries...
640 AC_LIBTOOL_WIN32_DLL
641 AC_PROG_LIBTOOL
643 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBTASN1_LIBS $LIBGCRYPT_LIBS $LIBS"
644 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS $LIBTASN1_CFLAGS -I${includedir}"
645 AC_SUBST(LIBGNUTLS_LIBS)
646 AC_SUBST(LIBGNUTLS_CFLAGS)
648 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra $LZO_LIBS $LIBGNUTLS_LIBS"
649 LIBGNUTLS_EXTRA_CFLAGS="-I${includedir}"
650 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
651 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
652 export ac_full
654 AM_CFLAGS="${AM_CFLAGS} ${LIBGCRYPT_CFLAGS}"
656 if test $ac_full -eq 0; then
657   AC_SUBST(POSSIBLY_WARN_ABOUT_MISSING_FEATURES, [[
658 #ifdef __GNUC__
659 #warning This is not the official GnuTLS library. Several features were disabled at compilation.
660 #endif /* __GNUC__ */]])
663 AC_SUBST(AM_CFLAGS)
665 AC_CONFIG_COMMANDS([chmod-config],[[
666  chmod +x lib/libgnutls-config
667  chmod +x libextra/libgnutls-extra-config
668 ]],[[]])
671 AC_DEFINE([INTERNAL_GNUTLS_CRYPTO_H_ENABLE_UNSUPPORTED_API], 1,
672           [Enable prototypes in includes/crypto.h.])
674 AC_CONFIG_FILES([Makefile po/Makefile.in \
675         doc/Makefile doc/examples/Makefile doc/scripts/Makefile \
676         doc/manpages/Makefile doc/reference/Makefile \
677         doc/credentials/Makefile doc/credentials/x509/Makefile \
678         doc/credentials/srp/Makefile doc/credentials/openpgp/Makefile \
679         gl/Makefile lgl/Makefile \
680         tests/Makefile tests/rsa-md5-collision/Makefile tests/userid/Makefile \
681         tests/pkcs1-padding/Makefile tests/pkcs8-decode/Makefile \
682         tests/pkcs12-decode/Makefile tests/pathlen/Makefile \
683         tests/key-id/Makefile tests/sha2/Makefile \
684         tests/hostname-check/Makefile \
685         includes/Makefile includes/gnutls/gnutls.h \
686         lib/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
687         libextra/Makefile lib/openpgp/Makefile lib/opencdk/Makefile \
688         tests/openpgp/Makefile \
689         src/Makefile \
690         src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
691         lib/libgnutls-config libextra/libgnutls-extra-config \
692         lib/gnutls.pc libextra/gnutls-extra.pc
693         guile/Makefile guile/modules/Makefile
694         guile/src/Makefile guile/tests/Makefile])
696 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
699 AC_OUTPUT