dnl -*- mode: m4 -*- AC_PREREQ(2.52) AC_INIT(src/balsa-app.h) dnl ########################################################################### dnl Versioning dnl ########################################################################### SCROLLKEEPER_REQUIRED=0.1.4 BALSA_MAJOR=2 BALSA_REVISION=2 BALSA_PATCHLEVEL=2 BALSA_VERSION="$BALSA_MAJOR.$BALSA_REVISION.${BALSA_PATCHLEVEL}" AC_SUBST(BALSA_MAJOR) AC_SUBST(BALSA_REVISION) AC_SUBST(BALSA_PATCHLEVEL) AC_SUBST(BALSA_VERSION) AM_INIT_AUTOMAKE(balsa, "$BALSA_MAJOR.$BALSA_REVISION.${BALSA_PATCHLEVEL}") AC_CONFIG_SRCDIR(src/main.c) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE AC_ISC_POSIX AC_PROG_CC AC_STDC_HEADERS AM_PROG_LIBTOOL AC_CHECK_FUNCS(getaddrinfo getnameinfo gai_strerror) AC_DEFINE_UNQUOTED(BALSA_MAJOR, $BALSA_MAJOR, [Define to the Balsa major version]) AC_DEFINE_UNQUOTED(BALSA_REVISION, $BALSA_REVISION, [Define to the Balsa revision]) AC_DEFINE_UNQUOTED(BALSA_PATCHLEVEL, $BALSA_PATCHLEVEL, [Define to the Balsa patch level]) AC_DEFINE_UNQUOTED(BALSA_VERSION, "$BALSA_VERSION", [Define to the Balsa version]) dnl ########################################################################### dnl Use the new GNOME2 pkgconfig to check required modules dnl ########################################################################### PKG_CHECK_MODULES(BALSA, [ glib-2.0 libgnome-2.0 libgnomeui-2.0 gtk+-2.0 >= 2.0 gnome-vfs-2.0 gnome-vfs-module-2.0 $gnome_extras gmime-2.0 >= 2.1.7 libbonobo-2.0 ]) AC_SUBST(BALSA_CFLAGS) AC_SUBST(BALSA_LIBS) AC_SUBST(PTHREAD_LIB) if $PKG_CONFIG --exists libgnomeprint-2.2 ; then PKG_CHECK_MODULES(LGPRINT, [ libgnomeprint-2.2 >= 2.1.4 libgnomeprintui-2.2 >= 2.1.4 ]) AC_DEFINE(HAVE_LGPRINT22,1,[If defined, build using libgnomeprint-2.2 specific API]) else PKG_CHECK_MODULES(LGPRINT, [ libgnomeprint-2.0 >= 1.106.0 libgnomeprintui-2.0 >= 1.106.0 ]) fi BALSA_CFLAGS="$BALSA_CFLAGS $LGPRINT_CFLAGS" BALSA_LIBS="$BALSA_LIBS $LGPRINT_LIBS" dnl ########################################################################## dnl Check for GtkHTML if available dnl ########################################################################## AC_MSG_CHECKING(whether to use GtkHTML) AC_ARG_ENABLE([gtkhtml], AC_HELP_STRING([--enable-gtkhtml], [Use GtkHTML if available (default=yes)]),[ use_gtkhtml=$enableval ],[ use_gtkhtml=yes ]) AC_MSG_RESULT($use_gtkhtml) if test x"$use_gtkhtml" = xyes ; then if $PKG_CONFIG --exists libgtkhtml-3.1 ; then PKG_CHECK_MODULES(HTML, [ libgtkhtml-3.1 ]) AC_DEFINE(HAVE_GTKHTML3,1,[Defined when GtkHtml-3 can be used.]) AC_DEFINE(HAVE_GTKHTML,1,[Defined when GtkHtml can be used.]) elif $PKG_CONFIG --exists libgtkhtml-3.0 ; then PKG_CHECK_MODULES(HTML, [ libgtkhtml-3.0 ]) AC_DEFINE(HAVE_GTKHTML3,1,[Defined when GtkHtml-3 can be used.]) AC_DEFINE(HAVE_GTKHTML,1,[Defined when GtkHtml can be used.]) elif $PKG_CONFIG --exists libgtkhtml-2.0 ; then PKG_CHECK_MODULES(HTML, [ libgtkhtml-2.0 ]) AC_DEFINE(HAVE_GTKHTML2,1,[Defined when GtkHtml-2 can be used.]) AC_DEFINE(HAVE_GTKHTML,1,[Defined when GtkHtml can be used.]) fi BALSA_CFLAGS="$BALSA_CFLAGS $HTML_CFLAGS" BALSA_LIBS="$BALSA_LIBS $HTML_LIBS" fi dnl ########################################################################### dnl Check for documentation requirements dnl ########################################################################### AC_SUBST(SCROLLKEEPER_REQUIRED) AC_PATH_PROG(SCROLLKEEPER_CONFIG, scrollkeeper-config,no) if test x$SCROLLKEEPER_CONFIG = xno; then AC_MSG_ERROR(Couldn't find scrollkeeper-config, please install the scrollkeeper package) fi dnl ########################################################################### dnl stuff for the CORBA interface dnl ########################################################################### ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`" AC_SUBST(ORBIT_IDL) LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`" AC_SUBST(LIBBONOBO_IDL) BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`" AC_SUBST(BONOBO_ACTIVATION_IDL) dnl ########################################################################### dnl Configure locking dnl ########################################################################### AC_ARG_ENABLE(flock, AC_HELP_STRING([--enable-flock], [Do NOT use flock() to lock files (default=no)]), [if test x$enableval = xno; then balsa_cv_flock=no; fi]) if test x$balsa_cv_flock = xyes; then AC_DEFINE(USE_FLOCK,1,[Define if flock locking should be used.]) fi balsa_cv_fcntl=yes AC_ARG_ENABLE(fcntl, AC_HELP_STRING([--disable-fcntl], [Use fcntl() to lock files (default=yes)]), [if test x$enableval = no; then balsa_cv_fcntl=no; fi]) if test x$balsa_cv_fcntl = xyes; then AC_DEFINE(USE_FCNTL,1,[Define if fcntl locking should be used.]) fi dnl ########################################################################### dnl Spell check detection. dnl ########################################################################### AC_CHECK_LIB(aspell, new_aspell_speller,,[ AC_CHECK_LIB(pspell, new_pspell_manager,,[ AC_MSG_ERROR([*** Neither aspell >=0.50 (recommended) nor pspell (deprecated) library was found. Please check http://balsa.gnome.org for information on the required files. Alternatively, check config.log for clues.]) ], -lstdc++ -lpspell-modules) ], -lstdc++) AC_CHECK_HEADER(pspell/pspell.h,, AC_MSG_ERROR([** aspell/pspell library found but not related header files. This probably means corresponding aspell-devel package is not installed ])) dnl ########################################################################### dnl All the linguas, all the time. dnl ########################################################################### ALL_LINGUAS="am az bg ca cs da de en_CA en_GB el es et fi fr ga he hi hr hu it ja ko lt lv ml ms nl no nn pl pt pt_BR ro ru sk sl sq sr sr@Latn sv tr uk vi wa zh_CN zh_TW" GETTEXT_PACKAGE=balsa AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The gettext package name.]) AC_PROG_INTLTOOL AM_GLIB_GNU_GETTEXT dnl ########################################################################### dnl More checks dnl ########################################################################### dnl these may be used later. dnl AC_CHECK_LIB(des, des_encrypt) dnl AC_CHECK_LIB(krb, krb_sendauth) dnl AC_CHECK_LIB(acap, acap_OpenConnection) AC_MSG_CHECKING([for isblank]) AC_TRY_LINK( [#include ], [return isblank('a');], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) AC_DEFINE(isblank,isspace, [Redefined to isspace if isblank is not available.])] ) dnl ########################################################################### dnl Use threading? dnl ########################################################################### AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads], [Use threading for mail retrieval (default=yes)]),[ use_threads=$enableval ],[ use_threads=yes ]) if test x"$use_threads" = xyes; then AC_DEFINE(BALSA_USE_THREADS, 1, [Defined when balsa is to use threads.]) fi dnl ########################################################################## dnl Check for GPGME if available dnl (we don't use the std macro AM_PATH_GPGME here to avoid dependencies...) dnl ########################################################################## AC_MSG_CHECKING(whether to build with gpgme/GnuPG support) AC_ARG_WITH([gpgme], AC_HELP_STRING([--with-gpgme=[gpgme-config]], [build with experimental gpgme/GnuPG support (default=no)]), [ gpgmecfg=$withval ], [ gpgmecfg=no ]) AC_ARG_ENABLE([smime], AC_HELP_STRING([--enable-smime], [include S/MIME support (needs gpgme and gpgsm, experimental) (default=no)]), [ have_smime=$withval ], [ have_smime=no ]) if test x"$gpgmecfg" = xyes ; then AC_PATH_PROG(gpgmecfg, gpgme-config, no) fi if test x"$gpgmecfg" != xno ; then AC_MSG_CHECKING([gpgme library version]) gpgmever=`$gpgmecfg --version` AC_MSG_RESULT($gpgmever) gpgme_ve=`echo $gpgmever|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gpgme_ma=`echo $gpgmever|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gpgme_mi=`echo $gpgmever|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test $gpgme_ve -eq 0 ; then if test $gpgme_ma -lt 9 ; then gpgmecfg=no fi fi if test x"$gpgmecfg" != xno ; then AC_DEFINE(HAVE_GPGME,1,[Defined when gpgme is available.]) AC_MSG_WARN(gmime has serios bugs in the treatment of RFC 3156 messages) BALSA_CFLAGS="$BALSA_CFLAGS `$gpgmecfg --cflags`" if test x"$use_threads" = xyes; then BALSA_LIBS="$BALSA_LIBS `$gpgmecfg --thread=pthread --libs`" else BALSA_LIBS="$BALSA_LIBS `$gpgmecfg --libs`" fi gpgmecfg=yes AC_PATH_PROG(gpg_path, gpg) if test x"$gpg_path" != "x" ; then AC_DEFINE(HAVE_GPG,1,[Defined when gpg is available.]) AC_DEFINE_UNQUOTED(GPG_PATH,["$gpg_path"],[Path of gpg.]) fi AC_MSG_CHECKING(whether to include experimental S/MIME support) if test x"$have_smime" = xyes ; then dnl if test $gpgme_ve -eq 0 -a $gpgme_ma -eq 4 -a $gpgme_mi -eq 3 ; then dnl AC_MSG_WARN(S/MIME support may fail with gpgme 0.4.3) dnl AC_MSG_WARN(you should upgrade to gpgme 0.4.4 or newer) dnl fi dnl AC_MSG_RESULT([yes]) dnl AC_DEFINE(HAVE_SMIME,1,[Defined when supporting S/MIME]) AC_MSG_WARN(S/MIME support is not yet available with gmime) else AC_MSG_RESULT([no]) fi else AC_MSG_WARN([sorry, you need at least gpgme version 0.9.0]) fi else AC_MSG_RESULT(no) fi AM_CONDITIONAL([BUILD_WITH_GPGME], [test $gpgmecfg = "yes"]) dnl ########################################################################### dnl Remember our prefixes dnl The way prefix et al are defined makes us jump through some hoops. dnl ########################################################################### if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi dnl datadir='${prefix}/share', so we must eval it or something. This works BALSA_STD_PREFIX=`eval "echo ${prefix}"` BALSA_DATA_PREFIX=`eval "echo ${datadir}/balsa"` dnl Consolidate them! AC_PROG_AWK BALSA_COMMON_PREFIXES=`sort<= 2.8 ]) AC_DEFINE(HAVE_SQLITE,1,[If defined, enable GPE address book support.]) BALSA_CFLAGS="$BALSA_CFLAGS $SQLITE_CFLAGS" BALSA_LIBS="$BALSA_LIBS $SQLITE_LIBS" else AC_MSG_RESULT([no]) fi dnl ########################################################################## dnl Have ESMTP ? dnl ########################################################################## AC_ARG_WITH(esmtp, AC_HELP_STRING([--with-esmtp=DIR], [Enable libESMTP (default=yes)]),[ with_esmtp=$withval ],[ with_esmtp=yes ]) AC_MSG_CHECKING([whether to build ESMTP support]) if test "x$with_esmtp" != xno ; then AC_MSG_RESULT([yes]) test "$with_esmtp" != yes && LIBS="$LIBS -L$with_esmtp/lib" AC_CHECK_LIB(esmtp, smtp_start_session, LIBS="$LIBS -lesmtp -lpthread", AC_MSG_ERROR([*** You enabled ESMTP but esmtp library is not found.]), -lpthread) AC_CHECK_LIB(esmtp, smtp_option_require_all_recipients, AC_DEFINE(ENABLE_ESMTP, 1, [Defined when ESTMP support is to be enabled.]), AC_MSG_ERROR([*** You enabled ESMTP but esmtp library doesn't support 'require_all_recipients'. Please get a Balsa aware libESMTP from http://balsa.gnome.org/main.html or compile libESMTP with './configure --enable-require-all-recipients'.])) AC_CHECK_LIB(esmtp, smtp_starttls_set_password_cb, AC_DEFINE(HAVE_SMTP_TLS_CLIENT_CERTIFICATE,1, [Defined when libESMTP has TLS support.])) test "$with_esmtp" != yes && CPPFLAGS="$CPPFLAGS -I$with_esmtp/include" LIBS="$LIBS -lesmtp" else AC_MSG_RESULT([no]) fi dnl ########################################################################## dnl Look for sendmail program dnl ########################################################################## AC_PATH_PROG(SENDMAIL, sendmail, no, $PATH:/usr/sbin:/usr/lib) AC_DEFINE_UNQUOTED(SENDMAIL, "$ac_cv_path_SENDMAIL", [Path to sendmail program.]) dnl ########################################################################## dnl Enable SASL? dnl ########################################################################## dnl AC_ARG_WITH(sasl, [ --with-sasl Use Cyrus SASL library for POP/IMAP authentication [default=no]],[ dnl with_sasl=$withval dnl ],[ dnl with_sasl=no dnl ]) dnl dnl AC_MSG_CHECKING([whether to build SASL support]) dnl if test "x$with_sasl" != xno ; then dnl AC_MSG_RESULT([yes]) dnl AC_CHECK_LIB(sasl, sasl_client_init,,AC_MSG_ERROR([could not find libsasl]),) dnl LIBS="$LIBS -lsasl" dnl AC_DEFINE(USE_SASL) dnl need_sasl=yes dnl need_md5=no dnl else dnl need_sasl=no dnl AC_MSG_RESULT([no]) dnl fi dnl AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes) dnl ############################################################# dnl Some systems have extra libiconv replacing iconv functions from dnl libc. Use this library if requested. dnl ############################################################# AC_ARG_WITH(iconv, AC_HELP_STRING([--with-iconv=DIR], [Where libiconv is installed]), [if test "$with_iconv" != yes -a "$with_iconv" != no ; then CPPFLAGS="-I${with_iconv}/include $CPPFLAGS" LDFLAGS="-L${with_iconv}/lib $LDFLAGS" fi]) AC_CHECK_LIB(iconv, iconv_open, , [ AC_CHECK_FUNC(iconv_open, , [ AC_MSG_ERROR([*** You need iconv for balsa.]) ]) ]) dnl ########################################################################## dnl Check for PCRE if available dnl ########################################################################## AC_ARG_ENABLE([pcre], AC_HELP_STRING([--enable-pcre], [Use Perl-compatible regular expressions if available (default=yes)]),[ check_pcre=$enableval],[ check_pcre=yes ]) AC_MSG_CHECKING(whether to use PCRE) if test x"$check_pcre" = xyes ; then if pcre-config --libs-posix > /dev/null 2>&1; then vers=`pcre-config --version` case $vers in 2.*) have_pcre=no ;; *) have_pcre=yes ;; esac else have_pcre=no fi if test x"$have_pcre" = xyes ; then AC_MSG_RESULT(yes) BALSA_CFLAGS="$BALSA_CFLAGS `pcre-config --cflags-posix`" PCRE_LIBS="`pcre-config --libs-posix`" AC_SUBST(PCRE_LIBS) BALSA_LIBS="$BALSA_LIBS $PCRE_LIBS" AC_DEFINE(HAVE_PCRE,1, [Defined when PCRE library is available.]) else AC_MSG_RESULT(not found) fi else have_pcre=no AC_MSG_RESULT(no) fi dnl ########################################################################## dnl Enable SSL? dnl ########################################################################## AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl], [Enable SSL (default=no)]),[ with_ssl=$withval ],[ with_ssl=no ]) AC_MSG_CHECKING([whether to build SSL support]) if test "x$with_ssl" != xno ; then # openssl >=0.9.7 is pkg-config compatible. if pkg-config openssl >/dev/null 2>&1; then BALSA_LIBS="$BALSA_LIBS `pkg-config --libs openssl`" BALSA_CFLAGS="`pkg-config --cflags-only-I openssl` $BALSA_CFLAGS" AC_MSG_RESULT(yes) AC_DEFINE(USE_SSL,1,[Defined when SSL support is to be compiled.]) AC_DEFINE(USE_TLS,USE_SSL,[Defined when TLS is to be enabled.]) else if test -d $with_ssl && test -f "$with_ssl/include/openssl/ssl.h" ; then ssldir=$with_ssl else AC_TRY_COMPILE([#include ], , ssldir=default, ssldir="") if test "x$ssldir" = x ; then for prefixdir in /usr /usr/local /usr/lib /usr/pkg /var /opt; do for dir in $prefixdir $prefixdir/openssl $prefixdir/ssl; do if test -f "$dir/include/openssl/ssl.h"; then ssldir=$dir fi done done fi fi if test -z "$ssldir"; then AC_MSG_ERROR([SSL requested but no SSL headers found.]) else AC_MSG_RESULT(yes) BALSA_LIBS="$BALSA_LIBS -lssl -lcrypto" if test "x$ssldir" != xdefault ; then BALSA_CFLAGS="-I${ssldir}/include $BALSA_CFLAGS" fi ac_cv_path_openssl=$ssldir AC_DEFINE(USE_SSL,1,[Defined when SSL support is to be compiled.]) AC_DEFINE(USE_TLS,USE_SSL,[Defined when TLS is to be enabled.]) fi fi else AC_MSG_RESULT(no) fi dnl ########################################################################## dnl Enable GSS? dnl ########################################################################## AC_ARG_WITH(gss, AC_HELP_STRING([--with-gss], [Enable GSS (default=no)]), [with_gss=$withval],[with_gss=no]) if test "x$with_gss" != xno ; then AC_PATH_PROG(KRB5_CONFIG, krb5-config,no) if test "x$KRB5_CONFIG" != xno ; then AC_DEFINE(HAVE_GSSAPI,1,[Defined when GSSAPI support is to be compiled.]) BALSA_CFLAGS="$BALSA_CFLAGS `$KRB5_CONFIG --cflags gssapi`" BALSA_LIBS="$BALSA_LIBS `$KRB5_CONFIG --libs gssapi`" else AC_MSG_ERROR([GSS requested but krb5-config not found. Install krb5-devel]) fi fi dnl ########################################################################## dnl Enable touchscreen optimized UI? dnl ########################################################################## AC_ARG_ENABLE(touch-ui, AC_HELP_STRING([--enable-touch-ui], [Enable Touchscreen UI mode (default=no)]), [AC_DEFINE(ENABLE_TOUCH_UI,1,[Defined when touchscreen optimized UI is to be enabled.])]) dnl ########################################################################## dnl Check versions dnl ########################################################################## if $PKG_CONFIG --atleast-version=2.2.0 glib-2.0 ; then AC_DEFINE(HAVE_GLIB22,1,[Defined when glib version is at least 2.2.0]) fi dnl ########################################################################### dnl turn warnings into errors to enforce clean code dnl ########################################################################### AC_ARG_ENABLE(more-warnings, AC_HELP_STRING([--enable-more-warnings], [Enable maximum compiler warnings (default=yes)]), set_more_warnings="$enableval", set_more_warnings=yes) if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then for option in -Wsign-compare -Wpointer-arith -Wnested-externs -Wchar-subscripts -Wuninitialized -Wmissing-prototypes -Wreturn-type; do SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $option" AC_MSG_CHECKING([whether gcc understands $option]) AC_TRY_COMPILE([], [], has_option=yes, has_option=no,) if test $has_option = no; then CFLAGS="$SAVE_CFLAGS" fi AC_MSG_RESULT($has_option) unset has_option unset SAVE_CFLAGS done unset option fi dnl ########################################################################### dnl Check for CVS nature, for warnings + extra program checks dnl have it at the end so configure tests do not die on warnings. dnl ########################################################################### if test -d "${srcdir}/CVS" ; then BALSA_FROM_CVS=yes BALSA_CFLAGS="$BALSA_CFLAGS -Wall -Werror" else BALSA_FROM_CVS=no fi AC_MSG_CHECKING([for CVS information]) AC_MSG_RESULT($BALSA_FROM_CVS) dnl ########################################################################### dnl Retrieve the command to generate marshallers from marshallers list files dnl ########################################################################### AC_SUBST(GLIB_GENMARSHAL) GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0` dnl ########################################################################## dnl Create files. dnl ########################################################################## AC_OUTPUT([ Makefile balsa.1 balsa.spec po/Makefile.in sounds/Makefile images/Makefile doc/Makefile doc/C/Makefile libbalsa/Makefile libbalsa/imap/Makefile libinit_balsa/Makefile src/Makefile ]) dnl ########################################################################## dnl Summary dnl ########################################################################## echo "" echo "================ Final configuration ===================" echo " Installing into prefix: $prefix" echo " Using multithreading: $use_threads" echo " Enable compile warnings: $set_more_warnings" echo " Use ESMTP : $with_esmtp" echo " Use GtkHTML: $use_gtkhtml" echo " Use GPGME: $gpgmecfg" echo " Use LDAP: $with_ldap" echo " Use GSS: $with_gss" echo " Use SSL: $with_ssl" dnl echo " Use SASL: $need_sasl" echo "" if test x"$BALSA_FROM_CVS" = xyes ; then echo "============================== NOTICE ================================" echo " You are using Balsa from CVS source." echo " The program is likely to be unstable, contain incomplete features," echo "or just plain not work. Use it at your own risk. You have been warned." echo "======================================================================" echo "" fi