dnl Process this file with autoconf to produce a configure script. AC_INIT(gmime.h.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=1 GMIME_MINOR_VERSION=0 GMIME_MICRO_VERSION=8 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 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ]) dnl Checks for programs. AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_STDC dnl AC_HEADER_STDC AC_STDC_HEADERS 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) AM_PROG_LIBTOOL AM_MAINTAINER_MODE LDFLAGS=${_ldflags} dnl Checks for header files. AC_CHECK_HEADERS(sys/mman.h) AC_CHECK_HEADERS(string.h) AC_CHECK_HEADERS(stdlib.h) AC_CHECK_HEADERS(ctype.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(alloca.h) AC_CHECK_TYPE(off_t, long) AC_CHECK_TYPE(size_t, unsigned int) AC_CHECK_TYPE(ssize_t, int) AC_CHECK_FUNCS(isblank strftime localtime alloca mmap munmap msync) AC_CHECK_FUNCS(memchr memrchr memmem strlen strcpy strncpy strlcpy stpcpy strcat strncat strlcat strchr strrchr strnstr strstr strncasestr strcasestr strncasecmp strcasecmp) dnl Specific dir for HTML output ? if test "x$with_html_dir" = "x" ; then HTML_DIR='${datadir}/gtk-doc/html' else HTML_DIR=$with_html_dir fi AC_SUBST(HTML_DIR) dnl ****************************** dnl gtk-doc dnl ****************************** AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false) AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC) AC_SUBST(HAVE_GTK_DOC) dnl Let people disable the gtk-doc stuff. AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto) if test x$enable_gtk_doc = xauto ; then if test x$GTKDOC = xtrue ; then enable_gtk_doc=yes else enable_gtk_doc=no fi fi 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 gprof action AC_ARG_ENABLE(gprof, [ --enable-gprof Enable gprof profiling compile flags [default=no]], enable_gprof="$enableval", enable_gprof=no) if test x$enable_gprof = xyes; then CFLAGS="$CFLAGS -pg" fi dnl Turn on a bunch of warnings AC_ARG_ENABLE(warnings, [ --enable-warnings Enable a bunch of compile warning options], enable_warnings="$enableval", enable_warnings=no) if test x$enable_warnings = xyes; then CFLAGS="$CFLAGS -Werror -Wcast-align -Wmissing-prototypes -Wreturn-type -Wuninitialized -Wconversion" fi dnl We need at *least* glib 1.2.0 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(Cannot find GLIB: Is glib-config in path?)) glib_cflags="$GLIB_CFLAGS" glib_libs="$GLIB_LIBS" AC_SUBST(glib_cflags) AC_SUBST(glib_libs) dnl Check for libiconv AM_ICONV() CFLAGS_save="$CFLAGS" CFLAGS="$CFLAGS -I$srcdir" LIBS_save="$LDFLAGS" LIBS="$LDFLAGS $LIBICONV" AC_MSG_CHECKING(preferred charset formats for system iconv) AC_TRY_RUN([ #define CONFIGURE_IN #include "iconv-detect.c" ],[ AC_MSG_RESULT(found) AC_DEFINE(HAVE_ICONV_DETECT_H) ],[ AC_MSG_RESULT(not found) AC_ERROR([ *** 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 ]) ]) CFLAGS="$CFLAGS_save" LIBS="$LIBS_save" dnl * Time zone stuff 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) else 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) else AC_ERROR(unable to find a way to determine timezone) fi fi dnl Extra libs if test "x$LIBICONV" != "x"; then LIBS="$LIBS $LIBICONV" fi AC_SUBST(CFLAGS) AC_SUBST(LIBS) GMIME_CFLAGS="" GMIME_LIBDIR="-L${libdir}" GMIME_INCLUDEDIR="-I${includedir}/gmime" GMIME_LIBS="-lgmime $LIBICONV" AC_SUBST(GMIME_CFLAGS) AC_SUBST(GMIME_LIBDIR) AC_SUBST(GMIME_LIBS) AC_SUBST(GMIME_INCLUDEDIR) AC_SUBST(HTML_DIR) AC_OUTPUT( Makefile tests/Makefile doc/Makefile gmime-config gmime.spec gmime.h ) echo " Configuration: Source code location: ${srcdir} Install prefix: ${prefix} Compiler: ${CC} Profiling enabled: ${enable_gprof} "