*** empty log message ***
[gnutls.git] / configure.in
blobc0b6d289e346bed6b976aee06a71771729398b41
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.57)
3 AC_INIT
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])
12 dnl Gnutls Version
13 GNUTLS_MAJOR_VERSION=1
14 GNUTLS_MINOR_VERSION=1
15 GNUTLS_MICRO_VERSION=6
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.90
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)
28 AM_MAINTAINER_MODE
30 dnl This is the library version
31 GNUTLS_MOST_RECENT_INTERFACE=12
32 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
33 GNUTLS_OLDEST_INTERFACE=11
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`
48 AC_SUBST(LT_CURRENT)
49 AC_SUBST(LT_REVISION)
50 AC_SUBST(LT_AGE)
52 case "${target}" in
53     *-*-mingw32*)
54         LIBS="$LIBS -lwsock32"
55         ;;
56     *)
57       ;;
58 esac
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"
64 opt_dmalloc_mode=no
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)
71 opt_efence_mode=no
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)
78 opt_developer_mode=no
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)
85 opt_profiler_mode=no
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)
92 AC_MSG_RESULT([***
93 *** Checking for compilation programs...
96 SAVED_CFLAGS="${CFLAGS}"
98 AC_PROG_CC
100 CFLAGS="${SAVED_CFLAGS}"
102 AC_PROG_LN_S
105 dnl Checks for programs.
106 AC_PROG_INSTALL
108 dnl AC_PROG_MAKE_SET
111 AC_MSG_RESULT([***
112 *** Detecting compiler options...
116 AC_C_CONST
117 AC_C_INLINE
119 AC_MSG_CHECKING([whether C99 macros are supported])
120 AC_TRY_COMPILE(,[ 
121 #define test_mac(...) 
122 int z,y,x;
123 test_mac(x,y,z);
124 return 0;
125 ], 
126 dnl ***** OK
127 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
128 AC_MSG_RESULT(yes),
129 dnl ***** NOT FOUND
130 AC_MSG_RESULT(no)
131 AC_MSG_WARN([C99 macros are not supported by your compiler. This may
132 affect compiling.])
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"
139         else
140           CFLAGS="${CFLAGS} -O2 -finline-functions"
141         fi
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])
146         else
147                 if test x$opt_efence_mode = xyes; then
148                   AC_CHECK_LIB( efence, main)
149                   AC_DEFINE(USE_EFENCE, 1, [use electric fence])
150                 fi
151         fi
154         AC_MSG_CHECKING([whether we have GNU assembler])
156         GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
157         if test "$GAS"; then
158           CFLAGS="${CFLAGS} -pipe"
159           AC_MSG_RESULT(yes)
160         else
161           AC_MSG_RESULT(no)
162         fi
166 AC_MSG_RESULT([***
167 *** Detecting C library capabilities...
170 AC_HEADER_STDC
171 AC_HEADER_TIME
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_FUNCS(isascii memmove strnstr mmap gmtime_r inet_ntop getpass,,)
176 AC_FUNC_ALLOCA
179 AC_MSG_RESULT([***
180 *** Detecting system's parameters...
183 AC_CHECK_SIZEOF(unsigned long, 4)
184 AC_CHECK_SIZEOF(unsigned int, 4)
185 AC_CHECK_SIZEOF(unsigned short, 2)
186 AC_CHECK_SIZEOF(unsigned char, 1)
187 AC_CHECK_SIZEOF(unsigned char*, 4)
189 AC_CHECK_TYPES(ptrdiff_t,,, [
190 # include <sys/types.h>
191 # include <stddef.h>
194 AC_CHECK_TYPES(uint,,, [
195 # include <sys/types.h>
198 AC_CHECK_TYPE(size_t,
199 DEFINE_SIZE_T="#include <sys/types.h>"
200 AC_SUBST( DEFINE_SIZE_T)
202 AC_DEFINE(NO_SIZE_T, 1, [no size_t type was found])
203 DEFINE_SIZE_T="typedef unsigned int size_t;"
204 AC_SUBST( DEFINE_SIZE_T)
206 #ifdef HAVE_SYS_TYPES_H
207 # include <sys/types.h>
208 #endif
209 #ifdef HAVE_UNISTD_H
210 # include <unistd.h>
211 #endif
214 AC_CHECK_TYPE(ssize_t,
215 DEFINE_SIZE_T="#include <sys/types.h>"
216 AC_SUBST( DEFINE_SSIZE_T)
218 AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
219 DEFINE_SSIZE_T="typedef int ssize_t;"
220 AC_SUBST( DEFINE_SSIZE_T)
222 #ifdef HAVE_SYS_TYPES_H
223 # include <sys/types.h>
224 #endif
225 #ifdef HAVE_UNISTD_H
226 # include <unistd.h>
227 #endif
230 AC_CHECK_TYPE(time_t,
231  DEFINE_TIME_T="#include <time.h>"
232  AC_SUBST( DEFINE_TIME_T)
234   AC_CHECK_TYPE(time_t,
235    DEFINE_TIME_T="#include <sys/time.h>"
236    AC_SUBST( DEFINE_TIME_T)
237    ,
238     DEFINE_TIME_T="typedef unsigned int time_t;"
239     AC_SUBST( DEFINE_TIME_T)
240     AC_DEFINE(NO_TIME_T, 1, [no time_t type was found]),
241   [
242    #include <sys/time.h>
243   ]
244   )
247  #include <time.h>
251 AC_C_BIGENDIAN
254 AC_MSG_RESULT([***
255 *** Checking for external libraries...
258 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
259         AC_MSG_ERROR([[
260 ***  
261 *** libgcrypt was not found. You may want to get it from
262 *** ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/
264 ]]))
265 dnl Can't disable - gnutls depends on gcrypt
266 AC_DEFINE(USE_GCRYPT, 1, [use gcrypt])
268 AC_MSG_CHECKING([whether to disable SRP authentication support])
269 AC_ARG_ENABLE( srp-authentication, [  --disable-srp-authentication     Disable the SRP authentication support],
270  ac_enable_srp=no
272 if test x$ac_enable_srp != xno; then
273  AC_MSG_RESULT(no)
274  AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
275 else
276  AC_MSG_RESULT(yes)
279 AC_MSG_CHECKING([whether to disable anonymous authentication support])
280 AC_ARG_ENABLE( anon-authentication, [  --disable-anon-authentication    Disable the anonymous authentication support],
281  ac_enable_anon=no
283 if test x$ac_enable_anon != xno; then
284  AC_MSG_RESULT(no)
285  AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
286 else
287  AC_MSG_RESULT(yes)
290 AC_MSG_CHECKING([whether to disable extra PKI stuff])
291 AC_ARG_ENABLE( extra-pki, [  --disable-extra-pki              only enable the basic PKI stuff],
292  ac_enable_pki=no
294 if test x$ac_enable_pki != xno; then
295  AC_MSG_RESULT(no)
296  AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS #x stuff and other PKI stuff])
297 else
298  AC_MSG_RESULT(yes)
302 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
303 AC_ARG_ENABLE( openpgp-authentication, [  --disable-openpgp-authentication Disable the OpenPGP authentication support],
304  ac_enable_openpgp=no
306 if test x$ac_enable_openpgp != xno; then
307  AC_MSG_RESULT(no)
308  AM_PATH_LIBOPENCDK( 0.5.2, AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]),
309  AC_MSG_ERROR([[
311 *** libopencdk 0.5.2 was not found. You may want to get it from
312 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
314 ]]))
315 else
316  AC_MSG_RESULT(yes)
319 ac_enable_openssl=yes
320 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
321 AC_ARG_ENABLE( openssl-compatibility, [  --disable-openssl-compatibility Disable the OpenSSL compatibility support],
322  ac_enable_openssl=no
324 if test x$ac_enable_openssl != xno; then
325  AC_MSG_RESULT(no)
326 else
327  AC_MSG_RESULT(yes)
330 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
333 AC_ARG_WITH(included-libtasn1,
334         [  --with-included-libtasn1 Use the included libtasn1],
335 minitasn1_enabled=$withval, 
336 minitasn1_enabled=no
338 dnl We now need libtasn1 0.2.x
340 AC_CHECK_LIB( tasn1, asn1_read_tag,:, 
341  minitasn1_enabled=yes
342 AC_MSG_WARN([[
343 *** 
344 *** LibtASN1 0.2.x was not found. Will use the included one.]])))
347 if test x$opt_developer_mode = xyes; then
348  minitasn1_enabled=yes
351 AC_MSG_CHECKING([whether to use the included minitasn1])
352 AC_MSG_RESULT($minitasn1_enabled)
355 dnl CHECK FOR ZLIB SUPPORT
358 AC_MSG_CHECKING([whether to include zlib compression support])
360 AC_ARG_WITH( zlib, [  --without-zlib          disable zlib compression support],
361  ac_zlib=$withval,
362  ac_zlib=yes
365 if test x$ac_zlib != xno; then
366  AC_MSG_RESULT(yes)
367  AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
368 *** 
369 *** ZLIB was not found. You will not be able to use ZLIB compression.))
370 else
371  AC_MSG_RESULT(no)
376 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
379 if test x$opt_developer_mode = xyes; then
380  minilzo_enabled=yes
383 AC_ARG_WITH(included-lzo,
384         [  --with-included-lzo     include minilzo in libgnutls-extra],
385  minilzo_enabled=$withval,
386  minilzo_enabled=no
389 AC_MSG_CHECKING([whether to use the included lzo compression library])
391 AC_MSG_RESULT($minilzo_enabled)
393 if test x$minilzo_enabled = xno; then
394 AC_CHECK_LIB( lzo, lzo1x_1_compress, minilzo_enabled=no, 
395  minilzo_enabled=yes
396  AC_MSG_WARN(
397 *** 
398 *** Liblzo was not found. Will use the included minilzo.))
401 if test x"$minilzo_enabled" = xyes; then
402  AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
403  LZO_OBJECTS="minilzo.lo"
404 else
405  LZO_LINK=-llzo
408 AC_SUBST(LZO_OBJECTS)
409 AC_SUBST(LZO_LINK)
411 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
414 if test x"$minitasn1_enabled" = xyes; then
415  MINITASN1_OBJECTS="minitasn1/coding.lo minitasn1/decoding.lo minitasn1/element.lo \
416         minitasn1/errors.lo minitasn1/gstr.lo minitasn1/parser_aux.lo minitasn1/structure.lo"
417  MINITASN1_DIR=minitasn1
418 else
419  LIBASN1_LINK=-ltasn1
422 AC_SUBST(MINITASN1_OBJECTS)
423 AC_SUBST(MINITASN1_DIR)
424 AC_SUBST(LIBASN1_LINK)
428 AC_MSG_RESULT([***
429 *** Detecting options for shared libraries...
431 AM_PROG_LIBTOOL
433 dnl This is after AM_PROG_LIBTOOL so that the LD variable
434 dnl has been set.
436 AC_MSG_CHECKING([whether we have GNU ld or compatible])
438 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
439 if test "$GLD"; then
440 have_ld_version_script=yes
441   AC_MSG_RESULT(yes)
442 else
443 have_ld_version_script=no
444   AC_MSG_RESULT(no)
445 AC_MSG_WARN(***
446 *** You may want to rerun configure using --with-gnu-ld to enable versioned symbols.
450 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
453 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBASN1_LINK $LIBGCRYPT_LIBS"
454 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
456 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
458 AC_SUBST(LIBGNUTLS_LIBS)
459 AC_SUBST(LIBGNUTLS_CFLAGS)
461 SERV_LIBS="$LIBS $SERV_LIBS"
462 AC_SUBST(SERV_LIBS)
464 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS $LZO_LINK"
465 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
467 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
468 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
470 if test $ac_cv_c_compiler_gnu != no; then
472         if test x$opt_profiler_mode = xyes; then
473           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
474           if test x$FC_OK = xyes; then
475                 CFLAGS="${CFLAGS} `fc-config --cflags`"
476                 LIBS="$LIBS `fc-config --libs`"
477           else
478 AC_MSG_WARN(***
479 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
481           fi
482         fi
486 AC_CONFIG_FILES(lib/gnutls.h.in)
488 AC_CONFIG_COMMANDS([includes/gnutls/gnutls.h],[[
489  test -f lib/gnutls.h.in || (echo "Could not generate includes/gnutls/gnutls.h" && exit 1)
490  cat lib/gnutls.h.in > includes/gnutls/gnutls.h
491  cat lib/gnutls_ui.h >> includes/gnutls/gnutls.h
492  echo "" >> includes/gnutls/gnutls.h
493  cat lib/gnutls_errors_int.h | grep -v _INT_ >> includes/gnutls/gnutls.h
494  echo "" >> includes/gnutls/gnutls.h
495  echo "#ifdef __cplusplus" >> includes/gnutls/gnutls.h
496  echo "}" >> includes/gnutls/gnutls.h
497  echo "#endif" >> includes/gnutls/gnutls.h
498  echo "#endif /* GNUTLS_H */" >> includes/gnutls/gnutls.h
499  echo "" >> includes/gnutls/gnutls.h
500  chmod +x lib/libgnutls-config
501  chmod +x libextra/libgnutls-extra-config
502 ]],[[]])
504 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
505 libextra/openpgp/Makefile lib/libgnutls-config libextra/libgnutls-extra-config \
506 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
507 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
508 doc/examples/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
509 includes/Makefile includes/gnutls/Makefile doc/manpages/Makefile])
511 AC_OUTPUT