*** empty log message ***
[gnutls.git] / configure.in
blob49eb78646ce68dab1a467967861c711b1a2209e4
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")
9 AC_DEFINE_UNQUOTED(T_VENDOR, "$target_vendor")
10 AC_DEFINE_UNQUOTED(T_OS, "$target_os")
12 dnl Gnutls Version
13 GNUTLS_MAJOR_VERSION=0
14 GNUTLS_MINOR_VERSION=4
15 GNUTLS_MICRO_VERSION=4
16 GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
18 AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION")
20 AM_INIT_AUTOMAKE(gnutls, $GNUTLS_VERSION)
21 AM_CONFIG_HEADER(config.h)
23 dnl This is the library version
24 GNUTLS_MOST_RECENT_INTERFACE=5
25 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
26 GNUTLS_OLDEST_INTERFACE=4
29 AC_SUBST(GNUTLS_MAJOR_VERSION)
30 AC_SUBST(GNUTLS_MINOR_VERSION)
31 AC_SUBST(GNUTLS_MICRO_VERSION)
32 AC_SUBST(GNUTLS_VERSION)
34 AC_SUBST(GNUTLS_MOST_RECENT_INTERFACE)
35 AC_SUBST(GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER)
36 AC_SUBST(GNUTLS_OLDEST_INTERFACE)
38 LT_CURRENT=$GNUTLS_MOST_RECENT_INTERFACE
39 LT_REVISION=$GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER
40 LT_AGE=`expr $GNUTLS_MOST_RECENT_INTERFACE - $GNUTLS_OLDEST_INTERFACE`
41 AC_SUBST(LT_CURRENT)
42 AC_SUBST(LT_REVISION)
43 AC_SUBST(LT_AGE)
45 opt_dmalloc_mode=no
46 AC_MSG_CHECKING([whether in dmalloc mode])
47 AC_ARG_ENABLE(dmalloc-mode,
48 [  --enable-dmalloc-mode      enable dmalloc mode],
49 opt_dmalloc_mode=$enableval)
50 AC_MSG_RESULT($opt_dmalloc_mode)
52 opt_efence_mode=no
53 AC_MSG_CHECKING([whether in electric fence mode])
54 AC_ARG_ENABLE(efence-mode,
55 [  --enable-efence-mode       enable electric fence mode],
56 opt_efence_mode=$enableval)
57 AC_MSG_RESULT($opt_efence_mode)
59 opt_maintainer_mode=no
60 AC_MSG_CHECKING([whether in maintanance mode])
61 AC_ARG_ENABLE(maintainer-mode,
62 [  --enable-maintainer-mode   enable maintainer mode],
63 opt_maintainer_mode=$enableval)
64 AC_MSG_RESULT($opt_maintainer_mode)
66 opt_profiler_mode=no
67 AC_MSG_CHECKING([whether in profile mode])
68 AC_ARG_ENABLE(profile-mode,
69 [  --enable-profile-mode      enable profiler],
70 opt_profiler_mode=$enableval)
71 AC_MSG_RESULT($opt_profiler_mode)
73 AC_MSG_RESULT([***
74 *** Checking for compilation programs...
77 AC_PROG_CC
79 AC_PROG_YACC
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)
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 performance.])
114 if test $ac_cv_c_compiler_gnu != no; then
116         if test x$opt_maintainer_mode = xyes; then
118           CFLAGS="${CFLAGS} -ggdb3 -Wall -Wpointer-arith -Wstrict-prototypes" # -Werror
119         else
120           CFLAGS="${CFLAGS} -O2 -finline-functions -fexpensive-optimizations -fomit-frame-pointer"
121         fi
123         if test x$opt_dmalloc_mode = xyes; then
124           AC_CHECK_LIB( dmalloc, main)
125           AC_DEFINE(USE_DMALLOC)
126         else
127                 if test x$opt_efence_mode = xyes; then
128                   AC_CHECK_LIB( efence, main)
129                   AC_DEFINE(USE_EFENCE)
130                 fi
131         fi
134         AC_MSG_CHECKING([whether we have GNU assembler])
135         
136         GAS=`as --version < /dev/null|grep GNU`
137         if test "$GAS"; then
138           CFLAGS="${CFLAGS} -pipe"
139           AC_MSG_RESULT(yes)
140         else
141           AC_MSG_RESULT(no)
142         fi
146 AC_MSG_RESULT([***
147 *** Detecting C library capabilities...
150 AC_HEADER_STDC
151 AC_HEADER_TIME
152 AC_CHECK_HEADERS(unistd.h pwd.h locale.h strings.h stdarg.h)
153 AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
154 AC_CHECK_HEADERS(errno.h sys/time.h time.h)
155 AC_CHECK_FUNCS(bzero memset memmove bcopy,,)
156 AC_FUNC_ALLOCA
159 AC_MSG_RESULT([***
160 *** Detecting system's parameters...
163 AC_CHECK_SIZEOF(unsigned long long, 8)
164 AC_CHECK_SIZEOF(unsigned long int, 4)
165 AC_CHECK_SIZEOF(unsigned int, 4)
166 AC_CHECK_SIZEOF(unsigned short int, 2)
167 AC_CHECK_SIZEOF(unsigned char, 1)
169 AC_CHECK_TYPES(ptrdiff_t,,, [
170 # include <sys/types.h>
173 AC_CHECK_TYPE(size_t,
174 DEFINE_SIZE_T="#include <sys/types.h>"
175 AC_SUBST( DEFINE_SIZE_T)
177 AC_DEFINE(NO_SIZE_T)
178 DEFINE_SIZE_T="typedef unsigned int size_t; typedef int ssize_t;"
179 AC_SUBST( DEFINE_SIZE_T)
181 #ifdef HAVE_SYS_TYPES_H
182 # include <sys/types.h>
183 #endif
184 #ifdef HAVE_UNISTD_H
185 # include <unistd.h>
186 #endif
190 AC_CHECK_TYPE(time_t,
191  DEFINE_TIME_T="#include <time.h>"
192  AC_SUBST( DEFINE_TIME_T)
194   AC_CHECK_TYPE(time_t,
195    DEFINE_TIME_T="#include <sys/time.h>"
196    AC_SUBST( DEFINE_TIME_T)
197    ,
198     DEFINE_TIME_T="typedef unsigned int time_t;"
199     AC_SUBST( DEFINE_TIME_T)
200     AC_DEFINE(NO_TIME_T),
201   [
202    #include <sys/time.h>
203   ]
204   )
207  #include <time.h>
211 AC_C_BIGENDIAN
214 AC_MSG_RESULT([***
215 *** Checking for external libraries...
218 AM_PATH_LIBGCRYPT(1.1.7,,
219         AC_MSG_ERROR([[
220 ***  
221 *** libgcrypt was not found. You may want to get it from
222 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/
224 ]]))
225 dnl Can't disable - gnutls depends on gcrypt
226 AC_DEFINE(USE_GCRYPT)
228 dnl MCRYPT
230 AC_ARG_WITH( mcrypt, [  --with-mcrypt           enable libmcrypt support],
231  [AM_PATH_LIBMCRYPT( 2.4.0,, 
232         AC_MSG_ERROR([[*** libmcrypt was not found]])
233     AC_MSG_ERROR([[*** You need libmcrypt 2.4.x to compile this program. http://mcrypt.hellug.gr]])
238 LIBS="${LIBS} ${LIBMCRYPT_LIBS}"
240 AC_ARG_WITH( mhash, [  --with-mhash            enable libmhash support],
241  [AC_CHECK_LIB(mhash, mhash_init, AC_DEFINE(USE_MHASH) 
242 LIBS="${LIBS} -lmhash")])
244 AC_MSG_CHECKING([whether to check for external libraries])
246 dnl if used --without-ext-libraries then we will not check
247 dnl for any library (libz, libgdbm)
249 AC_ARG_WITH( ext-libraries, [  --without-ext-libraries disable external libraries support],
250  ac_ext_libraries=$withval
253 if test x$ac_ext_libraries != xno; then
254  AC_MSG_RESULT(yes)
255  AC_CHECK_LIB(gdbm, gdbm_open,, AC_MSG_WARN(
256 *** 
257 *** GDBM was not found. You will not be able to use the default gdbm session resumption backend.))
258  AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
259 *** 
260 *** ZLIB was not found. You will not be able to use ZLIB compression.))
261 else
262  AC_MSG_RESULT()
265 AC_MSG_CHECKING([whether to disable SRP authentication support])
266 AC_ARG_ENABLE( srp-authentication, [  --disable-srp-authentication     disable the SRP authentication support],
267  ac_enable_srp=no
269 if test x$ac_enable_srp != xno; then
270  AC_MSG_RESULT(no)
271  AC_DEFINE(ENABLE_SRP)
272 else
273  AC_MSG_RESULT(yes)
276 AC_MSG_CHECKING([whether to disable anonymous authentication support])
277 AC_ARG_ENABLE( anon-authentication, [  --disable-anon-authentication    disable the anonymous authentication support],
278  ac_enable_anon=no
280 if test x$ac_enable_anon != xno; then
281  AC_MSG_RESULT(no)
282  AC_DEFINE(ENABLE_ANON)
283 else
284  AC_MSG_RESULT(yes)
288 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
289 AC_ARG_ENABLE( openpgp-authentication, [  --disable-openpgp-authentication disable the OpenPGP authentication support],
290  ac_enable_openpgp=no
292 if test x$ac_enable_openpgp != xno; then
293  AC_MSG_RESULT(no)
294  AM_PATH_LIBOPENCDK( 0.1.0, AC_DEFINE(HAVE_LIBOPENCDK),
295  AC_MSG_WARN([[
297 *** libopencdk was not found. You will not be able to use OpenPGP keys with gnutls.
298 ]]))
299 else
300  AC_MSG_RESULT(yes)
303 libtasn1_enabled=no
305 AC_CHECK_LIB( tasn1, asn1_array2tree,:, 
306  libtasn1_enabled=yes
307  AC_MSG_WARN(
308 *** 
309 *** LibtASN1 was not found. Will use the included one.),
310 AC_ARG_WITH(included-libtasn1,
311         [  --with-included-libtasn1 Use the included libtasn1],
312 libtasn1_enabled=yes, libtasn1_enabled=no)
316 AC_MSG_RESULT([***
317 *** Detecting options for shared libraries...
319 AM_PROG_LIBTOOL
321 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls -ltasn1 $LIBGCRYPT_LIBS"
322 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
324 AC_SUBST(LIBGNUTLS_LIBS)
325 AC_SUBST(LIBGNUTLS_CFLAGS)
328 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS"
329 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
331 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
332 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
334 if test $ac_cv_c_compiler_gnu != no; then
336         if test x$opt_profiler_mode = xyes; then
337           CFLAGS="${CFLAGS} `fc-config --cflags`"
338           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
339           if test x$FC_OK = xyes; then
340                 LIBS="$LIBS `fc-config --libs`"
341           else
342 AC_MSG_WARN(***
343 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
345           fi
346         fi
350 if test x"$libtasn1_enabled" = xyes; then
351  AC_CONFIG_SUBDIRS(libtasn1)
352  LIBASN1_DIR=libtasn1
353  AC_SUBST(LIBASN1_DIR)
354  LIBASN1_LINK=../libtasn1/lib/libtasn1.la
355 else
356  LIBASN1_LINK=-ltasn1
359 AC_SUBST(LIBASN1_LINK)
361 AC_CONFIG_FILES(lib/gnutls.h.in)
363 AC_CONFIG_COMMANDS([lib/gnutls.h],[[
364  test -f lib/gnutls.h.in || (echo "Could not generate lib/gnutls.h" && exit 1)
365  cat lib/gnutls.h.in > lib/gnutls.h
366  cat lib/gnutls_ui.h >> lib/gnutls.h
367  echo "" >> lib/gnutls.h
368  cat lib/gnutls_errors_int.h | grep -v _INT_ >> lib/gnutls.h
369  echo "" >> lib/gnutls.h
370  echo "#ifdef __cplusplus" >> lib/gnutls.h
371  echo "}" >> lib/gnutls.h
372  echo "#endif" >> lib/gnutls.h
373  echo "#endif /* GNUTLS_H */" >> lib/gnutls.h
374  echo "" >> lib/gnutls.h
375  chmod +x lib/libgnutls-config
376  chmod +x libextra/libgnutls-extra-config
377 ]],[[]])
379 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
380 lib/libgnutls-config libextra/libgnutls-extra-config \
381 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
382 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
383 tests/Makefile ])
386 AC_OUTPUT