Update gnulib.
[gnutls.git] / configure.in
blob03ee47216091be67f3ec25a02ad6d571442e8249
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.
5 # Author: Nikos Mavrogiannopoulos
7 # This file is part of GNUTLS.
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.
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.
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.
23 AC_PREREQ(2.61)
24 AC_INIT([GnuTLS], [2.1.8], [bug-gnutls@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CANONICAL_TARGET
29 AM_INIT_AUTOMAKE([1.10 dist-bzip2])
30 AM_CONFIG_HEADER(config.h)
32 AB_INIT
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, 27)
39 AC_SUBST(LT_REVISION, 0)
40 AC_SUBST(LT_AGE, 1)
41 ac_full=1
43 # Used when creating the Windows libgnutls-XX.def files.
44 SOVERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
45 AC_SUBST(SOVERSION)
47 dnl for opencdk needs also change in the test
48 GNUTLS_OPENCDK_VERSION=0.6.5
49 GNUTLS_GCRYPT_VERSION=1:1.2.4
50 GNUTLS_LIBTASN1_VERSION=0.3.4
51 AC_DEFINE_UNQUOTED(GNUTLS_GCRYPT_VERSION, "$GNUTLS_GCRYPT_VERSION", [version of gcrypt])
52 AC_DEFINE_UNQUOTED(GNUTLS_LIBTASN1_VERSION, "$GNUTLS_LIBTASN1_VERSION", [version of libtasn1])
54 # Compute numeric versions, used in includes/gnutls/gnutls.h.in.
55 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
56 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
57 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
58 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
60 opt_dmalloc_mode=no
61 AC_MSG_CHECKING([whether in dmalloc mode])
62 AC_ARG_ENABLE(dmalloc-mode,
63         AS_HELP_STRING([--enable-dmalloc-mode], [enable dmalloc mode]),
64         opt_dmalloc_mode=$enableval)
65 AC_MSG_RESULT($opt_dmalloc_mode)
67 opt_efence_mode=no
68 AC_MSG_CHECKING([whether in electric fence mode])
69 AC_ARG_ENABLE(efence-mode,
70         AS_HELP_STRING([--enable-efence-mode], [enable electric fence mode]),
71 opt_efence_mode=$enableval)
72 AC_MSG_RESULT($opt_efence_mode)
74 opt_developer_mode=no
75 AC_MSG_CHECKING([whether in developer mode])
76 AC_ARG_ENABLE(developer-mode,
77         AS_HELP_STRING([--enable-developer-mode], [enable developer mode]),
78 opt_developer_mode=$enableval)
79 AC_MSG_RESULT($opt_developer_mode)
81 opt_profiler_mode=no
82 AC_MSG_CHECKING([whether in profile mode])
83 AC_ARG_ENABLE(profile-mode,
84         AS_HELP_STRING([--enable-profile-mode], [enable profiler]),
85 opt_profiler_mode=$enableval)
86 AC_MSG_RESULT($opt_profiler_mode)
88 AC_MSG_RESULT([***
89 *** Checking for compilation programs...
92 dnl Checks for programs.
93 AM_GNU_GETTEXT([external])
94 AM_GNU_GETTEXT_VERSION([0.16])
95 AC_PROG_CC
96 AC_PROG_CXX
97 AC_PROG_LN_S
98 GTK_DOC_CHECK(1.1)
99 AC_PATH_PROG([GAA], [gaa])
100 if test "x$GAA" = "x"; then
101    AC_MSG_WARN([[***
102 *** GAA was not found.  It is only needed if you wish to modify
103 *** the source code or command-line description files.  In this case,
104 *** you may want to get it from http://gaa.sourceforge.net/
105 ***]])
107 AM_CONDITIONAL(HAVE_GCC,   test "x$GCC" = "xyes")
110 AC_MSG_RESULT([***
111 *** Detecting compiler options...
114 gl_EARLY
115 lgl_EARLY
116 AC_C_CONST
117 AC_C_INLINE
119 dnl In order to use the reentrant libc functions.
120 dnl I hope it is portable enough.
121 CFLAGS="${CFLAGS} -D_REENTRANT -D_THREAD_SAFE"
122 AM_CFLAGS="${CFLAGS}"
124 AC_ARG_ENABLE(cxx,
125        AS_HELP_STRING([--disable-cxx],
126                [unconditionally disable the C++ library]),
127        use_cxx=$enableval, use_cxx=yes)
128 if test "$use_cxx" != "no"; then
129   AC_LANG_PUSH(C++)
130   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
131   AC_LANG_POP(C++)
133 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
134 AC_MSG_CHECKING([whether to build C++ library])
135 AC_MSG_RESULT($use_cxx)
137 AC_MSG_CHECKING([whether C99 macros are supported])
138 AC_TRY_COMPILE(,[ 
139 #define test_mac(...) 
140 int z,y,x;
141 test_mac(x,y,z);
142 return 0;
143 ], 
144         dnl ***** OK
145         AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
146         AC_MSG_RESULT(yes),
147         dnl ***** NOT FOUND
148         AC_MSG_RESULT(no)
149         AC_MSG_WARN([C99 macros not supported. This may affect compiling.]))
151 if test $ac_cv_c_compiler_gnu != no; then
152         if test x$opt_developer_mode = xyes; then
153           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"
154 #         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"
155         fi
157         AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
158         _gcc_cflags_save=$CFLAGS
159         CFLAGS="${CFLAGS} -Wno-pointer-sign"
160         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
161         AC_MSG_RESULT($_gcc_psign)
162         if test x"$_gcc_psign" != xyes ; then
163           CFLAGS=$_gcc_cflags_save;
164         fi
166         AC_MSG_CHECKING([if gcc/ld supports -Wl,--output-def])
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"
173         if test x$opt_dmalloc_mode = xyes; then
174           AC_CHECK_LIB(dmalloc, main)
175           AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
176         else
177                 if test x$opt_efence_mode = xyes; then
178                   AC_CHECK_LIB(efence, main)
179                   AC_DEFINE(USE_EFENCE, 1, [use electric fence])
180                 fi
181         fi
183         AC_MSG_CHECKING([whether we have GNU assembler])
184         GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
185         if test "$GAS"; then
186           AM_CFLAGS="${AM_CFLAGS} -pipe"
187           AC_MSG_RESULT(yes)
188         else
189           AC_MSG_RESULT(no)
190         fi
193 # Needs to be called outside of 'if' clause.
194 AM_CONDITIONAL(HAVE_LD_OUTPUT_DEF, test "$output_def" = "yes")
196 AC_MSG_RESULT([***
197 *** Detecting C library capabilities...
200 AC_HEADER_STDC
201 AC_CHECK_HEADERS(strings.h alloca.h)
202 AC_CHECK_HEADERS(errno.h)
203 AC_CHECK_HEADERS(math.h limits.h float.h stdarg.h ctype.h)
204 dnl opencdk
205 AC_CHECK_HEADERS(netdb.h)
206 AC_CHECK_FUNCS(umask vasprintf isascii fork,,)
207 AC_FUNC_ALLOCA
209 # No fork on MinGW, disable some self-tests until we fix them.
210 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
212 AC_MSG_RESULT([***
213 *** Detecting system's parameters...
216 # Run self-tests under valgrind?
217 if test "$cross_compiling" = no; then
218   AC_CHECK_PROGS(VALGRIND, valgrind)
220 if test -n "$VALGRIND" && $VALGRIND true > /dev/null 2>&1; then
221   opt_valgrind_tests=yes
222 else
223   opt_valgrind_tests=no
224   VALGRIND=
225 fi 
226 AC_MSG_CHECKING([whether self tests are run under valgrind])
227 AC_ARG_ENABLE(valgrind-tests,
228         AS_HELP_STRING([--enable-valgrind-tests],
229                        [run self tests under valgrind]),
230   opt_valgrind_tests=$enableval)
231 AC_MSG_RESULT($opt_valgrind_tests)
233 # For minitasn1.
234 AC_CHECK_SIZEOF(unsigned long, 4)
235 AC_CHECK_SIZEOF(unsigned int, 4)
237 # For storing integers in pointers without warnings
238 # http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
239 AC_CHECK_SIZEOF(void *)
240 AC_CHECK_SIZEOF(long)
241 AC_CHECK_SIZEOF(int)
242 case $ac_cv_sizeof_void_p in
243   $ac_cv_sizeof_long)
244     AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [(long)],
245               [Additional cast to bring void* to a type castable to int.])
246     ;;
247   *)
248     AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [])
249     ;;
250 esac
252 # For some systems we know that we have ld_version scripts.
253 # Use it then as default.
254 have_ld_version_script=no
255 case "${host}" in
256     *-*-linux*)
257         have_ld_version_script=yes
258         ;;
259     *-*-gnu*)
260         have_ld_version_script=yes
261         ;;
262 esac
263 AC_ARG_ENABLE([ld-version-script],
264               AC_HELP_STRING([--enable-ld-version-script],
265                              [enable/disable use of linker version script.
266                               (default is system dependent)]),
267               [have_ld_version_script=$enableval],
268               [ : ] )
269 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
271 AC_CHECK_TYPES(uint,,, [
272 # include <sys/types.h>
275 # Check for and replace ssize_t.
276 AC_CHECK_TYPE(ssize_t,
277         [DEFINE_SSIZE_T="#include <sys/types.h>"
278         AC_SUBST(DEFINE_SSIZE_T)],
279         [AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
280         DEFINE_SSIZE_T="typedef int ssize_t;"
281         AC_SUBST(DEFINE_SSIZE_T)],
282         [#include <sys/types.h>])
284 AC_C_BIGENDIAN
286 AC_MSG_RESULT([***
287 *** Checking for external libraries...
290 # For Guile bindings.
292 opt_guile_bindings=yes
293 AC_MSG_CHECKING([whether building Guile bindings])
294 AC_ARG_ENABLE(guile,
295         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
296 opt_guile_bindings=$enableval)
297 AC_MSG_RESULT($opt_guile_bindings)
299 AC_ARG_WITH([--with-guile-site-dir],
300   [AS_HELP_STRING([--with-guile-site-dir],
301      [use the given directory as the Guile site (use with care)])])
303 if test "x$opt_guile_bindings" = "xyes"; then
304    AC_MSG_RESULT([***
305 *** Detecting GNU Guile...
308    AC_PATH_PROG([guile_snarf], [guile-snarf])
309    if test "x$guile_snarf" = "x"; then
310       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
311       opt_guile_bindings=no
312    else
313       GUILE_PROGS
314       GUILE_FLAGS
316       save_CFLAGS="$CFLAGS"
317       save_LIBS="$LIBS"
318       CFLAGS="$CFLAGS $GUILE_CFLAGS"
319       LIBS="$LIBS $GUILE_LDFLAGS"
320       AC_MSG_CHECKING([whether GNU Guile is recent enough])
321       AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
322         [], [opt_guile_bindings=no])
323       CFLAGS="$save_CFLAGS"
324       LIBS="$save_LIBS"
326       if test "x$opt_guile_bindings" = "xyes"; then
327         AC_MSG_RESULT([yes])
328         case "x$with_guile_site_dir" in 
329              xno)
330                 # Use the default $(GUILE_SITE).
331                 GUILE_SITE_DIR
332                 ;;
333              x|xyes)
334                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
335                 # hack is used to allow `distcheck' to work (see
336                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
337                 GUILE_SITE="\$(datadir)/guile/site"
338                 AC_SUBST(GUILE_SITE)
339                 ;;
340              *)
341                 # Use the user-specified directory as $(GUILE_SITE).
342                 GUILE_SITE="$with_guile_site_dir"
343                 AC_SUBST(GUILE_SITE)
344                 ;;
345         esac
346       else
347         AC_MSG_RESULT([no])
348         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
349         opt_guile_bindings=no
350       fi
351    fi
353 AM_CONDITIONAL(HAVE_GUILE, test "x$opt_guile_bindings" = "xyes")
355 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
356 dnl Can't disable - gnutls depends on gcrypt
357         AC_MSG_ERROR([[
358 ***  
359 *** libgcrypt was not found. You may want to get it from
360 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
362 ]]))
363 libgcrypt=yes
365 # Hard-wire the gl/m4/gc.m4 test.
366 AC_ARG_WITH(builtin-crypto,
367         AS_HELP_STRING([--with-builtin-crypto],
368                 [use internal crypto instead of libgcrypt (EXPERIMENTAL)]),
369         ac_cv_libgcrypt=no,
370         ac_cv_libgcrypt=yes)
371 LTLIBGCRYPT=$LIBGCRYPT_LIBS
373 AC_MSG_CHECKING([whether to enable Opaque PRF input support])
374 AC_ARG_ENABLE(opaque-prf-input,
375         AS_HELP_STRING([--enable-opaque-prf-input=DD],
376                 [enable Opaque PRF input using DD as extension type]),
377         ac_opaque_prf_input=$enableval, ac_opaque_prf_input=no)
378 if test "$ac_opaque_prf_input" != "no"; then
379   if ! echo $ac_opaque_prf_input | egrep -q '^[[0-9]]+$'; then
380     ac_opaque_prf_input=no
381     AC_MSG_WARN([[
382 *** Could not parse Opaque PRF Input extension type.
383 *** Use --enable-opaque-prf-input=XX where XX is decimal, for example
384 *** to use extension value 42 use --enable-opqaue-prf-input=42]])
385   fi
387 if test "$ac_opaque_prf_input" != "no"; then
388  AC_MSG_RESULT([yes (extension value $ac_opaque_prf_input)])
389  AC_DEFINE_UNQUOTED(ENABLE_OPRFI, $ac_opaque_prf_input,
390                     [enable Opaque PRF Input])
391 else
392  AC_MSG_RESULT(no)
394 AM_CONDITIONAL(ENABLE_OPRFI, test "$ac_opaque_prf_input" != "no")
396 AC_MSG_CHECKING([whether to disable SRP authentication support])
397 AC_ARG_ENABLE(srp-authentication,
398         AS_HELP_STRING([--disable-srp-authentication],
399                 [disable the SRP authentication support]),
400         ac_enable_srp=no)
401 if test x$ac_enable_srp != xno; then
402  AC_MSG_RESULT(no)
403  AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
404 else
405  ac_full=0
406  AC_MSG_RESULT(yes)
408 AM_CONDITIONAL(ENABLE_SRP, test "$ac_enable_srp" != "no")
410 AC_MSG_CHECKING([whether to disable PSK authentication support])
411 AC_ARG_ENABLE(psk-authentication,
412        AS_HELP_STRING([--disable-psk-authentication],
413                [disable the PSK authentication support]),
414        ac_enable_psk=no)
415 if test x$ac_enable_psk != xno; then
416  AC_MSG_RESULT(no)
417  AC_DEFINE(ENABLE_PSK, 1, [enable PSK authentication])
418 else
419  ac_full=0
420  AC_MSG_RESULT(yes)
423 AC_MSG_CHECKING([whether to disable anonymous authentication support])
424 AC_ARG_ENABLE(anon-authentication,
425         AS_HELP_STRING([--disable-anon-authentication],
426                 [disable the anonymous authentication support]),
427         ac_enable_anon=no)
428 if test x$ac_enable_anon != xno; then
429  AC_MSG_RESULT(no)
430  AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
431 else
432  ac_full=0
433  AC_MSG_RESULT(yes)
435 AM_CONDITIONAL(ENABLE_ANON, test "$ac_enable_anon" != "no")
437 dnl Check for Camellia support
439 AC_ARG_ENABLE(camellia,
440         AS_HELP_STRING([--disable-camellia], [disable Camellia cipher]),
441         ac_enable_camellia=no)
442 if test "$ac_enable_camellia" != "no"; then
443   AC_MSG_CHECKING([for Camellia support in libgcrypt])
444   if test -n "`$LIBGCRYPT_CONFIG --algorithms | grep -i camellia`"; then
445     AC_MSG_RESULT([yes])
446     ac_enable_camellia=yes
447   else
448     AC_MSG_RESULT([no])
449     ac_enable_camellia=no
450   fi
452 AC_MSG_CHECKING([whether to disable Camellia cipher])
453 if test "$ac_enable_camellia" = "yes"; then
454  AC_MSG_RESULT([no])
455  AC_DEFINE(ENABLE_CAMELLIA, 1, [enable camellia block cipher])
456 else
457  AC_MSG_RESULT([yes])
460 AC_MSG_CHECKING([whether to disable extra PKI stuff])
461 AC_ARG_ENABLE(extra-pki,
462         AS_HELP_STRING([--disable-extra-pki],
463                 [only enable the basic PKI stuff]),
464         disable_pki=$enableval, disable_pki=no)
465 if test "$disable_pki" != "no"; then
466  ac_full=0
467  AC_MSG_RESULT(yes)
468 else
469  AC_MSG_RESULT(no)
470  AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS/PKI stuff])
472 AM_CONDITIONAL(ENABLE_PKI, test "$disable_pki" = "no")
474 dnl Check whether to disable OpenPGP authentication completely
475 dnl from libgnutls-extra.
477 ac_enable_openpgp=yes
478 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
479 AC_ARG_ENABLE(openpgp-authentication,
480         AS_HELP_STRING([--disable-openpgp-authentication],
481                 [disable the OpenPGP authentication support]),
482         ac_enable_openpgp=no)
483 if test x$ac_enable_openpgp = xno; then
484  AC_MSG_RESULT(yes)
485  ac_full=0
486 else
487  AC_DEFINE(ENABLE_OPENPGP, 1, [use openpgp authentication])
488  AC_MSG_RESULT(no)
490 AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
492 dnl Test whether to use the included opencdk library
493 dnl 
494 if test x$ac_enable_openpgp = xyes; then
495  AC_ARG_WITH(included-opencdk,
496         AS_HELP_STRING([--with-included-opencdk], [use the included opencdk]),
497                 ac_enable_included_opencdk=$withval, 
498                 ac_enable_included_opencdk=no)
499  if test x$ac_enable_included_opencdk = xno;then 
500   AC_LIB_HAVE_LINKFLAGS(opencdk,, [
501 #include <opencdk.h>], [
502 #if OPENCDK_VERSION_MINOR < 6 || OPENCDK_VERSION_PATCH < 5
503 # error "OpenCDK 0.6.5 is required"
504 #else
505 cdk_check_version( NULL);
506 #endif
508   if test "$ac_cv_libopencdk" != yes; then
509    ac_enable_included_opencdk=yes
510    AC_MSG_WARN([[
512 *** libopencdk was not found. You may want to get it from
513 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
515 *** Will use the included opencdk.
518   fi
519   AC_MSG_CHECKING([whether to use the included opencdk])
520   AC_MSG_RESULT($ac_enable_included_opencdk)
521  fi
524 AM_CONDITIONAL(ENABLE_INCLUDED_OPENCDK, test "$ac_enable_included_opencdk" = "yes")
526 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
527 AC_ARG_ENABLE(openssl-compatibility,
528         AS_HELP_STRING([--disable-openssl-compatibility],
529                 [disable the OpenSSL compatibility support]),
530         ac_enable_openssl=$withval,
531         ac_enable_openssl=yes)
532 if test x$ac_enable_openssl != xno; then
533  AC_MSG_RESULT(no)
534 else
535  AC_MSG_RESULT(yes)
538 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
541 AC_ARG_WITH(included-libtasn1,
542         AS_HELP_STRING([--with-included-libtasn1],
543                 [use the included libtasn1]),
544         minitasn1_enabled=$withval,
545         minitasn1_enabled=no)
547 if test x$minitasn1_enabled = xno; then
548 AM_PATH_LIBTASN1($GNUTLS_LIBTASN1_VERSION,,
549  minitasn1_enabled=yes
550  AC_MSG_WARN([[
551 *** 
552 *** LibtASN1 ${GNUTLS_LIBTASN1_VERSION} was not found. Will use the included one.
553 ]]))
556 AC_MSG_CHECKING([whether to use the included minitasn1])
557 AC_MSG_RESULT($minitasn1_enabled)
559 AM_CONDITIONAL(ENABLE_MINITASN1, test "$minitasn1_enabled" = "yes")
561 dnl Check for libcfg+
563 SAVED_LIBS=$LIBS
564 AC_ARG_WITH(included-libcfg,
565         AS_HELP_STRING([--with-included-libcfg],
566                 [use the included libcfg+ (certtool only)]),
567         libcfg_enabled=$withval, 
568         libcfg_enabled=no
569 dnl We search for libcfg+ which is used by certtool
571         AC_CHECK_LIB(cfg+, cfg_get_context,:,
572                      libcfg_enabled=yes
573                      AC_MSG_WARN([[
574 *** 
575 *** Libcfg+ was not found. Will use the included one.]])))
577 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
578 LIBS=$SAVED_LIBS
580 AC_MSG_CHECKING([whether to use the included libcfg])
581 AC_MSG_RESULT($libcfg_enabled)
584 dnl CHECK FOR ZLIB SUPPORT
587 AC_MSG_CHECKING([whether to include zlib compression support])
589 AC_ARG_WITH(zlib,
590         AS_HELP_STRING([--without-zlib], [disable zlib compression support]),
591         ac_zlib=$withval,
592         ac_zlib=yes)
594 if test x$ac_zlib != xno; then
595  AC_MSG_RESULT(yes)
596  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
597  if test "$ac_cv_libz" != yes; then
598    AC_MSG_WARN(
599 *** 
600 *** ZLIB was not found. You will not be able to use ZLIB compression.)
601  fi
602 else
603  AC_MSG_RESULT(no)
608 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
611 minilzo_enabled=no
612 use_lzo=yes
613 AC_ARG_WITH(lzo,
614         AS_HELP_STRING([--without-lzo], [do not use lzo compression]),
615         use_lzo=$withval,
616         use_lzo=yes)
618 AC_MSG_CHECKING([whether to include lzo compression support])
619 AC_MSG_RESULT($use_lzo)
621 if test x$use_lzo = xyes; then
622   AC_DEFINE(USE_LZO, 1, [whether to use the lzo compression])
624   AC_ARG_WITH(included-lzo,
625         AS_HELP_STRING([--with-included-lzo],
626                 [include minilzo in libgnutls-extra]),
627         minilzo_enabled=$withval,
628         minilzo_enabled=no)
630   AC_MSG_CHECKING([whether to use the included lzo compression library])
631   AC_MSG_RESULT($minilzo_enabled)
633   LZO_LIBS=
634   if test "$minilzo_enabled" != "yes"; then
635     AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LIBS=-llzo2)
636     if test "$LZO_LIBS" = ""; then
637       AC_CHECK_LIB(lzo, lzo1x_1_compress, LZO_LIBS=-llzo, [
638         minilzo_enabled=yes
639         AC_MSG_WARN(
641 *** Could not find liblzo or liblzo2. Will use the included minilzo.
643       ])
644     fi
645   fi
646   AC_SUBST(LZO_LIBS)
648   if test "$LZO_LIBS" = "-llzo"; then
649     AC_CHECK_HEADERS(lzo1x.h)
650   elif test "$LZO_LIBS" = "-llzo2"; then
651     AC_CHECK_HEADERS(lzo/lzo1x.h)
652   fi
654   if test "$minilzo_enabled" = "yes"; then
655     AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
656   fi
659 AM_CONDITIONAL(USE_LZO, test "$use_lzo" = "yes")
660 AM_CONDITIONAL(ENABLE_INCLUDED_LZO, test "$minilzo_enabled" = "yes")
662 if test "$minilzo_enabled" = "yes"; then
663   # See libextra/minilzo/README.LZO
664   AC_CHECK_TYPE(ptrdiff_t,long)
665   AC_TYPE_SIZE_T
666   AC_CHECK_SIZEOF(short)
667   AC_CHECK_SIZEOF(int)
668   AC_CHECK_SIZEOF(long)
669   AC_CHECK_SIZEOF(long long)
670   AC_CHECK_SIZEOF(__int64)
671   AC_CHECK_SIZEOF(void *)
672   AC_CHECK_SIZEOF(size_t)
673   AC_CHECK_SIZEOF(ptrdiff_t)
674   AC_C_CONST
675   AC_CHECK_FUNCS(memcmp memcpy memmove memset)
678 AC_MSG_RESULT([***
679 *** Setting up gnulib compatibility files...
681 gl_INIT
682 lgl_INIT
684 AC_TRY_LINK([#include <winsock2.h>], [
685   WORD wVersionRequested = MAKEWORD(2, 2);
686   WSADATA wsaData;
687   int err = WSAStartup(wVersionRequested, &wsaData);
688   WSACleanup ();], wsastartup=yes, wsastartup=no)
689 if test x$wsastartup = xyes; then
690   AC_DEFINE(HAVE_WINSOCK, 1, [Call WSAStartup in gnutls_global_init])
692 AC_MSG_CHECKING([if we have Windows sockets and WSAStartup/WSACleanup])
693 AC_MSG_RESULT($wsastartup)
695 AC_MSG_RESULT([***
696 *** Detecting options for shared libraries...
698 AC_LIBTOOL_WIN32_DLL
699 AC_PROG_LIBTOOL
701 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBTASN1_LIBS $LIBGCRYPT_LIBS $LIBS"
702 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS $LIBTASN1_CFLAGS -I${includedir}"
703 AC_SUBST(LIBGNUTLS_LIBS)
704 AC_SUBST(LIBGNUTLS_CFLAGS)
706 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra $LTLIBOPENCDK $LZO_LIBS $LIBGNUTLS_LIBS"
707 LIBGNUTLS_EXTRA_CFLAGS="$INCOPENCDK -I${includedir}"
708 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
709 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
710 export ac_full
712 AM_CFLAGS="${AM_CFLAGS} ${LIBGCRYPT_CFLAGS}"
714 if test $ac_cv_c_compiler_gnu != no; then
715         if test x$opt_profiler_mode = xyes; then
716           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
717           if test x$FC_OK = xyes; then
718                 AM_CFLAGS="${AM_CFLAGS} `fc-config --cflags`"
719                 LIBS="$LIBS `fc-config --libs`"
720           else
721 AC_MSG_WARN(***
722 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
724           fi
725         fi
728 if test $ac_full -eq 0; then
729   AC_SUBST(POSSIBLY_WARN_ABOUT_MISSING_FEATURES, [[
730 #ifdef __GNUC__
731 #warning This is not the official GnuTLS library. Several features were disabled at compilation.
732 #endif /* __GNUC__ */]])
735 AC_SUBST(AM_CFLAGS)
737 AC_CONFIG_COMMANDS([chmod-config],[[
738  chmod +x lib/libgnutls-config
739  chmod +x libextra/libgnutls-extra-config
740 ]],[[]])
742 AC_CONFIG_FILES([Makefile po/Makefile.in \
743         doc/Makefile doc/examples/Makefile doc/scripts/Makefile \
744         doc/manpages/Makefile doc/reference/Makefile \
745         doc/credentials/Makefile doc/credentials/x509/Makefile \
746         doc/credentials/srp/Makefile doc/credentials/openpgp/Makefile \
747         gl/Makefile lgl/Makefile \
748         tests/Makefile tests/rsa-md5-collision/Makefile tests/userid/Makefile \
749         tests/pkcs1-padding/Makefile tests/pkcs8-decode/Makefile \
750         tests/pkcs12-decode/Makefile tests/pathlen/Makefile \
751         tests/key-id/Makefile tests/sha2/Makefile \
752         tests/hostname-check/Makefile \
753         includes/Makefile includes/gnutls/gnutls.h \
754         lib/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
755         libextra/Makefile libextra/openpgp/Makefile libextra/opencdk/Makefile \
756         libextra/minilzo/Makefile tests/openpgp/Makefile \
757         src/Makefile \
758         src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
759         lib/libgnutls-config libextra/libgnutls-extra-config \
760         lib/gnutls.pc libextra/gnutls-extra.pc
761         guile/Makefile guile/modules/Makefile
762         guile/src/Makefile guile/tests/Makefile])
764 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
767 AC_OUTPUT