Merge branch 'master' of git://repo.or.cz/gnutls
[gnutls:gnutls.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
3 #    Free Software Foundation, Inc.
4 #
5 # Author: Nikos Mavroyanopoulos
6 #
7 # This file is part of GNUTLS.
8 #
9 # GNUTLS is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # GNUTLS 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.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with GNUTLS; if not, write to the Free Software Foundation,
21 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
23 AC_PREREQ(2.61)
24 AC_INIT([GnuTLS], [2.0.1], [bug-gnutls@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
26
27 AC_CANONICAL_TARGET
28
29 AM_INIT_AUTOMAKE([1.10 dist-bzip2])
30 AM_CONFIG_HEADER(config.h)
31
32 AB_INIT
33
34 # Library code modified:                              REVISION++
35 # Interfaces changed/added/removed:   CURRENT++       REVISION=0
36 # Interfaces added:                             AGE++
37 # Interfaces removed:                           AGE=0
38 AC_SUBST(LT_CURRENT, 21)
39 AC_SUBST(LT_REVISION, 4)
40 AC_SUBST(LT_AGE, 8)
41 ac_full=1
42
43 # Used when creating the Windows libgnutls-XX.def files.
44 SOVERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
45 AC_SUBST(SOVERSION)
46
47 GNUTLS_GCRYPT_VERSION=1:1.2.2
48 GNUTLS_LIBTASN1_VERSION=0.3.4
49 AC_DEFINE_UNQUOTED(GNUTLS_GCRYPT_VERSION, "$GNUTLS_GCRYPT_VERSION", [version of gcrypt])
50 AC_DEFINE_UNQUOTED(GNUTLS_LIBTASN1_VERSION, "$GNUTLS_LIBTASN1_VERSION", [version of libtasn1])
51
52 # Compute numeric versions, used in includes/gnutls/gnutls.h.in.
53 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
54 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
55 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
56 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
57
58 dnl In order to use the reentrant libc functions.
59 dnl I hope it is portable enough.
60 CFLAGS="${CFLAGS} -D_REENTRANT -D_THREAD_SAFE"
61 AM_CFLAGS="${CFLAGS}"
62
63 opt_dmalloc_mode=no
64 AC_MSG_CHECKING([whether in dmalloc mode])
65 AC_ARG_ENABLE(dmalloc-mode,
66         AS_HELP_STRING([--enable-dmalloc-mode], [enable dmalloc mode]),
67         opt_dmalloc_mode=$enableval)
68 AC_MSG_RESULT($opt_dmalloc_mode)
69
70 opt_efence_mode=no
71 AC_MSG_CHECKING([whether in electric fence mode])
72 AC_ARG_ENABLE(efence-mode,
73         AS_HELP_STRING([--enable-efence-mode], [enable electric fence mode]),
74 opt_efence_mode=$enableval)
75 AC_MSG_RESULT($opt_efence_mode)
76
77 opt_developer_mode=no
78 AC_MSG_CHECKING([whether in developer mode])
79 AC_ARG_ENABLE(developer-mode,
80         AS_HELP_STRING([--enable-developer-mode], [enable developer mode]),
81 opt_developer_mode=$enableval)
82 AC_MSG_RESULT($opt_developer_mode)
83
84 opt_profiler_mode=no
85 AC_MSG_CHECKING([whether in profile mode])
86 AC_ARG_ENABLE(profile-mode,
87         AS_HELP_STRING([--enable-profile-mode], [enable profiler]),
88 opt_profiler_mode=$enableval)
89 AC_MSG_RESULT($opt_profiler_mode)
90
91 AC_MSG_RESULT([***
92 *** Checking for compilation programs...
93 ])
94
95 dnl Checks for programs.
96 AM_GNU_GETTEXT([external])
97 AM_GNU_GETTEXT_VERSION([0.16])
98 AC_PROG_CC
99 AC_PROG_CXX
100 AC_PROG_LN_S
101 GTK_DOC_CHECK(1.1)
102 AC_PATH_PROG([GAA], [gaa])
103 if test "x$GAA" = "x"; then
104    AC_MSG_WARN([[***
105 *** GAA was not found.  It is only needed if you wish to modify
106 *** the source code or command-line description files.  In this case,
107 *** you may want to get it from http://gaa.sourceforge.net/
108 ***]])
109 fi
110 AM_CONDITIONAL(HAVE_GCC,   test "x$GCC" = "xyes")
111
112
113 AC_MSG_RESULT([***
114 *** Detecting compiler options...
115 ])
116
117 gl_EARLY
118 lgl_EARLY
119 AC_C_CONST
120 AC_C_INLINE
121
122 AC_ARG_ENABLE(cxx,
123        AS_HELP_STRING([--disable-cxx],
124                [unconditionally disable the C++ library]),
125        use_cxx=$enableval, use_cxx=yes)
126 if test "$use_cxx" != "no"; then
127   AC_LANG_PUSH(C++)
128   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
129   AC_LANG_POP(C++)
130 fi
131 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
132 AC_MSG_CHECKING([whether to build C++ library])
133 AC_MSG_RESULT($use_cxx)
134
135 AC_MSG_CHECKING([whether C99 macros are supported])
136 AC_TRY_COMPILE(,[ 
137 #define test_mac(...) 
138 int z,y,x;
139 test_mac(x,y,z);
140 return 0;
141 ], 
142         dnl ***** OK
143         AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
144         AC_MSG_RESULT(yes),
145         dnl ***** NOT FOUND
146         AC_MSG_RESULT(no)
147         AC_MSG_WARN([C99 macros not supported. This may affect compiling.]))
148
149 if test $ac_cv_c_compiler_gnu != no; then
150         if test x$opt_developer_mode = xyes; then
151           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"
152 #         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"
153         fi
154
155         AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
156         _gcc_cflags_save=$CFLAGS
157         CFLAGS="${CFLAGS} -Wno-pointer-sign"
158         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
159         AC_MSG_RESULT($_gcc_psign)
160         if test x"$_gcc_psign" != xyes ; then
161           CFLAGS=$_gcc_cflags_save;
162         fi
163
164         AC_MSG_CHECKING([if gcc/ld supports -Wl,--output-def])
165         _gcc_ldflags_save=$LDFLAGS
166         LDFLAGS="-Wl,--output-def,foo.def"
167         AC_LINK_IFELSE(AC_LANG_PROGRAM([]),output_def=yes,output_def=no)
168         AC_MSG_RESULT($output_def)
169         LDFLAGS="$_gcc_ldflags_save"
170
171         if test x$opt_dmalloc_mode = xyes; then
172           AC_CHECK_LIB(dmalloc, main)
173           AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
174         else
175                 if test x$opt_efence_mode = xyes; then
176                   AC_CHECK_LIB(efence, main)
177                   AC_DEFINE(USE_EFENCE, 1, [use electric fence])
178                 fi
179         fi
180
181         AC_MSG_CHECKING([whether we have GNU assembler])
182         GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
183         if test "$GAS"; then
184           AM_CFLAGS="${AM_CFLAGS} -pipe"
185           AC_MSG_RESULT(yes)
186         else
187           AC_MSG_RESULT(no)
188         fi
189 fi
190
191 # Needs to be called outside of 'if' clause.
192 AM_CONDITIONAL(HAVE_LD_OUTPUT_DEF, test "$output_def" = "yes")
193
194 AC_MSG_RESULT([***
195 *** Detecting C library capabilities...
196 ])
197
198 AC_HEADER_STDC
199 AC_CHECK_HEADERS(strings.h alloca.h)
200 AC_CHECK_HEADERS(errno.h)
201 AC_CHECK_HEADERS(math.h limits.h float.h stdarg.h ctype.h)
202 dnl opencdk
203 AC_CHECK_HEADERS(netdb.h)
204 AC_CHECK_FUNCS(umask vasprintf isascii fork,,)
205 AC_FUNC_ALLOCA
206
207 # No fork on MinGW, disable some self-tests until we fix them.
208 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
209
210 AC_MSG_RESULT([***
211 *** Detecting system's parameters...
212 ])
213
214 # Run self-tests under valgrind?
215 if test "$cross_compiling" = no; then
216   AC_CHECK_PROGS(VALGRIND, valgrind)
217 fi
218 if test -n "$VALGRIND" && $VALGRIND true > /dev/null 2>&1; then
219   opt_valgrind_tests=yes
220 else
221   opt_valgrind_tests=no
222   VALGRIND=
223 fi 
224 AC_MSG_CHECKING([whether self tests are run under valgrind])
225 AC_ARG_ENABLE(valgrind-tests,
226         AS_HELP_STRING([--enable-valgrind-tests],
227                        [run self tests under valgrind]),
228   opt_valgrind_tests=$enableval)
229 AC_MSG_RESULT($opt_valgrind_tests)
230
231 # For minitasn1.
232 AC_CHECK_SIZEOF(unsigned long, 4)
233 AC_CHECK_SIZEOF(unsigned int, 4)
234
235 # For storing integers in pointers without warnings
236 # http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
237 AC_CHECK_SIZEOF(void *)
238 AC_CHECK_SIZEOF(long)
239 AC_CHECK_SIZEOF(int)
240 case $ac_cv_sizeof_void_p in
241   $ac_cv_sizeof_long)
242     AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [(long)],
243               [Additional cast to bring void* to a type castable to int.])
244     ;;
245   *)
246     AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [])
247     ;;
248 esac
249
250 # For some systems we know that we have ld_version scripts.
251 # Use it then as default.
252 have_ld_version_script=no
253 case "${host}" in
254     *-*-linux*)
255         have_ld_version_script=yes
256         ;;
257     *-*-gnu*)
258         have_ld_version_script=yes
259         ;;
260 esac
261 AC_ARG_ENABLE([ld-version-script],
262               AC_HELP_STRING([--enable-ld-version-script],
263                              [enable/disable use of linker version script.
264                               (default is system dependent)]),
265               [have_ld_version_script=$enableval],
266               [ : ] )
267 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
268
269 AC_CHECK_TYPES(uint,,, [
270 # include <sys/types.h>
271 ])
272
273 # Check for and replace ssize_t.
274 AC_CHECK_TYPE(ssize_t,
275         [DEFINE_SSIZE_T="#include <sys/types.h>"
276         AC_SUBST(DEFINE_SSIZE_T)],
277         [AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
278         DEFINE_SSIZE_T="typedef int ssize_t;"
279         AC_SUBST(DEFINE_SSIZE_T)],
280         [#include <sys/types.h>])
281
282 AC_C_BIGENDIAN
283
284 AC_MSG_RESULT([***
285 *** Checking for external libraries...
286 ])
287
288 # For Guile bindings.
289
290 opt_guile_bindings=yes
291 AC_MSG_CHECKING([whether building Guile bindings])
292 AC_ARG_ENABLE(guile,
293         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
294 opt_guile_bindings=$enableval)
295 AC_MSG_RESULT($opt_guile_bindings)
296
297 AC_ARG_WITH([--with-guile-site-dir],
298   [AS_HELP_STRING([--with-guile-site-dir],
299      [use the given directory as the Guile site (use with care)])])
300
301 if test "x$opt_guile_bindings" = "xyes"; then
302    AC_MSG_RESULT([***
303 *** Detecting GNU Guile...
304 ])
305
306    AC_PATH_PROG([guile_snarf], [guile-snarf])
307    if test "x$guile_snarf" = "x"; then
308       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
309       opt_guile_bindings=no
310    else
311       GUILE_PROGS
312       GUILE_FLAGS
313
314       save_CFLAGS="$CFLAGS"
315       save_LDFLAGS="$LDFLAGS"
316       CFLAGS="$CFLAGS $GUILE_CFLAGS"
317       LDFLAGS="$LDFLAGS $GUILE_LDFLAGS"
318       AC_MSG_CHECKING([whether GNU Guile is recent enough])
319       AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
320         [], [opt_guile_bindings=no])
321       CFLAGS="$save_CFLAGS"
322       LDFLAGS="$save_LDFLAGS"
323
324       if test "x$opt_guile_bindings" = "xyes"; then
325         AC_MSG_RESULT([yes])
326         case "x$with_guile_site_dir" in 
327              xno)
328                 # Use the default $(GUILE_SITE).
329                 GUILE_SITE_DIR
330                 ;;
331              x|xyes)
332                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
333                 # hack is used to allow `distcheck' to work (see
334                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
335                 GUILE_SITE="\$(datadir)/guile/site"
336                 AC_SUBST(GUILE_SITE)
337                 ;;
338              *)
339                 # Use the user-specified directory as $(GUILE_SITE).
340                 GUILE_SITE="$with_guile_site_dir"
341                 AC_SUBST(GUILE_SITE)
342                 ;;
343         esac
344       else
345         AC_MSG_RESULT([no])
346         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
347         opt_guile_bindings=no
348       fi
349    fi
350 fi
351 AM_CONDITIONAL(HAVE_GUILE, test "x$opt_guile_bindings" = "xyes")
352
353 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
354 dnl Can't disable - gnutls depends on gcrypt
355         AC_MSG_ERROR([[
356 ***  
357 *** libgcrypt was not found. You may want to get it from
358 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
359 ***
360 ]]))
361 libgcrypt=yes
362
363 # Hard-wire the gl/m4/gc.m4 test.
364 AC_ARG_WITH(builtin-crypto,
365         AS_HELP_STRING([--with-builtin-crypto],
366                 [use internal crypto instead of libgcrypt (EXPERIMENTAL)]),
367         ac_cv_libgcrypt=no,
368         ac_cv_libgcrypt=yes)
369 LTLIBGCRYPT=$LIBGCRYPT_LIBS
370
371 AC_MSG_CHECKING([whether to disable SRP authentication support])
372 AC_ARG_ENABLE(srp-authentication,
373         AS_HELP_STRING([--disable-srp-authentication],
374                 [disable the SRP authentication support]),
375         ac_enable_srp=no)
376 if test x$ac_enable_srp != xno; then
377  AC_MSG_RESULT(no)
378  AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
379 else
380  ac_full=0
381  AC_MSG_RESULT(yes)
382 fi
383 AM_CONDITIONAL(ENABLE_SRP, test "$ac_enable_srp" != "no")
384
385 AC_MSG_CHECKING([whether to disable PSK authentication support])
386 AC_ARG_ENABLE(psk-authentication,
387        AS_HELP_STRING([--disable-psk-authentication],
388                [disable the PSK authentication support]),
389        ac_enable_psk=no)
390 if test x$ac_enable_psk != xno; then
391  AC_MSG_RESULT(no)
392  AC_DEFINE(ENABLE_PSK, 1, [enable PSK authentication])
393 else
394  ac_full=0
395  AC_MSG_RESULT(yes)
396 fi
397
398 AC_MSG_CHECKING([whether to disable anonymous authentication support])
399 AC_ARG_ENABLE(anon-authentication,
400         AS_HELP_STRING([--disable-anon-authentication],
401                 [disable the anonymous authentication support]),
402         ac_enable_anon=no)
403 if test x$ac_enable_anon != xno; then
404  AC_MSG_RESULT(no)
405  AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
406 else
407  ac_full=0
408  AC_MSG_RESULT(yes)
409 fi
410 AM_CONDITIONAL(ENABLE_ANON, test "$ac_enable_anon" != "no")
411
412 AC_MSG_CHECKING([whether to disable authorization (tls-authz) support])
413 AC_ARG_ENABLE(tls-authorization,
414         AS_HELP_STRING([--disable-tls-authorization],
415                 [disable tls authorization support]),
416         ac_enable_authz=no)
417 if test x$ac_enable_authz != xno; then
418  AC_MSG_RESULT(no)
419  AC_DEFINE(ENABLE_AUTHZ, 1, [enable tls authorization])
420 else
421  ac_full=0
422  AC_MSG_RESULT(yes)
423 fi
424 AM_CONDITIONAL(ENABLE_AUTHZ, test "$ac_enable_authz" != "no")
425
426 AC_MSG_CHECKING([whether to disable extra PKI stuff])
427 AC_ARG_ENABLE(extra-pki,
428         AS_HELP_STRING([--disable-extra-pki],
429                 [only enable the basic PKI stuff]),
430         disable_pki=$enableval, disable_pki=no)
431 if test "$disable_pki" != "no"; then
432  ac_full=0
433  AC_MSG_RESULT(yes)
434 else
435  AC_MSG_RESULT(no)
436  AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS/PKI stuff])
437 fi
438 AM_CONDITIONAL(ENABLE_PKI, test "$disable_pki" = "no")
439
440 dnl Check whether to disable OpenPGP authentication completely
441 dnl from libgnutls-extra.
442
443 ac_enable_openpgp=yes
444 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
445 AC_ARG_ENABLE(openpgp-authentication,
446         AS_HELP_STRING([--disable-openpgp-authentication],
447                 [disable the OpenPGP authentication support]),
448         ac_enable_openpgp=no)
449 if test x$ac_enable_openpgp = xno; then
450  AC_MSG_RESULT(yes)
451  ac_full=0
452 else
453  AC_DEFINE(ENABLE_OPENPGP, 1, [use openpgp authentication])
454  AC_MSG_RESULT(no)
455 fi
456 AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
457
458 dnl Test whether to use the included opencdk library
459 dnl 
460 if test x$ac_enable_openpgp = xyes; then
461  AC_ARG_WITH(included-opencdk,
462         AS_HELP_STRING([--with-included-opencdk], [use the included opencdk]),
463                 ac_enable_included_opencdk=$withval, 
464                 ac_enable_included_opencdk=no)
465  if test x$ac_enable_included_opencdk = xno;then 
466   AC_LIB_HAVE_LINKFLAGS(opencdk,, [
467 #include <opencdk.h>], [cdk_armor_encode_buffer (NULL, 0, NULL, 0, NULL, 0);])
468   if test "$ac_cv_libopencdk" != yes; then
469    ac_enable_included_opencdk=yes
470    AC_MSG_WARN([[
471 ***
472 *** libopencdk was not found. You may want to get it from
473 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
474 ***
475 *** Will use the included opencdk.
476 ***
477 ]])
478   fi
479   AC_MSG_CHECKING([whether to use the included opencdk])
480   AC_MSG_RESULT($ac_enable_included_opencdk)
481  fi
482 fi
483
484 AM_CONDITIONAL(ENABLE_INCLUDED_OPENCDK, test "$ac_enable_included_opencdk" = "yes")
485
486 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
487 AC_ARG_ENABLE(openssl-compatibility,
488         AS_HELP_STRING([--disable-openssl-compatibility],
489                 [disable the OpenSSL compatibility support]),
490         ac_enable_openssl=$withval,
491         ac_enable_openssl=yes)
492 if test x$ac_enable_openssl != xno; then
493  AC_MSG_RESULT(no)
494 else
495  AC_MSG_RESULT(yes)
496 fi
497
498 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
499
500
501 AC_ARG_WITH(included-libtasn1,
502         AS_HELP_STRING([--with-included-libtasn1],
503                 [use the included libtasn1]),
504         minitasn1_enabled=$withval,
505         minitasn1_enabled=no)
506
507 if test x$minitasn1_enabled = xno; then
508 AM_PATH_LIBTASN1($GNUTLS_LIBTASN1_VERSION,,
509  minitasn1_enabled=yes
510  AC_MSG_WARN([[
511 *** 
512 *** LibtASN1 ${GNUTLS_LIBTASN1_VERSION} was not found. Will use the included one.
513 ]]))
514 fi
515
516 AC_MSG_CHECKING([whether to use the included minitasn1])
517 AC_MSG_RESULT($minitasn1_enabled)
518
519 AM_CONDITIONAL(ENABLE_MINITASN1, test "$minitasn1_enabled" = "yes")
520
521 dnl Check for libcfg+
522
523 SAVED_LIBS=$LIBS
524 AC_ARG_WITH(included-libcfg,
525         AS_HELP_STRING([--with-included-libcfg],
526                 [use the included libcfg+ (certtool only)]),
527         libcfg_enabled=$withval, 
528         libcfg_enabled=no
529 dnl We search for libcfg+ which is used by certtool
530 dnl
531         AC_CHECK_LIB(cfg+, cfg_get_context,:,
532                      libcfg_enabled=yes
533                      AC_MSG_WARN([[
534 *** 
535 *** Libcfg+ was not found. Will use the included one.]])))
536
537 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
538 LIBS=$SAVED_LIBS
539
540 AC_MSG_CHECKING([whether to use the included libcfg])
541 AC_MSG_RESULT($libcfg_enabled)
542
543
544 dnl CHECK FOR ZLIB SUPPORT
545 dnl
546
547 AC_MSG_CHECKING([whether to include zlib compression support])
548
549 AC_ARG_WITH(zlib,
550         AS_HELP_STRING([--without-zlib], [disable zlib compression support]),
551         ac_zlib=$withval,
552         ac_zlib=yes)
553
554 if test x$ac_zlib != xno; then
555  AC_MSG_RESULT(yes)
556  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
557  if test "$ac_cv_libz" != yes; then
558    AC_MSG_WARN(
559 *** 
560 *** ZLIB was not found. You will not be able to use ZLIB compression.)
561  fi
562 else
563  AC_MSG_RESULT(no)
564 fi
565
566
567
568 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
569 dnl
570
571 minilzo_enabled=no
572 use_lzo=yes
573 AC_ARG_WITH(lzo,
574         AS_HELP_STRING([--without-lzo], [do not use lzo compression]),
575         use_lzo=$withval,
576         use_lzo=yes)
577
578 AC_MSG_CHECKING([whether to include lzo compression support])
579 AC_MSG_RESULT($use_lzo)
580
581 if test x$use_lzo = xyes; then
582   AC_DEFINE(USE_LZO, 1, [whether to use the lzo compression])
583
584   AC_ARG_WITH(included-lzo,
585         AS_HELP_STRING([--with-included-lzo],
586                 [include minilzo in libgnutls-extra]),
587         minilzo_enabled=$withval,
588         minilzo_enabled=no)
589
590   AC_MSG_CHECKING([whether to use the included lzo compression library])
591   AC_MSG_RESULT($minilzo_enabled)
592
593   LZO_LIBS=
594   if test "$minilzo_enabled" != "yes"; then
595     AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LIBS=-llzo2)
596     if test "$LZO_LIBS" = ""; then
597       AC_CHECK_LIB(lzo, lzo1x_1_compress, LZO_LIBS=-llzo, [
598         minilzo_enabled=yes
599         AC_MSG_WARN(
600 ***
601 *** Could not find liblzo or liblzo2. Will use the included minilzo.
602 )
603       ])
604     fi
605   fi
606   AC_SUBST(LZO_LIBS)
607
608   if test "$LZO_LIBS" = "-llzo"; then
609     AC_CHECK_HEADERS(lzo1x.h)
610   elif test "$LZO_LIBS" = "-llzo2"; then
611     AC_CHECK_HEADERS(lzo/lzo1x.h)
612   fi
613
614   if test "$minilzo_enabled" = "yes"; then
615     AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
616   fi
617 fi
618
619 AM_CONDITIONAL(USE_LZO, test "$use_lzo" = "yes")
620 AM_CONDITIONAL(ENABLE_INCLUDED_LZO, test "$minilzo_enabled" = "yes")
621
622 if test "$minilzo_enabled" = "yes"; then
623   # See libextra/minilzo/README.LZO
624   AC_CHECK_TYPE(ptrdiff_t,long)
625   AC_TYPE_SIZE_T
626   AC_CHECK_SIZEOF(short)
627   AC_CHECK_SIZEOF(int)
628   AC_CHECK_SIZEOF(long)
629   AC_CHECK_SIZEOF(long long)
630   AC_CHECK_SIZEOF(__int64)
631   AC_CHECK_SIZEOF(void *)
632   AC_CHECK_SIZEOF(size_t)
633   AC_CHECK_SIZEOF(ptrdiff_t)
634   AC_C_CONST
635   AC_CHECK_FUNCS(memcmp memcpy memmove memset)
636 fi
637
638 AC_MSG_RESULT([***
639 *** Setting up gnulib compatibility files...
640 ])
641 gl_INIT
642 lgl_INIT
643
644 AC_TRY_LINK([#include <winsock2.h>], [
645   WORD wVersionRequested = MAKEWORD(2, 2);
646   WSADATA wsaData;
647   int err = WSAStartup(wVersionRequested, &wsaData);
648   WSACleanup ();], wsastartup=yes, wsastartup=no)
649 if test x$wsastartup = xyes; then
650   AC_DEFINE(HAVE_WINSOCK, 1, [Call WSAStartup in gnutls_global_init])
651 fi
652 AC_MSG_CHECKING([if we have Windows sockets and WSAStartup/WSACleanup])
653 AC_MSG_RESULT($wsastartup)
654
655 AC_MSG_RESULT([***
656 *** Detecting options for shared libraries...
657 ])
658 AC_LIBTOOL_WIN32_DLL
659 AC_PROG_LIBTOOL
660
661 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBTASN1_LIBS $LIBGCRYPT_LIBS $LIBS"
662 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS $LIBTASN1_CFLAGS -I${includedir}"
663 AC_SUBST(LIBGNUTLS_LIBS)
664 AC_SUBST(LIBGNUTLS_CFLAGS)
665
666 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra $LTLIBOPENCDK $LZO_LIBS $LIBGNUTLS_LIBS"
667 LIBGNUTLS_EXTRA_CFLAGS="$INCOPENCDK -I${includedir}"
668 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
669 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
670 export ac_full
671
672 AM_CFLAGS="${AM_CFLAGS} ${LIBGCRYPT_CFLAGS}"
673
674 if test $ac_cv_c_compiler_gnu != no; then
675         if test x$opt_profiler_mode = xyes; then
676           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
677           if test x$FC_OK = xyes; then
678                 AM_CFLAGS="${AM_CFLAGS} `fc-config --cflags`"
679                 LIBS="$LIBS `fc-config --libs`"
680           else
681 AC_MSG_WARN(***
682 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
683 )
684           fi
685         fi
686 fi
687
688 if test $ac_full -eq 0; then
689   AC_SUBST(POSSIBLY_WARN_ABOUT_MISSING_FEATURES, [[
690 #ifdef __GNUC__
691 #warning This is not the official GnuTLS library. Several features were disabled at compilation.
692 #endif /* __GNUC__ */]])
693 fi
694
695 AC_SUBST(AM_CFLAGS)
696
697 AC_CONFIG_COMMANDS([chmod-config],[[
698  chmod +x lib/libgnutls-config
699  chmod +x libextra/libgnutls-extra-config
700 ]],[[]])
701
702 AC_CONFIG_FILES([Makefile po/Makefile.in \
703         doc/Makefile doc/examples/Makefile doc/scripts/Makefile \
704         doc/manpages/Makefile doc/reference/Makefile \
705         gl/Makefile lgl/Makefile \
706         tests/Makefile tests/rsa-md5-collision/Makefile tests/userid/Makefile \
707         tests/pkcs1-padding/Makefile tests/pkcs8-decode/Makefile \
708         tests/pkcs12-decode/Makefile tests/pathlen/Makefile \
709         tests/key-id/Makefile tests/sha2/Makefile \
710         tests/hostname-check/Makefile \
711         includes/Makefile includes/gnutls/gnutls.h \
712         lib/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
713         libextra/Makefile libextra/openpgp/Makefile libextra/opencdk/Makefile \
714         libextra/minilzo/Makefile tests/openpgp/Makefile \
715         src/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
716         src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
717         lib/libgnutls-config libextra/libgnutls-extra-config \
718         lib/gnutls.pc libextra/gnutls-extra.pc
719         guile/Makefile guile/modules/Makefile
720         guile/src/Makefile guile/tests/Makefile])
721
722 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
723
724
725 AC_OUTPUT