Codebase list libetpan / upstream/0.42 configure.in
upstream/0.42

Tree @upstream/0.42 (Download .tar.gz)

configure.in @upstream/0.42raw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
dnl Process this file with autoconf to create configure
dnl $Id: configure.in,v 1.54 2006/01/08 23:02:26 alfie Exp $

AC_INIT(src/main/libetpan_version.h.in)

dnl Version major and minor
VERSION_MAJOR=0
VERSION_MINOR=42

dnl API version
dnl 1. If you have changed any of the sources for this library, the revision
dnl    number must be incremented. This is a new revision of the current
dnl    interface.
dnl 2. If the interface has changed, then current must be incremented, and
dnl    revision reset to `0'. This is the first revision of a new interface.
dnl 3. If the new interface is a superset of the previous interface (that is,
dnl    if the previous interface has not been broken by the changes in this new
dnl    release), then age must be incremented. This release is backwards
dnl    compatible with the previous release.
dnl 4. If the new interface has removed elements with respect to the previous
dnl    interface, then you have broken backward compatibility and age must be
dnl    reset to `0'. This release has a new, but backwards incompatible
dnl    interface.
API_CURRENT=6
API_REVISION=1
API_COMPATIBILITY=6

API_AGE=`expr $API_CURRENT - $API_COMPATIBILITY`
API_VERSION="$API_CURRENT:$API_REVISION:$API_AGE"
AC_SUBST(API_VERSION)

AC_ARG_ENABLE(debug,   [  --enable-debug          setup flags (gcc) for debugging (default=no)],
CFLAGS="$CFLAGS -O2 -W -Wall -g"
CPPFLAGS="$CPPFLAGS -DDEBUG"
LDFLAGS="$LDFLAGS",)
AC_ARG_ENABLE(optim,   [  --enable-optim          setup flags (gcc) for optimizations (default=no)],
if test "x$enable_debug" != "xyes" ; then
  CFLAGS="$CFLAGS -O2 -ffast-math -funroll-loops -g0"
  CPPFLAGS="$CPPFLAGS"
  LDFLAGS="$LDFLAGS -s"
else
  AC_MSG_WARN([enable-optim and enable-debug are incompatible -- disabling optimizations])
fi,)
AC_ARG_ENABLE(syntax,   [  --enable-unstrict-syntax be lazy on syntax checking for protocols (default=no)], , [AC_DEFINE(UNSTRICT_SYNTAX, 1, [Define to be lazy on protocol syntax])])

AC_CONFIG_HEADER(config.h)

dnl Programs
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET

dnl Headers
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h sys/types.h sys/stat.h sys/mman.h limits.h)
AC_CHECK_HEADERS(netdb.h netinet/in.h sys/socket.h)
AC_CHECK_HEADERS(sys/param.h)

dnl Functions
AC_FUNC_MMAP

dnl Network libs
AC_CHECK_FUNC(connect, checksocket=no, checksocket=yes)
if test "x$checksocket" = "xyes"; then 
case "x$LIBS" in
 *-lsocket*);;
 *) AC_CHECK_LIB(socket, connect) ;;
esac
fi
AC_CHECK_FUNC(inet_ntoa, checknsl=no, checknsl=yes)
if test "x$checknsl" = "xyes"; then 
case "x$LIBS" in
 *-lnsl*);;
 *) AC_CHECK_LIB(nsl, inet_ntoa) ;;
esac
fi

dnl OpenSSL -- very primitive right now
AC_ARG_WITH(openssl,   [  --with-openssl[=DIR]    include OpenSSL support (default=auto)],
            [], [with_openssl=yes])
if test "x$with_openssl" != "xno"; then
  OCPPFLAGS="$CPPFLAGS"
  OLDFLAGS="$LDFLAGS"
  if test "x$with_openssl" != "xyes" ; then
    CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
    LDFLAGS="$LDFLAGS -L$with_openssl/lib"
  fi
  with_openssl=no
  SSLLIBS=""
  AC_CHECK_HEADER(openssl/ssl.h, [
   AC_CHECK_LIB(rsaref, main, [SSLLIBS="-lrsaref"])
   AC_CHECK_LIB(crypto, main, [SSLLIBS="-lcrypto $SSLLIBS"], [], [$SSLLIBS])
   AC_CHECK_LIB(ssl, SSL_library_init, with_openssl=yes, [], [$SSLLIBS])])
  if test "x$with_openssl" != "xyes"; then
    CPPFLAGS="$OCPPFLAGS"
    LDFLAGS="$OLDFLAGS"
  else
   with_gnutls="no"
  fi
