updated p11tool documentation.
[gnutls.git] / configure.ac
blob619475cd502caced1b1d72a84d86e6c736d02d09
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000-2012 Free Software Foundation, Inc.
4 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
6 # This file is part of GnuTLS.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 # USA
23 AC_PREREQ(2.61)
24 AC_INIT([GnuTLS], [3.0.15], [bug-gnutls@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
26 AC_CONFIG_MACRO_DIR([m4])
28 AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz -Wall -Werror -Wno-override])
29 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
30 AM_CONFIG_HEADER(config.h)
32 AC_MSG_RESULT([***
33 *** Checking for compilation programs...
36 dnl Checks for programs.
37 AC_PROG_CC
38 AM_PROG_AS
39 AC_PROG_CXX
40 gl_EARLY
42 # For includes/gnutls/gnutls.h.in.
43 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
44 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
45 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
46 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
48 touch suppressions.valgrind
49 dnl C and C++ capabilities
50 AC_C_INLINE
51 AC_HEADER_STDC
53 # For the C++ code
54 AC_ARG_ENABLE(cxx,
55   AS_HELP_STRING([--disable-cxx], [unconditionally disable the C++ library]),
56     use_cxx=$enableval, use_cxx=yes)
57 if test "$use_cxx" != "no"; then
58   AC_LANG_PUSH(C++)
59   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
60   AC_LANG_POP(C++)
62 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
63 AM_CONDITIONAL(WANT_TEST_SUITE, [test -f tests/suite/mini-eagain2.c])
65 dnl Detect windows build
66 case "$host" in
67   *mingw32* | *mingw64*)
68     have_win=yes
69   ;;
70   *)
71   ;;
72 esac
74 AM_CONDITIONAL(WINDOWS, test "$have_win" = yes)
76 dnl Hardware Acceleration
77 AC_ARG_ENABLE(hardware-acceleration,
78   AS_HELP_STRING([--disable-hardware-acceleration], [unconditionally disable hardware acceleration]),
79     use_accel=$enableval, use_accel=yes)
80 hw_accel=none
83 if test "$use_accel" != "no"; then
84 case $host_cpu in
85   i?86 | x86_64 | amd64)
86 dnl    GCC_FLAG_ADD([-maes -mpclmul],[X86])
87 dnl    if test "x$X86" = "xyes";then
88       AC_CHECK_HEADERS(cpuid.h)
89       if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"; then
90         hw_accel="x86-64"
91       else
92         hw_accel="x86"
93       fi
94 dnl    fi
95   ;;
96   *)
97   ;;
98 esac
102 AM_CONDITIONAL(ASM_X86_64, test x"$hw_accel" = x"x86-64")
103 AM_CONDITIONAL(ASM_X86_32, test x"$hw_accel" = x"x86")
104 AM_CONDITIONAL(ASM_X86, test x"$hw_accel" = x"x86" || test x"$hw_accel" = x"x86-64")
105 AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"])
106 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes")
108 dnl Try the hooks.m4
109 LIBGNUTLS_HOOKS
110 LIBGNUTLS_EXTRA_HOOKS
112 GTK_DOC_CHECK(1.1)
113 AM_GNU_GETTEXT([external])
114 AM_GNU_GETTEXT_VERSION([0.18])
116 AC_C_BIGENDIAN
120 dnl No fork on MinGW, disable some self-tests until we fix them.
121 AC_CHECK_FUNCS([fork getrusage getpwuid_r daemon fchmod],,)
122 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
123 AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
125 dnl Check for p11-kit
126 AC_ARG_WITH(p11-kit,
127         AS_HELP_STRING([--without-p11-kit],
128                 [Build without p11-kit and PKCS#11 support]))
129 if test "$with_p11_kit" != "no"; then
130         PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= 0.11], [with_p11_kit=yes], [with_p11_kit=no])
131         if test "$with_p11_kit" != "no";then
132                 AC_DEFINE([ENABLE_PKCS11], 1, [Build PKCS#11 support])
133                 if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
134                         GNUTLS_REQUIRES_PRIVATE="Requires.private: p11-kit-1"
135                 else
136                         GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
137                 fi
138         else
139                 with_p11_kit=no
140                 AC_MSG_WARN([[
141 *** 
142 *** p11-kit was not found. PKCS #11 support will be disabled.
143 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
144 *** ]])
145         fi
148 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
150 dnl Checks for programs in src/ 
151 PKG_CHECK_MODULES([autoopts], autoopts >= 36.2.11,, [enable_local_libopts=yes])
153 NEED_LIBOPTS_DIR=true
154 LIBOPTS_CHECK([src/libopts])
156 AC_CHECK_TYPE(ssize_t,
157   [
158     DEFINE_SSIZE_T="#include <sys/types.h>"
159     AC_SUBST(DEFINE_SSIZE_T)
160   ], [
161     AC_DEFINE([NO_SSIZE_T], 1, [no ssize_t type was found])
162     DEFINE_SSIZE_T="typedef int ssize_t;"
163     AC_SUBST(DEFINE_SSIZE_T)
164   ], [
165     #include <sys/types.h>
166   ])
168 # For minitasn1.
169 AC_CHECK_SIZEOF(unsigned long int, 4)
170 AC_CHECK_SIZEOF(unsigned int, 4)
172 AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
173                                  [disable zlib compression support]),
174             ac_zlib=$withval, ac_zlib=yes)
175 AC_MSG_CHECKING([whether to include zlib compression support])
176 if test x$ac_zlib != xno; then
177  AC_MSG_RESULT(yes)
178  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
179  if test x$ac_cv_libz != xyes; then
180    AC_MSG_WARN(
181 *** 
182 *** ZLIB was not found. You will not be able to use ZLIB compression.)
183  fi
184 else
185  AC_MSG_RESULT(no)
188 PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
190 if test x$ac_zlib != xno; then
191   if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
192     if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
193       GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
194     else
195       GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE, zlib"
196     fi
197   else
198     GNUTLS_ZLIB_LIBS_PRIVATE="$LTLIBZ"
199   fi
201 AC_SUBST(GNUTLS_REQUIRES_PRIVATE)
202 AC_SUBST(GNUTLS_ZLIB_LIBS_PRIVATE)
205 gl_INIT
207 dnl GCC warnings to enable
209 AC_ARG_ENABLE([gcc-warnings],
210   [AS_HELP_STRING([--enable-gcc-warnings],
211                   [turn on lots of GCC warnings (for developers)])],
212   [case $enableval in
213      yes|no) ;;
214      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
215    esac
216    gl_gcc_warnings=$enableval],
217   [gl_gcc_warnings=no]
220 if test "$gl_gcc_warnings" = yes; then
221   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
222   gl_WARN_ADD([-Wframe-larger-than=5120], [WSTACK_CFLAGS])
224   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
225   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
226   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
227   nw="$nw -Wtraditional"            # Warns on #elif which we use often
228   nw="$nw -Wlogical-op"             # Too many false positives
229   nw="$nw -Wold-style-definition"   # 
230   nw="$nw -Wpadded"                 # Our structs are not padded
231   nw="$nw -Wunreachable-code"       # Too many false positives
232   nw="$nw -Wtraditional-conversion" # Too many warnings for now
233   nw="$nw -Wcast-qual"              # Too many warnings for now
234   nw="$nw -Waggregate-return"       # Too many warnings for now
235   nw="$nw -Wshadow"                 # Too many warnings for now
236   nw="$nw -Wswitch-default"         # Too many warnings for now
237   nw="$nw -Wswitch-enum"            # Too many warnings for now
238   nw="$nw -Wconversion"             # Too many warnings for now
239   nw="$nw -Wsign-conversion"        # Too many warnings for now
240   nw="$nw -Wformat-y2k"             # Too many warnings for now
241   nw="$nw -Wvla"                    # There is no point to avoid C99 variable length arrays
242   nw="$nw -Wformat-nonliteral"      # Incompatible with gettext _()
243   nw="$nw -Wunsafe-loop-optimizations"
244   nw="$nw -Wstrict-overflow"
245   nw="$nw -Wmissing-noreturn"
247   gl_MANYWARN_ALL_GCC([ws])
248   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
249   for w in $ws; do
250     gl_WARN_ADD([$w])
251   done
253   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
254   gl_WARN_ADD([-Wno-format-y2k])     # Too many warnings for now
255   gl_WARN_ADD([-Wno-suggest-attribute=pure])     # Too many warnings for now
256   gl_WARN_ADD([-Wno-suggest-attribute=const])     # Too many warnings for now
257   gl_WARN_ADD([-Wno-suggest-attribute=noreturn])     # Too many warnings for now
258   gl_WARN_ADD([-Wno-unused-value]) # warnings for things we don't want to get
259   gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
260   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
261   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
262   gl_WARN_ADD([-Wno-stack-protector])  # Some functions cannot be protected
263   gl_WARN_ADD([-Wno-int-to-pointer-cast])  # Some files cannot be compiled with that (gl_fd_to_handle)
264   gl_WARN_ADD([-Wno-redundant-decls])  # Some files cannot be compiled with that (gl_fd_to_handle)
265   gl_WARN_ADD([-fdiagnostics-show-option])
268 AC_SUBST([WERROR_CFLAGS])
269 AC_SUBST([WSTACK_CFLAGS])
270 AC_SUBST([WARN_CFLAGS])
272 dnl Programs for compilation or development
273 AC_PROG_LN_S
274 AC_LIBTOOL_WIN32_DLL
275 AC_PROG_LIBTOOL
277 dnl Guile bindings.
278 opt_guile_bindings=yes
279 AC_MSG_CHECKING([whether building Guile bindings])
280 AC_ARG_ENABLE(guile,
281         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
282 opt_guile_bindings=$enableval)
283 AC_MSG_RESULT($opt_guile_bindings)
285 AC_ARG_WITH([--with-guile-site-dir],
286   [AS_HELP_STRING([--with-guile-site-dir],
287      [use the given directory as the Guile site (use with care)])])
289 if test "$opt_guile_bindings" = "yes"; then
290    AC_MSG_RESULT([***
291 *** Detecting GNU Guile...
294    AC_PATH_PROG([guile_snarf], [guile-snarf])
295    if test "x$guile_snarf" = "x"; then
296       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
297       opt_guile_bindings=no
298    else
299       GUILE_PROGS
300       GUILE_FLAGS
302       save_CFLAGS="$CFLAGS"
303       save_LIBS="$LIBS"
304       CFLAGS="$CFLAGS $GUILE_CFLAGS"
305       LIBS="$LIBS $GUILE_LDFLAGS"
306       AC_MSG_CHECKING([whether GNU Guile is recent enough])
307       AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
308         [], [opt_guile_bindings=no])
309       CFLAGS="$save_CFLAGS"
310       LIBS="$save_LIBS"
312       if test "$opt_guile_bindings" = "yes"; then
313         AC_MSG_RESULT([yes])
314         case "x$with_guile_site_dir" in 
315              xno)
316                 # Use the default $(GUILE_SITE).
317                 GUILE_SITE_DIR
318                 ;;
319              x|xyes)
320                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
321                 # hack is used to allow `distcheck' to work (see
322                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
323                 GUILE_SITE="\$(datadir)/guile/site"
324                 AC_SUBST(GUILE_SITE)
325                 ;;
326              *)
327                 # Use the user-specified directory as $(GUILE_SITE).
328                 GUILE_SITE="$with_guile_site_dir"
329                 AC_SUBST(GUILE_SITE)
330                 ;;
331         esac
332         AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
333         _gcc_cflags_save="$CFLAGS"
334         CFLAGS="${CFLAGS} -fgnu89-inline"
335         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
336                           gnu89_inline=yes, gnu89_inline=no)
337         AC_MSG_RESULT($gnu89_inline)
338         CFLAGS="$_gcc_cflags_save"
340         # Optional Guile functions.
341         save_CFLAGS="$CFLAGS"
342         save_LIBS="$LIBS"
343         CFLAGS="$CFLAGS $GUILE_CFLAGS"
344         LIBS="$LIBS $GUILE_LDFLAGS"
345         AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
346         CFLAGS="$save_CFLAGS"
347         LIBS="$save_LIBS"
349         # The place where guile-gnutls.la will go.
350         AC_MSG_CHECKING([the Guile effective version])
351         guile_effective_version="`$GUILE -c '(display (effective-version))'`"
352         AC_MSG_RESULT([$guile_effective_version])
353         guileextensiondir="$libdir/guile/$guile_effective_version"
354         AC_SUBST([guileextensiondir])
355       else
356         AC_MSG_RESULT([no])
357         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
358         opt_guile_bindings=no
359       fi
360    fi
362 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
364 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
365 LIBGNUTLS_CFLAGS="-I${includedir}"
366 AC_SUBST(LIBGNUTLS_LIBS)
367 AC_SUBST(LIBGNUTLS_CFLAGS)
370 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
371 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
373 AC_DEFINE([fread_file], [_gnutls_fread_file], [static lib rename])
374 AC_DEFINE([read_file], [_gnutls_read_file], [static lib rename])
375 AC_DEFINE([read_binary_file], [_gnutls_read_binary_file], [static lib rename])
377 dnl Crywrap dependencies
378    AC_MSG_RESULT([***
379 *** Checking dependencies for crywrap...
382 crywrap=no
384 if test "$have_win" != "yes"; then
386 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/select.h sys/types.h sys/wait.h])
388 dnl **********************
389 dnl * Typedefs & co
390 dnl **********************
391 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
392 [AC_LANG_PROGRAM([#include <sys/types.h>
393 #include <signal.h>
395                  [return *(signal (0, 0)) (0) == 1;])],
396                    [ac_cv_type_signal=int],
397                    [ac_cv_type_signal=void])])
398 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
399                     (`int' or `void').])
401 AC_FUNC_SELECT_ARGTYPES
402 AC_CHECK_FUNCS([alarm atexit dup2 epoll_create kqueue memchr memset munmap \
403                 putenv regcomp scandir select socket strcasecmp strchr \
404                 strdup strerror strncasecmp strrchr strstr strtoul uname])
406 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
408  if test "x$libidn" != "xno" && test "$ac_cv_func_daemon" != "no";then
409   crywrap=yes
410  fi
414 AM_CONDITIONAL(ENABLE_CRYWRAP, test "x$crywrap" != "xno")
415 rm -f suppressions.valgrind
416 dnl end of crywrap requirements
418 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
419 AC_CONFIG_FILES([
420   Makefile
421   doc/Makefile
422   doc/credentials/Makefile
423   doc/credentials/openpgp/Makefile
424   doc/credentials/srp/Makefile
425   doc/credentials/x509/Makefile
426   doc/cyclo/Makefile
427   doc/doxygen/Doxyfile
428   doc/examples/Makefile
429   doc/latex/Makefile
430   doc/manpages/Makefile
431   doc/reference/Makefile
432   doc/reference/version.xml
433   doc/scripts/Makefile
434   extra/Makefile
435   extra/includes/Makefile
436   gl/Makefile
437   gl/tests/Makefile
438   guile/Makefile
439   guile/modules/Makefile
440   guile/src/Makefile
441   guile/tests/Makefile
442   lib/Makefile
443   lib/accelerated/Makefile
444   lib/accelerated/x86/Makefile
445   lib/algorithms/Makefile
446   lib/auth/Makefile
447   lib/ext/Makefile
448   lib/extras/Makefile
449   lib/gnutls.pc
450   lib/includes/Makefile
451   lib/includes/gnutls/gnutls.h
452   lib/minitasn1/Makefile
453   lib/nettle/Makefile
454   lib/opencdk/Makefile
455   lib/openpgp/Makefile
456   lib/x509/Makefile
457   po/Makefile.in
458   src/Makefile
459   src/crywrap/Makefile
460   tests/Makefile
461   tests/cert-tests/Makefile
462   tests/dsa/Makefile
463   tests/dtls/Makefile
464   tests/srp/Makefile
465   tests/ecdsa/Makefile
466   tests/key-id/Makefile
467   tests/openpgp-certs/Makefile
468   tests/pkcs1-padding/Makefile
469   tests/pkcs12-decode/Makefile
470   tests/pkcs8-decode/Makefile
471   tests/rsa-md5-collision/Makefile
472   tests/safe-renegotiation/Makefile
473   tests/scripts/Makefile
474   tests/sha2/Makefile
475   tests/slow/Makefile
476   tests/suite/Makefile
477   tests/userid/Makefile
480 AC_OUTPUT
482 AC_MSG_NOTICE([summary of build options:
484   version:          ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
485   Host type:        ${host}
486   Install prefix:   ${prefix}
487   Compiler:         ${CC}
488   CFlags:           ${CFLAGS}
489   Warning flags:    errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
490   Library types:    Shared=${enable_shared}, Static=${enable_static}
491   Valgrind:         $opt_valgrind_tests ${VALGRIND}
494 AC_MSG_NOTICE([Optional features:
495 (note that included applications might not compile properly
496 if features are disabled)
498   OCSP support:     $ac_enable_ocsp
499   OpenPGP support:  $ac_enable_openpgp
500   SRP support:      $ac_enable_srp
501   PSK support:      $ac_enable_psk
502   Anon auth support:$ac_enable_anon
505 AC_MSG_NOTICE([Optional applications:
507   crywrap app:      $libidn
508   local libopts:    $enable_local_libopts
511 AC_MSG_NOTICE([Optional libraries:
513   Guile wrappers:   $opt_guile_bindings
514   C++ library:      $use_cxx
515   OpenSSL compat:   $enable_openssl
518 AC_MSG_NOTICE([Hardware acceleration/support:
520   /dev/crypto:      $enable_cryptodev
521   Hardware accel:   $hw_accel
522   PKCS#11 support:  $with_p11_kit