1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000-2012 Free Software Foundation, Inc.
4 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
6 # This file is part of GnuTLS.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24 AC_INIT([GnuTLS], [3.1.2], [bug-gnutls@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
26 AC_CONFIG_MACRO_DIR([m4])
28 AM_INIT_AUTOMAKE([1.11.3 no-dist-gzip dist-xz dist-lzip -Wall -Werror -Wno-override])
29 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
30 AM_CONFIG_HEADER(config.h)
33 *** Checking for compilation programs...
36 dnl Checks for programs.
42 # For includes/gnutls/gnutls.h.in.
43 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
44 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
45 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
46 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
48 touch suppressions.valgrind
49 dnl C and C++ capabilities
55 AS_HELP_STRING([--disable-cxx], [unconditionally disable the C++ library]),
56 use_cxx=$enableval, use_cxx=yes)
57 if test "$use_cxx" != "no"; then
59 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
62 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
63 AM_CONDITIONAL(WANT_TEST_SUITE, [test -f tests/suite/mini-eagain2.c])
65 dnl Detect windows build
67 *mingw32* | *mingw64*)
78 AM_CONDITIONAL(WINDOWS, test "$have_win" = yes)
79 AM_CONDITIONAL(MACOSX, test "$have_macosx" = yes)
80 AM_CONDITIONAL(ELF, test "$have_elf" = yes)
82 dnl Hardware Acceleration
83 AC_ARG_ENABLE(hardware-acceleration,
84 AS_HELP_STRING([--disable-hardware-acceleration], [unconditionally disable hardware acceleration]),
85 use_accel=$enableval, use_accel=yes)
89 if test "$use_accel" != "no"; then
91 i?86 | x86_64 | amd64)
92 dnl GCC_FLAG_ADD([-maes -mpclmul],[X86])
93 dnl if test "x$X86" = "xyes";then
94 AC_CHECK_HEADERS(cpuid.h)
95 if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"; then
108 AM_CONDITIONAL(ASM_X86_64, test x"$hw_accel" = x"x86-64")
109 AM_CONDITIONAL(ASM_X86_32, test x"$hw_accel" = x"x86")
110 AM_CONDITIONAL(ASM_X86, test x"$hw_accel" = x"x86" || test x"$hw_accel" = x"x86-64")
111 AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"])
112 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes")
116 LIBGNUTLS_EXTRA_HOOKS
121 AM_GNU_GETTEXT([external])
122 AM_GNU_GETTEXT_VERSION([0.18])
128 dnl GCC warnings to enable
130 AC_ARG_ENABLE([gcc-warnings],
131 [AS_HELP_STRING([--enable-gcc-warnings],
132 [turn on lots of GCC warnings (for developers)])],
135 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
137 gl_gcc_warnings=$enableval],
141 if test "$gl_gcc_warnings" = yes; then
142 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
143 gl_WARN_ADD([-Wframe-larger-than=5120], [WSTACK_CFLAGS])
145 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
146 nw="$nw -Wc++-compat" # We don't care about C++ compilers
147 nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
148 nw="$nw -Wtraditional" # Warns on #elif which we use often
149 nw="$nw -Wlogical-op" # Too many false positives
150 nw="$nw -Wold-style-definition" #
151 nw="$nw -Wpadded" # Our structs are not padded
152 nw="$nw -Wunreachable-code" # Too many false positives
153 nw="$nw -Wtraditional-conversion" # Too many warnings for now
154 nw="$nw -Wcast-qual" # Too many warnings for now
155 nw="$nw -Waggregate-return" # Too many warnings for now
156 nw="$nw -Wshadow" # Too many warnings for now
157 nw="$nw -Wswitch-default" # Too many warnings for now
158 nw="$nw -Wswitch-enum" # Too many warnings for now
159 nw="$nw -Wconversion" # Too many warnings for now
160 nw="$nw -Wsign-conversion" # Too many warnings for now
161 nw="$nw -Wformat-y2k" # Too many warnings for now
162 nw="$nw -Woverlength-strings" # We use some in tests/
163 nw="$nw -Wvla" # There is no point to avoid C99 variable length arrays
164 nw="$nw -Wformat-nonliteral" # Incompatible with gettext _()
165 nw="$nw -Wunsafe-loop-optimizations"
166 nw="$nw -Wstrict-overflow"
167 nw="$nw -Wmissing-noreturn"
168 nw="$nw -Winline" # Too compiler dependent
169 nw="$nw -Wsuggest-attribute=pure" # Is it worth using attributes?
170 nw="$nw -Wsuggest-attribute=const" # Is it worth using attributes?
171 nw="$nw -Wsuggest-attribute=noreturn" # Is it worth using attributes?
172 nw="$nw -Wstack-protector" # Some functions cannot be protected
173 nw="$nw -Wredundant-decls" # Some files cannot be compiled with that (gl_fd_to_handle)
175 gl_MANYWARN_ALL_GCC([ws])
176 gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
181 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
182 gl_WARN_ADD([-Wno-format-y2k]) # Too many warnings for now
183 gl_WARN_ADD([-Wno-unused-value]) # warnings for things we don't want to get
184 gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
185 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
186 gl_WARN_ADD([-Wno-stack-protector]) # Some functions cannot be protected
187 gl_WARN_ADD([-Wno-int-to-pointer-cast]) # Some files cannot be compiled with that (gl_fd_to_handle)
188 gl_WARN_ADD([-fdiagnostics-show-option])
191 AC_SUBST([WERROR_CFLAGS])
192 AC_SUBST([WSTACK_CFLAGS])
193 AC_SUBST([WARN_CFLAGS])
195 dnl Programs for compilation or development
201 dnl No fork on MinGW, disable some self-tests until we fix them.
202 AC_CHECK_FUNCS([fork getrusage getpwuid_r daemon],,)
203 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
204 AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
206 AC_MSG_CHECKING([whether to build libdane])
207 AC_ARG_ENABLE(libdane,
208 AS_HELP_STRING([--disable-libdane],
209 [disable the built of libdane]),
210 enable_dane=$enableval, enable_dane=yes)
211 AC_MSG_RESULT($enable_dane)
213 if test "$enable_dane" != "no"; then
214 LIBS="$oldlibs -lunbound"
215 AC_MSG_CHECKING([for unbound library])
216 AC_LINK_IFELSE([AC_LANG_PROGRAM([
217 #include <unbound.h>],[
219 ctx = ub_ctx_create();])],
221 AC_SUBST([UNBOUND_LIBS], [-lunbound])
222 AC_SUBST([UNBOUND_CFLAGS], [])
223 AC_DEFINE([HAVE_DANE], 1, [Enable the DANE library])
228 *** libunbound was not found. Libdane will not be built.
234 AM_CONDITIONAL(ENABLE_DANE, test "$enable_dane" = "yes")
236 AC_ARG_WITH(unbound-root-key-file, AS_HELP_STRING([--with-unbound-root-key-file],
237 [specify the unbound root key file]),
238 unbound_root_key_file="$withval",
239 if test "$have_win" = yes; then
240 unbound_root_key_file="C:\\Program Files\\Unbound\\root.key"
242 unbound_root_key_file="/etc/unbound/root.key"
246 AC_DEFINE_UNQUOTED([UNBOUND_ROOT_KEY_FILE],
247 ["$unbound_root_key_file"], [The DNSSEC root key file])
250 dnl Check for p11-kit
252 AS_HELP_STRING([--without-p11-kit],
253 [Build without p11-kit and PKCS#11 support]))
254 if test "$with_p11_kit" != "no"; then
255 PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= 0.11], [with_p11_kit=yes], [with_p11_kit=no])
256 if test "$with_p11_kit" != "no";then
257 AC_DEFINE([ENABLE_PKCS11], 1, [Build PKCS#11 support])
258 if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
259 GNUTLS_REQUIRES_PRIVATE="Requires.private: p11-kit-1"
261 GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
267 *** p11-kit was not found. PKCS #11 support will be disabled.
268 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
273 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
276 AS_HELP_STRING([--without-tpm],
277 [Build without TPM (trousers) support]))
278 if test "$with_tpm" != "no"; then
279 LIBS="$oldlibs -ltspi"
280 AC_MSG_CHECKING([for tss library])
281 AC_LINK_IFELSE([AC_LANG_PROGRAM([
282 #include <trousers/tss.h>
283 #include <trousers/trousers.h>],[
284 int err = Tspi_Context_Create((void *)0);
285 Trspi_Error_String(err);])],
287 AC_SUBST([TSS_LIBS], [-ltspi])
288 AC_SUBST([TSS_CFLAGS], [])
289 AC_DEFINE([HAVE_TROUSERS], 1, [Enable TPM])
294 *** trousers was not found. TPM support will be disabled.
300 AM_CONDITIONAL(ENABLE_TROUSERS, test "$with_tpm" != "no")
302 enable_local_libopts=yes
303 dnl PKG_CHECK_MODULES([autoopts], autoopts >= 36.2.11,, [enable_local_libopts=yes])
305 NEED_LIBOPTS_DIR=true
306 LIBOPTS_CHECK([src/libopts])
308 AC_CHECK_TYPE(ssize_t,
310 DEFINE_SSIZE_T="#include <sys/types.h>"
311 AC_SUBST(DEFINE_SSIZE_T)
313 AC_DEFINE([NO_SSIZE_T], 1, [no ssize_t type was found])
314 DEFINE_SSIZE_T="typedef int ssize_t;"
315 AC_SUBST(DEFINE_SSIZE_T)
317 #include <sys/types.h>
321 AC_CHECK_SIZEOF(unsigned long int, 4)
322 AC_CHECK_SIZEOF(unsigned int, 4)
324 AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
325 [disable zlib compression support]),
326 ac_zlib=$withval, ac_zlib=yes)
327 AC_MSG_CHECKING([whether to include zlib compression support])
328 if test x$ac_zlib != xno; then
330 AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
331 if test x$ac_cv_libz != xyes; then
334 *** ZLIB was not found. You will not be able to use ZLIB compression.)
340 PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
342 if test x$ac_zlib != xno; then
343 if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
344 if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
345 GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
347 GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE, zlib"
350 GNUTLS_ZLIB_LIBS_PRIVATE="$LTLIBZ"
353 AC_SUBST(GNUTLS_REQUIRES_PRIVATE)
354 AC_SUBST(GNUTLS_ZLIB_LIBS_PRIVATE)
359 AC_ARG_WITH([default-trust-store-pkcs11],
360 [AS_HELP_STRING([--with-default-trust-store-pkcs11=URI],
361 [use the given pkcs11 uri as default trust store])])
363 if test "x$with_default_trust_store_pkcs11" != x; then
364 if test "x$with_p11_kit" = xno; then
365 AC_MSG_ERROR([cannot use pkcs11 store without p11-kit])
367 AC_DEFINE_UNQUOTED([DEFAULT_TRUST_STORE_PKCS11],
368 ["$with_default_trust_store_pkcs11"], [use the given pkcs11 uri as default trust store])
371 AC_ARG_WITH([default-trust-store-file],
372 [AS_HELP_STRING([--with-default-trust-store-file=FILE],
373 [use the given file default trust store])])
375 AC_ARG_WITH([default-crl-file],
376 [AS_HELP_STRING([--with-default-crl-file=FILE],
377 [use the given CRL file as default])])
379 if test "x$with_default_trust_store_pkcs11" = x -a "x$with_default_trust_store_file" = x; then
380 # auto detect http://lists.gnu.org/archive/html/help-gnutls/2012-05/msg00004.html
382 /etc/ssl/certs/ca-certificates.crt \
383 /etc/pki/tls/cert.pem \
384 /usr/local/share/certs/ca-root-nss.crt \
388 with_default_trust_store_file="$i"
394 if test "x$with_default_trust_store_file" != x; then
395 AC_DEFINE_UNQUOTED([DEFAULT_TRUST_STORE_FILE],
396 ["$with_default_trust_store_file"], [use the given file default trust store])
399 if test "x$with_default_crl_file" != x; then
400 AC_DEFINE_UNQUOTED([DEFAULT_CRL_FILE],
401 ["$with_default_crl_file"], [use the given CRL file])
405 opt_guile_bindings=yes
406 AC_MSG_CHECKING([whether building Guile bindings])
408 AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
409 opt_guile_bindings=$enableval)
410 AC_MSG_RESULT($opt_guile_bindings)
412 AC_ARG_WITH([--with-guile-site-dir],
413 [AS_HELP_STRING([--with-guile-site-dir],
414 [use the given directory as the Guile site (use with care)])])
416 if test "$opt_guile_bindings" = "yes"; then
418 *** Detecting GNU Guile...
421 AC_PATH_PROG([guile_snarf], [guile-snarf])
422 if test "x$guile_snarf" = "x"; then
423 AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found. Guile bindings not built.])
424 opt_guile_bindings=no
429 save_CFLAGS="$CFLAGS"
431 CFLAGS="$CFLAGS $GUILE_CFLAGS"
432 LIBS="$LIBS $GUILE_LDFLAGS"
433 AC_MSG_CHECKING([whether GNU Guile is recent enough])
434 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [scm_from_locale_string ("")])],
435 [], [opt_guile_bindings=no])
436 CFLAGS="$save_CFLAGS"
439 if test "$opt_guile_bindings" = "yes"; then
441 case "x$with_guile_site_dir" in
443 # Use the default $(GUILE_SITE).
447 # Automatically derive $(GUILE_SITE) from $(pkgdatadir). This
448 # hack is used to allow `distcheck' to work (see
449 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
450 GUILE_SITE="\$(datadir)/guile/site"
454 # Use the user-specified directory as $(GUILE_SITE).
455 GUILE_SITE="$with_guile_site_dir"
459 AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
460 _gcc_cflags_save="$CFLAGS"
461 CFLAGS="${CFLAGS} -fgnu89-inline"
462 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
463 gnu89_inline=yes, gnu89_inline=no)
464 AC_MSG_RESULT($gnu89_inline)
465 CFLAGS="$_gcc_cflags_save"
467 # Optional Guile functions.
468 save_CFLAGS="$CFLAGS"
470 CFLAGS="$CFLAGS $GUILE_CFLAGS"
471 LIBS="$LIBS $GUILE_LDFLAGS"
472 AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
473 CFLAGS="$save_CFLAGS"
476 # The place where guile-gnutls.la will go.
477 AC_MSG_CHECKING([the Guile effective version])
478 guile_effective_version="`$GUILE -c '(display (effective-version))'`"
479 AC_MSG_RESULT([$guile_effective_version])
480 guileextensiondir="$libdir/guile/$guile_effective_version"
481 AC_SUBST([guileextensiondir])
484 AC_MSG_WARN([A sufficiently recent GNU Guile not found. Guile bindings not built.])
485 opt_guile_bindings=no
489 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
491 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
492 LIBGNUTLS_CFLAGS="-I${includedir}"
493 AC_SUBST(LIBGNUTLS_LIBS)
494 AC_SUBST(LIBGNUTLS_CFLAGS)
497 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
498 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
500 AC_DEFINE([fread_file], [_gnutls_fread_file], [static lib rename])
501 AC_DEFINE([read_file], [_gnutls_read_file], [static lib rename])
502 AC_DEFINE([read_binary_file], [_gnutls_read_binary_file], [static lib rename])
504 dnl Crywrap dependencies
506 *** Checking dependencies for crywrap...
511 if test "$have_win" != "yes"; then
513 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/select.h sys/types.h sys/wait.h])
515 dnl **********************
517 dnl **********************
518 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
519 [AC_LANG_PROGRAM([#include <sys/types.h>
522 [return *(signal (0, 0)) (0) == 1;])],
523 [ac_cv_type_signal=int],
524 [ac_cv_type_signal=void])])
525 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
528 AC_FUNC_SELECT_ARGTYPES
529 AC_CHECK_FUNCS([alarm atexit dup2 epoll_create kqueue memchr memset munmap \
530 putenv regcomp scandir select socket strcasecmp strchr \
531 strdup strerror strncasecmp strrchr strstr strtoul uname])
533 AC_ARG_ENABLE(crywrap,
534 AS_HELP_STRING([--disable-crywrap], [unconditionally disable the crywrap TLS proxy service]))
538 if test "x$enable_crywrap" != "xno" ; then
539 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
542 if test "x$libidn" != "xno" && test "$ac_cv_func_daemon" != "no";then
548 AM_CONDITIONAL(ENABLE_CRYWRAP, test "x$crywrap" != "xno")
549 rm -f suppressions.valgrind
550 dnl end of crywrap requirements
552 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
556 doc/credentials/Makefile
557 doc/credentials/openpgp/Makefile
558 doc/credentials/srp/Makefile
559 doc/credentials/x509/Makefile
562 doc/examples/Makefile
564 doc/manpages/Makefile
565 doc/reference/Makefile
566 doc/reference/version.xml
569 extra/includes/Makefile
571 libdane/includes/Makefile
575 guile/modules/Makefile
579 lib/accelerated/Makefile
580 lib/accelerated/x86/Makefile
581 lib/algorithms/Makefile
586 lib/includes/Makefile
587 lib/includes/gnutls/gnutls.h
588 lib/minitasn1/Makefile
597 tests/cert-tests/Makefile
602 tests/key-id/Makefile
603 tests/openpgp-certs/Makefile
604 tests/pkcs1-padding/Makefile
605 tests/pkcs12-decode/Makefile
606 tests/pkcs8-decode/Makefile
607 tests/rsa-md5-collision/Makefile
608 tests/safe-renegotiation/Makefile
609 tests/scripts/Makefile
613 tests/userid/Makefile
618 AC_MSG_NOTICE([summary of build options:
620 version: ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
622 Install prefix: ${prefix}
625 Warning flags: errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
626 Library types: Shared=${enable_shared}, Static=${enable_static}
627 Valgrind: $opt_valgrind_tests ${VALGRIND}
630 AC_MSG_NOTICE([Hardware acceleration/support:
632 /dev/crypto: $enable_cryptodev
633 Hardware accel: $hw_accel
634 PKCS#11 support: $with_p11_kit
635 TPM support: $with_tpm
638 AC_MSG_NOTICE([Optional features:
639 (note that included applications might not compile properly
640 if features are disabled)
642 OCSP support: $ac_enable_ocsp
643 OpenPGP support: $ac_enable_openpgp
644 SRP support: $ac_enable_srp
645 PSK support: $ac_enable_psk
646 Anon auth support:$ac_enable_anon
649 AC_MSG_NOTICE([Optional applications:
652 local libopts: $enable_local_libopts
655 AC_MSG_NOTICE([Optional libraries:
657 Guile wrappers: $opt_guile_bindings
658 C++ library: $use_cxx
659 DANE library: $enable_dane
660 OpenSSL compat: $enable_openssl
663 AC_MSG_NOTICE([System files:
665 Trust store pkcs: $with_default_trust_store_pkcs11
666 Trust store file: $with_default_trust_store_file
667 CRL file: $with_default_crl_file
668 DNSSEC root key file: $unbound_root_key_file
671 if test ! -f "$unbound_root_key_file"; then
674 *** The DNSSEC root key file in $unbound_root_key_file was not found.
675 *** This file is needed for the verification of DNSSEC responses.
676 *** Use the command: unbound-anchor -a "$unbound_root_key_file"
677 *** to generate or update it.