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 # 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
25 AC_INIT([GnuTLS], [2.7.2], [bug-gnutls@gnu.org])
26 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CONFIG_MACRO_DIR([m4])
29 AM_INIT_AUTOMAKE([1.10 dist-bzip2 -Wall -Werror -Wno-override])
30 AM_CONFIG_HEADER(config.h)
33 AC_MSG_CHECKING([whether to enable compiler warnings])
34 AC_ARG_ENABLE(developer-mode,
35 AS_HELP_STRING([--enable-developer-mode], [enable compiler warnings]),
36 opt_developer_mode=$enableval)
37 AC_MSG_RESULT($opt_developer_mode)
40 *** Checking for compilation programs...
43 dnl Checks for programs.
47 AC_PATH_PROG([GAA], [gaa])
48 if test "x$GAA" = "x"; then
50 *** GAA was not found. It is only needed if you wish to modify
51 *** the source code or command-line description files. In this case,
52 *** you may want to get it from http://gaa.sourceforge.net/
55 AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
59 *** Detecting compiler options...
68 if test $ac_cv_c_compiler_gnu != no; then
70 if test x$opt_developer_mode = xyes; then
71 AC_MSG_CHECKING([whether gcc supports various warning flags])
72 _gcc_cflags_save="$CFLAGS"
73 CFLAGS="${CFLAGS} -Wall -W -Wchar-subscripts -Wformat-security -Wnonnull -Winit-self -Wmissing-include-dirs -Wunused -Wno-unused-parameter -Wfloat-equal -Wdeclaration-after-statement -Wshadow -Wunsafe-loop-optimizations -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wvolatile-register-var -Wdisabled-optimization -Wstack-protector -Woverlength-strings"
74 #removed "-Wlogical-op" and "-Wvla" which are not supported by my gcc --nmav
75 # -Wtraditional: warns on #elif which we use often
76 # -Wundef: warns on '#if GNULIB_PORTCHECK' etc in gnulib headers
77 # -Wpadded: many of our structs are not optimized for padding
78 # -Wtraditional-conversion: we catch missing prototypes anyway
79 # -Wno-unused-parameter: added because -Wunused cause too many warns
80 # -Wunreachable-code: appears to return many false positives
81 # -Wconversion: too many warnings for now
82 # -Wswitch-default: too many warnings for now
83 # -Wswitch-enum: too many warnings for now
84 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_warns=yes,_gcc_warns=no)
85 AC_MSG_RESULT($_gcc_warns)
86 if test x"$_gcc_warns" != xyes ; then
87 CFLAGS=$_gcc_cflags_save;
91 AC_MSG_CHECKING([whether gcc supports -Wno-pointer-sign])
92 _gcc_cflags_save="$CFLAGS"
93 CFLAGS="${CFLAGS} -Wno-pointer-sign"
94 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
95 AC_MSG_RESULT($_gcc_psign)
96 if test "$_gcc_psign" != "yes"; then
97 CFLAGS="$_gcc_cflags_save";
100 AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
101 _gcc_cflags_save="$CFLAGS"
102 CFLAGS="${CFLAGS} -fgnu89-inline"
103 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
104 _gcc_gnu89_inline=yes, _gcc_gnu89_inline=no)
105 AC_MSG_RESULT($_gcc_gnu89_inline)
106 CFLAGS="$_gcc_cflags_save"
109 # Needs to be called outside of 'if' clause.
110 AM_CONDITIONAL([HAVE_GCC_GNU89_INLINE_OPTION],
111 [test "$_gcc_gnu89_inline" = "yes"])
114 *** Detecting C library capabilities...
118 AC_CHECK_FUNCS(fork,,)
119 AC_DEFINE([HAVE_STRINGS_H], 1, [Hard-code for src/cfg/.])
120 AC_DEFINE([HAVE_FLOAT_H], 1, [Hard-code for src/cfg/.])
121 AC_DEFINE([HAVE_LIMITS_H], 1, [Hard-code for src/cfg/.])
122 AC_DEFINE([HAVE_MATH_H], 1, [Hard-code for src/cfg/.])
123 AC_DEFINE([HAVE_CTYPE_H], 1, [Hard-code for src/cfg/.])
124 AC_DEFINE([HAVE_ERRNO_H], 1, [Hard-code for src/cfg/.])
126 # No fork on MinGW, disable some self-tests until we fix them.
127 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
130 *** Detecting system's parameters...
133 # Run self-tests under valgrind?
134 if test "$cross_compiling" = no; then
135 AC_CHECK_PROGS(VALGRIND, valgrind)
137 if test -n "$VALGRIND" && $VALGRIND true > /dev/null 2>&1; then
138 opt_valgrind_tests=yes
140 opt_valgrind_tests=no
143 AC_MSG_CHECKING([whether self tests are run under valgrind])
144 AC_ARG_ENABLE(valgrind-tests,
145 AS_HELP_STRING([--enable-valgrind-tests],
146 [run self tests under valgrind]),
147 opt_valgrind_tests=$enableval)
148 AC_MSG_RESULT($opt_valgrind_tests)
150 AC_CHECK_TYPES(uint,,, [
151 # include <sys/types.h>
155 *** Checking for external libraries...
158 # For Guile bindings.
160 opt_guile_bindings=yes
161 AC_MSG_CHECKING([whether building Guile bindings])
163 AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
164 opt_guile_bindings=$enableval)
165 AC_MSG_RESULT($opt_guile_bindings)
167 AC_ARG_WITH([--with-guile-site-dir],
168 [AS_HELP_STRING([--with-guile-site-dir],
169 [use the given directory as the Guile site (use with care)])])
171 if test "x$opt_guile_bindings" = "xyes"; then
173 *** Detecting GNU Guile...
176 AC_PATH_PROG([guile_snarf], [guile-snarf])
177 if test "x$guile_snarf" = "x"; then
178 AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found. Guile bindings not built.])
179 opt_guile_bindings=no
184 save_CFLAGS="$CFLAGS"
186 CFLAGS="$CFLAGS $GUILE_CFLAGS"
187 LIBS="$LIBS $GUILE_LDFLAGS"
188 AC_MSG_CHECKING([whether GNU Guile is recent enough])
189 AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
190 [], [opt_guile_bindings=no])
191 CFLAGS="$save_CFLAGS"
194 if test "x$opt_guile_bindings" = "xyes"; then
196 case "x$with_guile_site_dir" in
198 # Use the default $(GUILE_SITE).
202 # Automatically derive $(GUILE_SITE) from $(pkgdatadir). This
203 # hack is used to allow `distcheck' to work (see
204 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
205 GUILE_SITE="\$(datadir)/guile/site"
209 # Use the user-specified directory as $(GUILE_SITE).
210 GUILE_SITE="$with_guile_site_dir"
216 AC_MSG_WARN([A sufficiently recent GNU Guile not found. Guile bindings not built.])
217 opt_guile_bindings=no
221 AM_CONDITIONAL(HAVE_GUILE, test "x$opt_guile_bindings" = "xyes")
223 dnl Check for libcfg+
226 AC_ARG_WITH(included-libcfg,
227 AS_HELP_STRING([--with-included-libcfg],
228 [use the included libcfg+ (certtool only)]),
229 libcfg_enabled=$withval,
231 dnl We search for libcfg+ which is used by certtool
233 AC_CHECK_LIB(cfg+, cfg_get_context,:,
237 *** Libcfg+ was not found. Will use the included one.]])))
239 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
242 AC_MSG_CHECKING([whether to use the included libcfg])
243 AC_MSG_RESULT($libcfg_enabled)
246 *** Setting up gnulib compatibility files...
251 *** Detecting options for shared libraries...
256 AC_CONFIG_SUBDIRS([lib])
257 AC_CONFIG_SUBDIRS([libextra])
259 AC_CONFIG_FILES([Makefile \
260 doc/Makefile doc/examples/Makefile doc/scripts/Makefile \
261 doc/manpages/Makefile doc/reference/Makefile doc/doxygen/Doxyfile \
262 doc/credentials/Makefile doc/credentials/x509/Makefile \
263 doc/credentials/srp/Makefile doc/credentials/openpgp/Makefile \
264 gl/Makefile gl/tests/Makefile \
265 tests/Makefile tests/rsa-md5-collision/Makefile tests/userid/Makefile \
266 tests/pkcs1-padding/Makefile tests/pkcs8-decode/Makefile \
267 tests/pkcs12-decode/Makefile tests/pathlen/Makefile \
268 tests/key-id/Makefile tests/sha2/Makefile \
269 tests/openpgp-certs/Makefile \
271 src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
272 guile/Makefile guile/modules/Makefile \
273 guile/src/Makefile guile/tests/Makefile])
275 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])