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