1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000-2011 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
24 AC_INIT([GnuTLS], [3.0.5], [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)
33 *** Checking for compilation programs...
36 dnl Checks for programs.
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`)
49 dnl C and C++ capabilities
52 AC_DEFINE([HAVE_STRINGS_H], 1, [Hard-code for src/cfg/.])
53 AC_DEFINE([HAVE_FLOAT_H], 1, [Hard-code for src/cfg/.])
54 AC_DEFINE([HAVE_LIMITS_H], 1, [Hard-code for src/cfg/.])
55 AC_DEFINE([HAVE_MATH_H], 1, [Hard-code for src/cfg/.])
56 AC_DEFINE([HAVE_CTYPE_H], 1, [Hard-code for src/cfg/.])
57 AC_DEFINE([HAVE_ERRNO_H], 1, [Hard-code for src/cfg/.])
61 AS_HELP_STRING([--disable-cxx], [unconditionally disable the C++ library]),
62 use_cxx=$enableval, use_cxx=yes)
63 if test "$use_cxx" != "no"; then
65 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
68 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
69 AM_CONDITIONAL(WANT_TEST_SUITE, [test -f tests/suite/mini-eagain2.c])
71 dnl Detect windows build
73 *mingw32* | *mingw64*)
80 AM_CONDITIONAL(WINDOWS, test "$have_win" = yes)
82 dnl Hardware Acceleration
83 AC_ARG_ENABLE(hardware-acceleration,
84 AS_HELP_STRING([--disable-hardware-acceleration], [unconditionally disable hardware acceleration]),
85 use_accel=$enableval, use_accel=yes)
89 if test "$use_accel" != "no"; then
91 i?86 | x86_64 | amd64)
92 dnl GCC_FLAG_ADD([-maes -mpclmul],[X86])
93 dnl if test "x$X86" = "xyes";then
94 AC_CHECK_HEADERS(cpuid.h)
95 if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"; then
108 AM_CONDITIONAL(ASM_X86_64, test x"$hw_accel" = x"x86-64")
109 AM_CONDITIONAL(ASM_X86_32, test x"$hw_accel" = x"x86")
110 AM_CONDITIONAL(ASM_X86, test x"$hw_accel" = x"x86" -o x"$hw_accel" = x"x86-64")
111 AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"])
112 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes")
116 LIBGNUTLS_EXTRA_HOOKS
119 AM_GNU_GETTEXT([external])
120 AM_GNU_GETTEXT_VERSION([0.17])
126 dnl Checks for functions
128 dnl No fork on MinGW, disable some self-tests until we fix them.
129 AC_CHECK_FUNCS(fork,,)
130 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
131 AC_CHECK_FUNCS(getrusage,,)
132 AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
134 dnl Check for p11-kit
136 AS_HELP_STRING([--without-p11-kit],
137 [Build without p11-kit and PKCS#11 support]))
138 if test "$with_p11_kit" != "no"; then
139 PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= 0.4], [with_p11_kit=yes], [with_p11_kit=no])
140 if test "$with_p11_kit" != "no";then
141 AC_DEFINE([ENABLE_PKCS11], 1, [Build PKCS#11 support])
142 CFLAGS="$CFLAGS $P11_KIT_CFLAGS"
143 LIBS="$LIBS $P11_KIT_LIBS"
144 if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
145 GNUTLS_REQUIRES_PRIVATE="Requires.private: p11-kit-1"
147 GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
153 *** p11-kit was not found. PKCS #11 support will be disabled.
154 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
159 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
161 dnl Check for libcfg+
163 AC_ARG_WITH(included-libcfg,
164 AS_HELP_STRING([--with-included-libcfg],
165 [use the included libcfg+ (certtool only)]),
166 libcfg_enabled=$withval,
168 dnl We search for libcfg+ which is used by certtool
170 AC_CHECK_LIB(cfg+, cfg_get_context,:,
174 *** Libcfg+ was not found. Will use the included one.]])))
176 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
179 AC_MSG_CHECKING([whether to use the included libcfg])
180 AC_MSG_RESULT($libcfg_enabled)
182 AC_CHECK_TYPE(ssize_t,
184 DEFINE_SSIZE_T="#include <sys/types.h>"
185 AC_SUBST(DEFINE_SSIZE_T)
187 AC_DEFINE([NO_SSIZE_T], 1, [no ssize_t type was found])
188 DEFINE_SSIZE_T="typedef int ssize_t;"
189 AC_SUBST(DEFINE_SSIZE_T)
191 #include <sys/types.h>
195 AC_CHECK_SIZEOF(unsigned long int, 4)
196 AC_CHECK_SIZEOF(unsigned int, 4)
198 AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
199 [disable zlib compression support]),
200 ac_zlib=$withval, ac_zlib=yes)
201 AC_MSG_CHECKING([whether to include zlib compression support])
202 if test x$ac_zlib != xno; then
204 AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
205 if test x$ac_cv_libz != xyes; then
208 *** ZLIB was not found. You will not be able to use ZLIB compression.)
214 PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
216 if test x$ac_zlib != xno; then
217 if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
218 if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
219 GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
221 GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE , zlib"
224 GNUTLS_ZLIB_LIBS_PRIVATE="$LTLIBZ"
227 AC_SUBST(GNUTLS_REQUIRES_PRIVATE)
228 AC_SUBST(GNUTLS_ZLIB_LIBS_PRIVATE)
233 dnl GCC warnings to enable
235 AC_ARG_ENABLE([gcc-warnings],
236 [AS_HELP_STRING([--enable-gcc-warnings],
237 [turn on lots of GCC warnings (for developers)])],
240 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
242 gl_gcc_warnings=$enableval],
246 if test "$gl_gcc_warnings" = yes; then
247 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
248 gl_WARN_ADD([-Wframe-larger-than=5120], [WSTACK_CFLAGS])
250 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
251 nw="$nw -Wc++-compat" # We don't care about C++ compilers
252 nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
253 nw="$nw -Wtraditional" # Warns on #elif which we use often
254 nw="$nw -Wlogical-op" # Too many false positives
255 nw="$nw -Wold-style-definition" #
256 nw="$nw -Wpadded" # Our structs are not padded
257 nw="$nw -Wunreachable-code" # Too many false positives
258 nw="$nw -Wtraditional-conversion" # Too many warnings for now
259 nw="$nw -Wcast-qual" # Too many warnings for now
260 nw="$nw -Waggregate-return" # Too many warnings for now
261 nw="$nw -Wshadow" # Too many warnings for now
262 nw="$nw -Wswitch-default" # Too many warnings for now
263 nw="$nw -Wswitch-enum" # Too many warnings for now
264 nw="$nw -Wconversion" # Too many warnings for now
265 nw="$nw -Wsign-conversion" # Too many warnings for now
266 nw="$nw -Wformat-y2k" # Too many warnings for now
267 nw="$nw -Wvla" # There is no point to avoid C99 variable length arrays
268 nw="$nw -Wformat-nonliteral" # Incompatible with gettext _()
269 nw="$nw -Wunsafe-loop-optimizations"
270 nw="$nw -Wstrict-overflow"
271 nw="$nw -Wmissing-noreturn"
273 gl_MANYWARN_ALL_GCC([ws])
274 gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
279 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
280 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
281 gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
282 gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
283 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
284 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
285 gl_WARN_ADD([-Wno-stack-protector]) # Some functions cannot be protected
286 gl_WARN_ADD([-Wno-int-to-pointer-cast]) # Some files cannot be compiled with that (gl_fd_to_handle)
287 gl_WARN_ADD([-fdiagnostics-show-option])
290 AC_SUBST([WERROR_CFLAGS])
291 AC_SUBST([WSTACK_CFLAGS])
292 AC_SUBST([WARN_CFLAGS])
294 dnl Programs for compilation or development
298 AC_PATH_PROG([GAA], [gaa])
299 if test "x$GAA" = "x"; then
301 *** GAA was not found. It is only needed if you wish to modify
302 *** the source code or command-line description files. In this case,
303 *** you may want to get it from http://gaa.sourceforge.net/ and
304 *** read doc/README.gaa.
310 opt_guile_bindings=yes
311 AC_MSG_CHECKING([whether building Guile bindings])
313 AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
314 opt_guile_bindings=$enableval)
315 AC_MSG_RESULT($opt_guile_bindings)
317 AC_ARG_WITH([--with-guile-site-dir],
318 [AS_HELP_STRING([--with-guile-site-dir],
319 [use the given directory as the Guile site (use with care)])])
321 if test "$opt_guile_bindings" = "yes"; then
323 *** Detecting GNU Guile...
326 AC_PATH_PROG([guile_snarf], [guile-snarf])
327 if test "x$guile_snarf" = "x"; then
328 AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found. Guile bindings not built.])
329 opt_guile_bindings=no
334 save_CFLAGS="$CFLAGS"
336 CFLAGS="$CFLAGS $GUILE_CFLAGS"
337 LIBS="$LIBS $GUILE_LDFLAGS"
338 AC_MSG_CHECKING([whether GNU Guile is recent enough])
339 AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
340 [], [opt_guile_bindings=no])
341 CFLAGS="$save_CFLAGS"
344 if test "$opt_guile_bindings" = "yes"; then
346 case "x$with_guile_site_dir" in
348 # Use the default $(GUILE_SITE).
352 # Automatically derive $(GUILE_SITE) from $(pkgdatadir). This
353 # hack is used to allow `distcheck' to work (see
354 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
355 GUILE_SITE="\$(datadir)/guile/site"
359 # Use the user-specified directory as $(GUILE_SITE).
360 GUILE_SITE="$with_guile_site_dir"
364 AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
365 _gcc_cflags_save="$CFLAGS"
366 CFLAGS="${CFLAGS} -fgnu89-inline"
367 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
368 gnu89_inline=yes, gnu89_inline=no)
369 AC_MSG_RESULT($gnu89_inline)
370 CFLAGS="$_gcc_cflags_save"
372 # Optional Guile functions.
373 save_CFLAGS="$CFLAGS"
375 CFLAGS="$CFLAGS $GUILE_CFLAGS"
376 LIBS="$LIBS $GUILE_LDFLAGS"
377 AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
378 CFLAGS="$save_CFLAGS"
382 AC_MSG_WARN([A sufficiently recent GNU Guile not found. Guile bindings not built.])
383 opt_guile_bindings=no
387 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
389 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
390 LIBGNUTLS_CFLAGS="-I${includedir}"
391 AC_SUBST(LIBGNUTLS_LIBS)
392 AC_SUBST(LIBGNUTLS_CFLAGS)
395 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
396 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
398 dnl Crywrap dependencies
400 *** Checking dependencies for crywrap...
403 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/select.h sys/types.h sys/wait.h])
405 dnl **********************
407 dnl **********************
408 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
409 [AC_LANG_PROGRAM([#include <sys/types.h>
412 [return *(signal (0, 0)) (0) == 1;])],
413 [ac_cv_type_signal=int],
414 [ac_cv_type_signal=void])])
415 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
418 AC_FUNC_SELECT_ARGTYPES
419 AC_CHECK_FUNCS([alarm atexit dup2 epoll_create kqueue memchr memset munmap \
420 putenv regcomp scandir select socket strcasecmp strchr \
421 strdup strerror strncasecmp strrchr strstr strtoul uname])
423 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
425 AM_CONDITIONAL(ENABLE_CRYWRAP, test "x$libidn" != "xno")
427 dnl end of crywrap requirements
429 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
433 doc/credentials/Makefile
434 doc/credentials/openpgp/Makefile
435 doc/credentials/srp/Makefile
436 doc/credentials/x509/Makefile
440 doc/examples/Makefile
441 doc/manpages/Makefile
442 doc/reference/Makefile
447 guile/modules/Makefile
453 src/cfg/platon/Makefile
454 src/cfg/platon/str/Makefile
456 tests/key-id/Makefile
458 tests/scripts/Makefile
459 tests/openpgp-certs/Makefile
460 tests/safe-renegotiation/Makefile
461 tests/pathlen/Makefile
462 tests/pkcs1-padding/Makefile
463 tests/pkcs12-decode/Makefile
464 tests/pkcs8-decode/Makefile
465 tests/rsa-md5-collision/Makefile
467 tests/userid/Makefile
469 extra/includes/Makefile
472 lib/includes/Makefile
473 lib/includes/gnutls/gnutls.h
474 lib/minitasn1/Makefile
482 lib/accelerated/Makefile
483 lib/accelerated/x86/Makefile
485 lib/algorithms/Makefile
491 AC_MSG_NOTICE([summary of build options:
493 version: ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
495 Install prefix: ${prefix}
498 Warning flags: errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
499 Library types: Shared=${enable_shared}, Static=${enable_static}
500 Valgrind: $opt_valgrind_tests ${VALGRIND}
501 Guile wrappers: $opt_guile_bindings
502 C++ library: $use_cxx
503 OpenSSL compat: $enable_openssl
504 /dev/crypto: $enable_cryptodev
505 Hardware accel: $hw_accel
506 Crypto library: $cryptolib
507 PKCS#11 support: $with_p11_kit