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=99
16 GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
18 AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION", [version of gnutls])
20 GNUTLS_GCRYPT_VERSION=1.1.44
21 GNUTLS_LIBTASN1_VERSION=0.2.5
22 AC_DEFINE_UNQUOTED(GNUTLS_GCRYPT_VERSION, "$GNUTLS_GCRYPT_VERSION", [version of gcrypt])
23 AC_DEFINE_UNQUOTED(GNUTLS_LIBTASN1_VERSION, "$GNUTLS_LIBTASN1_VERSION", [version of libtasn1])
25 AM_INIT_AUTOMAKE(gnutls, $GNUTLS_VERSION, [version of gnutls])
26 AM_CONFIG_HEADER(config.h)
30 dnl This is the library version
31 GNUTLS_MOST_RECENT_INTERFACE=9
32 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
33 GNUTLS_OLDEST_INTERFACE=8
36 AC_SUBST(GNUTLS_MAJOR_VERSION)
37 AC_SUBST(GNUTLS_MINOR_VERSION)
38 AC_SUBST(GNUTLS_MICRO_VERSION)
39 AC_SUBST(GNUTLS_VERSION)
41 AC_SUBST(GNUTLS_MOST_RECENT_INTERFACE)
42 AC_SUBST(GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER)
43 AC_SUBST(GNUTLS_OLDEST_INTERFACE)
45 LT_CURRENT=$GNUTLS_MOST_RECENT_INTERFACE
46 LT_REVISION=$GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER
47 LT_AGE=`expr $GNUTLS_MOST_RECENT_INTERFACE - $GNUTLS_OLDEST_INTERFACE`
54 LIBS="$LIBS -lwsock32"
62 AC_MSG_CHECKING([whether in dmalloc mode])
63 AC_ARG_ENABLE(dmalloc-mode,
64 [ --enable-dmalloc-mode enable dmalloc mode],
65 opt_dmalloc_mode=$enableval)
66 AC_MSG_RESULT($opt_dmalloc_mode)
69 AC_MSG_CHECKING([whether in electric fence mode])
70 AC_ARG_ENABLE(efence-mode,
71 [ --enable-efence-mode enable electric fence mode],
72 opt_efence_mode=$enableval)
73 AC_MSG_RESULT($opt_efence_mode)
76 AC_MSG_CHECKING([whether in maintanance mode])
77 AC_ARG_ENABLE(developer-mode,
78 [ --enable-developer-mode enable developer mode],
79 opt_developer_mode=$enableval)
80 AC_MSG_RESULT($opt_developer_mode)
83 AC_MSG_CHECKING([whether in profile mode])
84 AC_ARG_ENABLE(profile-mode,
85 [ --enable-profile-mode enable profiler],
86 opt_profiler_mode=$enableval)
87 AC_MSG_RESULT($opt_profiler_mode)
90 *** Checking for compilation programs...
93 SAVED_CFLAGS="${CFLAGS}"
97 CFLAGS="${SAVED_CFLAGS}"
102 dnl Checks for programs.
109 *** Detecting compiler options...
116 AC_MSG_CHECKING([whether C99 macros are supported])
118 #define test_mac(...)
124 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
128 AC_MSG_WARN([C99 macros are not supported by your compiler. This may
132 if test $ac_cv_c_compiler_gnu != no; then
134 if test x$opt_developer_mode = xyes; then
135 CFLAGS="${CFLAGS} -g -Wno-format-y2k -Wall -Wcast-align -W -Wpointer-arith -Wchar-subscripts -Wformat-security -Wmissing-braces -Winline -Wstrict-prototypes"
137 CFLAGS="${CFLAGS} -O2 -finline-functions"
140 if test x$opt_dmalloc_mode = xyes; then
141 AC_CHECK_LIB( dmalloc, main)
142 AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
144 if test x$opt_efence_mode = xyes; then
145 AC_CHECK_LIB( efence, main)
146 AC_DEFINE(USE_EFENCE, 1, [use electric fence])
151 AC_MSG_CHECKING([whether we have GNU assembler])
153 GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
155 CFLAGS="${CFLAGS} -pipe"
164 *** Detecting C library capabilities...
169 AC_CHECK_HEADERS(unistd.h strings.h stddef.h alloca.h)
170 AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
171 AC_CHECK_HEADERS(errno.h sys/time.h time.h)
172 AC_CHECK_FUNCS(isascii memmove strnstr mmap gmtime_r inet_ntop,,)
177 *** Detecting system's parameters...
180 AC_CHECK_SIZEOF(unsigned long, 4)
181 AC_CHECK_SIZEOF(unsigned int, 4)
182 AC_CHECK_SIZEOF(unsigned short, 2)
183 AC_CHECK_SIZEOF(unsigned char, 1)
184 AC_CHECK_SIZEOF(unsigned char*, 4)
186 AC_CHECK_TYPES(ptrdiff_t,,, [
187 # include <sys/types.h>
191 AC_CHECK_TYPES(uint,,, [
192 # include <sys/types.h>
195 AC_CHECK_TYPE(size_t,
196 DEFINE_SIZE_T="#include <sys/types.h>"
197 AC_SUBST( DEFINE_SIZE_T)
199 AC_DEFINE(NO_SIZE_T, 1, [no size_t type was found])
200 DEFINE_SIZE_T="typedef unsigned int size_t;"
201 AC_SUBST( DEFINE_SIZE_T)
203 #ifdef HAVE_SYS_TYPES_H
204 # include <sys/types.h>
211 AC_CHECK_TYPE(ssize_t,
212 DEFINE_SIZE_T="#include <sys/types.h>"
213 AC_SUBST( DEFINE_SSIZE_T)
215 AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
216 DEFINE_SSIZE_T="typedef int ssize_t;"
217 AC_SUBST( DEFINE_SSIZE_T)
219 #ifdef HAVE_SYS_TYPES_H
220 # include <sys/types.h>
227 AC_CHECK_TYPE(time_t,
228 DEFINE_TIME_T="#include <time.h>"
229 AC_SUBST( DEFINE_TIME_T)
231 AC_CHECK_TYPE(time_t,
232 DEFINE_TIME_T="#include <sys/time.h>"
233 AC_SUBST( DEFINE_TIME_T)
235 DEFINE_TIME_T="typedef unsigned int time_t;"
236 AC_SUBST( DEFINE_TIME_T)
237 AC_DEFINE(NO_TIME_T, 1, [no time_t type was found]),
239 #include <sys/time.h>
252 *** Checking for external libraries...
255 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
258 *** libgcrypt was not found. You may want to get it from
259 *** ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/
262 dnl Can't disable - gnutls depends on gcrypt
263 AC_DEFINE(USE_GCRYPT, 1, [use gcrypt])
265 # Since libgcrypt 1.1.90 we have a new function to create nonces etc.
266 # it is useful to use this one instead of the the standard random
267 # functions. As a temporary solution we check for that function and
268 # don't require an unrelease libgcrypt. This should be changed after
269 # libgcrypt 1.2 has been released.
271 LIBS="$LIBS $LIBGCRYPT_LIBS"
272 AC_CHECK_FUNCS(gcry_create_nonce)
276 AC_MSG_CHECKING([whether to disable SRP authentication support])
277 AC_ARG_ENABLE( srp-authentication, [ --disable-srp-authentication Disable the SRP authentication support],
280 if test x$ac_enable_srp != xno; then
282 AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
287 AC_MSG_CHECKING([whether to disable anonymous authentication support])
288 AC_ARG_ENABLE( anon-authentication, [ --disable-anon-authentication Disable the anonymous authentication support],
291 if test x$ac_enable_anon != xno; then
293 AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
298 AC_MSG_CHECKING([whether to disable extra PKI stuff])
299 AC_ARG_ENABLE( extra-pki, [ --disable-extra-pki only enable the basic PKI stuff],
302 if test x$ac_enable_pki != xno; then
304 AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS #x stuff and other PKI stuff])
310 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
311 AC_ARG_ENABLE( openpgp-authentication, [ --disable-openpgp-authentication Disable the OpenPGP authentication support],
314 if test x$ac_enable_openpgp != xno; then
316 AM_PATH_LIBOPENCDK( 0.5.2, AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]),
319 *** libopencdk 0.5.2 was not found. You may want to get it from
320 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
327 ac_enable_openssl=yes
328 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
329 AC_ARG_ENABLE( openssl-compatibility, [ --disable-openssl-compatibility Disable the OpenSSL compatibility support],
332 if test x$ac_enable_openssl != xno; then
338 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
341 AC_ARG_WITH(included-libtasn1,
342 [ --with-included-libtasn1 Use the included libtasn1],
343 minitasn1_enabled=$withval,
346 dnl We now need libtasn1 0.2.x
348 AC_CHECK_LIB( tasn1, asn1_read_tag,:,
349 minitasn1_enabled=yes
352 *** LibtASN1 0.2.x was not found. Will use the included one.]])))
355 if test x$opt_developer_mode = xyes; then
356 minitasn1_enabled=yes
359 AC_MSG_CHECKING([whether to use the included minitasn1])
360 AC_MSG_RESULT($minitasn1_enabled)
363 dnl CHECK FOR ZLIB SUPPORT
366 AC_MSG_CHECKING([whether to include zlib compression support])
368 AC_ARG_WITH( zlib, [ --without-zlib disable zlib compression support],
373 if test x$ac_zlib != xno; then
375 AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
377 *** ZLIB was not found. You will not be able to use ZLIB compression.))
384 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
387 if test x$opt_developer_mode = xyes; then
391 AC_ARG_WITH(included-lzo,
392 [ --with-included-lzo include minilzo in libgnutls-extra],
393 minilzo_enabled=$withval,
397 AC_MSG_CHECKING([whether to use the included lzo compression library])
399 AC_MSG_RESULT($minilzo_enabled)
401 if test x$minilzo_enabled = xno; then
402 AC_CHECK_LIB( lzo, lzo1x_1_compress, minilzo_enabled=no,
406 *** Liblzo was not found. Will use the included minilzo.))
409 if test x"$minilzo_enabled" = xyes; then
410 AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
411 LZO_OBJECTS="minilzo.lo"
416 AC_SUBST(LZO_OBJECTS)
419 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
422 if test x"$minitasn1_enabled" = xyes; then
423 MINITASN1_OBJECTS="minitasn1/coding.lo minitasn1/decoding.lo minitasn1/element.lo \
424 minitasn1/errors.lo minitasn1/gstr.lo minitasn1/parser_aux.lo minitasn1/structure.lo"
425 MINITASN1_DIR=minitasn1
430 AC_SUBST(MINITASN1_OBJECTS)
431 AC_SUBST(MINITASN1_DIR)
432 AC_SUBST(LIBASN1_LINK)
437 *** Detecting options for shared libraries...
441 dnl This is after AM_PROG_LIBTOOL so that the LD variable
444 AC_MSG_CHECKING([whether we have GNU ld or compatible])
446 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
448 have_ld_version_script=yes
451 have_ld_version_script=no
454 *** You may want to rerun configure using --with-gnu-ld to enable versioned symbols.
458 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
461 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBASN1_LINK $LIBGCRYPT_LIBS"
462 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
464 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
466 AC_SUBST(LIBGNUTLS_LIBS)
467 AC_SUBST(LIBGNUTLS_CFLAGS)
469 SERV_LIBS="$LIBS $SERV_LIBS"
472 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS $LZO_LINK"
473 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
475 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
476 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
478 if test $ac_cv_c_compiler_gnu != no; then
480 if test x$opt_profiler_mode = xyes; then
481 AC_CHECK_PROG(FC_OK, fc-config, yes, no)
482 if test x$FC_OK = xyes; then
483 CFLAGS="${CFLAGS} `fc-config --cflags`"
484 LIBS="$LIBS `fc-config --libs`"
487 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
494 AC_CONFIG_FILES(lib/gnutls.h.in)
496 AC_CONFIG_COMMANDS([includes/gnutls/gnutls.h],[[
497 test -f lib/gnutls.h.in || (echo "Could not generate includes/gnutls/gnutls.h" && exit 1)
498 cat lib/gnutls.h.in > includes/gnutls/gnutls.h
499 cat lib/gnutls_ui.h >> includes/gnutls/gnutls.h
500 echo "" >> includes/gnutls/gnutls.h
501 cat lib/gnutls_errors_int.h | grep -v _INT_ >> includes/gnutls/gnutls.h
502 echo "" >> includes/gnutls/gnutls.h
503 echo "#ifdef __cplusplus" >> includes/gnutls/gnutls.h
504 echo "}" >> includes/gnutls/gnutls.h
505 echo "#endif" >> includes/gnutls/gnutls.h
506 echo "#endif /* GNUTLS_H */" >> includes/gnutls/gnutls.h
507 echo "" >> includes/gnutls/gnutls.h
508 chmod +x lib/libgnutls-config
509 chmod +x libextra/libgnutls-extra-config
512 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
513 libextra/openpgp/Makefile lib/libgnutls-config libextra/libgnutls-extra-config \
514 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
515 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
516 doc/examples/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
517 includes/Makefile includes/gnutls/Makefile doc/manpages/Makefile])