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 Mavroyanopoulos
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.
24 AC_INIT([GnuTLS], [1.7.8], [bug-gnutls@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
29 AM_INIT_AUTOMAKE([1.10 gnits dist-bzip2])
30 AM_CONFIG_HEADER(config.h)
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, 20)
39 AC_SUBST(LT_REVISION, 0)
43 # Used when creating the Windows libgnutls-XX.def files.
44 SOVERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
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])
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`)
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"
63 AC_MSG_CHECKING([whether in dmalloc mode])
64 AC_ARG_ENABLE(dmalloc-mode,
65 AS_HELP_STRING([--enable-dmalloc-mode], [enable dmalloc mode]),
66 opt_dmalloc_mode=$enableval)
67 AC_MSG_RESULT($opt_dmalloc_mode)
70 AC_MSG_CHECKING([whether in electric fence mode])
71 AC_ARG_ENABLE(efence-mode,
72 AS_HELP_STRING([--enable-efence-mode], [enable electric fence mode]),
73 opt_efence_mode=$enableval)
74 AC_MSG_RESULT($opt_efence_mode)
77 AC_MSG_CHECKING([whether in developer mode])
78 AC_ARG_ENABLE(developer-mode,
79 AS_HELP_STRING([--enable-developer-mode], [enable developer mode]),
80 opt_developer_mode=$enableval)
81 AC_MSG_RESULT($opt_developer_mode)
84 AC_MSG_CHECKING([whether in profile mode])
85 AC_ARG_ENABLE(profile-mode,
86 AS_HELP_STRING([--enable-profile-mode], [enable profiler]),
87 opt_profiler_mode=$enableval)
88 AC_MSG_RESULT($opt_profiler_mode)
91 *** Checking for compilation programs...
94 dnl Checks for programs.
95 AM_GNU_GETTEXT([external])
96 AM_GNU_GETTEXT_VERSION([0.16])
101 AC_PATH_PROG([GAA], [gaa])
102 if test "x$GAA" = "x"; then
104 *** GAA was not found. It is only needed if you wish to modify
105 *** the source code or command-line description files. In this case,
106 *** you may want to get it from http://gaa.sourceforge.net/
111 *** Detecting compiler options...
120 AS_HELP_STRING([--disable-cxx],
121 [unconditionally disable the C++ library]),
122 use_cxx=$enableval, use_cxx=yes)
123 if test "$use_cxx" != "no"; then
125 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
128 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
129 AC_MSG_CHECKING([whether to build C++ library])
130 AC_MSG_RESULT($use_cxx)
132 AC_MSG_CHECKING([whether C99 macros are supported])
134 #define test_mac(...)
140 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
144 AC_MSG_WARN([C99 macros not supported. This may affect compiling.]))
146 if test $ac_cv_c_compiler_gnu != no; then
147 if test x$opt_developer_mode = xyes; then
148 CFLAGS="${CFLAGS} -g -Wall -Wcast-align -W -Wpointer-arith -Wchar-subscripts -Wformat-security -Wno-format-y2k -Wmissing-braces -Winline -Wstrict-prototypes -Wno-unused-parameter"
149 # CFLAGS="${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"
152 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
153 _gcc_cflags_save=$CFLAGS
154 CFLAGS="${CFLAGS} -Wno-pointer-sign"
155 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
156 AC_MSG_RESULT($_gcc_psign)
157 if test x"$_gcc_psign" != xyes ; then
158 CFLAGS=$_gcc_cflags_save;
161 AC_MSG_CHECKING([if gcc/ld supports -Wl,--output-def])
162 _gcc_ldflags_save=$LDFLAGS
163 LDFLAGS="-Wl,--output-def,foo.def"
164 AC_LINK_IFELSE(AC_LANG_PROGRAM([]),output_def=yes,output_def=no)
165 AC_MSG_RESULT($output_def)
166 LDFLAGS="$_gcc_ldflags_save"
168 if test x$opt_dmalloc_mode = xyes; then
169 AC_CHECK_LIB(dmalloc, main)
170 AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
172 if test x$opt_efence_mode = xyes; then
173 AC_CHECK_LIB(efence, main)
174 AC_DEFINE(USE_EFENCE, 1, [use electric fence])
178 AC_MSG_CHECKING([whether we have GNU assembler])
179 GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
181 CFLAGS="${CFLAGS} -pipe"
188 # Needs to be called outside of 'if' clause.
189 AM_CONDITIONAL(HAVE_LD_OUTPUT_DEF, test "$output_def" = "yes")
192 *** Detecting C library capabilities...
196 AC_CHECK_HEADERS(strings.h alloca.h)
197 AC_CHECK_HEADERS(errno.h)
198 AC_CHECK_HEADERS(math.h limits.h float.h stdarg.h ctype.h)
200 AC_CHECK_HEADERS(netdb.h)
201 AC_CHECK_FUNCS(umask vasprintf isascii fork,,)
204 # No fork on MinGW, disable some self-tests until we fix them.
205 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
208 *** Detecting system's parameters...
211 # Run self-tests under valgrind?
212 if test "$cross_compiling" = no; then
213 AC_CHECK_PROGS(VALGRIND, valgrind)
215 if test -n "$VALGRIND" && $VALGRIND true > /dev/null 2>&1; then
216 opt_valgrind_tests=yes
218 opt_valgrind_tests=no
221 AC_MSG_CHECKING([whether self tests are run under valgrind])
222 AC_ARG_ENABLE(valgrind-tests,
223 AS_HELP_STRING([--enable-valgrind-tests],
224 [run self tests under valgrind]),
225 opt_valgrind_tests=$enableval)
226 AC_MSG_RESULT($opt_valgrind_tests)
229 AC_CHECK_SIZEOF(unsigned long, 4)
230 AC_CHECK_SIZEOF(unsigned int, 4)
232 # For storing integers in pointers without warnings
233 # http://developer.gnome.org/doc/API/2.0/glib/glib-Type-Conversion-Macros.html#desc
234 AC_CHECK_SIZEOF(void *)
235 AC_CHECK_SIZEOF(long)
237 case $ac_cv_sizeof_void_p in
239 AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [(long)],
240 [Additional cast to bring void* to a type castable to int.])
243 AC_DEFINE(GNUTLS_POINTER_TO_INT_CAST, [])
247 # For some systems we know that we have ld_version scripts.
248 # Use it then as default.
249 have_ld_version_script=no
252 have_ld_version_script=yes
255 have_ld_version_script=yes
258 AC_ARG_ENABLE([ld-version-script],
259 AC_HELP_STRING([--enable-ld-version-script],
260 [enable/disable use of linker version script.
261 (default is system dependent)]),
262 [have_ld_version_script=$enableval],
264 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
266 AC_CHECK_TYPES(uint,,, [
267 # include <sys/types.h>
270 # Check for and replace ssize_t.
271 AC_CHECK_TYPE(ssize_t,
272 [DEFINE_SSIZE_T="#include <sys/types.h>"
273 AC_SUBST(DEFINE_SSIZE_T)],
274 [AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
275 DEFINE_SSIZE_T="typedef int ssize_t;"
276 AC_SUBST(DEFINE_SSIZE_T)],
277 [#include <sys/types.h>])
282 *** Checking for external libraries...
285 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
286 dnl Can't disable - gnutls depends on gcrypt
289 *** libgcrypt was not found. You may want to get it from
290 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
295 # Hard-wire the gl/m4/gc.m4 test.
296 AC_ARG_WITH(builtin-crypto,
297 AS_HELP_STRING([--with-builtin-crypto],
298 [use internal crypto instead of libgcrypt (EXPERIMENTAL)]),
301 LTLIBGCRYPT=$LIBGCRYPT_LIBS
303 AC_MSG_CHECKING([whether to disable SRP authentication support])
304 AC_ARG_ENABLE(srp-authentication,
305 AS_HELP_STRING([--disable-srp-authentication],
306 [disable the SRP authentication support]),
308 if test x$ac_enable_srp != xno; then
310 AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
315 AM_CONDITIONAL(ENABLE_SRP, test "$ac_enable_srp" != "no")
317 AC_MSG_CHECKING([whether to disable PSK authentication support])
318 AC_ARG_ENABLE(psk-authentication,
319 AS_HELP_STRING([--disable-psk-authentication],
320 [disable the PSK authentication support]),
322 if test x$ac_enable_psk != xno; then
324 AC_DEFINE(ENABLE_PSK, 1, [enable PSK authentication])
330 AC_MSG_CHECKING([whether to disable anonymous authentication support])
331 AC_ARG_ENABLE(anon-authentication,
332 AS_HELP_STRING([--disable-anon-authentication],
333 [disable the anonymous authentication support]),
335 if test x$ac_enable_anon != xno; then
337 AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
342 AM_CONDITIONAL(ENABLE_ANON, test "$ac_enable_anon" != "no")
344 AC_MSG_CHECKING([whether to disable authorization (tls-authz) support])
345 AC_ARG_ENABLE(tls-authorization,
346 AS_HELP_STRING([--disable-tls-authorization],
347 [disable tls authorization support]),
349 if test x$ac_enable_authz != xno; then
351 AC_DEFINE(ENABLE_AUTHZ, 1, [enable tls authorization])
356 AM_CONDITIONAL(ENABLE_AUTHZ, test "$ac_enable_authz" != "no")
358 AC_MSG_CHECKING([whether to disable extra PKI stuff])
359 AC_ARG_ENABLE(extra-pki,
360 AS_HELP_STRING([--disable-extra-pki],
361 [only enable the basic PKI stuff]),
362 disable_pki=$enableval, disable_pki=no)
363 if test "$disable_pki" != "no"; then
368 AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS/PKI stuff])
370 AM_CONDITIONAL(ENABLE_PKI, test "$disable_pki" = "no")
372 dnl Check whether to disable OpenPGP authentication completely
373 dnl from libgnutls-extra.
375 ac_enable_openpgp=yes
376 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
377 AC_ARG_ENABLE(openpgp-authentication,
378 AS_HELP_STRING([--disable-openpgp-authentication],
379 [disable the OpenPGP authentication support]),
380 ac_enable_openpgp=no)
381 if test x$ac_enable_openpgp = xno; then
385 AC_DEFINE(ENABLE_OPENPGP, 1, [use openpgp authentication])
388 AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
390 dnl Test whether to use the included opencdk library
392 if test x$ac_enable_openpgp = xyes; then
393 AC_ARG_WITH(included-opencdk,
394 AS_HELP_STRING([--with-included-opencdk], [use the included opencdk]),
395 ac_enable_included_opencdk=$withval,
396 ac_enable_included_opencdk=no)
397 if test x$ac_enable_included_opencdk = xno;then
398 AC_LIB_HAVE_LINKFLAGS(opencdk,, [
399 #include <stddef.h> /* opencdk <= 0.5.13 uses size_t without this include */
400 #include <opencdk.h>], [cdk_check_version (OPENCDK_VERSION);])
401 if test "$ac_cv_libopencdk" != yes; then
402 ac_enable_included_opencdk=yes
405 *** libopencdk was not found. You may want to get it from
406 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
408 *** Will use the included opencdk.
412 AC_MSG_CHECKING([whether to use the included opencdk])
413 AC_MSG_RESULT($ac_enable_included_opencdk)
417 AM_CONDITIONAL(ENABLE_INCLUDED_OPENCDK, test "$ac_enable_included_opencdk" = "yes")
419 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
420 AC_ARG_ENABLE(openssl-compatibility,
421 AS_HELP_STRING([--disable-openssl-compatibility],
422 [disable the OpenSSL compatibility support]),
423 ac_enable_openssl=$withval,
424 ac_enable_openssl=yes)
425 if test x$ac_enable_openssl != xno; then
431 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
434 AC_ARG_WITH(included-libtasn1,
435 AS_HELP_STRING([--with-included-libtasn1],
436 [use the included libtasn1]),
437 minitasn1_enabled=$withval,
438 minitasn1_enabled=no)
440 if test x$minitasn1_enabled = xno; then
441 AM_PATH_LIBTASN1($GNUTLS_LIBTASN1_VERSION,,
442 minitasn1_enabled=yes
445 *** LibtASN1 ${GNUTLS_LIBTASN1_VERSION} was not found. Will use the included one.
449 AC_MSG_CHECKING([whether to use the included minitasn1])
450 AC_MSG_RESULT($minitasn1_enabled)
452 AM_CONDITIONAL(ENABLE_MINITASN1, test "$minitasn1_enabled" = "yes")
454 dnl Check for libcfg+
457 AC_ARG_WITH(included-libcfg,
458 AS_HELP_STRING([--with-included-libcfg],
459 [use the included libcfg+ (certtool only)]),
460 libcfg_enabled=$withval,
462 dnl We search for libcfg+ which is used by certtool
464 AC_CHECK_LIB(cfg+, cfg_get_context,:,
468 *** Libcfg+ was not found. Will use the included one.]])))
470 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
473 AC_MSG_CHECKING([whether to use the included libcfg])
474 AC_MSG_RESULT($libcfg_enabled)
477 dnl CHECK FOR ZLIB SUPPORT
480 AC_MSG_CHECKING([whether to include zlib compression support])
483 AS_HELP_STRING([--without-zlib], [disable zlib compression support]),
487 if test x$ac_zlib != xno; then
489 AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
490 if test "$ac_cv_libz" != yes; then
493 *** ZLIB was not found. You will not be able to use ZLIB compression.)
501 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
507 AS_HELP_STRING([--without-lzo], [do not use lzo compression]),
511 AC_MSG_CHECKING([whether to include lzo compression support])
512 AC_MSG_RESULT($use_lzo)
514 if test x$use_lzo = xyes; then
515 AC_DEFINE(USE_LZO, 1, [whether to use the lzo compression])
517 AC_ARG_WITH(included-lzo,
518 AS_HELP_STRING([--with-included-lzo],
519 [include minilzo in libgnutls-extra]),
520 minilzo_enabled=$withval,
523 AC_MSG_CHECKING([whether to use the included lzo compression library])
524 AC_MSG_RESULT($minilzo_enabled)
527 if test "$minilzo_enabled" != "yes"; then
528 AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LIBS=-llzo2)
529 if test "$LZO_LIBS" = ""; then
530 AC_CHECK_LIB(lzo, lzo1x_1_compress, LZO_LIBS=-llzo, [
534 *** Could not find liblzo or liblzo2. Will use the included minilzo.
541 if test "$LZO_LIBS" = "-llzo"; then
542 AC_CHECK_HEADERS(lzo1x.h)
543 elif test "$LZO_LIBS" = "-llzo2"; then
544 AC_CHECK_HEADERS(lzo/lzo1x.h)
547 if test "$minilzo_enabled" = "yes"; then
548 AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
552 AM_CONDITIONAL(USE_LZO, test "$use_lzo" = "yes")
553 AM_CONDITIONAL(ENABLE_INCLUDED_LZO, test "$minilzo_enabled" = "yes")
555 if test "$minilzo_enabled" = "yes"; then
556 # See libextra/minilzo/README.LZO
557 AC_CHECK_TYPE(ptrdiff_t,long)
559 AC_CHECK_SIZEOF(short)
561 AC_CHECK_SIZEOF(long)
562 AC_CHECK_SIZEOF(long long)
563 AC_CHECK_SIZEOF(__int64)
564 AC_CHECK_SIZEOF(void *)
565 AC_CHECK_SIZEOF(size_t)
566 AC_CHECK_SIZEOF(ptrdiff_t)
568 AC_CHECK_FUNCS(memcmp memcpy memmove memset)
572 *** Setting up gnulib compatibility files...
577 AC_TRY_LINK([#include <winsock2.h>], [
578 WORD wVersionRequested = MAKEWORD(2, 2);
580 int err = WSAStartup(wVersionRequested, &wsaData);
581 WSACleanup ();], wsastartup=yes, wsastartup=no)
582 if test x$wsastartup = xyes; then
583 AC_DEFINE(HAVE_WINSOCK, 1, [Call WSAStartup in gnutls_global_init])
585 AC_MSG_CHECKING([if we have Windows sockets and WSAStartup/WSACleanup])
586 AC_MSG_RESULT($wsastartup)
589 *** Detecting options for shared libraries...
594 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBTASN1_LIBS $LIBGCRYPT_LIBS $LIBS"
595 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS $LIBTASN1_CFLAGS -I${includedir}"
596 AC_SUBST(LIBGNUTLS_LIBS)
597 AC_SUBST(LIBGNUTLS_CFLAGS)
599 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra $LTLIBOPENCDK $LZO_LIBS $LIBGNUTLS_LIBS"
600 LIBGNUTLS_EXTRA_CFLAGS="$INCOPENCDK -I${includedir}"
601 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
602 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
605 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
607 if test $ac_cv_c_compiler_gnu != no; then
608 if test x$opt_profiler_mode = xyes; then
609 AC_CHECK_PROG(FC_OK, fc-config, yes, no)
610 if test x$FC_OK = xyes; then
611 CFLAGS="${CFLAGS} `fc-config --cflags`"
612 LIBS="$LIBS `fc-config --libs`"
615 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
621 if test $ac_full -eq 0; then
622 AC_SUBST(POSSIBLY_WARN_ABOUT_MISSING_FEATURES, [[
624 #warning This is not the official GnuTLS library. Several features were disabled at compilation.
625 #endif /* __GNUC__ */]])
628 AC_CONFIG_COMMANDS([chmod-config],[[
629 chmod +x lib/libgnutls-config
630 chmod +x libextra/libgnutls-extra-config
633 AC_CONFIG_FILES([Makefile po/Makefile.in \
634 doc/Makefile doc/examples/Makefile doc/scripts/Makefile \
635 doc/manpages/Makefile doc/reference/Makefile \
636 gl/Makefile lgl/Makefile \
637 tests/Makefile tests/rsa-md5-collision/Makefile tests/userid/Makefile \
638 tests/pkcs1-padding/Makefile tests/pkcs8-decode/Makefile \
639 tests/pkcs12-decode/Makefile tests/pathlen/Makefile \
640 tests/key-id/Makefile tests/sha2/Makefile \
641 tests/hostname-check/Makefile \
642 includes/Makefile includes/gnutls/gnutls.h \
643 lib/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
644 libextra/Makefile libextra/openpgp/Makefile libextra/opencdk/Makefile \
645 libextra/minilzo/Makefile \
646 src/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
647 src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
648 lib/libgnutls-config libextra/libgnutls-extra-config \
649 lib/gnutls.pc libextra/gnutls-extra.pc])