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.0.23], [bug-gnutls@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
26 AC_CONFIG_MACRO_DIR([m4])
28 AM_INIT_AUTOMAKE([1.11 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
119 AM_GNU_GETTEXT([external])
120 AM_GNU_GETTEXT_VERSION([0.18])
126 dnl No fork on MinGW, disable some self-tests until we fix them.
127 AC_CHECK_FUNCS([fork getrusage getpwuid_r daemon],,)
128 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
129 AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
131 dnl Check for p11-kit
133 AS_HELP_STRING([--without-p11-kit],
134 [Build without p11-kit and PKCS#11 support]))
135 if test "$with_p11_kit" != "no"; then
136 PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= 0.11], [with_p11_kit=yes], [with_p11_kit=no])
137 if test "$with_p11_kit" != "no";then
138 AC_DEFINE([ENABLE_PKCS11], 1, [Build PKCS#11 support])
139 if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
140 GNUTLS_REQUIRES_PRIVATE="Requires.private: p11-kit-1"
142 GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
148 *** p11-kit was not found. PKCS #11 support will be disabled.
149 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
154 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
156 enable_local_libopts=yes
157 dnl PKG_CHECK_MODULES([autoopts], autoopts >= 36.2.11,, [enable_local_libopts=yes])
159 NEED_LIBOPTS_DIR=true
160 LIBOPTS_CHECK([src/libopts])
162 AC_CHECK_TYPE(ssize_t,
164 DEFINE_SSIZE_T="#include <sys/types.h>"
165 AC_SUBST(DEFINE_SSIZE_T)
167 AC_DEFINE([NO_SSIZE_T], 1, [no ssize_t type was found])
168 DEFINE_SSIZE_T="typedef int ssize_t;"
169 AC_SUBST(DEFINE_SSIZE_T)
171 #include <sys/types.h>
175 AC_CHECK_SIZEOF(unsigned long int, 4)
176 AC_CHECK_SIZEOF(unsigned int, 4)
178 AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
179 [disable zlib compression support]),
180 ac_zlib=$withval, ac_zlib=yes)
181 AC_MSG_CHECKING([whether to include zlib compression support])
182 if test x$ac_zlib != xno; then
184 AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
185 if test x$ac_cv_libz != xyes; then
188 *** ZLIB was not found. You will not be able to use ZLIB compression.)
194 PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
196 if test x$ac_zlib != xno; then
197 if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
198 if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
199 GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
201 GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE, zlib"
204 GNUTLS_ZLIB_LIBS_PRIVATE="$LTLIBZ"
207 AC_SUBST(GNUTLS_REQUIRES_PRIVATE)
208 AC_SUBST(GNUTLS_ZLIB_LIBS_PRIVATE)
213 dnl GCC warnings to enable
215 AC_ARG_ENABLE([gcc-warnings],
216 [AS_HELP_STRING([--enable-gcc-warnings],
217 [turn on lots of GCC warnings (for developers)])],
220 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
222 gl_gcc_warnings=$enableval],
226 if test "$gl_gcc_warnings" = yes; then
227 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
228 gl_WARN_ADD([-Wframe-larger-than=5120], [WSTACK_CFLAGS])
230 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
231 nw="$nw -Wc++-compat" # We don't care about C++ compilers
232 nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
233 nw="$nw -Wtraditional" # Warns on #elif which we use often
234 nw="$nw -Wlogical-op" # Too many false positives
235 nw="$nw -Wold-style-definition" #
236 nw="$nw -Wpadded" # Our structs are not padded
237 nw="$nw -Wunreachable-code" # Too many false positives
238 nw="$nw -Wtraditional-conversion" # Too many warnings for now
239 nw="$nw -Wcast-qual" # Too many warnings for now
240 nw="$nw -Waggregate-return" # Too many warnings for now
241 nw="$nw -Wshadow" # Too many warnings for now
242 nw="$nw -Wswitch-default" # Too many warnings for now
243 nw="$nw -Wswitch-enum" # Too many warnings for now
244 nw="$nw -Wconversion" # Too many warnings for now
245 nw="$nw -Wsign-conversion" # Too many warnings for now
246 nw="$nw -Wformat-y2k" # Too many warnings for now
247 nw="$nw -Woverlength-strings" # We use some in tests/
248 nw="$nw -Wvla" # There is no point to avoid C99 variable length arrays
249 nw="$nw -Wformat-nonliteral" # Incompatible with gettext _()
250 nw="$nw -Wunsafe-loop-optimizations"
251 nw="$nw -Wstrict-overflow"
252 nw="$nw -Wmissing-noreturn"
254 gl_MANYWARN_ALL_GCC([ws])
255 gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
260 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
261 gl_WARN_ADD([-Wno-format-y2k]) # Too many warnings for now
262 gl_WARN_ADD([-Wno-suggest-attribute=pure]) # Too many warnings for now
263 gl_WARN_ADD([-Wno-suggest-attribute=const]) # Too many warnings for now
264 gl_WARN_ADD([-Wno-suggest-attribute=noreturn]) # Too many warnings for now
265 gl_WARN_ADD([-Wno-unused-value]) # warnings for things we don't want to get
266 gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
267 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
268 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
269 gl_WARN_ADD([-Wno-stack-protector]) # Some functions cannot be protected
270 gl_WARN_ADD([-Wno-int-to-pointer-cast]) # Some files cannot be compiled with that (gl_fd_to_handle)
271 gl_WARN_ADD([-Wno-redundant-decls]) # Some files cannot be compiled with that (gl_fd_to_handle)
272 gl_WARN_ADD([-fdiagnostics-show-option])
275 AC_SUBST([WERROR_CFLAGS])
276 AC_SUBST([WSTACK_CFLAGS])
277 AC_SUBST([WARN_CFLAGS])
279 dnl Programs for compilation or development
284 AC_ARG_WITH([default-trust-store-pkcs11],
285 [AS_HELP_STRING([--with-default-trust-store-pkcs11=URI],
286 [use the given pkcs11 uri as default trust store])])
288 if test "x$with_default_trust_store_pkcs11" != x; then
289 if test "x$with_p11_kit" = xno; then
290 AC_MSG_ERROR([cannot use pkcs11 store without p11-kit])
292 AC_DEFINE_UNQUOTED([DEFAULT_TRUST_STORE_PKCS11],
293 ["$with_default_trust_store_pkcs11"], [use the given pkcs11 uri as default trust store])
296 AC_ARG_WITH([default-trust-store-file],
297 [AS_HELP_STRING([--with-default-trust-store-file=FILE],
298 [use the given file default trust store])])
300 AC_ARG_WITH([default-crl-file],
301 [AS_HELP_STRING([--with-default-crl-file=FILE],
302 [use the given CRL file as default])])
304 if test "x$with_default_trust_store_pkcs11" = x -a "x$with_default_trust_store_file" = x; then
305 # auto detect http://lists.gnu.org/archive/html/help-gnutls/2012-05/msg00004.html
307 /etc/ssl/certs/ca-certificates.crt \
308 /etc/pki/tls/cert.pem \
309 /usr/local/share/certs/ca-root-nss.crt \
313 with_default_trust_store_file="$i"
319 if test "x$with_default_trust_store_file" != x; then
320 AC_DEFINE_UNQUOTED([DEFAULT_TRUST_STORE_FILE],
321 ["$with_default_trust_store_file"], [use the given file default trust store])
324 if test "x$with_default_crl_file" != x; then
325 AC_DEFINE_UNQUOTED([DEFAULT_CRL_FILE],
326 ["$with_default_crl_file"], [use the given CRL file])
330 opt_guile_bindings=yes
331 AC_MSG_CHECKING([whether building Guile bindings])
333 AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
334 opt_guile_bindings=$enableval)
335 AC_MSG_RESULT($opt_guile_bindings)
337 AC_ARG_WITH([--with-guile-site-dir],
338 [AS_HELP_STRING([--with-guile-site-dir],
339 [use the given directory as the Guile site (use with care)])])
341 if test "$opt_guile_bindings" = "yes"; then
343 *** Detecting GNU Guile...
346 AC_PATH_PROG([guile_snarf], [guile-snarf])
347 if test "x$guile_snarf" = "x"; then
348 AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found. Guile bindings not built.])
349 opt_guile_bindings=no
354 save_CFLAGS="$CFLAGS"
356 CFLAGS="$CFLAGS $GUILE_CFLAGS"
357 LIBS="$LIBS $GUILE_LDFLAGS"
358 AC_MSG_CHECKING([whether GNU Guile is recent enough])
359 AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
360 [], [opt_guile_bindings=no])
361 CFLAGS="$save_CFLAGS"
364 if test "$opt_guile_bindings" = "yes"; then
366 case "x$with_guile_site_dir" in
368 # Use the default $(GUILE_SITE).
372 # Automatically derive $(GUILE_SITE) from $(pkgdatadir). This
373 # hack is used to allow `distcheck' to work (see
374 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
375 GUILE_SITE="\$(datadir)/guile/site"
379 # Use the user-specified directory as $(GUILE_SITE).
380 GUILE_SITE="$with_guile_site_dir"
384 AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
385 _gcc_cflags_save="$CFLAGS"
386 CFLAGS="${CFLAGS} -fgnu89-inline"
387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
388 gnu89_inline=yes, gnu89_inline=no)
389 AC_MSG_RESULT($gnu89_inline)
390 CFLAGS="$_gcc_cflags_save"
392 # Optional Guile functions.
393 save_CFLAGS="$CFLAGS"
395 CFLAGS="$CFLAGS $GUILE_CFLAGS"
396 LIBS="$LIBS $GUILE_LDFLAGS"
397 AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
398 CFLAGS="$save_CFLAGS"
401 # The place where guile-gnutls.la will go.
402 AC_MSG_CHECKING([the Guile effective version])
403 guile_effective_version="`$GUILE -c '(display (effective-version))'`"
404 AC_MSG_RESULT([$guile_effective_version])
405 guileextensiondir="$libdir/guile/$guile_effective_version"
406 AC_SUBST([guileextensiondir])
409 AC_MSG_WARN([A sufficiently recent GNU Guile not found. Guile bindings not built.])
410 opt_guile_bindings=no
414 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
416 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
417 LIBGNUTLS_CFLAGS="-I${includedir}"
418 AC_SUBST(LIBGNUTLS_LIBS)
419 AC_SUBST(LIBGNUTLS_CFLAGS)
422 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
423 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
425 AC_DEFINE([fread_file], [_gnutls_fread_file], [static lib rename])
426 AC_DEFINE([read_file], [_gnutls_read_file], [static lib rename])
427 AC_DEFINE([read_binary_file], [_gnutls_read_binary_file], [static lib rename])
429 dnl Crywrap dependencies
431 *** Checking dependencies for crywrap...
436 if test "$have_win" != "yes"; then
438 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/select.h sys/types.h sys/wait.h])
440 dnl **********************
442 dnl **********************
443 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
444 [AC_LANG_PROGRAM([#include <sys/types.h>
447 [return *(signal (0, 0)) (0) == 1;])],
448 [ac_cv_type_signal=int],
449 [ac_cv_type_signal=void])])
450 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
453 AC_FUNC_SELECT_ARGTYPES
454 AC_CHECK_FUNCS([alarm atexit dup2 epoll_create kqueue memchr memset munmap \
455 putenv regcomp scandir select socket strcasecmp strchr \
456 strdup strerror strncasecmp strrchr strstr strtoul uname])
458 AC_ARG_ENABLE(crywrap,
459 AS_HELP_STRING([--disable-crywrap], [unconditionally disable the crywrap TLS proxy service]))
463 if test "x$enable_crywrap" != "xno" ; then
464 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
467 if test "x$libidn" != "xno" && test "$ac_cv_func_daemon" != "no";then
473 AM_CONDITIONAL(ENABLE_CRYWRAP, test "x$crywrap" != "xno")
474 rm -f suppressions.valgrind
475 dnl end of crywrap requirements
477 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
481 doc/credentials/Makefile
482 doc/credentials/openpgp/Makefile
483 doc/credentials/srp/Makefile
484 doc/credentials/x509/Makefile
487 doc/examples/Makefile
489 doc/manpages/Makefile
490 doc/reference/Makefile
491 doc/reference/version.xml
494 extra/includes/Makefile
498 guile/modules/Makefile
502 lib/accelerated/Makefile
503 lib/accelerated/x86/Makefile
504 lib/algorithms/Makefile
509 lib/includes/Makefile
510 lib/includes/gnutls/gnutls.h
511 lib/minitasn1/Makefile
520 tests/cert-tests/Makefile
525 tests/key-id/Makefile
526 tests/openpgp-certs/Makefile
527 tests/pkcs1-padding/Makefile
528 tests/pkcs12-decode/Makefile
529 tests/pkcs8-decode/Makefile
530 tests/rsa-md5-collision/Makefile
531 tests/safe-renegotiation/Makefile
532 tests/scripts/Makefile
536 tests/userid/Makefile
541 AC_MSG_NOTICE([summary of build options:
543 version: ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
545 Install prefix: ${prefix}
548 Warning flags: errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
549 Library types: Shared=${enable_shared}, Static=${enable_static}
550 Valgrind: $opt_valgrind_tests ${VALGRIND}
553 AC_MSG_NOTICE([Optional features:
554 (note that included applications might not compile properly
555 if features are disabled)
557 OCSP support: $ac_enable_ocsp
558 OpenPGP support: $ac_enable_openpgp
559 SRP support: $ac_enable_srp
560 PSK support: $ac_enable_psk
561 Anon auth support:$ac_enable_anon
563 Trust store pkcs: $with_default_trust_store_pkcs11
564 Trust store file: $with_default_trust_store_file
565 CRL file: $with_default_crl_file
568 AC_MSG_NOTICE([Optional applications:
571 local libopts: $enable_local_libopts
574 AC_MSG_NOTICE([Optional libraries:
576 Guile wrappers: $opt_guile_bindings
577 C++ library: $use_cxx
578 OpenSSL compat: $enable_openssl
581 AC_MSG_NOTICE([Hardware acceleration/support:
583 /dev/crypto: $enable_cryptodev
584 Hardware accel: $hw_accel
585 PKCS#11 support: $with_p11_kit