forked from dinhvh/libetpan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
737 lines (665 loc) · 22.5 KB
/
configure.ac
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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
m4_define([maj_version], [1])
m4_define([min_version], [1])
m4_define([api_current], [16])
m4_define([api_revision], [0])
m4_define([api_compatibility], [16])
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.
dnl age = api_current - api_compatiblity
AC_PREREQ(2.61)
AC_INIT([libetpan],[maj_version.min_version],[libetpan-devel@lists.sourceforge.net])
AC_CONFIG_SRCDIR([src/main/libetpan_version.h.in])
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
dnl Version major and minor
VERSION_MAJOR=maj_version
VERSION_MINOR=min_version
dnl required version of libcurl
libcurl_major_required=0
libcurl_minor_required=0
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=api_current
API_REVISION=api_revision
API_COMPATIBILITY=api_compatibility
AC_SUBST(API_CURRENT)
AC_SUBST(API_COMPATIBILITY)
AC_SUBST(API_REVISION)
API_AGE=`expr $API_CURRENT - $API_COMPATIBILITY`
API_VERSION="$API_CURRENT:$API_REVISION:$API_AGE"
AC_SUBST(API_VERSION)
dnl FIXME: This should be the CVS revision.
BUILD_REVISION=0
AC_SUBST(BUILD_REVISION)
BUILD_TIMESTAMP=`date +'%Y-%m-%dT%H:%M%z'`
AC_SUBST(BUILD_TIMESTAMP)
changequote(,)dnl
BUILD_FILEVERSION=`echo "${VERSION_MAJOR}.${VERSION_MINOR}.0" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
AC_SUBST(BUILD_FILEVERSION)
# Architecture specific.
have_w32_system=no
case "${host}" in
*-mingw32*)
have_w32_system=yes
CFLAGS="$CFLAGS -mms-bitfields -I\${top_srcdir}/src/windows"
## Currently we export all symbols indiscriminately.
## Eventually, this can be limited to those which should be
## exported (which helps to hide our internal mmap stubs, for
## example), but before this can happen, the missing export
## declarations have to be added to all header files. Also, it
## should first be verified that exporting data members from a
## DLL is safe. To reenable discriminate exports, uncomment
## the following line and replace the "@ifdef _MSC_VER" around the
## export/import declaration stuff in libetpan.h.in by
## "@if WIN32".
# CFLAGS="$CFLAGS -DLIBETPAN_DLL"
# We use winsock2.
LIBS="$LIBS -lws2_32"
;;
*)
;;
esac
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_MINGW32_SYSTEM, 1, [Defined if we run on a W32 API based system])
fi
AM_CONDITIONAL(HAVE_MINGW32_SYSTEM, test "$have_w32_system" = yes)
# Check the C compiler.
AC_PROG_CC
AC_PROG_CXX
# Compiler flags.
AC_ARG_ENABLE(debug, [ --enable-debug setup flags (gcc) for debugging (default=no)],
if test "x$enable_debug" = xyes; then
CFLAGS="$CFLAGS -O2 -g"
fi
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
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -O2 -ffast-math -funroll-loops -g0"
fi
CPPFLAGS="$CPPFLAGS"
LDFLAGS="$LDFLAGS -s"
else
AC_MSG_WARN([enable-optim and enable-debug are incompatible -- disabling optimizations])
fi,)
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -W -Wall"
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])])
AH_VERBATIM([CONFIG_H_FIRST], [/* Check for Linux's /usr/include/features.h
*/
#ifdef _FEATURES_H
# error config.h must be first file included
#endif])
AC_C_INLINE
# Checks for programs.
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_RC
AC_PROG_LIBTOOL
AC_PROG_MKDIR_P
dnl Can't use AC_PROG_INSTALL
INSTALL='$(SHELL) $(top_srcdir)/install-sh -c'
AC_SUBST(INSTALL)
# Checks for header files.
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 sys/select.h inttypes.h)
AC_CHECK_HEADERS(arpa/inet.h winsock2.h)
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library 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
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV, 1, [Define to use setenv]),)
# Check for getopt_long; if not found, use included source.
AC_CHECK_FUNCS([getopt_long], has_getopt_long=no, has_getopt_long=yes)
if test "x$has_getoptlong" = "xyes"; then
AC_DEFINE([HAVE_GETOPT_LONG], 1, [Define to use getopt_long])
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="CPPFLAGS -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 -lgcrypt -lgpg-error -lz"])
])
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 -lgcrypt -lgpg-error -lz"
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],
[])
saved_LIBS="$LIBS"
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="$saved_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-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 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])
OLDLIBS="$LIBS"
LIBS="$LIBS -$flag"
AC_TRY_LINK([], [pthread_create();],
[pthflag=yes; checkpthread=no],
[pthflag=no; LIBS="$OLDLIBS"])
AC_MSG_RESULT($pthflag)
fi
done
# pthreadGC2 is provided by pthreads-w32 on mingw32 platforms.
for lib in "c_r" "pthread" "pthreadGC2" ; 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_ARG_ENABLE(lockfile, [ --disable-lockfile do not use liblockfile for locking mailboxes])
if test "x$enable_lockfile" != "xno"; then
AC_CHECK_LIB(lockfile, lockfile_create,, [
if test "x$enable_lockfile" = "xyes"; then
AC_MSG_ERROR([liblockfile not found])
fi ])
fi
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="$SSLLIBS"
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 IPv6 support
enable_ipv6=maybe
AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--enable-ipv6], [enable IPv6 support]), enable_ipv6=$enableval)
AC_MSG_CHECKING([whether to use IPv6])
AC_MSG_RESULT($enable_ipv6)
if test "x$enable_ipv6" != "xno"; then
dnl check for IPv6 support
AC_MSG_CHECKING([for IPv6 support])
AC_TRY_COMPILE([#define INET6
#include <sys/types.h>
#include <netinet/in.h>],
[int x = IPPROTO_IPV6; struct in6_addr a;],
ipv6_support=yes, ipv6_support=no)
AC_MSG_RESULT($ipv6_support)
if test "x$ipv6_support" = "xno"; then
if test "x$enable_ipv6" = "xyes"; then
AC_MSG_ERROR([cannot enable IPv6 support])
fi
else
AC_DEFINE(HAVE_IPV6, 1, [Define to enable IPv6 support.])
dnl check for getaddrinfo and freeaddrinfo function presence
for func in "getaddrinfo" "freeaddrinfo"; do
AC_MSG_CHECKING([for $func])
AC_TRY_LINK([], [$func();],
[func_present=yes],
[func_present=no])
AC_MSG_RESULT($func_present)
if test "x$func_present" = "xno"; then
AC_MSG_ERROR([$func function required for IPv6 support])
fi
done
fi
fi
dnl libcurl
libcurl=no
AC_ARG_WITH(curl, [ --with-curl[=DIR] curl install directory (default=auto)],
[], [with_curl=auto])
if test "x$with_curl" != "xno"; then
:
elif test "x$with_curl" != "xauto"; then
OCPPFLAGS="$CPPFLAGS"
OLDFLAGS="$LDFLAGS"
if test "x$with_curl" != "xyes" ; then
CPPFLAGS="$CPPFLAGS -I$with_curl/include"
LDFLAGS="$LDFLAGS -L$with_curl/lib -lcurl -lz"
fi
AC_CHECK_HEADER(curl/curl.h, [libcurl=yes])
if test "x$libcurl" = "xyes"; then
AC_MSG_CHECKING([whether with-curl compiles and links fine])
AC_TRY_LINK([], [curl_easy_init();], [libcurl=yes], [libcurl=no])
AC_MSG_RESULT([$libcurl])
fi
if test "x$libcurl" = "xno"; then
CPPFLAGS="$OCPPFLAGS"
LDFLAGS="$OLDFLAGS"
fi
else
AC_PATH_PROG(libcurlconfig, [curl-config])
if test "x$libcurlconfig" != "x"; then
CPPFLAGS="$CPPFLAGS `$libcurlconfig --cflags 2>/dev/null`"
AC_CHECK_HEADER(curl/curl.h, [libcurl=yes])
if test "x$libcurl" = "xyes"; then
AC_MSG_CHECKING([whether curl-config hints compiles and links fine])
OLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS `$libcurlconfig --libs 2>/dev/null`"
AC_TRY_LINK([], [curl_easy_init();], [libcurl=yes], [libcurl=no])
AC_MSG_RESULT([$libcurl])
if test "x$libcurl" = "xno"; then
LDFLAGS="$OLDFLAGS"
fi
fi
libcurl_major_version=`$libcurlconfig --version | \
sed 's/^.* \([[0-9]]*\)\.\([[0-9]]*\).*$/\1/'`
libcurl_minor_version=`$libcurlconfig --version | \
sed 's/^.* \([[0-9]]*\)\.\([[0-9]]*\).*$/\2/'`
if test "$libcurl_major_version" -lt "$libcurl_major_required" ; then
libcurl=no
fi
if test "$libcurl_major_version" -eq "$libcurl_major_required" ; then
if test "$libcurl_minor_version" -lt "$libcurl_minor_required" ; then
libcurl=no
fi
fi
fi
fi
if test "x$libcurl" = "xyes" ; then
AC_DEFINE([HAVE_CURL], 1, [Define to use curl])
fi
dnl expat
libexpat=no
AC_ARG_WITH(expat, [ --with-expat[=DIR] expat install directory (default=auto)],
[], [with_expat=auto])
if test "x$with_expat" != "xno"; then
:
elif test "x$with_expat" != "xauto"; then
OCPPFLAGS="$CPPFLAGS"
OLDFLAGS="$LDFLAGS"
if test "x$with_expat" != "xyes" ; then
CPPFLAGS="$CPPFLAGS -I$with_expat/include"
LDFLAGS="$LDFLAGS -L$with_expat/lib -lexpat"
fi
AC_CHECK_HEADER(expat.h, [libexpat=yes])
if test "x$libexpat" = "xyes"; then
AC_MSG_CHECKING([whether with-expat compiles and links fine])
AC_TRY_LINK([], [XML_SetElementHandler();], [libexpat=yes], [libexpat=no])
AC_MSG_RESULT([$libexpat])
fi
if test "x$libexpat" = "xno"; then
CPPFLAGS="$OCPPFLAGS"
LDFLAGS="$OLDFLAGS"
fi
else
AC_CHECK_HEADER(expat.h, [libexpat=yes])
if test "x$libexpat" = "xyes"; then
AC_MSG_CHECKING([whether libexpat compiles and links fine])
OLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -lexpat"
AC_TRY_LINK([], [XML_SetElementHandler();], [libexpat=yes], [libexpat=no])
AC_MSG_RESULT([$libexpat])
if test "x$libexpat" = "xno"; then
LDFLAGS="$OLDFLAGS"
fi
fi
fi
if test "x$libexpat" = "xyes" ; then
AC_DEFINE([HAVE_EXPAT], 1, [Define to use expat])
fi
dnl Version
VERSION="$VERSION_MAJOR.$VERSION_MINOR"
test -d .git && VERSION="$VERSION-dev-"`date +'%Y%m%d'`
AC_DEFINE_UNQUOTED(LIBETPAN_VERSION, "$VERSION",
[Define this to the version of libEtPan])
AC_SUBST(VERSION)
# Further checks.
AC_CONFIG_FILES(libetpan-config
Makefile
build-windows/Makefile
include/Makefile
src/Makefile
src/bsd/Makefile
src/windows/Makefile
src/data-types/Makefile
src/low-level/Makefile
src/low-level/feed/Makefile
src/low-level/imap/Makefile
src/low-level/imf/Makefile
src/low-level/maildir/Makefile
src/low-level/mbox/Makefile
src/low-level/mh/Makefile
src/low-level/mime/Makefile
src/low-level/nntp/Makefile
src/low-level/pop3/Makefile
src/low-level/smtp/Makefile
src/driver/Makefile
src/driver/implementation/Makefile
src/driver/implementation/data-message/Makefile
src/driver/implementation/db/Makefile
src/driver/implementation/feed/Makefile
src/driver/implementation/hotmail/Makefile
src/driver/implementation/imap/Makefile
src/driver/implementation/maildir/Makefile
src/driver/implementation/mbox/Makefile
src/driver/implementation/mh/Makefile
src/driver/implementation/mime-message/Makefile
src/driver/implementation/nntp/Makefile
src/driver/implementation/pop3/Makefile
src/driver/interface/Makefile
src/driver/tools/Makefile
src/main/Makefile
src/main/libetpan_version.h
src/engine/Makefile
src/versioninfo.rc
doc/Makefile
tests/Makefile)
# We collect all files which could potentially install public header
# files via HEADERS. Updating any of these files will trigger
# rebuilding the header link farm. See rules.mk for what we do with
# this information. Because pmake does not support $(addprefix
# $(top_builddir), $(cfg_files), we need to calculate absolute path
# names here for automatic dependency tracking to work properly.
cfg_files=
crd="`pwd`"
for cfg_file in ${ac_config_files}; do
cfg_files="${cfg_files} ${crd}/${cfg_file}"
done
AC_SUBST(cfg_files)
AC_OUTPUT
cp -f ${crd}/src/main/libetpan_version.h ${crd}/build-windows