fi
if test "x$with_openssl" = "xyes"; then
  AC_DEFINE([USE_SSL], 1, [Define to use OpenSSL])
  SSLLIBS="-lssl $SSLLIBS"
else
  SSLLIBS=""
fi
AC_SUBST(SSLLIBS)

dnl GNUTLS
AC_ARG_WITH(gnutls,    [ --with-gnutls[=DIR]      include GnuTLS support (default=auto)],
            [], [with_gnutls=no])
if test "x$with_gnutls" != "xno"; then
  OCPPFLAGS="$CPPFLAGS"
  OLDFLAGS="$LDFLAGS"
  if test "x$with_gnutls" != "xyes" ; then
    CPPFLAGS="CRPPFLAGS -I$with_gnutls/include"
    LDFLAGS="$LDFLAGS -L$with_gnutls/lib"
  fi
  GNUTLSLIB=""
  AC_CHECK_HEADER(gnutls/gnutls.h, [
   AC_CHECK_LIB(gnutls, gnutls_global_deinit, with_gnutls=yes, [GNUTLSLIB="-lgnutls"])
  ])
  if test "x$with_gnutls" != "xyes"; then
   CPPFLAGS="$OCPPFLAGS"
   LDFLAGS="$OLDFLAGS"
  else
   with_openssl="no"
  fi
fi
if test "x$with_gnutls" = "xyes"; then
  AC_DEFINE([USE_GNUTLS],1, [Define to use GnuTLS])
  AC_DEFINE([USE_SSL], 1, [Define to use OpenSSL])
  GNUTLSLIB="-lgnutls"
else
  GNUTLSLIB=""
fi
AC_SUBST(GNUTLSLIB)

if test "x$with_openssl" = "xno"; then
   if test "x$with_gnutls" = "xno"; then
      AC_MSG_WARN([OpenSSL support disabled.])
   fi
fi

dnl iconv
LIBICONV=""

AC_ARG_ENABLE(iconv,
	[ --disable-iconv	make a version not using iconv],
		enable_iconv=no, enable_iconv=yes)
if test x$enable_iconv = xyes; then
   dnl get prototype
   AC_CHECK_HEADER(iconv.h, [ICONV_HEADER=1], [ICONV_HEADER=0])
   
   ICONV_PROTO=no
   AC_MSG_CHECKING([checking iconv() prototype])
   if test "x$ICONV_HEADER" = x1 ; then
     SAVED_CPPFLAGS="$CPPFLAGS"
     CPPFLAGS="-std=c99 $CPPFLAGS"
     AC_TRY_COMPILE([#include <iconv.h>
       size_t iconv (iconv_t cd, char ** restrict inbuf,
                     size_t * restrict inbytesleft,
                     char ** restrict outbuf,
                     size_t * restrict outbytesleft);],
       [],
       [ICONV_PROTO=noconst]
       [])
     AC_TRY_COMPILE([#include <iconv.h>
       size_t iconv (iconv_t cd, const char ** restrict inbuf,
                     size_t * restrict inbytesleft,
                     char ** restrict outbuf,
                     size_t * restrict outbytesleft);],
       [],
       [ICONV_PROTO=const]
       [])
     CPPFLAGS="$SAVED_CPPFLAGS"
   fi

   dnl try to link
   ICONV_LINKED=NO
   if test "$ICONV_PROTO" != "xno" ; then
     AC_MSG_RESULT([ok])
     
     AC_MSG_CHECKING([for iconv])
     
     ICONV_LINKED=0
     AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
       [iconv_t cd = iconv_open("","");
        iconv(cd,NULL,NULL,NULL,NULL);
        iconv_close(cd);],
       [ICONV_LINKED=1],
       [])
     for lib in iconv ; do
       if test "x$ICONV_LINKED" = "x0" ; then
	 LIBS=-l$lib
         AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
         [iconv_t cd = iconv_open("","");
          iconv(cd,NULL,NULL,NULL,NULL);
          iconv_close(cd);],
         [LIBICONV="$LIBS" ; ICONV_LINKED=1],
         [])
       fi
     done
     LIBS=""
     
     if test "x$ICONV_LINKED" = "x1" ; then
       AC_MSG_RESULT([found])
     else
       AC_MSG_RESULT([not found])
     fi
   else
     AC_MSG_RESULT([failed])
   fi

   if test "x$ICONV_LINKED" = "x1" ; then
     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
   fi
   
   ICONV_PROTO_CONST=0
   if test "x$ICONV_PROTO" = "xconst" ; then
     AC_DEFINE_UNQUOTED(HAVE_ICONV_PROTO_CONST, 1,
       [prototype of iconv() has const parameters])
   fi
