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