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=1
14 GNUTLS_MINOR_VERSION=1
15 GNUTLS_MICRO_VERSION=8
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.1.94
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=13
32 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
33 GNUTLS_OLDEST_INTERFACE=12
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"
60 dnl In order to use the reentrant libc functions.
61 dnl I hope it is portable enough.
62 CFLAGS="${CFLAGS} -D_REENTRANT -D_THREAD_SAFE"
65 AC_MSG_CHECKING([whether in dmalloc mode])
66 AC_ARG_ENABLE(dmalloc-mode,
67 [ --enable-dmalloc-mode enable dmalloc mode],
68 opt_dmalloc_mode=$enableval)
69 AC_MSG_RESULT($opt_dmalloc_mode)
72 AC_MSG_CHECKING([whether in electric fence mode])
73 AC_ARG_ENABLE(efence-mode,
74 [ --enable-efence-mode enable electric fence mode],
75 opt_efence_mode=$enableval)
76 AC_MSG_RESULT($opt_efence_mode)
79 AC_MSG_CHECKING([whether in maintanance mode])
80 AC_ARG_ENABLE(developer-mode,
81 [ --enable-developer-mode enable developer mode],
82 opt_developer_mode=$enableval)
83 AC_MSG_RESULT($opt_developer_mode)
86 AC_MSG_CHECKING([whether in profile mode])
87 AC_ARG_ENABLE(profile-mode,
88 [ --enable-profile-mode enable profiler],
89 opt_profiler_mode=$enableval)
90 AC_MSG_RESULT($opt_profiler_mode)
93 *** Checking for compilation programs...
96 SAVED_CFLAGS="${CFLAGS}"
100 CFLAGS="${SAVED_CFLAGS}"
105 dnl Checks for programs.
112 *** Detecting compiler options...
119 AC_MSG_CHECKING([whether C99 macros are supported])
121 #define test_mac(...)
127 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
131 AC_MSG_WARN([C99 macros are not supported by your compiler. This may
135 if test $ac_cv_c_compiler_gnu != no; then
137 if test x$opt_developer_mode = xyes; then
138 CFLAGS="${CFLAGS} -g -Wno-format-y2k -Wall -Wcast-align -W -Wpointer-arith -Wchar-subscripts -Wformat-security -Wmissing-braces -Winline -Wstrict-prototypes"
140 CFLAGS="${CFLAGS} -O2 -finline-functions"
143 if test x$opt_dmalloc_mode = xyes; then
144 AC_CHECK_LIB( dmalloc, main)
145 AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
147 if test x$opt_efence_mode = xyes; then
148 AC_CHECK_LIB( efence, main)
149 AC_DEFINE(USE_EFENCE, 1, [use electric fence])
154 AC_MSG_CHECKING([whether we have GNU assembler])
156 GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
158 CFLAGS="${CFLAGS} -pipe"
167 *** Detecting C library capabilities...
172 AC_CHECK_HEADERS(unistd.h strings.h stddef.h alloca.h)
173 AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
174 AC_CHECK_HEADERS(errno.h sys/time.h time.h)
175 AC_CHECK_HEADERS(math.h limits.h float.h stdarg.h)
176 AC_CHECK_FUNCS(isascii memmove strnstr mmap gmtime_r inet_ntop,,)
181 *** Detecting system's parameters...
184 AC_CHECK_SIZEOF(unsigned long, 4)
185 AC_CHECK_SIZEOF(unsigned int, 4)
186 AC_CHECK_SIZEOF(unsigned short, 2)
187 AC_CHECK_SIZEOF(unsigned char, 1)
188 AC_CHECK_SIZEOF(unsigned char*, 4)
190 AC_CHECK_TYPES(ptrdiff_t,,, [
191 # include <sys/types.h>
195 AC_CHECK_TYPES(uint,,, [
196 # include <sys/types.h>
199 AC_CHECK_TYPE(size_t,
200 DEFINE_SIZE_T="#include <sys/types.h>"
201 AC_SUBST( DEFINE_SIZE_T)
203 AC_DEFINE(NO_SIZE_T, 1, [no size_t type was found])
204 DEFINE_SIZE_T="typedef unsigned int size_t;"
205 AC_SUBST( DEFINE_SIZE_T)
207 #ifdef HAVE_SYS_TYPES_H
208 # include <sys/types.h>
215 AC_CHECK_TYPE(ssize_t,
216 DEFINE_SIZE_T="#include <sys/types.h>"
217 AC_SUBST( DEFINE_SSIZE_T)
219 AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
220 DEFINE_SSIZE_T="typedef int ssize_t;"
221 AC_SUBST( DEFINE_SSIZE_T)
223 #ifdef HAVE_SYS_TYPES_H
224 # include <sys/types.h>
231 AC_CHECK_TYPE(time_t,
232 DEFINE_TIME_T="#include <time.h>"
233 AC_SUBST( DEFINE_TIME_T)
235 AC_CHECK_TYPE(time_t,
236 DEFINE_TIME_T="#include <sys/time.h>"
237 AC_SUBST( DEFINE_TIME_T)
239 DEFINE_TIME_T="typedef unsigned int time_t;"
240 AC_SUBST( DEFINE_TIME_T)
241 AC_DEFINE(NO_TIME_T, 1, [no time_t type was found]),
243 #include <sys/time.h>
256 *** Checking for external libraries...
259 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
262 *** libgcrypt was not found. You may want to get it from
263 *** ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/
266 dnl Can't disable - gnutls depends on gcrypt
267 AC_DEFINE(USE_GCRYPT, 1, [use gcrypt])
269 AC_MSG_CHECKING([whether to disable SRP authentication support])
270 AC_ARG_ENABLE( srp-authentication, [ --disable-srp-authentication Disable the SRP authentication support],
273 if test x$ac_enable_srp != xno; then
275 AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
280 AC_MSG_CHECKING([whether to disable anonymous authentication support])
281 AC_ARG_ENABLE( anon-authentication, [ --disable-anon-authentication Disable the anonymous authentication support],
284 if test x$ac_enable_anon != xno; then
286 AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
291 AC_MSG_CHECKING([whether to disable extra PKI stuff])
292 AC_ARG_ENABLE( extra-pki, [ --disable-extra-pki only enable the basic PKI stuff],
295 if test x$ac_enable_pki != xno; then
297 AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS #x stuff and other PKI stuff])
303 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
304 AC_ARG_ENABLE( openpgp-authentication, [ --disable-openpgp-authentication Disable the OpenPGP authentication support],
307 if test x$ac_enable_openpgp != xno; then
309 AM_PATH_LIBOPENCDK( 0.5.2, AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]),
312 *** libopencdk 0.5.2 was not found. You may want to get it from
313 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
320 ac_enable_openssl=yes
321 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
322 AC_ARG_ENABLE( openssl-compatibility, [ --disable-openssl-compatibility Disable the OpenSSL compatibility support],
325 if test x$ac_enable_openssl != xno; then
331 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
334 AC_ARG_WITH(included-libtasn1,
335 [ --with-included-libtasn1 Use the included libtasn1],
336 minitasn1_enabled=$withval,
339 dnl We now need libtasn1 0.2.x
341 AC_CHECK_LIB( tasn1, asn1_read_tag,:,
342 minitasn1_enabled=yes
345 *** LibtASN1 0.2.x was not found. Will use the included one.]])))
348 if test x$opt_developer_mode = xyes; then
349 minitasn1_enabled=yes
354 AC_MSG_CHECKING([whether to use the included minitasn1])
355 AC_MSG_RESULT($minitasn1_enabled)
357 AC_ARG_WITH(included-libcfg,
358 [ --with-included-libcfg Use the included libcfg+],
359 libcfg_enabled=$withval,
362 dnl We search for libcfg+ which is used by certtool
364 AC_CHECK_LIB( cfg+, cfg_get_context,:,
368 *** Libcfg+ was not found. Will use the included one.]])))
370 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
373 if test x$opt_developer_mode = xyes; then
374 minitasn1_enabled=yes
377 AC_MSG_CHECKING([whether to use the included minitasn1])
378 AC_MSG_RESULT($minitasn1_enabled)
381 dnl CHECK FOR ZLIB SUPPORT
384 AC_MSG_CHECKING([whether to include zlib compression support])
386 AC_ARG_WITH( zlib, [ --without-zlib disable zlib compression support],
391 if test x$ac_zlib != xno; then
393 AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
395 *** ZLIB was not found. You will not be able to use ZLIB compression.))
402 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
405 if test x$opt_developer_mode = xyes; then
409 AC_ARG_WITH(included-lzo,
410 [ --with-included-lzo include minilzo in libgnutls-extra],
411 minilzo_enabled=$withval,
415 AC_MSG_CHECKING([whether to use the included lzo compression library])
417 AC_MSG_RESULT($minilzo_enabled)
419 if test x$minilzo_enabled = xno; then
420 AC_CHECK_LIB( lzo, lzo1x_1_compress, minilzo_enabled=no,
424 *** Liblzo was not found. Will use the included minilzo.))
427 if test x"$minilzo_enabled" = xyes; then
428 AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
429 LZO_OBJECTS="minilzo.lo"
434 AC_SUBST(LZO_OBJECTS)
437 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
440 if test x"$minitasn1_enabled" = xyes; then
441 MINITASN1_OBJECTS="minitasn1/coding.lo minitasn1/decoding.lo minitasn1/element.lo \
442 minitasn1/errors.lo minitasn1/gstr.lo minitasn1/parser_aux.lo minitasn1/structure.lo"
443 MINITASN1_DIR=minitasn1
448 AC_SUBST(MINITASN1_OBJECTS)
449 AC_SUBST(MINITASN1_DIR)
450 AC_SUBST(LIBASN1_LINK)
455 *** Detecting options for shared libraries...
459 dnl This is after AM_PROG_LIBTOOL so that the LD variable
462 AC_MSG_CHECKING([whether we have GNU ld or compatible])
464 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
466 have_ld_version_script=yes
469 have_ld_version_script=no
472 *** You may want to rerun configure using --with-gnu-ld to enable versioned symbols.
476 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
479 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBASN1_LINK $LIBGCRYPT_LIBS"
480 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
482 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
484 AC_SUBST(LIBGNUTLS_LIBS)
485 AC_SUBST(LIBGNUTLS_CFLAGS)
487 SERV_LIBS="$LIBS $SERV_LIBS"
490 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS $LZO_LINK"
491 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
493 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
494 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
496 if test $ac_cv_c_compiler_gnu != no; then
498 if test x$opt_profiler_mode = xyes; then
499 AC_CHECK_PROG(FC_OK, fc-config, yes, no)
500 if test x$FC_OK = xyes; then
501 CFLAGS="${CFLAGS} `fc-config --cflags`"
502 LIBS="$LIBS `fc-config --libs`"
505 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
512 AC_CONFIG_FILES(lib/gnutls.h.in)
514 AC_CONFIG_COMMANDS([includes/gnutls/gnutls.h],[[
515 test -f lib/gnutls.h.in || (echo "Could not generate includes/gnutls/gnutls.h" && exit 1)
516 cat lib/gnutls.h.in > includes/gnutls/gnutls.h
517 cat lib/gnutls_ui.h >> includes/gnutls/gnutls.h
518 echo "" >> includes/gnutls/gnutls.h
519 cat lib/gnutls_errors_int.h | grep -v _INT_ >> includes/gnutls/gnutls.h
520 echo "" >> includes/gnutls/gnutls.h
521 echo "#ifdef __cplusplus" >> includes/gnutls/gnutls.h
522 echo "}" >> includes/gnutls/gnutls.h
523 echo "#endif" >> includes/gnutls/gnutls.h
524 echo "#endif /* GNUTLS_H */" >> includes/gnutls/gnutls.h
525 echo "" >> includes/gnutls/gnutls.h
526 chmod +x lib/libgnutls-config
527 chmod +x libextra/libgnutls-extra-config
530 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
531 libextra/openpgp/Makefile lib/libgnutls-config libextra/libgnutls-extra-config \
532 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
533 src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
534 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
535 doc/examples/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
536 includes/Makefile includes/gnutls/Makefile doc/manpages/Makefile])