fi
AC_SUBST(LIBICONV)

dnl Berkeley DB

DBVERS=0
DBLINKED=0
DBLIB=""

AC_ARG_ENABLE(db,   [  --disable-db            disable Berkeley DB (default=try to detect DB)],[enable_db=$enableval],[enable_db=yes])

dnl Check for a presence of Berkeley DB header
if test "x$enable_db" != "xyes"; then
   AC_MSG_WARN(cache support disabled)
else
   AC_CHECK_HEADER(db.h, [DB_HEADER=1], [DB_HEADER=0])
fi

if test "x$DB_HEADER" = "x1"; then
dnl Check for version of Berkeley DB
  AC_MSG_CHECKING([version of Berkeley DB])

dnl check for version 3 and above
  AC_TRY_COMPILE(
    [#include <db.h>],
    [#if DB_VERSION_MAJOR < 3
    #error DB version 3 or above needed
    #endif],
    [DBVERS=3]
    [])

dnl check for version 2
  if test "x$DBVERS" = "x0"; then
     AC_TRY_COMPILE([#include <db.h>],
       [#if DB_VERSION_MAJOR != 2
       #error DB version 2 needed
       #endif],
       [DBVERS=2]
       [])
  fi

  if test "x$DBVERS" = "x0"; then
dnl assume version 1
    DBVERS=1
  fi

dnl test linkage with Berkeley DB

dnl Look for db3 or superior with db_create call
  case "$DBVERS" in
    3)
    AC_MSG_RESULT([version 3.x or above])
    for lib in db-4.2 db-4.1 db-4.0 db-4 db4 db-3.2 db-3 db3 db; do
      if test "x$DBLINKED" = "x0"; then
dnl        AC_CHECK_LIB($lib, db_create, [DBLIB="-l$lib"; DBLINKED=1], [])
dnl installations of libdb4 function names are defined in db.h
dnl to other symbols
        AC_MSG_CHECKING([for db_create() in -l$lib])
	LIBS=-l$lib
	AC_TRY_LINK(
	   [#include <db.h>],
	   [db_create(0,0,0)],
	   [DBLIB="-l$lib"; DBLINKED=1; AC_MSG_RESULT([found])],
	   [AC_MSG_RESULT([not found])])
      fi
    done
    LIBS=""
    ;;

dnl Look for db2 with db_open call
    2)
    AC_MSG_RESULT([version 2.x])
    for lib in db2 db; do
      if test "x$DBLINKED" = "x0"; then 
        AC_CHECK_LIB($lib, db_open, [DBLIB="-l$lib"; DBLINKED=1], [])
      fi
    done
    ;;

    *)
dnl Look for db1 with dbopen call in -ldb or in libc (bsds)
    AC_MSG_RESULT([version 1.x])
    AC_CHECK_FUNC(dbopen, [DBLINKED=1], [])
    for lib in db-1 db1 db; do
      if test "x$DBLINKED" = "x0"; then
        AC_CHECK_LIB($lib, dbopen, [DBLIB="-l$lib"; DBLINKED=1], [])
      fi
    done
    ;;
dnl fi
  esac
fi

if test "x$DBLINKED" = "x0"; then
  DBVERS=0
  if test "x$enable_db" = "xyes"; then
    AC_MSG_WARN(cache support disabled (Berkeley DB is missing).)
  fi
fi

AC_DEFINE_UNQUOTED(DBVERS, $DBVERS,
  [Define to detected Berkeley DB major version number])
AC_SUBST(DBLIB)

dnl Threading support, if enabled
AC_ARG_ENABLE(threads,  [  --disable-threads        do not include multithreading support using pthread],,[enable_threads=yes])

if test "x$enable_threads" = "xyes"; then
  dnl Try to find a good CFLAGS/LDFLAGS for pthreads
  AC_CHECK_HEADERS(pthread.h, [], [AC_MSG_ERROR([pthread support required])])
  CPPFLAGS="$CPPFLAGS -D_REENTRANT"
  checkpthread=yes

  AC_MSG_CHECKING([for pthread_create with libc])
  AC_TRY_LINK([], [pthread_create();], 
                  [pthflag=yes; checkpthread=no], 
                  [pthflag=no])
  AC_MSG_RESULT($pthflag)

  for flag in "pthreads" "pthread"; do
    if test "x$checkpthread" = "xyes"; then
      AC_MSG_CHECKING([for pthread_create with -$flag])
      OLDFLAGS="$LDFLAGS"
      LDFLAGS="-$flag $LDFLAGS"
      AC_TRY_LINK([], [pthread_create();], 
                      [pthflag=yes; checkpthread=no], 
                      [pthflag=no; LDFLAGS="$OLDCFLAGS"])
      AC_MSG_RESULT($pthflag)
    fi
  done

  for lib in "c_r" "pthread"; do
    if test "x$checkpthread" = "xyes"; then
       case "x$LIBS" in
          *-l$lib*);;
          *) AC_CHECK_LIB($lib, pthread_create, [LIBS="$LIBS -l$lib"; checkpthread=no]) ;;
       esac
    fi
  done

  if test "x$checkpthread" = "xyes"; then
    AC_CHECK_FUNC(pthread_create, checkpthread=no)
    text "x$checkpthread" = "xyes" && AC_MSG_ERROR([pthread library required])
  fi
  AC_DEFINE([LIBETPAN_REENTRANT], 1, [Define to include multithreading support])
  LIBSUFFIX=
  REENTRANT=1
