dnl Process this file with autoconf to produce a configure script. AC_INIT(configure.in) AM_CONFIG_HEADER(config.h) # In the following, there are a the following variants # of GLib cflags and libs variables # # GLIB_CFLAGS: cflags for compiling libraries and example progs # GLIB_LIBS: libraries for linking example programs # glib_cflags: cflags to store in gmime-config # glib_libs: libs to store in gmime-config GMIME_MAJOR_VERSION=2 GMIME_MINOR_VERSION=2 GMIME_MICRO_VERSION=27 GMIME_VERSION=$GMIME_MAJOR_VERSION.$GMIME_MINOR_VERSION.$GMIME_MICRO_VERSION GMIME_VERSION_INFO=`expr $GMIME_MAJOR_VERSION + $GMIME_MINOR_VERSION`:$GMIME_MICRO_VERSION:$GMIME_MINOR_VERSION AC_SUBST(GMIME_MAJOR_VERSION) AC_SUBST(GMIME_MINOR_VERSION) AC_SUBST(GMIME_MICRO_VERSION) AC_SUBST(GMIME_VERSION) AC_SUBST(GMIME_VERSION_INFO) VERSION=$GMIME_VERSION AM_INIT_AUTOMAKE(gmime, $VERSION) AC_CANONICAL_HOST dnl Check for win32 platforms AC_MSG_CHECKING([if building for Win32]) case "$host" in *-*-mingw*) platform_win32="yes" native_win32="yes" ;; *-*-cygwin*) platform_win32="yes" native_win32="no" ;; *) platform_win32="no" native_win32="no" ;; esac AC_MSG_RESULT($platform_win32) AM_CONDITIONAL(PLATFORM_WIN32, test "x$platform_win32" = "xyes") AM_CONDITIONAL(OS_WIN32, test "$native_win32" = "xyes") if test "$glib_native_win32" = "yes"; then if test "X$enable_static" = "xyes" -o "x$enable_static" = "x"; then AC_MSG_WARN([Disabling static library build, must build as DLL on Windows]) enable_static="no" fi if test "x$enable_shared" = "xno"; then AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows]) enable_shared="yes" fi fi dnl Checks for programs. AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_STDC AC_C_INLINE dnl AC_HEADER_STDC AC_STDC_HEADERS dnl AC_ARG_PROGRAM AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PATH_PROG(RM, rm, /bin/rm) AC_PATH_PROG(MV, mv, /bin/mv) AC_PATH_PROG(TAR, tar, /bin/tar) AC_EXEEXT AC_PROG_LIBTOOL AM_MAINTAINER_MODE dnl Checks for header files. AC_CHECK_HEADERS(sys/mman.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(string.h) AC_CHECK_HEADERS(stdlib.h) AC_CHECK_HEADERS(netdb.h) AC_CHECK_HEADERS(ctype.h) AC_CHECK_HEADERS(time.h) AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T dnl Check for nfds_t - used by poll() AC_MSG_CHECKING(for nfds_t) AC_TRY_COMPILE([ #include #include ], [ nfds_t nfds = 1; ] , AC_MSG_RESULT(yes) , AC_DEFINE(nfds_t, unsigned int, [Define to `unsigned int' if does not define.]) AC_MSG_RESULT(no) ) dnl Check for some time functions AC_CHECK_FUNCS(strftime localtime gmtime_r) dnl Check for working mmap AC_FUNC_MMAP AC_CHECK_FUNCS(munmap msync) dnl ************************************ dnl Checks for gtk-doc and docbook-tools dnl ************************************ GTK_DOC_CHECK([1.8]) AC_CHECK_PROG(DB2HTML, db2html, true, false) AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML) dnl NOTE: We need to use a separate automake conditional for this dnl to make this work with the tarballs. AM_CONDITIONAL(ENABLE_GTK_DOC, test "x$enable_gtk_doc" = "xyes") dnl Check for profiling options AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling],[enable profiling compile flags [[default=no]]]),, enable_profiling=no) if test "x$enable_profiling" = "xyes"; then # CFLAGS="-O0 -g -pg -fprofile-arcs -ftest-coverage" CFLAGS="-O0 -g -pg" fi dnl Enable warning spewage on the console AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings], [enable g_warning output when invalid MIME is encountered [[default=no]]]),, enable_warnings=no) if test "x$enable_warnings" = "xyes"; then AC_DEFINE(ENABLE_WARNINGS, 1, [Define if GMime should enable warning output.]) fi dnl We need at *least* glib 2.0.0 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(Cannot find GLIB: Is pkg-config in your path?), gobject gmodule gthread) glib_cflags="$GLIB_CFLAGS" glib_libs="$GLIB_LIBS" AC_SUBST(glib_cflags) AC_SUBST(glib_libs) dnl ***************************** dnl *** Checks for zlib *** dnl ***************************** AC_CHECK_HEADERS(zlib.h) AC_CHECK_LIB(z, inflate, ZLIB="-lz") dnl Check for libiconv AM_ICONV() CFLAGS_save="$CFLAGS" CFLAGS="$CFLAGS -I$srcdir" LIBS_save="$LIBS" LIBS="$LIBS $LIBICONV" AC_CACHE_CHECK([preferred charset formats for system iconv], [ac_cv_have_iconv_detect_h], [ AC_RUN_IFELSE([AC_LANG_SOURCE([ #define CONFIGURE_IN #include "iconv-detect.c" ])], [ac_cv_have_iconv_detect_h=yes], [ac_cv_have_iconv_detect_h=no], [ AC_MSG_RESULT([cannot run test program while cross compiling]) AC_MSG_ERROR([Copy target system's iconv-detect.h to . and configure with ac_cv_have_iconv_detect_h=yes]) ]) ]) if test "x$ac_cv_have_iconv_detect_h" = xyes; then AC_MSG_RESULT([found]) AC_DEFINE(HAVE_ICONV_DETECT_H, 1, [Define to 1 to use auto-detected iconv-friendly charset names.]) else AC_MSG_RESULT([not found *** The iconv-detect program was unable to determine the *** preferred charset formats recognized by your system *** iconv library. It is suggested that you install a *** working iconv library such as the one found at *** ftp://ftp.gnu.org/pub/gnu/libiconv *** *** Default charset formats will be used. ]) fi CFLAGS="$CFLAGS_save" LIBS="$LIBS_save" dnl Check for regex AC_CHECK_HEADER(regex.h, have_regex="yes") AM_CONDITIONAL(HAVE_REGEX, test "x$have_regex" = "xyes") dnl Check for GNU getopt AC_CHECK_HEADER(getopt.h) AC_MSG_CHECKING(for GNU getopt_long) AC_TRY_LINK([ #include #include #define _GNU_SOURCE #include ], [ return getopt_long (0, NULL, NULL, NULL, NULL); ] , AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_GETOPT_H, 1, [Define to 1 if you have the header with the GNU `getopt_long' function.]) have_getopt="yes" , AC_MSG_RESULT([no]) have_getopt="no" ) AM_CONDITIONAL(SYSTEM_GETOPT, test "x$have_getopt" = "xyes") dnl Check for fsync (native win32 doesn't have this) AC_MSG_CHECKING(for fsync) AC_TRY_LINK([ #include ], [ fsync(0); ] , AC_MSG_RESULT(yes) AC_DEFINE(HAVE_FSYNC, 1, [Define to 1 if you have the `fsync' function.]) , AC_MSG_RESULT(no) ) dnl Check if we should work around broken rfc2047 encodings AC_ARG_ENABLE(rfc2047-workarounds, AC_HELP_STRING([--enable-rfc2047-workarounds], [enable workarounds for broken rfc2047 encodings [[default=no]]]),, enable_rfc2047_workarounds=no) if test "x$enable_rfc2047_workarounds" = "xyes"; then AC_DEFINE(ENABLE_RFC2047_WORKAROUNDS, 1, [Define if GMime should enable workarounds for broken rfc2047 encodings.]) fi dnl Check for MAXHOSTNAMELEN AC_MSG_CHECKING(for MAXHOSTNAMELEN) AC_TRY_COMPILE([ #include ], [ return MAXHOSTNAMELEN; ] , AC_MSG_RESULT(yes) , AC_DEFINE(MAXHOSTNAMELEN, 64, [Define with a value if your does not define MAXHOSTNAMELEN]) AC_MSG_RESULT(no; defined as 64) ) dnl Check for domainname member in struct utsname from uname(2) AC_MSG_CHECKING(for domainname in struct utsname) AC_TRY_COMPILE([ #define _GNU_SOURCE #include ], [ struct utsname unam; unam.domainname[0] = '\0'; ], AC_MSG_RESULT(yes) AC_DEFINE(HAVE_UTSNAME_DOMAINNAME, 1, [Define if struct utsname has a domainname member]) , AC_MSG_RESULT(no) ) dnl Timezone checks AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff, AC_TRY_COMPILE([ #include ], [ struct tm tm; tm.tm_gmtoff = 1; ], ac_cv_struct_tm_gmtoff="yes", ac_cv_struct_tm_gmtoff="no")) if test "$ac_cv_struct_tm_gmtoff" = "yes"; then AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff member]) else AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone, AC_TRY_COMPILE([ #include ], [ timezone = 1; ], ac_cv_var_timezone="yes", ac_cv_var_timezone="no")) if test "$ac_cv_var_timezone" = "yes"; then AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable]) AC_CACHE_CHECK(for altzone variable, ac_cv_var_altzone, AC_TRY_COMPILE([ #include ], [ altzone = 1; ], ac_cv_var_altzone="yes", ac_cv_var_altzone="no")) if test "$ac_cv_var_altzone" = "yes"; then AC_DEFINE(HAVE_ALTZONE, 1, [Define if libc defines an altzone variable]) fi else AC_CACHE_CHECK(for _timezone variable, ac_cv_var__timezone, AC_TRY_COMPILE([ #include ], [ _timezone = 1; ], ac_cv_var__timezone="yes", ac_cv_var__timezone="no")) if test "$ac_cv_var__timezone" = "yes"; then AC_DEFINE(HAVE__TIMEZONE, 1, [Define if libc defines a _timezone variable]) else AC_ERROR(unable to find a way to determine timezone) fi fi fi dnl ************************************* dnl *** Checks for large file support *** dnl ************************************* AC_ARG_ENABLE(largefile, AC_HELP_STRING([--enable-largefile], [enable support for large files [[default=no]]]),, enable_largefile="no") if test "x$enable_largefile" != "xno"; then AC_SYS_LARGEFILE AC_CACHE_CHECK([for _LARGEFILE64_SOURCE value needed for large files], largefile64_source, [ AC_TRY_COMPILE([ #include #include #include ],[ int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644); ],[ largefile64_source="no" ],[ AC_TRY_COMPILE([ #define _LARGEFILE64_SOURCE #include #include #include ],[ int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644); ],[ largefile64_source="yes" ],[ largefile64_source="unknown" ]) ]) ]) enable_largefile="no" if test "x$largefile64_source" = "xyes"; then GMIME_CFLAGS="-D_LARGEFILE64_SOURCE" enable_largefile="yes" elif test "x$largefile64_source" = "xunknown"; then AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag]) fi if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then GMIME_CFLAGS="$GMIME_CFLAGS -D_LARGE_FILES" enable_largefile="yes" fi if test "x$ac_cv_sys_file_offset_bits" != "xno"; then GMIME_CFLAGS="$GMIME_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" enable_largefile="yes" fi else GMIME_CFLAGS="" fi AM_CONDITIONAL(ENABLE_LARGEFILE, test "x$enable_largefile" = "xyes") dnl Check type sizes CFLAGS_save="$CFLAGS" CFLAGS="$CFLAGS $GMIME_CFLAGS" AC_CHECK_SIZEOF(ssize_t) AC_CHECK_SIZEOF(size_t) AC_CHECK_SIZEOF(off_t) CFLAGS="$CFLAGS_save" dnl convenience printf formatting macros for ssize_t/size_t/off_t if test $ac_cv_sizeof_size_t -eq 8; then AC_DEFINE(SSIZE_T, "%lld", [Define to the `ssize_t' printf formatter.]) AC_DEFINE(SIZE_T, "%llu", [Define to the `size_t' printf formatter.]) else AC_DEFINE(SSIZE_T, "%ld", [Define to the `ssize_t' printf formatter.]) AC_DEFINE(SIZE_T, "%lu", [Define to the `size_t' printf formatter.]) fi if test $ac_cv_sizeof_off_t -eq 8; then AC_DEFINE(OFF_T, "%lld", [Define to the `off_t' printf formatter.]) else AC_DEFINE(OFF_T, "%ld", [Define to the `off_t' printf formatter.]) fi dnl Check for some network functions AC_CHECK_FUNCS(gethostname getdomainname getaddrinfo) dnl **************************** dnl *** Checks for libsocket *** dnl **************************** LIBSOCKET="" AC_CHECK_LIB(socket, getaddrinfo, LIBSOCKET="-lsocket -lnsl") dnl ************************* dnl *** Checks for libnsl *** dnl ************************* LIBNSL="" AC_CHECK_LIB(nsl, getaddrinfo, LIBNSL="-lnsl") dnl **************************** dnl *** Enable Mono bindings *** dnl **************************** AC_ARG_ENABLE(mono, AC_HELP_STRING([--enable-mono], [enable Mono bindings [[default=auto]]]),, enable_mono="auto") if test ! "x$enable_mono" = "xno"; then AC_PATH_PROG(CSC, mcs, no) # if we found mcs, make sure it's mono and not something else named # mcs, such as Tru64's /usr/bin/mcs, for manipulating object file # comment sections of eCOFF object files. if test "x$CSC" != "xno"; then AC_MSG_CHECKING([whether $CSC is GNU Mono]) $CSC --version > /dev/null 2>&1 if test $? -ne 0; then CSC=no AC_MSG_RESULT([no]) else AC_MSG_RESULT([yes]) fi fi else CSC="no" fi if test "x$CSC" = "xno"; then dnl error out if the user has explicitly requested mono bindings if test "x$enable_mono" = "xyes"; then AC_MSG_ERROR([Could not find mcs]) fi enable_mono="no" AM_CONDITIONAL(ENABLE_MONO, false) else enable_mono="yes" AM_CONDITIONAL(ENABLE_MONO, true) fi if test "x$enable_mono" = "xyes"; then AC_PATH_PROG(GACUTIL, gacutil, no) if test "x$GACUTIL" = "xno"; then AC_MSG_ERROR([Your mono installation doesn't expose gacutil]) fi AC_SUBST(CSC) AC_SUBST(GACUTIL) PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0 >= 2.4.0) AC_SUBST(GTK_SHARP_LIBS) AC_PATH_PROG(GAPI_CODEGEN, gapi2-codegen, no) if test "x$GAPI_CODEGEN" = "xno"; then AC_MSG_ERROR([You need to install gtk-sharp2-gapi]) fi AC_PATH_PROG(GAPI_FIXUP, gapi2-fixup, no) if test "x$GAPI_FIXUP" = "xno"; then AC_MSG_ERROR([You need to install gtk-sharp2-gapi]) fi dnl The version should be along the lines of dnl "..0.", where major and minor are dnl the current major and minor gmime versions, and interface count is dnl incremented any time the mono API changes, which should really dnl only happen within development series. MONO_INTERFACE_VERSION=0 API_VERSION="$GMIME_MAJOR_VERSION.$GMIME_MINOR_VERSION.0.$MONO_INTERFACE_VERSION" AC_SUBST(API_VERSION) fi dnl Extra libs EXTRA_LIBS="$ZLIB" if test "x$LIBSOCKET" != "x"; then EXTRA_LIBS="$EXTRA_LIBS $LIBSOCKET" fi if test "x$LIBNSL" != "x"; then EXTRA_LIBS="$EXTRA_LIBS $LIBNSL" fi if test "x$LIBICONV" != "x"; then EXTRA_LIBS="$EXTRA_LIBS $LIBICONV" fi CFLAGS="$CFLAGS -fno-strict-aliasing" AC_SUBST(CFLAGS) LIBS="$LIBS $EXTRA_LIBS" AC_SUBST(LIBS) GMIME_LIBDIR="-L${libdir}" GMIME_INCLUDEDIR="-I${includedir}/gmime-2.0" GMIME_LIBS="-lgmime-2.0 $EXTRA_LIBS" AC_SUBST(GMIME_LIBS) AC_SUBST(GMIME_LIBDIR) AC_SUBST(GMIME_INCLUDEDIR) AC_SUBST(GMIME_CFLAGS) AC_OUTPUT( Makefile docs/Makefile docs/reference/Makefile docs/tutorial/Makefile examples/Makefile util/Makefile gmime/Makefile mono/Makefile mono/AssemblyInfo.cs mono/gmime-sharp.dll.config mono/gmime-sharp.pc src/Makefile tests/Makefile gmime-config gmime-2.0.pc gmime.spec ) echo " Configuration: Source code location: ${srcdir} Install prefix: ${prefix} Compiler: ${CC} Profiling enabled: ${enable_profiling} Large file support: ${enable_largefile} rfc2047 workarounds: ${enable_rfc2047_workarounds} Console warnings: ${enable_warnings} Mono bindings: ${enable_mono} " if test "$enable_largefile" = "yes"; then echo " WARNING: You have elected to enable large file support (>2GB). This may break API/ABI compatability with previous installations of GMime which could cause applications using GMime on your system to break in mysterious ways. It is not recommended that you enable this feature unless you really know what you are doing. " fi