libetpan - fdik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

778 lines
24 KiB

11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. m4_define([maj_version], [1])
  4. m4_define([min_version], [1])
  5. m4_define([api_current], [16])
  6. m4_define([api_revision], [0])
  7. m4_define([api_compatibility], [16])
  8. dnl API version
  9. dnl 1. If you have changed any of the sources for this library, the revision
  10. dnl number must be incremented. This is a new revision of the current
  11. dnl interface.
  12. dnl 2. If the interface has changed, then current must be incremented, and
  13. dnl revision reset to `0'. This is the first revision of a new interface.
  14. dnl 3. If the new interface is a superset of the previous interface (that is,
  15. dnl if the previous interface has not been broken by the changes in this new
  16. dnl release), then age must be incremented. This release is backwards
  17. dnl compatible with the previous release.
  18. dnl 4. If the new interface has removed elements with respect to the previous
  19. dnl interface, then you have broken backward compatibility and age must be
  20. dnl reset to `0'. This release has a new, but backwards incompatible
  21. dnl interface.
  22. dnl age = api_current - api_compatiblity
  23. AC_PREREQ(2.61)
  24. AC_INIT([libetpan],[maj_version.min_version],[libetpan-devel@lists.sourceforge.net])
  25. AC_CONFIG_SRCDIR([src/main/libetpan_version.h.in])
  26. AC_CONFIG_MACRO_DIR([m4])
  27. AC_CONFIG_HEADER([config.h])
  28. AM_INIT_AUTOMAKE
  29. AM_MAINTAINER_MODE
  30. AC_CANONICAL_HOST
  31. dnl Version major and minor
  32. VERSION_MAJOR=maj_version
  33. VERSION_MINOR=min_version
  34. dnl required version of libcurl
  35. libcurl_major_required=0
  36. libcurl_minor_required=0
  37. dnl API version
  38. dnl 1. If you have changed any of the sources for this library, the revision
  39. dnl number must be incremented. This is a new revision of the current
  40. dnl interface.
  41. dnl 2. If the interface has changed, then current must be incremented, and
  42. dnl revision reset to `0'. This is the first revision of a new interface.
  43. dnl 3. If the new interface is a superset of the previous interface (that is,
  44. dnl if the previous interface has not been broken by the changes in this new
  45. dnl release), then age must be incremented. This release is backwards
  46. dnl compatible with the previous release.
  47. dnl 4. If the new interface has removed elements with respect to the previous
  48. dnl interface, then you have broken backward compatibility and age must be
  49. dnl reset to `0'. This release has a new, but backwards incompatible
  50. dnl interface.
  51. API_CURRENT=api_current
  52. API_REVISION=api_revision
  53. API_COMPATIBILITY=api_compatibility
  54. AC_SUBST(API_CURRENT)
  55. AC_SUBST(API_COMPATIBILITY)
  56. AC_SUBST(API_REVISION)
  57. API_AGE=`expr $API_CURRENT - $API_COMPATIBILITY`
  58. API_VERSION="$API_CURRENT:$API_REVISION:$API_AGE"
  59. AC_SUBST(API_VERSION)
  60. dnl FIXME: This should be the git revision.
  61. BUILD_REVISION=0
  62. AC_SUBST(BUILD_REVISION)
  63. BUILD_TIMESTAMP=`date +'%Y-%m-%dT%H:%M%z'`
  64. AC_SUBST(BUILD_TIMESTAMP)
  65. changequote(,)dnl
  66. BUILD_FILEVERSION=`echo "${VERSION_MAJOR}.${VERSION_MINOR}.0" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
  67. changequote([,])dnl
  68. BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
  69. AC_SUBST(BUILD_FILEVERSION)
  70. # Architecture specific.
  71. have_w32_system=no
  72. case "${host}" in
  73. *-mingw32*)
  74. have_w32_system=yes
  75. CFLAGS="$CFLAGS -mms-bitfields -I\${top_srcdir}/src/windows"
  76. ## Currently we export all symbols indiscriminately.
  77. ## Eventually, this can be limited to those which should be
  78. ## exported (which helps to hide our internal mmap stubs, for
  79. ## example), but before this can happen, the missing export
  80. ## declarations have to be added to all header files. Also, it
  81. ## should first be verified that exporting data members from a
  82. ## DLL is safe. To reenable discriminate exports, uncomment
  83. ## the following line and replace the "@ifdef _MSC_VER" around the
  84. ## export/import declaration stuff in libetpan.h.in by
  85. ## "@if WIN32".
  86. # CFLAGS="$CFLAGS -DLIBETPAN_DLL"
  87. # We use winsock2.
  88. LIBS="$LIBS -lws2_32"
  89. ;;
  90. *)
  91. ;;
  92. esac
  93. if test "$have_w32_system" = yes; then
  94. AC_DEFINE(HAVE_MINGW32_SYSTEM, 1, [Defined if we run on a W32 API based system])
  95. fi
  96. AM_CONDITIONAL(HAVE_MINGW32_SYSTEM, test "$have_w32_system" = yes)
  97. # Check the C compiler.
  98. AC_PROG_CC
  99. AC_PROG_CXX
  100. # Compiler flags.
  101. AC_ARG_ENABLE(debug, [ --enable-debug setup flags (gcc) for debugging (default=no)],
  102. if test "x$enable_debug" = xyes; then
  103. CFLAGS="$CFLAGS -O2 -g"
  104. fi
  105. CPPFLAGS="$CPPFLAGS -DDEBUG"
  106. LDFLAGS="$LDFLAGS",)
  107. AC_ARG_ENABLE(optim, [ --enable-optim setup flags (gcc) for optimizations (default=no)],
  108. if test "x$enable_debug" != "xyes" ; then
  109. if test "x$GCC" = xyes; then
  110. CFLAGS="$CFLAGS -O2 -ffast-math -funroll-loops -g0"
  111. fi
  112. CPPFLAGS="$CPPFLAGS"
  113. LDFLAGS="$LDFLAGS -s"
  114. else
  115. AC_MSG_WARN([enable-optim and enable-debug are incompatible -- disabling optimizations])
  116. fi,)
  117. if test "x$GCC" = xyes; then
  118. CFLAGS="$CFLAGS -W -Wall"
  119. fi
  120. 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])])
  121. AH_VERBATIM([CONFIG_H_FIRST], [/* Check for Linux's /usr/include/features.h
  122. */
  123. #ifdef _FEATURES_H
  124. # error config.h must be first file included
  125. #endif])
  126. AC_C_INLINE
  127. # Checks for programs.
  128. AC_LIBTOOL_WIN32_DLL
  129. LT_AC_PROG_RC
  130. AC_LIBTOOL_RC
  131. AC_PROG_LIBTOOL
  132. AC_PROG_MKDIR_P
  133. dnl Can't use AC_PROG_INSTALL
  134. INSTALL='$(SHELL) $(top_srcdir)/install-sh -c'
  135. AC_SUBST(INSTALL)
  136. # Checks for header files.
  137. AC_HEADER_STDC
  138. AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h sys/types.h sys/stat.h sys/mman.h limits.h)
  139. AC_CHECK_HEADERS(netdb.h netinet/in.h sys/socket.h)
  140. AC_CHECK_HEADERS(sys/param.h sys/select.h inttypes.h)
  141. AC_CHECK_HEADERS(arpa/inet.h winsock2.h)
  142. # Checks for typedefs, structures, and compiler characteristics.
  143. # Checks for library functions.
  144. AC_FUNC_MMAP
  145. dnl Network libs
  146. AC_CHECK_FUNC(connect, checksocket=no, checksocket=yes)
  147. if test "x$checksocket" = "xyes"; then
  148. case "x$LIBS" in
  149. *-lsocket*);;
  150. *) AC_CHECK_LIB(socket, connect) ;;
  151. esac
  152. fi
  153. AC_CHECK_FUNC(inet_ntoa, checknsl=no, checknsl=yes)
  154. if test "x$checknsl" = "xyes"; then
  155. case "x$LIBS" in
  156. *-lnsl*);;
  157. *) AC_CHECK_LIB(nsl, inet_ntoa) ;;
  158. esac
  159. fi
  160. AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV, 1, [Define to use setenv]),)
  161. # Check for getopt_long; if not found, use included source.
  162. AC_CHECK_FUNCS([getopt_long], has_getopt_long=no, has_getopt_long=yes)
  163. if test "x$has_getoptlong" = "xyes"; then
  164. AC_DEFINE([HAVE_GETOPT_LONG], 1, [Define to use getopt_long])
  165. fi
  166. dnl OpenSSL -- very primitive right now
  167. AC_ARG_WITH(openssl, [ --with-openssl[=DIR] include OpenSSL support (default=auto)],
  168. [], [with_openssl=yes])
  169. if test "x$with_openssl" != "xno"; then
  170. OCPPFLAGS="$CPPFLAGS"
  171. OLDFLAGS="$LDFLAGS"
  172. if test "x$with_openssl" != "xyes" ; then
  173. CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
  174. LDFLAGS="$LDFLAGS -L$with_openssl/lib"
  175. fi
  176. with_openssl=no
  177. SSLLIBS=""
  178. AC_CHECK_HEADER(openssl/ssl.h, [
  179. AC_CHECK_LIB(rsaref, main, [SSLLIBS="-lrsaref"])
  180. AC_CHECK_LIB(crypto, main, [SSLLIBS="-lcrypto $SSLLIBS"], [], [$SSLLIBS])
  181. AC_CHECK_LIB(ssl, SSL_library_init, with_openssl=yes, [], [$SSLLIBS])])
  182. if test "x$with_openssl" != "xyes"; then
  183. CPPFLAGS="$OCPPFLAGS"
  184. LDFLAGS="$OLDFLAGS"
  185. else
  186. with_gnutls="no"
  187. fi
  188. fi
  189. if test "x$with_openssl" = "xyes"; then
  190. AC_DEFINE([USE_SSL], 1, [Define to use OpenSSL])
  191. SSLLIBS="-lssl $SSLLIBS"
  192. else
  193. SSLLIBS=""
  194. fi
  195. AC_SUBST(SSLLIBS)
  196. dnl GNUTLS
  197. AC_ARG_WITH(gnutls, [ --with-gnutls[=DIR] include GnuTLS support (default=auto)],
  198. [], [with_gnutls=no])
  199. if test "x$with_gnutls" != "xno"; then
  200. OCPPFLAGS="$CPPFLAGS"
  201. OLDFLAGS="$LDFLAGS"
  202. if test "x$with_gnutls" != "xyes" ; then
  203. CPPFLAGS="CPPFLAGS -I$with_gnutls/include"
  204. LDFLAGS="$LDFLAGS -L$with_gnutls/lib"
  205. fi
  206. GNUTLSLIB=""
  207. AC_CHECK_HEADER(gnutls/gnutls.h, [
  208. AC_CHECK_LIB(gnutls, gnutls_global_deinit, with_gnutls=yes, [GNUTLSLIB="-lgnutls -lgcrypt -lgpg-error -lz"])
  209. ])
  210. if test "x$with_gnutls" != "xyes"; then
  211. CPPFLAGS="$OCPPFLAGS"
  212. LDFLAGS="$OLDFLAGS"
  213. else
  214. with_openssl="no"
  215. fi
  216. fi
  217. if test "x$with_gnutls" = "xyes"; then
  218. AC_DEFINE([USE_GNUTLS],1, [Define to use GnuTLS])
  219. AC_DEFINE([USE_SSL], 1, [Define to use OpenSSL])
  220. GNUTLSLIB="-lgnutls -lgcrypt -lgpg-error -lz"
  221. else
  222. GNUTLSLIB=""
  223. fi
  224. AC_SUBST(GNUTLSLIB)
  225. if test "x$with_openssl" = "xno"; then
  226. if test "x$with_gnutls" = "xno"; then
  227. AC_MSG_WARN([OpenSSL support disabled.])
  228. fi
  229. fi
  230. dnl iconv
  231. LIBICONV=""
  232. AC_ARG_ENABLE(iconv,
  233. [ --disable-iconv make a version not using iconv],
  234. enable_iconv=no, enable_iconv=yes)
  235. if test x$enable_iconv = xyes; then
  236. dnl get prototype
  237. AC_CHECK_HEADER(iconv.h, [ICONV_HEADER=1], [ICONV_HEADER=0])
  238. ICONV_PROTO=no
  239. AC_MSG_CHECKING([checking iconv() prototype])
  240. if test "x$ICONV_HEADER" = x1 ; then
  241. SAVED_CPPFLAGS="$CPPFLAGS"
  242. CPPFLAGS="-std=c99 $CPPFLAGS"
  243. AC_TRY_COMPILE([#include <iconv.h>
  244. size_t iconv (iconv_t cd, char ** restrict inbuf,
  245. size_t * restrict inbytesleft,
  246. char ** restrict outbuf,
  247. size_t * restrict outbytesleft);],
  248. [],
  249. [ICONV_PROTO=noconst]
  250. [])
  251. AC_TRY_COMPILE([#include <iconv.h>
  252. size_t iconv (iconv_t cd, const char ** restrict inbuf,
  253. size_t * restrict inbytesleft,
  254. char ** restrict outbuf,
  255. size_t * restrict outbytesleft);],
  256. [],
  257. [ICONV_PROTO=const]
  258. [])
  259. CPPFLAGS="$SAVED_CPPFLAGS"
  260. fi
  261. dnl try to link
  262. ICONV_LINKED=NO
  263. if test "$ICONV_PROTO" != "xno" ; then
  264. AC_MSG_RESULT([ok])
  265. AC_MSG_CHECKING([for iconv])
  266. ICONV_LINKED=0
  267. AC_TRY_LINK([#include <stdlib.h>
  268. #include <iconv.h>],
  269. [iconv_t cd = iconv_open("","");
  270. iconv(cd,NULL,NULL,NULL,NULL);
  271. iconv_close(cd);],
  272. [ICONV_LINKED=1],
  273. [])
  274. saved_LIBS="$LIBS"
  275. for lib in iconv ; do
  276. if test "x$ICONV_LINKED" = "x0" ; then
  277. LIBS=-l$lib
  278. AC_TRY_LINK([#include <stdlib.h>
  279. #include <iconv.h>],
  280. [iconv_t cd = iconv_open("","");
  281. iconv(cd,NULL,NULL,NULL,NULL);
  282. iconv_close(cd);],
  283. [LIBICONV="$LIBS" ; ICONV_LINKED=1],
  284. [])
  285. fi
  286. done
  287. LIBS="$saved_LIBS"
  288. if test "x$ICONV_LINKED" = "x1" ; then
  289. AC_MSG_RESULT([found])
  290. else
  291. AC_MSG_RESULT([not found])
  292. fi
  293. else
  294. AC_MSG_RESULT([failed])
  295. fi
  296. if test "x$ICONV_LINKED" = "x1" ; then
  297. AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
  298. fi
  299. ICONV_PROTO_CONST=0
  300. if test "x$ICONV_PROTO" = "xconst" ; then
  301. AC_DEFINE_UNQUOTED(HAVE_ICONV_PROTO_CONST, 1,
  302. [prototype of iconv() has const parameters])
  303. fi
  304. fi
  305. AC_SUBST(LIBICONV)
  306. dnl Berkeley DB
  307. DBVERS=0
  308. DBLINKED=0
  309. DBLIB=""
  310. AC_ARG_ENABLE(db, [ --disable-db disable Berkeley DB (default=try to detect DB)],[enable_db=$enableval],[enable_db=yes])
  311. dnl Check for a presence of Berkeley DB header
  312. if test "x$enable_db" != "xyes"; then
  313. AC_MSG_WARN(cache support disabled)
  314. else
  315. AC_CHECK_HEADER(db.h, [DB_HEADER=1], [DB_HEADER=0])
  316. fi
  317. if test "x$DB_HEADER" = "x1"; then
  318. dnl Check for version of Berkeley DB
  319. AC_MSG_CHECKING([version of Berkeley DB])
  320. dnl check for version 3 and above
  321. AC_TRY_COMPILE(
  322. [#include <db.h>],
  323. [#if DB_VERSION_MAJOR < 3
  324. #error DB version 3 or above needed
  325. #endif],
  326. [DBVERS=3]
  327. [])
  328. dnl check for version 2
  329. if test "x$DBVERS" = "x0"; then
  330. AC_TRY_COMPILE([#include <db.h>],
  331. [#if DB_VERSION_MAJOR != 2
  332. #error DB version 2 needed
  333. #endif],
  334. [DBVERS=2]
  335. [])
  336. fi
  337. if test "x$DBVERS" = "x0"; then
  338. dnl assume version 1
  339. DBVERS=1
  340. fi
  341. dnl test linkage with Berkeley DB
  342. dnl Look for db3 or superior with db_create call
  343. case "$DBVERS" in
  344. 3)
  345. AC_MSG_RESULT([version 3.x or above])
  346. 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
  347. if test "x$DBLINKED" = "x0"; then
  348. dnl AC_CHECK_LIB($lib, db_create, [DBLIB="-l$lib"; DBLINKED=1], [])
  349. dnl installations of libdb4 function names are defined in db.h
  350. dnl to other symbols
  351. AC_MSG_CHECKING([for db_create() in -l$lib])
  352. LIBS=-l$lib
  353. AC_TRY_LINK(
  354. [#include <db.h>],
  355. [db_create(0,0,0)],
  356. [DBLIB="-l$lib"; DBLINKED=1; AC_MSG_RESULT([found])],
  357. [AC_MSG_RESULT([not found])])
  358. fi
  359. done
  360. LIBS=""
  361. ;;
  362. dnl Look for db2 with db_open call
  363. 2)
  364. AC_MSG_RESULT([version 2.x])
  365. for lib in db2 db; do
  366. if test "x$DBLINKED" = "x0"; then
  367. AC_CHECK_LIB($lib, db_open, [DBLIB="-l$lib"; DBLINKED=1], [])
  368. fi
  369. done
  370. ;;
  371. *)
  372. dnl Look for db1 with dbopen call in -ldb or in libc (bsds)
  373. AC_MSG_RESULT([version 1.x])
  374. AC_CHECK_FUNC(dbopen, [DBLINKED=1], [])
  375. for lib in db-1 db1 db; do
  376. if test "x$DBLINKED" = "x0"; then
  377. AC_CHECK_LIB($lib, dbopen, [DBLIB="-l$lib"; DBLINKED=1], [])
  378. fi
  379. done
  380. ;;
  381. dnl fi
  382. esac
  383. fi
  384. if test "x$DBLINKED" = "x0"; then
  385. DBVERS=0
  386. if test "x$enable_db" = "xyes"; then
  387. AC_MSG_WARN(cache support disabled (Berkeley DB is missing).)
  388. fi
  389. fi
  390. AC_DEFINE_UNQUOTED(DBVERS, $DBVERS,
  391. [Define to detected Berkeley DB major version number])
  392. AC_SUBST(DBLIB)
  393. dnl Threading support, if enabled
  394. AC_ARG_ENABLE(threads, [ --disable-threads do not include multithreading support using pthread],,[enable_threads=yes])
  395. if test "x$enable_threads" = "xyes"; then
  396. dnl Try to find a good CFLAGS/LDFLAGS for pthreads
  397. AC_CHECK_HEADERS(pthread.h, [], [AC_MSG_ERROR([pthread support required])])
  398. CPPFLAGS="$CPPFLAGS -D_REENTRANT"
  399. checkpthread=yes
  400. AC_MSG_CHECKING([for pthread_create with libc])
  401. AC_TRY_LINK([], [pthread_create();],
  402. [pthflag=yes; checkpthread=no],
  403. [pthflag=no])
  404. AC_MSG_RESULT($pthflag)
  405. for flag in "pthreads" "pthread"; do
  406. if test "x$checkpthread" = "xyes"; then
  407. AC_MSG_CHECKING([for pthread_create with -$flag])
  408. OLDLIBS="$LIBS"
  409. LIBS="$LIBS -$flag"
  410. AC_TRY_LINK([], [pthread_create();],
  411. [pthflag=yes; checkpthread=no],
  412. [pthflag=no; LIBS="$OLDLIBS"])
  413. AC_MSG_RESULT($pthflag)
  414. fi
  415. done
  416. # pthreadGC2 is provided by pthreads-w32 on mingw32 platforms.
  417. for lib in "c_r" "pthread" "pthreadGC2" ; do
  418. if test "x$checkpthread" = "xyes"; then
  419. case "x$LIBS" in
  420. *-l$lib*);;
  421. *) AC_CHECK_LIB($lib, pthread_create, [LIBS="$LIBS -l$lib"; checkpthread=no]) ;;
  422. esac
  423. fi
  424. done
  425. if test "x$checkpthread" = "xyes"; then
  426. AC_CHECK_FUNC(pthread_create, checkpthread=no)
  427. text "x$checkpthread" = "xyes" && AC_MSG_ERROR([pthread library required])
  428. fi
  429. AC_DEFINE([LIBETPAN_REENTRANT], 1, [Define to include multithreading support])
  430. LIBSUFFIX=
  431. REENTRANT=1
  432. else
  433. REENTRANT=0
  434. LIBSUFFIX=-no-mt
  435. fi
  436. AC_SUBST(LIBSUFFIX)
  437. AC_SUBST(REENTRANT)
  438. dnl liblockfile on debian systems
  439. AC_ARG_ENABLE(lockfile, [ --disable-lockfile do not use liblockfile for locking mailboxes])
  440. if test "x$enable_lockfile" != "xno"; then
  441. AC_CHECK_LIB(lockfile, lockfile_create,, [
  442. if test "x$enable_lockfile" = "xyes"; then
  443. AC_MSG_ERROR([liblockfile not found])
  444. fi ])
  445. fi
  446. AC_DEFINE_UNQUOTED(LIBETPAN_VERSION_MAJOR, $VERSION_MAJOR,
  447. [Define this to the major version of libEtPan])
  448. AC_DEFINE_UNQUOTED(LIBETPAN_VERSION_MINOR, $VERSION_MINOR,
  449. [Define this to the minor version of libEtPan])
  450. AC_SUBST(VERSION_MAJOR)
  451. AC_SUBST(VERSION_MINOR)
  452. dnl Cyrus SASL
  453. AC_ARG_WITH(sasl, [ --with-sasl[=DIR] include SASL support (default=auto)],
  454. [], [with_sasl=yes])
  455. if test "x$with_sasl" != "xno"; then
  456. OCPPFLAGS="$CPPFLAGS"
  457. OLDFLAGS="$LDFLAGS"
  458. if test "x$with_sasl" != "xyes" ; then
  459. CPPFLAGS="$CPPFLAGS -I$with_sasl/include"
  460. LDFLAGS="$LDFLAGS -L$with_sasl/lib"
  461. fi
  462. with_sasl=no
  463. SASLLIBS="$SSLLIBS"
  464. AC_CHECK_HEADER(sasl/sasl.h, [
  465. AC_CHECK_LIB(sasl2, sasl_client_init, with_sasl=yes, [], [$SASLLIBS])])
  466. if test "x$with_sasl" != "xyes"; then
  467. CPPFLAGS="$OCPPFLAGS"
  468. LDFLAGS="$OLDFLAGS"
  469. fi
  470. fi
  471. if test "x$with_sasl" = "xyes"; then
  472. AC_DEFINE([USE_SASL], 1, [Define to use SASL])
  473. SASLLIBS="-lsasl2 $SASLLIBS"
  474. else
  475. AC_MSG_WARN([SASL support disabled.])
  476. SASLLIBS=""
  477. fi
  478. AC_SUBST(SASLLIBS)
  479. dnl IPv6 support
  480. enable_ipv6=maybe
  481. AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--enable-ipv6], [enable IPv6 support]), enable_ipv6=$enableval)
  482. AC_MSG_CHECKING([whether to use IPv6])
  483. AC_MSG_RESULT($enable_ipv6)
  484. if test "x$enable_ipv6" != "xno"; then
  485. dnl check for IPv6 support
  486. AC_MSG_CHECKING([for IPv6 support])
  487. AC_TRY_COMPILE([#define INET6
  488. #include <sys/types.h>
  489. #include <netinet/in.h>],
  490. [int x = IPPROTO_IPV6; struct in6_addr a;],
  491. ipv6_support=yes, ipv6_support=no)
  492. AC_MSG_RESULT($ipv6_support)
  493. if test "x$ipv6_support" = "xno"; then
  494. if test "x$enable_ipv6" = "xyes"; then
  495. AC_MSG_ERROR([cannot enable IPv6 support])
  496. fi
  497. else
  498. AC_DEFINE(HAVE_IPV6, 1, [Define to enable IPv6 support.])
  499. dnl check for getaddrinfo and freeaddrinfo function presence
  500. for func in "getaddrinfo" "freeaddrinfo"; do
  501. AC_MSG_CHECKING([for $func])
  502. AC_TRY_LINK([], [$func();],
  503. [func_present=yes],
  504. [func_present=no])
  505. AC_MSG_RESULT($func_present)
  506. if test "x$func_present" = "xno"; then
  507. AC_MSG_ERROR([$func function required for IPv6 support])
  508. fi
  509. done
  510. fi
  511. fi
  512. dnl libcurl
  513. libcurl=no
  514. AC_ARG_WITH(curl, [ --with-curl[=DIR] curl install directory (default=auto)],
  515. [], [with_curl=auto])
  516. if test "x$with_curl" != "xno"; then
  517. :
  518. elif test "x$with_curl" != "xauto"; then
  519. OCPPFLAGS="$CPPFLAGS"
  520. OLDFLAGS="$LDFLAGS"
  521. if test "x$with_curl" != "xyes" ; then
  522. CPPFLAGS="$CPPFLAGS -I$with_curl/include"
  523. LDFLAGS="$LDFLAGS -L$with_curl/lib -lcurl -lz"
  524. fi
  525. AC_CHECK_HEADER(curl/curl.h, [libcurl=yes])
  526. if test "x$libcurl" = "xyes"; then
  527. AC_MSG_CHECKING([whether with-curl compiles and links fine])
  528. AC_TRY_LINK([], [curl_easy_init();], [libcurl=yes], [libcurl=no])
  529. AC_MSG_RESULT([$libcurl])
  530. fi
  531. if test "x$libcurl" = "xno"; then
  532. CPPFLAGS="$OCPPFLAGS"
  533. LDFLAGS="$OLDFLAGS"
  534. fi
  535. else
  536. AC_PATH_PROG(libcurlconfig, [curl-config])
  537. if test "x$libcurlconfig" != "x"; then
  538. CPPFLAGS="$CPPFLAGS `$libcurlconfig --cflags 2>/dev/null`"
  539. AC_CHECK_HEADER(curl/curl.h, [libcurl=yes])
  540. if test "x$libcurl" = "xyes"; then
  541. AC_MSG_CHECKING([whether curl-config hints compiles and links fine])
  542. OLDFLAGS="$LDFLAGS"
  543. LDFLAGS="$LDFLAGS `$libcurlconfig --libs 2>/dev/null`"
  544. AC_TRY_LINK([], [curl_easy_init();], [libcurl=yes], [libcurl=no])
  545. AC_MSG_RESULT([$libcurl])
  546. if test "x$libcurl" = "xno"; then
  547. LDFLAGS="$OLDFLAGS"
  548. fi
  549. fi
  550. libcurl_major_version=`$libcurlconfig --version | \
  551. sed 's/^.* \([[0-9]]*\)\.\([[0-9]]*\).*$/\1/'`
  552. libcurl_minor_version=`$libcurlconfig --version | \
  553. sed 's/^.* \([[0-9]]*\)\.\([[0-9]]*\).*$/\2/'`
  554. if test "$libcurl_major_version" -lt "$libcurl_major_required" ; then
  555. libcurl=no
  556. fi
  557. if test "$libcurl_major_version" -eq "$libcurl_major_required" ; then
  558. if test "$libcurl_minor_version" -lt "$libcurl_minor_required" ; then
  559. libcurl=no
  560. fi
  561. fi
  562. fi
  563. fi
  564. if test "x$libcurl" = "xyes" ; then
  565. AC_DEFINE([HAVE_CURL], 1, [Define to use curl])
  566. fi
  567. dnl expat
  568. libexpat=no
  569. AC_ARG_WITH(expat, [ --with-expat[=DIR] expat install directory (default=auto)],
  570. [], [with_expat=auto])
  571. if test "x$with_expat" != "xno"; then
  572. :
  573. elif test "x$with_expat" != "xauto"; then
  574. OCPPFLAGS="$CPPFLAGS"
  575. OLDFLAGS="$LDFLAGS"
  576. if test "x$with_expat" != "xyes" ; then
  577. CPPFLAGS="$CPPFLAGS -I$with_expat/include"
  578. LDFLAGS="$LDFLAGS -L$with_expat/lib -lexpat"
  579. fi
  580. AC_CHECK_HEADER(expat.h, [libexpat=yes])
  581. if test "x$libexpat" = "xyes"; then
  582. AC_MSG_CHECKING([whether with-expat compiles and links fine])
  583. AC_TRY_LINK([], [XML_SetElementHandler();], [libexpat=yes], [libexpat=no])
  584. AC_MSG_RESULT([$libexpat])
  585. fi
  586. if test "x$libexpat" = "xno"; then
  587. CPPFLAGS="$OCPPFLAGS"
  588. LDFLAGS="$OLDFLAGS"
  589. fi
  590. else
  591. AC_CHECK_HEADER(expat.h, [libexpat=yes])
  592. if test "x$libexpat" = "xyes"; then
  593. AC_MSG_CHECKING([whether libexpat compiles and links fine])
  594. OLDFLAGS="$LDFLAGS"
  595. LDFLAGS="$LDFLAGS -lexpat"
  596. AC_TRY_LINK([], [XML_SetElementHandler();], [libexpat=yes], [libexpat=no])
  597. AC_MSG_RESULT([$libexpat])
  598. if test "x$libexpat" = "xno"; then
  599. LDFLAGS="$OLDFLAGS"
  600. fi
  601. fi
  602. fi
  603. if test "x$libexpat" = "xyes" ; then
  604. AC_DEFINE([HAVE_EXPAT], 1, [Define to use expat])
  605. fi
  606. AC_ARG_WITH([zlib],
  607. [AS_HELP_STRING([--with-zlib],
  608. [include classes for streaming compressed data in and out @<:@default=check@:>@])],
  609. [],[with_zlib=check])
  610. # Check for zlib.
  611. HAVE_ZLIB=0
  612. AS_IF([test "$with_zlib" != no], [
  613. AC_MSG_CHECKING([zlib version])
  614. # First check the zlib header version.
  615. AC_COMPILE_IFELSE(
  616. [AC_LANG_PROGRAM([[
  617. #include <zlib.h>
  618. #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1204)
  619. # error zlib version too old
  620. #endif
  621. ]], [])], [
  622. AC_MSG_RESULT([ok (1.2.0.4 or later)])
  623. # Also need to add -lz to the linker flags and make sure this succeeds.
  624. AC_SEARCH_LIBS([zlibVersion], [z], [
  625. AC_DEFINE([HAVE_ZLIB], [1], [Enable classes using zlib compression.])
  626. HAVE_ZLIB=1
  627. LDFLAGS="$LDFLAGS -lz"
  628. ], [
  629. AS_IF([test "$with_zlib" != check], [
  630. AC_MSG_FAILURE([--with-zlib was given, but no working zlib library was found])
  631. ])
  632. ])
  633. ], [
  634. AS_IF([test "$with_zlib" = check], [
  635. AC_MSG_RESULT([headers missing or too old (requires 1.2.0.4)])
  636. ], [
  637. AC_MSG_FAILURE([--with-zlib was given, but zlib headers were not present or were too old (requires 1.2.0.4)])
  638. ])
  639. ])
  640. ])
  641. AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1])
  642. dnl Version
  643. VERSION="$VERSION_MAJOR.$VERSION_MINOR"
  644. test -d .git && VERSION="$VERSION-dev-"`date +'%Y%m%d'`
  645. AC_DEFINE_UNQUOTED(LIBETPAN_VERSION, "$VERSION",
  646. [Define this to the version of libEtPan])
  647. AC_SUBST(VERSION)
  648. # Further checks.
  649. AC_CONFIG_FILES(libetpan-config
  650. Makefile
  651. build-windows/Makefile
  652. include/Makefile
  653. src/Makefile
  654. src/bsd/Makefile
  655. src/windows/Makefile
  656. src/data-types/Makefile
  657. src/low-level/Makefile
  658. src/low-level/feed/Makefile
  659. src/low-level/imap/Makefile
  660. src/low-level/imf/Makefile
  661. src/low-level/maildir/Makefile
  662. src/low-level/mbox/Makefile
  663. src/low-level/mh/Makefile
  664. src/low-level/mime/Makefile
  665. src/low-level/nntp/Makefile
  666. src/low-level/pop3/Makefile
  667. src/low-level/smtp/Makefile
  668. src/driver/Makefile
  669. src/driver/implementation/Makefile
  670. src/driver/implementation/data-message/Makefile
  671. src/driver/implementation/db/Makefile
  672. src/driver/implementation/feed/Makefile
  673. src/driver/implementation/hotmail/Makefile
  674. src/driver/implementation/imap/Makefile
  675. src/driver/implementation/maildir/Makefile
  676. src/driver/implementation/mbox/Makefile
  677. src/driver/implementation/mh/Makefile
  678. src/driver/implementation/mime-message/Makefile
  679. src/driver/implementation/nntp/Makefile
  680. src/driver/implementation/pop3/Makefile
  681. src/driver/interface/Makefile
  682. src/driver/tools/Makefile
  683. src/main/Makefile
  684. src/main/libetpan_version.h
  685. src/engine/Makefile
  686. src/versioninfo.rc
  687. doc/Makefile
  688. tests/Makefile)
  689. # We collect all files which could potentially install public header
  690. # files via HEADERS. Updating any of these files will trigger
  691. # rebuilding the header link farm. See rules.mk for what we do with
  692. # this information. Because pmake does not support $(addprefix
  693. # $(top_builddir), $(cfg_files), we need to calculate absolute path
  694. # names here for automatic dependency tracking to work properly.
  695. cfg_files=
  696. crd="`pwd`"
  697. for cfg_file in ${ac_config_files}; do
  698. cfg_files="${cfg_files} ${crd}/${cfg_file}"
  699. done
  700. AC_SUBST(cfg_files)
  701. AC_OUTPUT
  702. cp -f ${crd}/src/main/libetpan_version.h ${crd}/build-windows