else
  REENTRANT=0
  LIBSUFFIX=-no-mt
fi
AC_SUBST(LIBSUFFIX)
AC_SUBST(REENTRANT)

dnl liblockfile on debian systems
AC_CHECK_LIB(lockfile, lockfile_create)

AC_DEFINE_UNQUOTED(LIBETPAN_VERSION_MAJOR, $VERSION_MAJOR,
  [Define this to the major version of libEtPan])
AC_DEFINE_UNQUOTED(LIBETPAN_VERSION_MINOR, $VERSION_MINOR,
  [Define this to the minor version of libEtPan])
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)

dnl Cyrus SASL
AC_ARG_WITH(sasl,   [  --with-sasl[=DIR]    include SASL support (default=auto)],
            [], [with_sasl=yes])
if test "x$with_sasl" != "xno"; then
  OCPPFLAGS="$CPPFLAGS"
  OLDFLAGS="$LDFLAGS"
  if test "x$with_sasl" != "xyes" ; then
    CPPFLAGS="$CPPFLAGS -I$with_sasl/include"
    LDFLAGS="$LDFLAGS -L$with_sasl/lib"
  fi
  with_sasl=no
  SASLLIBS=""
  AC_CHECK_HEADER(sasl/sasl.h, [
   AC_CHECK_LIB(sasl2, sasl_client_init, with_sasl=yes, [], [$SASLLIBS])])
  if test "x$with_sasl" != "xyes"; then
    CPPFLAGS="$OCPPFLAGS"
    LDFLAGS="$OLDFLAGS"
  fi
fi
if test "x$with_sasl" = "xyes"; then
  AC_DEFINE([USE_SASL], 1, [Define to use SASL])
  SASLLIBS="-lsasl2 $SASLLIBS"
else
  AC_MSG_WARN([SASL support disabled.])
  SASLLIBS=""
fi
AC_SUBST(SASLLIBS)


dnl Version
VERSION="$VERSION_MAJOR.$VERSION_MINOR"
test -d CVS && VERSION="$VERSION-dev-"`date +'%Y%m%d'`
AC_DEFINE_UNQUOTED(LIBETPAN_VERSION, "$VERSION",
  [Define this to the version of libEtPan])
AC_SUBST(VERSION)


AC_OUTPUT(Makefile \
	Rules \
	libetpan-config \
	src/Makefile \
	src/main/libetpan_version.h \
	)