session tickets can be disabled
[gnutls:gnutls.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000-2012 Free Software Foundation, Inc.
3 #
4 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
5 #
6 # This file is part of GnuTLS.
7 #
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.
12 #
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.
17 #
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
21 # USA
22
23 AC_PREREQ(2.61)
24 AC_INIT([GnuTLS], [3.3.0], [bugs@gnutls.org])
25 AC_CONFIG_AUX_DIR([build-aux])
26 AC_CONFIG_MACRO_DIR([m4])
27 AC_CANONICAL_HOST
28
29 AM_INIT_AUTOMAKE([1.12.2 subdir-objects no-dist-gzip dist-xz dist-lzip -Wall -Wno-override])
30 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 AC_CONFIG_HEADERS([config.h])
32
33 AC_MSG_RESULT([***
34 *** Checking for compilation programs...
35 ])
36
37 dnl Checks for programs.
38 AC_PROG_CC
39 gl_EARLY
40 ggl_EARLY
41 AM_PROG_AS
42 AM_PROG_AR
43 AC_PROG_CXX
44 AM_PROG_CC_C_O
45 AC_PROG_YACC
46 AC_CHECK_PROG([AUTOGEN], [autogen], [autogen], [/bin/true])
47
48 if test x"$AUTOGEN" = "x/bin/true"; then
49   AC_MSG_WARN([[
50 ***
51 *** autogen not found. Will not link against libopts.
52 *** ]])
53 enable_local_libopts=yes
54 fi
55
56 # For includes/gnutls/gnutls.h.in.
57 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
58 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
59 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
60 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
61
62 touch suppressions.valgrind
63 dnl C and C++ capabilities
64 AC_C_INLINE
65 AC_HEADER_STDC
66
67 # For the C++ code
68 AC_ARG_ENABLE(cxx,
69   AS_HELP_STRING([--disable-cxx], [unconditionally disable the C++ library]),
70     use_cxx=$enableval, use_cxx=yes)
71 if test "$use_cxx" != "no"; then
72   AC_LANG_PUSH(C++)
73   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
74   AC_LANG_POP(C++)
75 fi
76 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
77 AM_CONDITIONAL(WANT_TEST_SUITE, [test -f tests/suite/mini-eagain2.c])
78
79 dnl Detect windows build
80 case "$host" in
81   *mingw32* | *mingw64*)
82     have_win=yes
83   ;;
84   *darwin*)
85     have_macosx=yes
86   ;;
87   *)
88     have_elf=yes
89   ;;
90 esac
91
92 AM_CONDITIONAL(WINDOWS, test "$have_win" = yes)
93 AM_CONDITIONAL(MACOSX, test "$have_macosx" = yes)
94 AM_CONDITIONAL(ELF, test "$have_elf" = yes)
95
96 dnl Hardware Acceleration
97 AC_ARG_ENABLE(hardware-acceleration,
98   AS_HELP_STRING([--disable-hardware-acceleration], [unconditionally disable hardware acceleration]),
99     use_accel=$enableval, use_accel=yes)
100 hw_accel=none
101
102
103 if test "$use_accel" != "no"; then
104 case $host_cpu in
105   i?86 | x86_64 | amd64)
106       AC_CHECK_HEADERS(cpuid.h)
107       if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"; then
108         hw_accel="x86-64"
109       else
110         hw_accel="x86"
111       fi
112   ;;
113   *)
114   ;;
115 esac
116
117 fi
118
119 AM_CONDITIONAL(ASM_X86_64, test x"$hw_accel" = x"x86-64")
120 AM_CONDITIONAL(ASM_X86_32, test x"$hw_accel" = x"x86")
121 AM_CONDITIONAL(ASM_X86, test x"$hw_accel" = x"x86" || test x"$hw_accel" = x"x86-64")
122 AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"])
123 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes")
124
125
126 dnl Try the hooks.m4
127 LIBGNUTLS_HOOKS
128 LIBGNUTLS_EXTRA_HOOKS
129
130 AC_ARG_ENABLE(doc,
131   AS_HELP_STRING([--disable-doc], [don't generate any documentation]),
132     enable_doc=$enableval, enable_doc=yes)
133 AM_CONDITIONAL(ENABLE_DOC, test "$enable_doc" != "no")
134
135 AC_ARG_ENABLE(tests,
136   AS_HELP_STRING([--disable-tests], [don't compile or run any tests]),
137     enable_tests=$enableval, enable_tests=yes)
138 AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" != "no")
139
140 GTK_DOC_CHECK(1.1)
141 AM_GNU_GETTEXT([external])
142 AM_GNU_GETTEXT_VERSION([0.18])
143
144 AC_C_BIGENDIAN
145
146 dnl No fork on MinGW, disable some self-tests until we fix them.
147 dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs)
148 AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime pthread_mutex_lock iconv localtime vasprintf],,)
149 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
150
151 AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>
152 #include <signal.h>
153 ], [timer_create (0,0,0);])
154
155 if test "$ac_cv_func_pthread_mutex_lock" != "yes";then
156   AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
157 fi
158
159 if test "$ac_cv_func_nanosleep" != "yes";then
160   AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>], [nanosleep (0, 0);])
161   gnutls_needs_librt=yes
162 fi
163
164 if test "$ac_cv_func_clock_gettime" != "yes";then
165   AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>], [clock_gettime (0, 0);])
166   gnutls_needs_librt=yes
167 fi
168
169 ac_have_unicode=no
170 if test "$ac_cv_func_iconv" != "yes";then
171   AC_LIB_HAVE_LINKFLAGS(iconv,, [#include <iconv.h>], [iconv (0, 0, 0, 0, 0);])
172   if test "$HAVE_LIBICONV" = "yes";then
173     ac_have_unicode=yes
174   fi
175 else
176   ac_have_unicode=yes
177 fi
178
179 if test "$ac_have_unicode" != "yes";then
180   if test "$have_win" = "yes";then
181     ac_have_unicode=yes
182   fi
183 fi
184
185 dnl Note that g*l_INIT are run after we check for library capabilities,
186 dnl to prevent issues from caching lib dependencies. See discussion
187 dnl in https://bugs.gentoo.org/show_bug.cgi?id=494940 and
188 dnl http://gnu-autoconf.7623.n7.nabble.com/Correct-way-to-check-for-clock-gettime-td12276.html
189 gl_INIT
190 ggl_INIT
191
192 dnl GCC warnings to enable
193
194 AC_ARG_ENABLE([gcc-warnings],
195   [AS_HELP_STRING([--enable-gcc-warnings],
196                   [turn on lots of GCC warnings (for developers)])],
197   [case $enableval in
198      yes|no) ;;
199      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
200    esac
201    gl_gcc_warnings=$enableval],
202   [gl_gcc_warnings=no]
203 )
204
205 if test "$gl_gcc_warnings" = yes; then
206   gl_WARN_ADD([-Wframe-larger-than=1024], [WSTACK_CFLAGS])
207
208   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
209   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
210   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
211   nw="$nw -Wtraditional"            # Warns on #elif which we use often
212   nw="$nw -Wlogical-op"             # Too many false positives
213   nw="$nw -Wold-style-definition"   # 
214   nw="$nw -Wpadded"                 # Our structs are not padded
215   nw="$nw -Wunreachable-code"       # Too many false positives
216   nw="$nw -Wtraditional-conversion" # Too many warnings for now
217   nw="$nw -Wcast-qual"              # Too many warnings for now
218   nw="$nw -Waggregate-return"       # Too many warnings for now
219   nw="$nw -Wshadow"                 # Too many warnings for now
220   nw="$nw -Wswitch-default"         # Too many warnings for now
221   nw="$nw -Wswitch-enum"            # Too many warnings for now
222   nw="$nw -Wconversion"             # Too many warnings for now
223   nw="$nw -Wsign-conversion"        # Too many warnings for now
224   nw="$nw -Wformat-y2k"             # Too many warnings for now
225   nw="$nw -Woverlength-strings"     # We use some in tests/
226   nw="$nw -Wvla"                    # There is no point to avoid C99 variable length arrays
227   nw="$nw -Wformat-nonliteral"      # Incompatible with gettext _()
228   nw="$nw -Wunsafe-loop-optimizations"
229   nw="$nw -Wstrict-overflow"
230   nw="$nw -Wmissing-noreturn"
231   nw="$nw -Winline"                 # Too compiler dependent
232   nw="$nw -Wsuggest-attribute=pure" # Is it worth using attributes?
233   nw="$nw -Wsuggest-attribute=const" # Is it worth using attributes?
234   nw="$nw -Wsuggest-attribute=noreturn" # Is it worth using attributes?
235   nw="$nw -Wstack-protector"        # Some functions cannot be protected
236   nw="$nw -Wredundant-decls"        # Some files cannot be compiled with that (gl_fd_to_handle)
237
238   gl_MANYWARN_ALL_GCC([ws])
239   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
240   for w in $ws; do
241     gl_WARN_ADD([$w])
242   done
243
244   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
245   gl_WARN_ADD([-Wno-format-y2k])     # Too many warnings for now
246   gl_WARN_ADD([-Wno-unused-value]) # warnings for things we don't want to get
247   gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
248   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
249   gl_WARN_ADD([-Wno-stack-protector])  # Some functions cannot be protected
250   gl_WARN_ADD([-Wno-int-to-pointer-cast])  # Some files cannot be compiled with that (gl_fd_to_handle)
251   gl_WARN_ADD([-fdiagnostics-show-option])
252 fi
253
254 AC_SUBST([WERROR_CFLAGS])
255 AC_SUBST([WSTACK_CFLAGS])
256 AC_SUBST([WARN_CFLAGS])
257
258 dnl Programs for compilation or development
259 AC_PROG_LN_S
260 LT_INIT([disable-static,win32-dll,shared])
261
262
263
264 AC_ARG_ENABLE(self-checks,
265   AS_HELP_STRING([--enable-self-checks], [enable self checking functionality]),
266     enable_self_checks=$enableval, enable_self_checks=no)
267
268 AC_ARG_ENABLE(fips140-mode,
269   AS_HELP_STRING([--enable-fips140-mode], [enable FIPS140-2 mode (implies self checks)]),
270     enable_fips=$enableval, enable_fips=no)
271 AM_CONDITIONAL(ENABLE_FIPS140, test "$enable_fips" = "yes")
272 if [ test "$enable_fips" = "yes" ];then
273   AC_LIB_HAVE_LINKFLAGS(dl,, [#include <dlfcn.h>], [dladdr (0, 0);])
274   if test "x$HAVE_LIBDL" = "xyes";then
275     enable_self_checks=yes
276
277     AC_DEFINE([ENABLE_FIPS140], 1, [Enable FIPS140-2 mode])
278
279     AC_SUBST([FIPS140_LIBS], $LIBDL)
280   else
281     enable_fips=no
282     AC_MSG_WARN([[
283 *** 
284 *** This system is not supported in FIPS140 mode.
285 *** libdl and dladdr() are required.
286 *** ]])
287   fi
288 fi
289
290 AC_ARG_ENABLE(non-suiteb-curves,
291   AS_HELP_STRING([--disable-non-suiteb-curves], [disable curves not in SuiteB]),
292     enable_non_suiteb=$enableval, enable_non_suiteb=yes)
293 if [ test "$enable_non_suiteb" = "yes" ];then
294   AC_DEFINE([ENABLE_NON_SUITEB_CURVES], 1, [Enable all curves])
295 fi
296
297 AM_CONDITIONAL(ENABLE_SELF_CHECKS, test "$enable_self_checks" = "yes")
298 if [ test "$enable_self_checks" = "yes" ];then
299    AC_DEFINE([ENABLE_SELF_CHECKS], 1, [Self checks are included in the library])
300 fi
301
302 AC_MSG_CHECKING([whether to build libdane])
303 AC_ARG_ENABLE(libdane,
304     AS_HELP_STRING([--disable-libdane],
305                    [disable the built of libdane]),
306     enable_dane=$enableval, enable_dane=yes)
307 AC_MSG_RESULT($enable_dane)
308
309 if test "$enable_dane" != "no"; then
310     LIBS="$oldlibs -lunbound"
311     AC_MSG_CHECKING([for unbound library])
312     AC_LINK_IFELSE([AC_LANG_PROGRAM([
313                    #include <unbound.h>],[
314                    struct ub_ctx* ctx;
315                    ctx = ub_ctx_create();])],
316                   [AC_MSG_RESULT(yes)
317                    AC_SUBST([UNBOUND_LIBS], [-lunbound])
318                    AC_SUBST([UNBOUND_CFLAGS], [])
319                    AC_DEFINE([HAVE_DANE], 1, [Enable the DANE library])
320                    enable_dane=yes],
321                   [AC_MSG_RESULT(no)
322                    AC_MSG_WARN([[
323 *** 
324 *** libunbound was not found. Libdane will not be built.
325 *** ]])
326                   enable_dane=no])
327     LIBS="$oldlibs"
328 fi
329
330 AM_CONDITIONAL(ENABLE_DANE, test "$enable_dane" = "yes")
331
332 AC_ARG_WITH(unbound-root-key-file, AS_HELP_STRING([--with-unbound-root-key-file],
333                                  [specify the unbound root key file]),
334             unbound_root_key_file="$withval", 
335 if test "$have_win" = yes; then
336     unbound_root_key_file="C:\\Program Files\\Unbound\\root.key"
337 else
338     if test -f /var/lib/unbound/root.key;then
339         unbound_root_key_file="/var/lib/unbound/root.key"
340     else
341         unbound_root_key_file="/etc/unbound/root.key"
342     fi
343 fi
344 )
345
346 AC_DEFINE_UNQUOTED([UNBOUND_ROOT_KEY_FILE],
347   ["$unbound_root_key_file"], [The DNSSEC root key file])
348
349 AC_ARG_WITH(system-priority-file, AS_HELP_STRING([--with-system-priority-file],
350                                  [specify the system priority file]),
351             system_priority_file="$withval", 
352 system_priority_file="/etc/gnutls/default-priority"
353 )
354
355 AC_DEFINE_UNQUOTED([SYSTEM_PRIORITY_FILE],
356   ["$system_priority_file"], [The system priority file])
357
358 dnl Check for p11-kit
359 P11_KIT_MINIMUM=0.20.0
360 AC_ARG_WITH(p11-kit,
361         AS_HELP_STRING([--without-p11-kit],
362                 [Build without p11-kit and PKCS#11 support]))
363 if test "$with_p11_kit" != "no"; then
364         PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= $P11_KIT_MINIMUM], [with_p11_kit=yes], [with_p11_kit=no])
365         if test "$with_p11_kit" != "no";then
366                 AC_DEFINE([ENABLE_PKCS11], 1, [Build PKCS#11 support])
367                 if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
368                         GNUTLS_REQUIRES_PRIVATE="Requires.private: p11-kit-1"
369                 else
370                         GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
371                 fi
372         else
373                 with_p11_kit=no
374                 AC_MSG_WARN([[
375 *** 
376 *** p11-kit >= $P11_KIT_MINIMUM was not found. PKCS #11 support will be disabled.
377 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
378 *** ]])
379         fi
380 fi
381
382 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
383
384 AC_ARG_WITH(tpm,
385         AS_HELP_STRING([--without-tpm],
386                 [Disable TPM (trousers) support.]),
387                 [with_tpm=$withval], [with_tpm=yes])
388 if test "$with_tpm" != "no"; then
389     LIBS="$oldlibs -ltspi"
390     AC_MSG_CHECKING([for tss library])
391     AC_LINK_IFELSE([AC_LANG_PROGRAM([
392                    #include <trousers/tss.h>
393                    #include <trousers/trousers.h>],[
394                    int err = Tspi_Context_Create((void *)0);
395                    Trspi_Error_String(err);])],
396                   [AC_MSG_RESULT(yes)
397                    AC_SUBST([TSS_LIBS], [-ltspi])
398                    AC_SUBST([TSS_CFLAGS], [])
399                    AC_DEFINE([HAVE_TROUSERS], 1, [Enable TPM])
400                    with_tpm=yes],
401                   [AC_MSG_RESULT(no)
402                    AC_MSG_WARN([[
403 *** 
404 *** trousers was not found. TPM support will be disabled.
405 *** ]])
406                   with_tpm=no])
407     LIBS="$oldlibs"
408 fi
409
410 AM_CONDITIONAL(ENABLE_TROUSERS, test "$with_tpm" != "no")
411
412 LIBOPTS_CHECK([src/libopts])
413 if test "$NEED_LIBOPTS_DIR" = "true";then
414         dnl delete libopts-generated files
415         for i in ${srcdir}/src/*-args.c.bak ${srcdir}/src/*-args.h.bak; do
416                 nam=`echo $i|sed 's/.bak//g'`
417                 if test -f $i;then
418                         cp -f $i $nam
419                 fi
420         done
421         AC_SUBST([AUTOGEN], [/bin/true])
422         enable_local_libopts=yes
423 else
424         enable_local_libopts=no
425 fi
426 AM_CONDITIONAL(NEED_LIBOPTS, test "$enable_local_libopts" = "yes")
427
428 AC_CHECK_TYPE(ssize_t,
429   [
430     DEFINE_SSIZE_T="#include <sys/types.h>"
431     AC_SUBST(DEFINE_SSIZE_T)
432   ], [
433     AC_DEFINE([NO_SSIZE_T], 1, [no ssize_t type was found])
434     DEFINE_SSIZE_T="typedef int ssize_t;"
435     AC_SUBST(DEFINE_SSIZE_T)
436   ], [
437     #include <sys/types.h>
438   ])
439
440 # For minitasn1.
441 AC_CHECK_SIZEOF(unsigned long int, 4)
442 AC_CHECK_SIZEOF(unsigned int, 4)
443
444 AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
445                                  [disable zlib compression support]),
446             ac_zlib=$withval, ac_zlib=yes)
447 AC_MSG_CHECKING([whether to include zlib compression support])
448 if test x$ac_zlib != xno; then
449  AC_MSG_RESULT(yes)
450  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
451  if test x$ac_cv_libz != xyes; then
452    AC_MSG_WARN(
453 *** 
454 *** ZLIB was not found. You will not be able to use ZLIB compression.)
455  fi
456 else
457  AC_MSG_RESULT(no)
458 fi
459
460 PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
461
462 if test x$ac_zlib != xno; then
463   if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
464     if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
465       GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
466     else
467       GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE, zlib"
468     fi
469   fi
470 fi
471 AC_SUBST(GNUTLS_REQUIRES_PRIVATE)
472
473
474
475 AC_ARG_WITH([default-trust-store-pkcs11],
476   [AS_HELP_STRING([--with-default-trust-store-pkcs11=URI],
477     [use the given pkcs11 uri as default trust store])])
478
479 if test "x$with_default_trust_store_pkcs11" != x; then
480   if test "x$with_p11_kit" = xno; then
481     AC_MSG_ERROR([cannot use pkcs11 store without p11-kit])
482   fi
483   AC_DEFINE_UNQUOTED([DEFAULT_TRUST_STORE_PKCS11],
484     ["$with_default_trust_store_pkcs11"], [use the given pkcs11 uri as default trust store])
485 fi
486
487 dnl auto detect http://lists.gnu.org/archive/html/help-gnutls/2012-05/msg00004.html
488 AC_ARG_WITH([default-trust-store-file],
489   [AS_HELP_STRING([--with-default-trust-store-file=FILE],
490     [use the given file default trust store])], with_default_trust_store_file="$withval",
491   [if test "$build" = "$host" && test x$with_default_trust_store_pkcs11 = x;then
492   for i in \
493     /etc/ssl/ca-bundle.pem \
494     /etc/ssl/certs/ca-certificates.crt \
495     /etc/pki/tls/cert.pem \
496     /usr/local/share/certs/ca-root-nss.crt \
497     /etc/ssl/cert.pem
498     do
499     if test -e "$i"; then
500       with_default_trust_store_file="$i"
501       break
502     fi
503   done
504   fi]
505 )
506
507 if test "$with_default_trust_store_file" = "no";then
508   with_default_trust_store_file=""
509 fi
510
511 AC_ARG_WITH([default-crl-file],
512   [AS_HELP_STRING([--with-default-crl-file=FILE],
513     [use the given CRL file as default])])
514
515 AC_ARG_WITH([default-blacklist-file],
516   [AS_HELP_STRING([--with-default-blacklist-file=FILE],
517     [use the given certificate blacklist file as default])])
518
519 if test "x$with_default_trust_store_file" != x; then
520   AC_DEFINE_UNQUOTED([DEFAULT_TRUST_STORE_FILE],
521     ["$with_default_trust_store_file"], [use the given file default trust store])
522 fi
523
524 if test "x$with_default_crl_file" != x; then
525   AC_DEFINE_UNQUOTED([DEFAULT_CRL_FILE],
526     ["$with_default_crl_file"], [use the given CRL file])
527 fi
528
529 if test "x$with_default_blacklist_file" != x; then
530   AC_DEFINE_UNQUOTED([DEFAULT_BLACKLIST_FILE],
531     ["$with_default_blacklist_file"], [use the given certificate blacklist file])
532 fi
533
534 dnl Guile bindings.
535 opt_guile_bindings=yes
536 AC_MSG_CHECKING([whether building Guile bindings])
537 AC_ARG_ENABLE(guile,
538         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
539 opt_guile_bindings=$enableval)
540 AC_MSG_RESULT($opt_guile_bindings)
541
542 AC_ARG_WITH([guile-site-dir],
543   [AS_HELP_STRING([--with-guile-site-dir],
544      [use the given directory as the Guile site (use with care)])])
545
546 if test "$opt_guile_bindings" = "yes"; then
547    AC_MSG_RESULT([***
548 *** Detecting GNU Guile...
549 ])
550
551    AC_PATH_PROG([guile_snarf], [guile-snarf])
552    if test "x$guile_snarf" = "x"; then
553       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
554       opt_guile_bindings=no
555    else
556       GUILE_PROGS
557       GUILE_FLAGS
558
559       save_CFLAGS="$CFLAGS"
560       save_LIBS="$LIBS"
561       CFLAGS="$CFLAGS $GUILE_CFLAGS"
562       LIBS="$LIBS $GUILE_LDFLAGS"
563       AC_MSG_CHECKING([whether GNU Guile is recent enough])
564       AC_LINK_IFELSE([AC_LANG_PROGRAM([], [scm_from_locale_string ("")])],
565         [], [opt_guile_bindings=no])
566       CFLAGS="$save_CFLAGS"
567       LIBS="$save_LIBS"
568
569       if test "$opt_guile_bindings" = "yes"; then
570         AC_MSG_RESULT([yes])
571         case "x$with_guile_site_dir" in 
572              xno)
573                 # Use the default $(GUILE_SITE).
574                 GUILE_SITE_DIR
575                 ;;
576              x|xyes)
577                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
578                 # hack is used to allow `distcheck' to work (see
579                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
580                 GUILE_SITE="\$(datadir)/guile/site"
581                 AC_SUBST(GUILE_SITE)
582                 ;;
583              *)
584                 # Use the user-specified directory as $(GUILE_SITE).
585                 GUILE_SITE="$with_guile_site_dir"
586                 AC_SUBST(GUILE_SITE)
587                 ;;
588         esac
589         AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
590         _gcc_cflags_save="$CFLAGS"
591         CFLAGS="${CFLAGS} -fgnu89-inline"
592         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
593                           gnu89_inline=yes, gnu89_inline=no)
594         AC_MSG_RESULT($gnu89_inline)
595         CFLAGS="$_gcc_cflags_save"
596
597         # Optional Guile functions.
598         save_CFLAGS="$CFLAGS"
599         save_LIBS="$LIBS"
600         CFLAGS="$CFLAGS $GUILE_CFLAGS"
601         LIBS="$LIBS $GUILE_LDFLAGS"
602         AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
603         CFLAGS="$save_CFLAGS"
604         LIBS="$save_LIBS"
605
606         # The place where guile-gnutls.la will go.
607         AC_MSG_CHECKING([the Guile effective version])
608         guile_effective_version="`$GUILE -c '(display (effective-version))'`"
609         AC_MSG_RESULT([$guile_effective_version])
610         guileextensiondir="$libdir/guile/$guile_effective_version"
611         AC_SUBST([guileextensiondir])
612       else
613         AC_MSG_RESULT([no])
614         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
615         opt_guile_bindings=no
616       fi
617    fi
618 fi
619 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
620
621 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
622 LIBGNUTLS_CFLAGS="-I${includedir}"
623 AC_SUBST(LIBGNUTLS_LIBS)
624 AC_SUBST(LIBGNUTLS_CFLAGS)
625
626 AM_CONDITIONAL(NEEDS_LIBRT, test "$gnutls_needs_librt" = "yes")
627
628 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
629 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
630
631 AC_DEFINE([fread_file], [_gnutls_fread_file], [static lib rename])
632 AC_DEFINE([read_file], [_gnutls_read_file], [static lib rename])
633 AC_DEFINE([read_binary_file], [_gnutls_read_binary_file], [static lib rename])
634
635 dnl Crywrap dependencies
636    AC_MSG_RESULT([***
637 *** Checking dependencies for crywrap...
638 ])
639
640 crywrap=no
641
642 if test "$have_win" != "yes"; then
643
644 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/select.h sys/types.h sys/wait.h])
645
646 dnl **********************
647 dnl * Typedefs & co
648 dnl **********************
649 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
650 [AC_LANG_PROGRAM([#include <sys/types.h>
651 #include <signal.h>
652 ],
653                  [return *(signal (0, 0)) (0) == 1;])],
654                    [ac_cv_type_signal=int],
655                    [ac_cv_type_signal=void])])
656 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
657                     (`int' or `void').])
658
659 AC_FUNC_SELECT_ARGTYPES
660 AC_CHECK_FUNCS([alarm atexit dup2 epoll_create kqueue memchr memset munmap \
661                 putenv regcomp scandir select socket strcasecmp strchr \
662                 strdup strerror strncasecmp strrchr strstr strtoul uname])
663
664 AC_ARG_ENABLE(crywrap,
665         AS_HELP_STRING([--disable-crywrap], [unconditionally disable the crywrap TLS proxy service]))
666
667  libidn=no
668
669  if test "x$enable_crywrap" != "xno" ; then
670         PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
671         AC_CHECK_FUNCS([argp_usage],[ac_argp=yes],[ac_argp=no])
672  fi
673
674  if test "x$libidn" != "xno" && test "$ac_cv_func_daemon" != "no" && test "$ac_argp" != "no";then
675   crywrap=yes
676  fi
677
678 fi
679
680 AM_CONDITIONAL(ENABLE_CRYWRAP, test "x$crywrap" != "xno")
681
682 dnl end of crywrap requirements
683
684 dnl Some variables needed in makefiles
685 YEAR=`date +%Y`
686 AC_SUBST([YEAR], $YEAR)
687
688 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
689 AC_CONFIG_FILES([
690   Makefile
691   doc/Makefile
692   doc/credentials/Makefile
693   doc/credentials/openpgp/Makefile
694   doc/credentials/srp/Makefile
695   doc/credentials/x509/Makefile
696   doc/cyclo/Makefile
697   doc/doxygen/Doxyfile
698   doc/examples/Makefile
699   doc/latex/Makefile
700   doc/manpages/Makefile
701   doc/reference/Makefile
702   doc/reference/version.xml
703   doc/scripts/Makefile
704   extra/Makefile
705   extra/includes/Makefile
706   libdane/Makefile
707   libdane/includes/Makefile
708   libdane/gnutls-dane.pc
709   gl/Makefile
710   gl/tests/Makefile
711   guile/Makefile
712   guile/modules/Makefile
713   guile/src/Makefile
714   guile/tests/Makefile
715   lib/Makefile
716   lib/accelerated/Makefile
717   lib/accelerated/x86/Makefile
718   lib/algorithms/Makefile
719   lib/auth/Makefile
720   lib/ext/Makefile
721   lib/extras/Makefile
722   lib/gnutls.pc
723   lib/includes/Makefile
724   lib/includes/gnutls/gnutls.h
725   lib/minitasn1/Makefile
726   lib/nettle/Makefile
727   lib/opencdk/Makefile
728   lib/openpgp/Makefile
729   lib/x509/Makefile
730   po/Makefile.in
731   src/Makefile
732   src/crywrap/Makefile
733   src/gl/Makefile
734   tests/Makefile
735   tests/cert-tests/Makefile
736   tests/dsa/Makefile
737   tests/dtls/Makefile
738   tests/srp/Makefile
739   tests/ecdsa/Makefile
740   tests/key-id/Makefile
741   tests/openpgp-certs/Makefile
742   tests/pkcs1-padding/Makefile
743   tests/pkcs12-decode/Makefile
744   tests/pkcs8-decode/Makefile
745   tests/rsa-md5-collision/Makefile
746   tests/safe-renegotiation/Makefile
747   tests/scripts/Makefile
748   tests/sha2/Makefile
749   tests/slow/Makefile
750   tests/suite/Makefile
751   tests/userid/Makefile
752 ])
753
754 AC_OUTPUT
755
756 dnl  Warning flags:        errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
757 dnl  Valgrind:             $opt_valgrind_tests ${VALGRIND}
758 AC_MSG_NOTICE([summary of build options:
759
760   version:              ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
761   Host/Target system:   ${host}
762   Build system:         ${build}
763   Install prefix:       ${prefix}
764   Compiler:             ${CC}
765   CFlags:               ${CFLAGS}
766   Library types:        Shared=${enable_shared}, Static=${enable_static}
767 ])
768
769 AC_MSG_NOTICE([External hardware support:
770
771   /dev/crypto:          $enable_cryptodev
772   Hardware accel:       $hw_accel
773   PKCS#11 support:      $with_p11_kit
774   TPM support:          $with_tpm
775 ])
776
777 AC_MSG_NOTICE([Optional features:
778 (note that included applications might not compile properly
779 if features are disabled)
780
781   DTLS-SRTP support:    $ac_enable_srtp
782   ALPN support:         $ac_enable_alpn
783   OCSP support:         $ac_enable_ocsp
784   Ses. ticket support:  $ac_enable_session_tickets
785   OpenPGP support:      $ac_enable_openpgp
786   SRP support:          $ac_enable_srp
787   PSK support:          $ac_enable_psk
788   DHE support:          $ac_enable_dhe
789   ECDHE support:        $ac_enable_ecdhe
790   Anon auth support:    $ac_enable_anon
791   Heartbeat support:    $ac_enable_heartbeat
792   Unicode support:      $ac_have_unicode
793   Self checks:          $enable_self_checks
794   Non-SuiteB curves:    $enable_non_suiteb
795   FIPS140 mode:         $enable_fips
796 ])
797
798 AC_MSG_NOTICE([Optional applications:
799
800   crywrap app:          $libidn
801   local libopts:        ${enable_local_libopts}
802   local libtasn1:       ${included_libtasn1}
803 ])
804
805 AC_MSG_NOTICE([Optional libraries:
806
807   Guile wrappers:       $opt_guile_bindings
808   C++ library:          $use_cxx
809   DANE library:         $enable_dane
810   OpenSSL compat:       $enable_openssl
811 ])
812
813 AC_MSG_NOTICE([System files:
814
815   Trust store pkcs11:   $with_default_trust_store_pkcs11
816   Trust store file:     $with_default_trust_store_file
817   Blacklist file:       $with_default_blacklist_file
818   CRL file:             $with_default_crl_file
819   Priority file:        $system_priority_file
820   DNSSEC root key file: $unbound_root_key_file
821 ])
822
823 if test ! -f "$unbound_root_key_file"; then
824 AC_MSG_WARN([[
825 *** 
826 *** The DNSSEC root key file in $unbound_root_key_file was not found. 
827 *** This file is needed for the verification of DNSSEC responses.
828 *** Use the command: unbound-anchor -a "$unbound_root_key_file"
829 *** to generate or update it.
830 *** ]])
831 fi