1 dnl Process this file with autoconf to produce a configure script.
5 AC_PREFIX_DEFAULT(/usr/local)
7 AC_CANONICAL_TARGET([])
8 AC_DEFINE_UNQUOTED(T_CPU, "$target_cpu", [CPU name])
9 AC_DEFINE_UNQUOTED(T_VENDOR, "$target_vendor", [Vendor name])
10 AC_DEFINE_UNQUOTED(T_OS, "$target_os", [OS name])
13 GNUTLS_MAJOR_VERSION=0
14 GNUTLS_MINOR_VERSION=9
15 GNUTLS_MICRO_VERSION=0
16 GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
18 AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION", [version of gnutls])
20 AM_INIT_AUTOMAKE(gnutls, $GNUTLS_VERSION, [version of gnutls])
21 AM_CONFIG_HEADER(config.h)
25 dnl This is the library version
26 GNUTLS_MOST_RECENT_INTERFACE=6
27 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
28 GNUTLS_OLDEST_INTERFACE=6
31 AC_SUBST(GNUTLS_MAJOR_VERSION)
32 AC_SUBST(GNUTLS_MINOR_VERSION)
33 AC_SUBST(GNUTLS_MICRO_VERSION)
34 AC_SUBST(GNUTLS_VERSION)
36 AC_SUBST(GNUTLS_MOST_RECENT_INTERFACE)
37 AC_SUBST(GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER)
38 AC_SUBST(GNUTLS_OLDEST_INTERFACE)
40 LT_CURRENT=$GNUTLS_MOST_RECENT_INTERFACE
41 LT_REVISION=$GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER
42 LT_AGE=`expr $GNUTLS_MOST_RECENT_INTERFACE - $GNUTLS_OLDEST_INTERFACE`
48 AC_MSG_CHECKING([whether in dmalloc mode])
49 AC_ARG_ENABLE(dmalloc-mode,
50 [ --enable-dmalloc-mode enable dmalloc mode],
51 opt_dmalloc_mode=$enableval)
52 AC_MSG_RESULT($opt_dmalloc_mode)
55 AC_MSG_CHECKING([whether in electric fence mode])
56 AC_ARG_ENABLE(efence-mode,
57 [ --enable-efence-mode enable electric fence mode],
58 opt_efence_mode=$enableval)
59 AC_MSG_RESULT($opt_efence_mode)
62 AC_MSG_CHECKING([whether in maintanance mode])
63 AC_ARG_ENABLE(developer-mode,
64 [ --enable-developer-mode enable developer mode],
65 opt_developer_mode=$enableval)
66 AC_MSG_RESULT($opt_developer_mode)
69 AC_MSG_CHECKING([whether in profile mode])
70 AC_ARG_ENABLE(profile-mode,
71 [ --enable-profile-mode enable profiler],
72 opt_profiler_mode=$enableval)
73 AC_MSG_RESULT($opt_profiler_mode)
76 *** Checking for compilation programs...
84 dnl Checks for programs.
91 *** Detecting compiler options...
98 AC_MSG_CHECKING([whether C99 macros are supported])
100 #define test_mac(...)
106 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
110 AC_MSG_WARN([C99 macros are not supported by your compiler. This may
114 if test $ac_cv_c_compiler_gnu != no; then
116 if test x$opt_developer_mode = xyes; then
117 CFLAGS="${CFLAGS} -Wall -Wcast-align -W -Wpointer-arith -Wchar-subscripts -Wformat-security -Wmissing-braces -Wsign-compare -Winline -Wstrict-prototypes"
119 CFLAGS="${CFLAGS} -O2 -finline-functions"
122 if test x$opt_dmalloc_mode = xyes; then
123 AC_CHECK_LIB( dmalloc, main)
124 AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
126 if test x$opt_efence_mode = xyes; then
127 AC_CHECK_LIB( efence, main)
128 AC_DEFINE(USE_EFENCE, 1, [use electric fence])
133 AC_MSG_CHECKING([whether we have GNU assembler])
135 GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
137 CFLAGS="${CFLAGS} -pipe"
146 *** Detecting C library capabilities...
151 AC_CHECK_HEADERS(unistd.h pwd.h strings.h stdarg.h)
152 AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
153 AC_CHECK_HEADERS(errno.h sys/time.h time.h)
154 AC_CHECK_FUNCS(bzero memset memmove bcopy memcmp memcpy,,)
159 *** Detecting system's parameters...
162 AC_CHECK_SIZEOF(unsigned long, 4)
163 AC_CHECK_SIZEOF(unsigned int, 4)
164 AC_CHECK_SIZEOF(unsigned short, 2)
165 AC_CHECK_SIZEOF(unsigned char, 1)
166 AC_CHECK_SIZEOF(unsigned char*, 4)
168 AC_CHECK_TYPES(ptrdiff_t,,, [
169 # include <sys/types.h>
172 AC_CHECK_TYPES(uint,,, [
173 # include <sys/types.h>
176 AC_CHECK_TYPE(size_t,
177 DEFINE_SIZE_T="#include <sys/types.h>"
178 AC_SUBST( DEFINE_SIZE_T)
180 AC_DEFINE(NO_SIZE_T, 1, [no size_t type was found])
181 DEFINE_SIZE_T="typedef unsigned int size_t; typedef int ssize_t;"
182 AC_SUBST( DEFINE_SIZE_T)
184 #ifdef HAVE_SYS_TYPES_H
185 # include <sys/types.h>
192 AC_CHECK_TYPE(time_t,
193 DEFINE_TIME_T="#include <time.h>"
194 AC_SUBST( DEFINE_TIME_T)
196 AC_CHECK_TYPE(time_t,
197 DEFINE_TIME_T="#include <sys/time.h>"
198 AC_SUBST( DEFINE_TIME_T)
200 DEFINE_TIME_T="typedef unsigned int time_t;"
201 AC_SUBST( DEFINE_TIME_T)
202 AC_DEFINE(NO_TIME_T, 1, [no time_t type was found]),
204 #include <sys/time.h>
217 *** Checking for external libraries...
220 AM_PATH_LIBGCRYPT(1.1.12,,
223 *** libgcrypt was not found. You may want to get it from
224 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/
227 dnl Can't disable - gnutls depends on gcrypt
228 AC_DEFINE(USE_GCRYPT, 1, [use gcrypt])
232 AC_MSG_CHECKING([whether to disable SRP authentication support])
233 AC_ARG_ENABLE( srp-authentication, [ --disable-srp-authentication disable the SRP authentication support],
236 if test x$ac_enable_srp != xno; then
238 AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
243 AC_MSG_CHECKING([whether to disable anonymous authentication support])
244 AC_ARG_ENABLE( anon-authentication, [ --disable-anon-authentication disable the anonymous authentication support],
247 if test x$ac_enable_anon != xno; then
249 AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
255 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
256 AC_ARG_ENABLE( openpgp-authentication, [ --disable-openpgp-authentication disable the OpenPGP authentication support],
259 if test x$ac_enable_openpgp != xno; then
261 AM_PATH_LIBOPENCDK( 0.4.0, AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]),
264 *** libopencdk 0.4.0 was not found. You will not be able to use OpenPGP keys with gnutls.
270 AC_ARG_WITH(included-libtasn1,
271 [ --with-included-libtasn1 Use the included libtasn1],
272 minitasn1_enabled=$withval,
275 AC_CHECK_LIB( tasn1, asn1_array2tree,:,
276 minitasn1_enabled=yes
278 *** LibtASN1 was not found. Will use the included one.))
281 if test x$opt_developer_mode = xyes; then
282 minitasn1_enabled=yes
285 AC_MSG_CHECKING([whether to use the included minitasn1])
286 AC_MSG_RESULT($minitasn1_enabled)
289 dnl CHECK FOR ZLIB SUPPORT
292 AC_MSG_CHECKING([whether to include zlib compression support])
294 AC_ARG_WITH( zlib, [ --without-zlib disable zlib compression support],
299 if test x$ac_zlib != xno; then
301 AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
303 *** ZLIB was not found. You will not be able to use ZLIB compression.))
309 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
312 if test x$opt_developer_mode = xyes; then
316 AC_ARG_WITH(included-lzo,
317 [ --with-included-lzo include minilzo in libgnutls-extra],
318 minilzo_enabled=$withval,
322 AC_MSG_CHECKING([whether to use the included lzo compression library])
324 AC_MSG_RESULT($minilzo_enabled)
326 if test x$minilzo_enabled = xno; then
327 AC_CHECK_LIB( lzo, lzo1x_1_compress, minilzo_enabled=no,
331 *** Liblzo was not found. Will use the included minilzo.))
334 if test x"$minilzo_enabled" = xyes; then
335 AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
336 LZO_OBJECTS="minilzo.lo"
341 AC_SUBST(LZO_OBJECTS)
344 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
347 if test x"$minitasn1_enabled" = xyes; then
348 MINITASN1_OBJECTS="minitasn1/coding.lo minitasn1/decoding.lo minitasn1/element.lo \
349 minitasn1/errors.lo minitasn1/gstr.lo minitasn1/parser_aux.lo minitasn1/structure.lo"
350 MINITASN1_DIR=minitasn1
355 AC_SUBST(MINITASN1_OBJECTS)
356 AC_SUBST(MINITASN1_DIR)
357 AC_SUBST(LIBASN1_LINK)
362 *** Detecting options for shared libraries...
367 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBASN1_LINK $LIBGCRYPT_LIBS"
368 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
370 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
372 AC_SUBST(LIBGNUTLS_LIBS)
373 AC_SUBST(LIBGNUTLS_CFLAGS)
375 SERV_LIBS="$LIBS $SERV_LIBS"
378 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS $LZO_LINK"
379 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
381 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
382 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
384 if test $ac_cv_c_compiler_gnu != no; then
386 if test x$opt_profiler_mode = xyes; then
387 AC_CHECK_PROG(FC_OK, fc-config, yes, no)
388 if test x$FC_OK = xyes; then
389 CFLAGS="${CFLAGS} `fc-config --cflags`"
390 LIBS="$LIBS `fc-config --libs`"
393 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
400 AC_CONFIG_FILES(lib/gnutls.h.in)
402 AC_CONFIG_COMMANDS([includes/gnutls/gnutls.h],[[
403 test -f lib/gnutls.h.in || (echo "Could not generate includes/gnutls/gnutls.h" && exit 1)
404 cat lib/gnutls.h.in > includes/gnutls/gnutls.h
405 cat lib/gnutls_ui.h >> includes/gnutls/gnutls.h
406 echo "" >> includes/gnutls/gnutls.h
407 cat lib/gnutls_errors_int.h | grep -v _INT_ >> includes/gnutls/gnutls.h
408 echo "" >> includes/gnutls/gnutls.h
409 echo "#ifdef __cplusplus" >> includes/gnutls/gnutls.h
410 echo "}" >> includes/gnutls/gnutls.h
411 echo "#endif" >> includes/gnutls/gnutls.h
412 echo "#endif /* GNUTLS_H */" >> includes/gnutls/gnutls.h
413 echo "" >> includes/gnutls/gnutls.h
414 chmod +x lib/libgnutls-config
415 chmod +x libextra/libgnutls-extra-config
418 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
419 lib/libgnutls-config libextra/libgnutls-extra-config \
420 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
421 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
422 doc/examples/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
423 includes/Makefile includes/gnutls/Makefile])