Export new ABIs. Doc fixes for new APIs.
[gnutls.git] / configure.ac
blobc2da2bb593a36e824ddd1920af1e21e6ac05b769
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 # 2009, 2010 Free Software Foundation, Inc.
5 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
7 # This file is part of GNUTLS.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22 # USA
24 AC_PREREQ(2.61)
25 AC_INIT([GnuTLS], [2.9.10], [bug-gnutls@gnu.org])
26 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CONFIG_MACRO_DIR([m4])
29 AM_INIT_AUTOMAKE([1.10 no-dist-gzip dist-bzip2 -Wall -Werror -Wno-override])
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 AC_PROG_LN_S
39 GTK_DOC_CHECK(1.1)
40 AC_PATH_PROG([GAA], [gaa])
41 if test "x$GAA" = "x"; then
42    AC_MSG_WARN([[***
43 *** GAA was not found.  It is only needed if you wish to modify
44 *** the source code or command-line description files.  In this case,
45 *** you may want to get it from http://gaa.sourceforge.net/ and
46 *** read doc/README.gaa.
47 ***]])
50 gl_EARLY
51 AC_C_INLINE
53 # For the C++ code
54 AC_PROG_CXX
55 AC_ARG_ENABLE(cxx,
56   AS_HELP_STRING([--disable-cxx], [unconditionally disable the C++ library]),
57     use_cxx=$enableval, use_cxx=yes)
58 if test "$use_cxx" != "no"; then
59   AC_LANG_PUSH(C++)
60   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
61   AC_LANG_POP(C++)
63 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
65 LIBGNUTLS_HOOKS
66 LIBGNUTLS_EXTRA_HOOKS
68 AC_HEADER_STDC
69 AC_CHECK_FUNCS(fork,,)
70 AC_DEFINE([HAVE_STRINGS_H], 1, [Hard-code for src/cfg/.])
71 AC_DEFINE([HAVE_FLOAT_H], 1, [Hard-code for src/cfg/.])
72 AC_DEFINE([HAVE_LIMITS_H], 1, [Hard-code for src/cfg/.])
73 AC_DEFINE([HAVE_MATH_H], 1, [Hard-code for src/cfg/.])
74 AC_DEFINE([HAVE_CTYPE_H], 1, [Hard-code for src/cfg/.])
75 AC_DEFINE([HAVE_ERRNO_H], 1, [Hard-code for src/cfg/.])
77 # No fork on MinGW, disable some self-tests until we fix them.
78 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
80 sj_VALGRIND
82 AC_CHECK_TYPES(uint,,, [
83 # include <sys/types.h>
86 # For Guile bindings.
87 opt_guile_bindings=yes
88 AC_MSG_CHECKING([whether building Guile bindings])
89 AC_ARG_ENABLE(guile,
90         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
91 opt_guile_bindings=$enableval)
92 AC_MSG_RESULT($opt_guile_bindings)
94 AC_ARG_WITH([--with-guile-site-dir],
95   [AS_HELP_STRING([--with-guile-site-dir],
96      [use the given directory as the Guile site (use with care)])])
98 if test "$opt_guile_bindings" = "yes"; then
99    AC_MSG_RESULT([***
100 *** Detecting GNU Guile...
103    AC_PATH_PROG([guile_snarf], [guile-snarf])
104    if test "x$guile_snarf" = "x"; then
105       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
106       opt_guile_bindings=no
107    else
108       GUILE_PROGS
109       GUILE_FLAGS
111       save_CFLAGS="$CFLAGS"
112       save_LIBS="$LIBS"
113       CFLAGS="$CFLAGS $GUILE_CFLAGS"
114       LIBS="$LIBS $GUILE_LDFLAGS"
115       AC_MSG_CHECKING([whether GNU Guile is recent enough])
116       AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
117         [], [opt_guile_bindings=no])
118       CFLAGS="$save_CFLAGS"
119       LIBS="$save_LIBS"
121       if test "$opt_guile_bindings" = "yes"; then
122         AC_MSG_RESULT([yes])
123         case "x$with_guile_site_dir" in 
124              xno)
125                 # Use the default $(GUILE_SITE).
126                 GUILE_SITE_DIR
127                 ;;
128              x|xyes)
129                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
130                 # hack is used to allow `distcheck' to work (see
131                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
132                 GUILE_SITE="\$(datadir)/guile/site"
133                 AC_SUBST(GUILE_SITE)
134                 ;;
135              *)
136                 # Use the user-specified directory as $(GUILE_SITE).
137                 GUILE_SITE="$with_guile_site_dir"
138                 AC_SUBST(GUILE_SITE)
139                 ;;
140         esac
141         AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
142         _gcc_cflags_save="$CFLAGS"
143         CFLAGS="${CFLAGS} -fgnu89-inline"
144         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
145                           gnu89_inline=yes, gnu89_inline=no)
146         AC_MSG_RESULT($gnu89_inline)
147         CFLAGS="$_gcc_cflags_save"
149         # Optional Guile functions.
150         save_CFLAGS="$CFLAGS"
151         save_LIBS="$LIBS"
152         CFLAGS="$CFLAGS $GUILE_CFLAGS"
153         LIBS="$LIBS $GUILE_LDFLAGS"
154         AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
155         CFLAGS="$save_CFLAGS"
156         LIBS="$save_LIBS"
157       else
158         AC_MSG_RESULT([no])
159         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
160         opt_guile_bindings=no
161       fi
162    fi
164 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
165 AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"])
166 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes")
168 dnl Check for libcfg+
170 SAVED_LIBS=$LIBS
171 AC_ARG_WITH(included-libcfg,
172         AS_HELP_STRING([--with-included-libcfg],
173                 [use the included libcfg+ (certtool only)]),
174         libcfg_enabled=$withval, 
175         libcfg_enabled=no
176 dnl We search for libcfg+ which is used by certtool
178         AC_CHECK_LIB(cfg+, cfg_get_context,:,
179                      libcfg_enabled=yes
180                      AC_MSG_WARN([[
181 *** 
182 *** Libcfg+ was not found. Will use the included one.]])))
184 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
185 LIBS=$SAVED_LIBS
187 AC_MSG_CHECKING([whether to use the included libcfg])
188 AC_MSG_RESULT($libcfg_enabled)
190 AC_LIBTOOL_WIN32_DLL
191 AC_PROG_LIBTOOL
193 gl_INIT
195 AC_ARG_ENABLE([gcc-warnings],
196   [AS_HELP_STRING([--enable-gcc-warnings],
197                   [turn on lots of GCC warnings (for developers)])],
198   [case $enableval in
199      yes|no) ;;
200      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
201    esac
202    gl_gcc_warnings=$enableval],
203   [gl_gcc_warnings=no]
206 if test "$gl_gcc_warnings" = yes; then
207   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
208   gl_WARN_ADD([-Wframe-larger-than=2100], [WSTACK_CFLAGS])
210   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
211   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
212   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
213   nw="$nw -Wtraditional"            # Warns on #elif which we use often
214   nw="$nw -Wlogical-op"             # Too many false positives
215   nw="$nw -Wold-style-definition"   # 
216   nw="$nw -Wpadded"                 # Our structs are not padded
217   nw="$nw -Wunreachable-code"       # Too many false positives
218   nw="$nw -Wtraditional-conversion" # Too many warnings for now
219   nw="$nw -Wcast-qual"              # Too many warnings for now
220   nw="$nw -Waggregate-return"       # Too many warnings for now
221   nw="$nw -Wshadow"                 # Too many warnings for now
222   nw="$nw -Wswitch-default"         # Too many warnings for now
223   nw="$nw -Wswitch-enum"            # Too many warnings for now
224   nw="$nw -Wconversion"             # Too many warnings for now
225   nw="$nw -Wsign-conversion"        # Too many warnings for now
226   nw="$nw -Wformat-y2k"             # Too many warnings for now
227   nw="$nw -Wformat-nonliteral"      # Incompatible with gettext _()
228   nw="$nw -Wunsafe-loop-optimizations"
229   nw="$nw -Wstrict-overflow"
230   nw="$nw -Wmissing-noreturn"
232   gl_MANYWARN_ALL_GCC([ws])
233   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
234   for w in $ws; do
235     gl_WARN_ADD([$w])
236   done
238   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
239   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
240   gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
241   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
242   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
243   gl_WARN_ADD([-Wno-stack-protector])  # Some functions cannot be protected
244   gl_WARN_ADD([-Wno-int-to-pointer-cast])  # Some files cannot be compiled with that (gl_fd_to_handle)
245   gl_WARN_ADD([-fdiagnostics-show-option])
248 # Export things for */configure.ac.
249 export WERROR_CFLAGS
250 export WSTACK_CFLAGS
251 export WARN_CFLAGS
252 export use_cxx
254 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
256 AC_CONFIG_SUBDIRS([lib])
257 AC_CONFIG_SUBDIRS([libextra])
259 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
260 AC_CONFIG_FILES([
261   Makefile
262   doc/Makefile
263   doc/credentials/Makefile
264   doc/credentials/openpgp/Makefile
265   doc/credentials/srp/Makefile
266   doc/credentials/x509/Makefile
267   doc/cyclo/Makefile
268   doc/doxygen/Doxyfile
269   doc/examples/Makefile
270   doc/manpages/Makefile
271   doc/reference/Makefile
272   doc/scripts/Makefile
273   gl/Makefile
274   gl/tests/Makefile
275   guile/Makefile
276   guile/modules/Makefile
277   guile/src/Makefile
278   guile/tests/Makefile
279   src/Makefile
280   src/cfg/Makefile
281   src/cfg/platon/Makefile
282   src/cfg/platon/str/Makefile
283   tests/Makefile
284   tests/key-id/Makefile
285   tests/openpgp-certs/Makefile
286   tests/safe-renegotiation/Makefile
287   tests/pathlen/Makefile
288   tests/pkcs1-padding/Makefile
289   tests/pkcs12-decode/Makefile
290   tests/pkcs8-decode/Makefile
291   tests/rsa-md5-collision/Makefile
292   tests/sha2/Makefile
293   tests/userid/Makefile
295 AC_OUTPUT
297 AC_MSG_NOTICE([summary of build options:
299   version:          ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
300   Host type:        ${host}
301   Install prefix:   ${prefix}
302   Compiler:         ${CC}
303   Warning flags:    errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
304   Library types:    Shared=${enable_shared}, Static=${enable_static}
305   Valgrind:         $opt_valgrind_tests ${VALGRIND}
306   Guile wrappers:   $opt_guile_bindings
307   C++ library:      $use_cxx
308   OpenSSL library:  $enable_openssl
309   /dev/crypto:      $enable_cryptodev