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