1 # Process this file with autoconf to produce a configure script.
2 # require autoconf 2.54
6 # gmime_micro_version += 1;
7 # gmime_interface_age += 1;
8 # gmime_binary_age += 1;
9 # if any functions have been added, set gmime_interface_age to 0.
10 # if backwards compatibility has been broken,
11 # set gmime_binary_age _and_ gmime_interface_age to 0.
13 m4_define([gmime_major_version], [2])
14 m4_define([gmime_minor_version], [6])
15 m4_define([gmime_micro_version], [15])
16 m4_define([gmime_interface_age], [15])
17 m4_define([gmime_binary_age],
18 [m4_eval(100 * gmime_minor_version + gmime_micro_version)])
19 m4_define([gmime_version],
20 [gmime_major_version.gmime_minor_version.gmime_micro_version])
22 # the API version is the major.minor since the last API breakage
23 m4_define([gmime_api_major], [2])
24 m4_define([gmime_api_minor], [6])
25 m4_define([gmime_api_version], [gmime_api_major.gmime_api_minor])
27 # libtool version related macros
28 m4_define([gmime_lt_release], [gmime_major_version.gmime_minor_version])
29 m4_define([gmime_lt_current],
30 [m4_eval(100 * gmime_minor_version + gmime_micro_version - gmime_interface_age)])
31 m4_define([gmime_lt_revision], [gmime_interface_age])
32 m4_define([gmime_lt_age], [m4_eval(gmime_binary_age - gmime_interface_age)])
33 m4_define([gmime_lt_current_minus_age],
34 [m4_eval(gmime_lt_current - gmime_lt_age)])
36 # if the minor version number is odd, then we want debugging. Otherwise
37 # we only want minimal debugging support.
38 m4_define([gmime_debug_default],
39 [m4_if(m4_eval(gmime_minor_version % 2), [1], [yes], [minimum])])
42 AC_INIT(gmime, [gmime_version],
43 [http://bugzilla.gnome.org/enter_bug.cgi?product=gmime])
45 AC_CONFIG_SRCDIR([README])
46 AC_CONFIG_MACRO_DIR([m4])
50 # Save this value here, since automake will set cflags later
51 cflags_set=${CFLAGS+set}
53 AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign])
54 AC_SUBST([ACLOCAL_AMFLAGS], ["-I m4 \${ACLOCAL_FLAGS}"])
55 dnl m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
56 AM_CONFIG_HEADER([config.h])
60 GMIME_MAJOR_VERSION=gmime_major_version
61 GMIME_MINOR_VERSION=gmime_minor_version
62 GMIME_MICRO_VERSION=gmime_micro_version
63 GMIME_INTERFACE_AGE=gmime_interface_age
64 GMIME_BINARY_AGE=gmime_binary_age
65 GMIME_API_VERSION=gmime_api_version
66 GMIME_VERSION=gmime_version
68 AC_SUBST(GMIME_MAJOR_VERSION)
69 AC_SUBST(GMIME_MINOR_VERSION)
70 AC_SUBST(GMIME_MICRO_VERSION)
71 AC_SUBST(GMIME_API_VERSION)
72 AC_SUBST(GMIME_VERSION)
73 AC_SUBST(GMIME_INTERFACE_AGE)
74 AC_SUBST(GMIME_BINARY_AGE)
76 AC_DEFINE(GMIME_VERSION, ["gmime_version"],
77 [Define to the GMime version])
80 LT_RELEASE=gmime_lt_release
81 LT_CURRENT=gmime_lt_current
82 LT_REVISION=gmime_lt_revision
84 LT_CURRENT_MINUS_AGE=gmime_lt_current_minus_age
89 AC_SUBST(LT_CURRENT_MINUS_AGE)
91 dnl Check for win32 platforms
92 AC_MSG_CHECKING([if building for Win32])
93 LIB_EXE_MACHINE_FLAG=X86
100 LIB_EXE_MACHINE_FLAG=X64
110 AC_MSG_RESULT([$platform_win32])
112 AC_SUBST(LIB_EXE_MACHINE_FLAG)
114 AM_CONDITIONAL(PLATFORM_WIN32, [test "x$platform_win32" = "xyes"])
115 AM_CONDITIONAL(OS_WIN32, test ["$native_win32" = "xyes"])
116 AM_CONDITIONAL(OS_WIN32_X64, [test "$LIB_EXE_MACHINE_FLAG" = "X64"])
118 if test "$glib_native_win32" = "yes"; then
119 AC_CHECK_TOOL(WINDRES, windres, no)
120 if test "$WINDRES" = no; then
121 AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
123 AC_CHECK_TOOL(NM, nm, no)
124 if test "$NM" = no; then
125 AC_MSG_ERROR([*** Could not find an implementation of nm in your PATH.])
127 AC_CHECK_TOOL(RANLIB, ranlib, :)
128 AC_CHECK_PROG(ms_librarian, [lib.exe], [yes], [no])
130 AM_CONDITIONAL(MS_LIB_AVAILABLE, [test x$ms_librarian = xyes])
132 dnl Checks for programs.
143 AC_PATH_PROG(RM, rm, /bin/rm)
144 AC_PATH_PROG(MV, mv, /bin/mv)
145 AC_PATH_PROG(TAR, tar, /bin/tar)
149 dnl when using libtool 2.x create libtool early, because it's used in configure
150 m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
153 dnl Checks for header files.
154 AC_CHECK_HEADERS(sys/mman.h)
155 AC_CHECK_HEADERS(sys/param.h)
156 AC_CHECK_HEADERS(winsock2.h)
157 AC_CHECK_HEADERS(string.h)
158 AC_CHECK_HEADERS(stdlib.h)
159 AC_CHECK_HEADERS(netdb.h)
160 AC_CHECK_HEADERS(regex.h)
161 AC_CHECK_HEADERS(time.h)
162 AC_CHECK_HEADERS(poll.h)
169 dnl Check for nfds_t - used by poll()
170 AC_MSG_CHECKING(for nfds_t)
172 #include <sys/types.h>
181 AC_DEFINE(nfds_t, unsigned long int, [Define to `unsigned long int' if <poll.h> does not define.])
185 dnl Check for some time functions
186 AC_CHECK_FUNCS(strftime localtime gmtime_r gmtime_s)
188 dnl Check for working mmap
190 AC_CHECK_FUNCS(munmap msync)
192 dnl Check for select() and poll()
193 AC_CHECK_FUNCS(select poll)
195 dnl ************************************
196 dnl Checks for gtk-doc and docbook-tools
197 dnl ************************************
201 AC_PATH_PROGS([DB2HTML], [db2html docbook2html])
202 AM_CONDITIONAL(HAVE_DOCBOOK, [test -n "$DB2HTML"])
204 dnl NOTE: We need to use a separate automake conditional for this
205 dnl to make this work with the tarballs.
206 AM_CONDITIONAL(ENABLE_GTK_DOC, test "x$enable_gtk_doc" = "xyes")
208 dnl Check for profiling options
209 AC_ARG_ENABLE([profiling],
210 AC_HELP_STRING([--enable-profiling],
211 [enable profiling compile flags [[default=no]]]),,
212 [enable_profiling="no"])
213 if test "x$enable_profiling" = "xyes"; then
214 # CFLAGS="-O0 -g -pg -fprofile-arcs -ftest-coverage"
218 dnl Enable warning spewage on the console
219 AC_ARG_ENABLE([warnings],
220 AC_HELP_STRING([--enable-warnings],
221 [enable g_warning output when invalid MIME is encountered [[default=no]]]),,
222 [enable_warnings="no"])
223 if test "x$enable_warnings" = "xyes"; then
224 AC_DEFINE(ENABLE_WARNINGS, 1, [Define if GMime should enable warning output.])
227 dnl Enable stricter MIME parsing rules
228 AC_ARG_ENABLE(strict-parser,
229 AC_HELP_STRING([--enable-strict-parser],
230 [enable stricter MIME parser rules [[default=no]]]),,
231 [enable_strict_parser="no"])
232 if test "x$enable_strict_parser" = "xyes"; then
233 AC_DEFINE(STRICT_PARSER, 1, [Define if GMime should enable stricter parsing rules.])
236 dnl Disable cryptography support
237 AC_ARG_ENABLE(cryptography,
238 AC_HELP_STRING([--enable-cryptography],
239 [enable cryptography support [[default=yes]]]),,
240 [enable_cryptography="yes"])
241 AM_CONDITIONAL(ENABLE_CRYPTOGRAPHY, test "x$enable_cryptography" = "xyes")
242 if test "x$enable_cryptography" = "xyes"; then
243 AC_DEFINE(ENABLE_CRYPTOGRAPHY, 1, [Define if cryptography in GMime is enabled.])
247 dnl We need at *least* glib 2.16.0 for GIO and 2.18.0 for g_set_error_literal
248 AM_PATH_GLIB_2_0(2.18.0, ,
249 AC_MSG_ERROR(Cannot find GLIB: Is pkg-config in your path?),
250 gobject gmodule gthread gio)
252 dnl *****************************
253 dnl *** Checks for zlib ***
254 dnl *****************************
255 AC_CHECK_HEADERS(zlib.h)
256 AC_CHECK_LIB(z, inflate, ZLIB="-lz")
258 dnl Check for libiconv
261 CFLAGS_save="$CFLAGS"
262 CFLAGS="$CFLAGS -I$srcdir"
264 LIBS="$LIBS $LIBICONV"
266 AC_CACHE_CHECK([preferred charset formats for system iconv], [ac_cv_have_iconv_detect_h], [
267 AC_RUN_IFELSE([AC_LANG_SOURCE([
269 #include "iconv-detect.c"
271 [ac_cv_have_iconv_detect_h=yes], [ac_cv_have_iconv_detect_h=no],
273 AC_MSG_RESULT([cannot run test program while cross compiling])
274 AC_MSG_ERROR([Copy target system's iconv-detect.h to . and configure with ac_cv_have_iconv_detect_h=yes])
277 if test "x$ac_cv_have_iconv_detect_h" = xyes; then
278 AC_MSG_RESULT([found])
279 AC_DEFINE(HAVE_ICONV_DETECT_H, 1, [Define to 1 to use auto-detected iconv-friendly charset names.])
281 AC_MSG_RESULT([not found
282 *** The iconv-detect program was unable to determine the
283 *** preferred charset formats recognized by your system
284 *** iconv library. It is suggested that you install a
285 *** working iconv library such as the one found at
286 *** ftp://ftp.gnu.org/pub/gnu/libiconv
288 *** Default charset formats will be used.
292 CFLAGS="$CFLAGS_save"
295 dnl Check for GNU getopt
296 AC_CHECK_HEADER(getopt.h)
297 AC_MSG_CHECKING(for GNU getopt_long)
304 return getopt_long (0, NULL, NULL, NULL, NULL);
308 AC_DEFINE(HAVE_GETOPT_H, 1, [Define to 1 if you have the <getopt.h> header with the GNU `getopt_long' function.])
314 AM_CONDITIONAL(SYSTEM_GETOPT, test "x$have_getopt" = "xyes")
316 dnl Check for fsync (native win32 doesn't have this)
317 AC_MSG_CHECKING(for fsync)
325 AC_DEFINE(HAVE_FSYNC, 1, [Define to 1 if you have the `fsync' function.])
330 dnl Check for MAXHOSTNAMELEN
331 AC_MSG_CHECKING(for MAXHOSTNAMELEN)
333 #include <sys/param.h>
335 return MAXHOSTNAMELEN;
340 AC_DEFINE(MAXHOSTNAMELEN, 64, [Define with a value if your <sys/param.h> does not define MAXHOSTNAMELEN])
341 AC_MSG_RESULT(no; defined as 64)
344 dnl Check for domainname member in struct utsname from uname(2)
345 AC_MSG_CHECKING(for domainname in struct utsname)
348 #include <sys/utsname.h>
352 unam.domainname[0] = '\0';
354 return unam.domainname[0];
357 AC_DEFINE(HAVE_UTSNAME_DOMAINNAME, 1, [Define if struct utsname has a domainname member])
363 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
370 ], ac_cv_struct_tm_gmtoff="yes", ac_cv_struct_tm_gmtoff="no"))
371 if test "$ac_cv_struct_tm_gmtoff" = "yes"; then
372 AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff member])
374 AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
379 ], ac_cv_var_timezone="yes", ac_cv_var_timezone="no"))
380 if test "$ac_cv_var_timezone" = "yes"; then
381 AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable])
382 AC_CACHE_CHECK(for altzone variable, ac_cv_var_altzone,
387 ], ac_cv_var_altzone="yes", ac_cv_var_altzone="no"))
388 if test "$ac_cv_var_altzone" = "yes"; then
389 AC_DEFINE(HAVE_ALTZONE, 1, [Define if libc defines an altzone variable])
392 AC_CACHE_CHECK(for _timezone variable, ac_cv_var__timezone,
397 ], ac_cv_var__timezone="yes", ac_cv_var__timezone="no"))
398 if test "$ac_cv_var__timezone" = "yes"; then
399 AC_DEFINE(HAVE__TIMEZONE, 1, [Define if libc defines a _timezone variable])
401 AC_ERROR(unable to find a way to determine timezone)
406 dnl *************************************
407 dnl *** Checks for large file support ***
408 dnl *************************************
409 AC_ARG_ENABLE([largefile],
410 AC_HELP_STRING([--enable-largefile],
411 [enable support for large files [[default=yes]]]),,
412 [enable_largefile="yes"])
413 if test "x$enable_largefile" != "xno"; then
415 AC_CACHE_CHECK([for _LARGEFILE64_SOURCE value needed for large files], ac_cv_largefile64_source,
418 #include <sys/types.h>
419 #include <sys/stat.h>
422 return open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);
424 ac_cv_largefile64_source="no"
427 #define _LARGEFILE64_SOURCE
428 #include <sys/types.h>
429 #include <sys/stat.h>
432 return open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);
434 ac_cv_largefile64_source="yes"
436 ac_cv_largefile64_source="unknown"
441 enable_largefile="no"
443 if test "x$ac_cv_largefile64_source" = "xyes"; then
444 LFS_CFLAGS="-D_LARGEFILE64_SOURCE"
445 enable_largefile="yes"
446 elif test "x$ac_cv_largefile64_source" = "xunknown"; then
447 AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
450 if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then
451 LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
452 enable_largefile="yes"
455 if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
456 LFS_CFLAGS="$LFS_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
457 enable_largefile="yes"
462 AM_CONDITIONAL(ENABLE_LARGEFILE, test "x$enable_largefile" = "xyes")
465 CFLAGS_save="$CFLAGS"
466 CFLAGS="$CFLAGS $LFS_CFLAGS"
467 AC_CHECK_SIZEOF(ssize_t)
468 AC_CHECK_SIZEOF(size_t)
469 AC_CHECK_SIZEOF(off_t)
470 CFLAGS="$CFLAGS_save"
472 dnl Check for some network functions
473 AC_CHECK_FUNCS(gethostname getdomainname getaddrinfo)
475 dnl ****************************
476 dnl *** Checks for libsocket ***
477 dnl ****************************
479 AC_CHECK_LIB(socket, getaddrinfo, LIBSOCKET="-lsocket")
481 dnl *************************
482 dnl *** Checks for libnsl ***
483 dnl *************************
485 AC_CHECK_LIB(nsl, getaddrinfo, LIBNSL="-lnsl")
487 dnl ******************************************
488 dnl *** Checks for GpgME needed for S/MIME ***
489 dnl ******************************************
490 AC_ARG_ENABLE([smime],
491 AC_HELP_STRING([--enable-smime],
492 [enable S/MIME support [[default=no]]]),,
495 if test "x$enable_cryptography" != "xyes"; then
499 if test "x$enable_smime" = "xyes"; then
500 AM_PATH_GPGME_PTHREAD(1.1.6, enable_smime="yes (via GpgME)", enable_smime="no")
501 if test "x$enable_smime" != "xno"; then
502 AC_DEFINE(ENABLE_SMIME, 1, [Define if GMime should enable experimental S/MIME support.])
506 dnl ****************************
507 dnl *** Enable Mono bindings ***
508 dnl ****************************
509 AC_ARG_ENABLE([mono],
510 AC_HELP_STRING([--enable-mono],
511 [enable Mono bindings [[default=auto]]]),,
512 [enable_mono="auto"])
513 if test "x$enable_mono" != "xno"; then
514 AC_PATH_PROG(CSC, mcs, no)
515 # if we found mcs, make sure it's mono and not something else named
516 # mcs, such as Tru64's /usr/bin/mcs, for manipulating object file
517 # comment sections of eCOFF object files.
518 if test "x$CSC" != "xno"; then
519 AC_MSG_CHECKING([whether $CSC is GNU Mono])
520 $CSC --version > /dev/null 2>&1
521 if test $? -ne 0; then
532 if test "x$CSC" = "xno"; then
533 dnl error out if the user has explicitly requested mono bindings
534 if test "x$enable_mono" = "xyes"; then
535 AC_MSG_ERROR([Could not find mcs])
539 AM_CONDITIONAL(ENABLE_MONO, false)
542 AM_CONDITIONAL(ENABLE_MONO, true)
545 if test "x$enable_mono" = "xyes"; then
546 AC_PATH_PROG(GACUTIL, gacutil, no)
547 if test "x$GACUTIL" = "xno"; then
548 AC_MSG_ERROR([Your mono installation doesn't expose gacutil])
554 PKG_CHECK_MODULES(GLIB_SHARP, glib-sharp-2.0 >= 2.4.0)
555 AC_SUBST(GLIB_SHARP_LIBS)
557 PKG_CHECK_MODULES(GAPI_TOOLS, gapi-2.0)
558 AC_PATH_PROG(GAPI_CODEGEN, gapi2-codegen, no)
559 if test "x$GAPI_CODEGEN" = "xno"; then
560 AC_MSG_ERROR([You need to install gtk-sharp2-gapi])
563 AC_PATH_PROG(GAPI_FIXUP, gapi2-fixup, no)
564 if test "x$GAPI_FIXUP" = "xno"; then
565 AC_MSG_ERROR([You need to install gtk-sharp2-gapi])
568 AC_PATH_PROG(GAPI_PARSER, gapi2-parser, no)
569 if test "x$GAPI_PARSER" = "xno"; then
570 AC_MSG_ERROR([You need to install gtk-sharp2-gapi])
573 dnl The version should be along the lines of
574 dnl "<major>.<minor>.0.<interface count>", where major and minor are
575 dnl the current major and minor gmime versions, and interface count is
576 dnl incremented any time the mono API changes, which should really
577 dnl only happen within development series.
578 MONO_INTERFACE_VERSION=0
579 API_VERSION="$GMIME_MAJOR_VERSION.$GMIME_MINOR_VERSION.0.$MONO_INTERFACE_VERSION"
580 AC_SUBST(API_VERSION)
583 AC_ARG_WITH([gacdir], AC_HELP_STRING([--with-gacdir], [Specify the Global Assembly Cache root directory]),
584 [[with_gacdir=$withval]],
585 [[with_gacdir=\${prefix}/lib]])
591 if test "x$LIBSOCKET" != "x"; then
592 EXTRA_LIBS="$EXTRA_LIBS $LIBSOCKET"
594 if test "x$LIBNSL" != "x"; then
595 EXTRA_LIBS="$EXTRA_LIBS $LIBNSL"
597 if test "x$LIBICONV" != "x"; then
598 EXTRA_LIBS="$EXTRA_LIBS $LIBICONV"
600 if test "x$GPGME_PTHREAD_LIBS" != "x"; then
601 EXTRA_LIBS="$EXTRA_LIBS $GPGME_PTHREAD_LIBS"
604 CFLAGS="$CFLAGS -fno-strict-aliasing"
605 LIBS="$LIBS $EXTRA_LIBS"
610 GMIME_CFLAGS="$LFS_CFLAGS $GPGME_PTHREAD_CFLAGS"
611 GMIME_LIBDIR="-L${libdir}"
612 GMIME_INCLUDEDIR="-I${includedir}/gmime-$GMIME_API_VERSION"
613 GMIME_LIBS_PRIVATE="$EXTRA_LIBS"
614 GMIME_LIBS="-lgmime-$GMIME_API_VERSION"
616 AC_SUBST(GMIME_LIBDIR)
617 AC_SUBST(GMIME_INCLUDEDIR)
618 AC_SUBST(GMIME_LIBS_PRIVATE)
619 AC_SUBST(GMIME_CFLAGS)
627 build/vs2008/Makefile
628 build/vs2008/config-win32.h
629 build/vs2010/Makefile
630 build/vs2010/config-win32.h
632 docs/reference/Makefile
633 docs/tutorial/Makefile
636 gmime/gmime-version.h
639 mono/gmime-sharp.dll.config
650 Source code location: ${srcdir}
651 Install prefix: ${prefix}
654 Profiling enabled: ${enable_profiling}
656 Large file support: ${enable_largefile}
657 Console warnings: ${enable_warnings}
658 PGP/MIME support: ${enable_cryptography}
659 S/MIME support: ${enable_smime}
660 Strict parser: ${enable_strict_parser}
662 Mono bindings: ${enable_mono}