*** empty log message ***
[gnutls.git] / configure.in
blobea990b3930f873eb30277514ffe242ec55787adb
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.50)
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=0
14 GNUTLS_MINOR_VERSION=8
15 GNUTLS_MICRO_VERSION=5
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)
23 AM_MAINTAINER_MODE
25 dnl This is the library version
26 GNUTLS_MOST_RECENT_INTERFACE=8
27 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
28 GNUTLS_OLDEST_INTERFACE=5
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`
43 AC_SUBST(LT_CURRENT)
44 AC_SUBST(LT_REVISION)
45 AC_SUBST(LT_AGE)
47 opt_dmalloc_mode=no
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)
54 opt_efence_mode=no
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)
61 opt_developer_mode=no
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)
68 opt_profiler_mode=no
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)
75 AC_MSG_RESULT([***
76 *** Checking for compilation programs...
79 AC_PROG_CC
81 AC_PROG_LN_S
84 dnl Checks for programs.
85 AC_PROG_INSTALL
87 dnl AC_PROG_MAKE_SET
90 AC_MSG_RESULT([***
91 *** Detecting compiler options...
95 AC_C_CONST
96 AC_C_INLINE
98 AC_MSG_CHECKING([whether C99 macros are supported])
99 AC_TRY_COMPILE(,[ 
100 #define test_mac(...) 
101 int z,y,x;
102 test_mac(x,y,z);
103 return 0;
104 ], 
105 dnl ***** OK
106 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
107 AC_MSG_RESULT(yes),
108 dnl ***** NOT FOUND
109 AC_MSG_RESULT(no)
110 AC_MSG_WARN([C99 macros are not supported by your compiler. This may
111 affect compiling.])
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"
118         else
119           CFLAGS="${CFLAGS} -O2 -finline-functions"
120         fi
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])
125         else
126                 if test x$opt_efence_mode = xyes; then
127                   AC_CHECK_LIB( efence, main)
128                   AC_DEFINE(USE_EFENCE, 1, [use electric fence])
129                 fi
130         fi
133         AC_MSG_CHECKING([whether we have GNU assembler])
135         GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
136         if test "$GAS"; then
137           CFLAGS="${CFLAGS} -pipe"
138           AC_MSG_RESULT(yes)
139         else
140           AC_MSG_RESULT(no)
141         fi
145 AC_MSG_RESULT([***
146 *** Detecting C library capabilities...
149 AC_HEADER_STDC
150 AC_HEADER_TIME
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,,)
155 AC_FUNC_ALLOCA
158 AC_MSG_RESULT([***
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>
186 #endif
187 #ifdef HAVE_UNISTD_H
188 # include <unistd.h>
189 #endif
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)
199    ,
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]),
203   [
204    #include <sys/time.h>
205   ]
206   )
209  #include <time.h>
213 AC_C_BIGENDIAN
216 AC_MSG_RESULT([***
217 *** Checking for external libraries...
220 AM_PATH_LIBGCRYPT(1.1.12,,
221         AC_MSG_ERROR([[
222 ***  
223 *** libgcrypt was not found. You may want to get it from
224 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/
226 ]]))
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],
234  ac_enable_srp=no
236 if test x$ac_enable_srp != xno; then
237  AC_MSG_RESULT(no)
238  AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
239 else
240  AC_MSG_RESULT(yes)
243 AC_MSG_CHECKING([whether to disable anonymous authentication support])
244 AC_ARG_ENABLE( anon-authentication, [  --disable-anon-authentication    disable the anonymous authentication support],
245  ac_enable_anon=no
247 if test x$ac_enable_anon != xno; then
248  AC_MSG_RESULT(no)
249  AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
250 else
251  AC_MSG_RESULT(yes)
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],
257  ac_enable_openpgp=no
259 if test x$ac_enable_openpgp != xno; then
260  AC_MSG_RESULT(no)
261  AM_PATH_LIBOPENCDK( 0.4.0, AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]),
262  AC_MSG_WARN([[
264 *** libopencdk 0.4.0 was not found. You will not be able to use OpenPGP keys with gnutls.
265 ]]))
266 else
267  AC_MSG_RESULT(yes)
270 AC_ARG_WITH(included-libtasn1,
271         [  --with-included-libtasn1 Use the included libtasn1],
272 minitasn1_enabled=$withval, 
273 minitasn1_enabled=no
275 AC_CHECK_LIB( tasn1, asn1_array2tree,:, 
276  minitasn1_enabled=yes
277 AC_MSG_WARN([[
278 *** 
279 *** LibtASN1 was not found. Will use the included one.]])))
282 if test x$opt_developer_mode = xyes; then
283  minitasn1_enabled=yes
286 AC_MSG_CHECKING([whether to use the included minitasn1])
287 AC_MSG_RESULT($minitasn1_enabled)
290 dnl CHECK FOR ZLIB SUPPORT
293 AC_MSG_CHECKING([whether to include zlib compression support])
295 AC_ARG_WITH( zlib, [  --without-zlib          disable zlib compression support],
296  ac_zlib=$withval,
297  ac_zlib=yes
300 if test x$ac_zlib != xno; then
301  AC_MSG_RESULT(yes)
302  AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
303 *** 
304 *** ZLIB was not found. You will not be able to use ZLIB compression.))
305 else
306  AC_MSG_RESULT(no)
310 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
313 if test x$opt_developer_mode = xyes; then
314  minilzo_enabled=yes
317 AC_ARG_WITH(included-lzo,
318         [  --with-included-lzo     include minilzo in libgnutls-extra],
319  minilzo_enabled=$withval,
320  minilzo_enabled=no
323 AC_MSG_CHECKING([whether to use the included lzo compression library])
325 AC_MSG_RESULT($minilzo_enabled)
327 if test x$minilzo_enabled = xno; then
328 AC_CHECK_LIB( lzo, lzo1x_1_compress, minilzo_enabled=no, 
329  minilzo_enabled=yes
330  AC_MSG_WARN(
331 *** 
332 *** Liblzo was not found. Will use the included minilzo.))
335 if test x"$minilzo_enabled" = xyes; then
336  AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
337  LZO_OBJECTS="minilzo.lo"
338 else
339  LZO_LINK=-llzo
342 AC_SUBST(LZO_OBJECTS)
343 AC_SUBST(LZO_LINK)
345 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
348 if test x"$minitasn1_enabled" = xyes; then
349  MINITASN1_OBJECTS="minitasn1/coding.lo minitasn1/decoding.lo minitasn1/element.lo \
350         minitasn1/errors.lo minitasn1/gstr.lo minitasn1/parser_aux.lo minitasn1/structure.lo"
351  MINITASN1_DIR=minitasn1
352 else
353  LIBASN1_LINK=-ltasn1
356 AC_SUBST(MINITASN1_OBJECTS)
357 AC_SUBST(MINITASN1_DIR)
358 AC_SUBST(LIBASN1_LINK)
362 AC_MSG_RESULT([***
363 *** Detecting options for shared libraries...
365 AM_PROG_LIBTOOL
368 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBASN1_LINK $LIBGCRYPT_LIBS"
369 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
371 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
373 AC_SUBST(LIBGNUTLS_LIBS)
374 AC_SUBST(LIBGNUTLS_CFLAGS)
376 SERV_LIBS="$LIBS $SERV_LIBS"
377 AC_SUBST(SERV_LIBS)
379 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS $LZO_LINK"
380 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
382 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
383 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
385 if test $ac_cv_c_compiler_gnu != no; then
387         if test x$opt_profiler_mode = xyes; then
388           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
389           if test x$FC_OK = xyes; then
390                 CFLAGS="${CFLAGS} `fc-config --cflags`"
391                 LIBS="$LIBS `fc-config --libs`"
392           else
393 AC_MSG_WARN(***
394 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
396           fi
397         fi
401 AC_CONFIG_FILES(lib/gnutls.h.in)
403 AC_CONFIG_COMMANDS([includes/gnutls/gnutls.h],[[
404  test -f lib/gnutls.h.in || (echo "Could not generate includes/gnutls/gnutls.h" && exit 1)
405  cat lib/gnutls.h.in > includes/gnutls/gnutls.h
406  cat lib/gnutls_ui.h >> includes/gnutls/gnutls.h
407  echo "" >> includes/gnutls/gnutls.h
408  cat lib/gnutls_errors_int.h | grep -v _INT_ >> includes/gnutls/gnutls.h
409  echo "" >> includes/gnutls/gnutls.h
410  echo "#ifdef __cplusplus" >> includes/gnutls/gnutls.h
411  echo "}" >> includes/gnutls/gnutls.h
412  echo "#endif" >> includes/gnutls/gnutls.h
413  echo "#endif /* GNUTLS_H */" >> includes/gnutls/gnutls.h
414  echo "" >> includes/gnutls/gnutls.h
415  chmod +x lib/libgnutls-config
416  chmod +x libextra/libgnutls-extra-config
417 ]],[[]])
419 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
420 lib/libgnutls-config libextra/libgnutls-extra-config \
421 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
422 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
423 doc/examples/Makefile lib/minitasn1/Makefile \
424 includes/Makefile includes/gnutls/Makefile])
426 AC_OUTPUT