simplify build system
[apps/madmutt.git] / configure.ac
index 2f71dfd..65260ca 100644 (file)
@@ -95,35 +95,27 @@ ac_aux_path_sendmail=/usr/sbin:/usr/lib
 AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$ac_aux_path_sendmail)
 AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL",[ Where to find sendmail on your system. ])
 
-
 OPS='$(srcdir)/OPS'
 
 dnl ---------------- gpgme ----------------
 
-    AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--enable-gpgme], [Enable GPGME support]),
-    [   if test x$enableval = xyes; then
-            have_gpgme=yes
-        fi
-    ])
-    if test x$have_gpgme = xyes; then
+AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--enable-gpgme], [Enable GPGME support]),[
+    if test x$enableval = xyes; then
         AM_PATH_GPGME(,,[AC_MSG_ERROR(GPGME not found)])
         MUTTLIBS="$MUTTLIBS $GPGME_LIBS"
         MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS crypt-gpgme.o crypt-mod-pgp-gpgme.o crypt-mod-smime-gpgme.o"
         AC_DEFINE(CRYPT_BACKEND_GPGME, 1, [Defined, if GPGME support is enabled])
     fi
+])
 
 dnl ---------------- mixmaster ----------------
 
-    AC_ARG_WITH(mixmaster, AC_HELP_STRING([--with-mixmaster[=PATH]], [Include Mixmaster support]),
-    [  if test -x "$withval" ; then
-            MIXMASTER="$withval"
-        else
-            MIXMASTER="mixmaster"
-        fi
-        OPS="$OPS \$(srcdir)/OPS.MIX"
-        MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS remailer.o"
-        AC_DEFINE_UNQUOTED(MIXMASTER,"$MIXMASTER", [ Where to find mixmaster on your system. ])
-    ])
+AC_ARG_WITH(mixmaster, AC_HELP_STRING([--with-mixmaster[=PATH]], [Include Mixmaster support]), [
+    MIXMASTER=${withval:-"mixmaster"}
+    OPS="$OPS \$(srcdir)/OPS.MIX"
+    MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS remailer.o"
+    AC_DEFINE_UNQUOTED(MIXMASTER,"$MIXMASTER",[Where to find mixmaster on your system.])
+])
 
 # We now require all OPS
 OPS="$OPS \$(srcdir)/OPS.PGP \$(srcdir)/OPS.SMIME \$(srcdir)/OPS.CRYPT "
@@ -131,7 +123,7 @@ AC_SUBST([OPS])
 
 AC_PATH_PROG(ISPELL, ispell, no)
 if test $ISPELL != no; then
-    AC_DEFINE_UNQUOTED(ISPELL,"$ISPELL",[ Where to find ispell on your system. ])
+    AC_DEFINE_UNQUOTED(ISPELL,"$ISPELL",[Where to find ispell on your system.])
 fi
 
 AC_ARG_WITH(slang, AC_HELP_STRING([--with-slang[=DIR]], [Use S-Lang instead of ncurses]),
@@ -473,72 +465,57 @@ AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl[=PFX]], [Compile in SSL support for
         fi
 ])
 
-AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls[=PFX]], [Enable SSL support using gnutls]),
-    [gnutls_prefix="$withval"], [gnutls_prefix="no"])
-if test "$gnutls_prefix" != "no"
-then
-  if test x"$need_ssl" = x"yes"
-  then
-    AC_MSG_ERROR([Only either OpenSSL or GNUTLS may be used])
-  fi
-  MUTT_AM_PATH_GNUTLS([$gnutls_prefix],
-    [dnl GNUTLS found
-    CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
-    MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS"
-    AC_DEFINE(USE_GNUTLS, 1, [Define if you want support for SSL via the gnutls library.])
-
-    MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
-    need_ssl=yes],
-    [dnl GNUTLS not found
-      AC_MSG_ERROR([could not find libgnutls])
+AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls], [Enable SSL support using gnutls]),
+            [gnutls_prefix="$withval"], [gnutls_prefix="no"])
+if test "$gnutls_prefix" != "no"; then
+    if test x"$need_ssl" = x"yes"; then
+        AC_MSG_ERROR([Only either OpenSSL or GNUTLS may be used])
+    fi
+    AM_PATH_LIBGNUTLS(,[
+        CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
+        MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS"
+        AC_DEFINE(USE_GNUTLS, 1, [Define if you want support for SSL via the gnutls library.])
+        MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o"
+        need_ssl=yes],
+        [AC_MSG_ERROR([could not find libgnutls])
     ])
 fi
-
 AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes)
 
 AC_ARG_WITH(sasl2, AC_HELP_STRING([--with-sasl2[=PFX]],
-            [Use Cyrus SASL library version 2 for POP/IMAP authentication]),
-        [
-        if test "$with_sasl2" != "no"
-        then
-          if test "$with_sasl2" != "yes"
-          then
+            [Use Cyrus SASL library version 2 for POP/IMAP authentication]),[
+    if test "$with_sasl2" != "no"; then
+        if test "$with_sasl2" != "yes"; then
             CPPFLAGS="$CPPFLAGS -I$with_sasl2/include"
             LDFLAGS="$LDFLAGS -L$with_sasl2/lib"
-          fi
+        fi
 
-          saved_LIBS="$LIBS"
+        saved_LIBS="$LIBS"
 
-          AC_CHECK_LIB(sasl2, sasl_client_init,,
-            AC_MSG_ERROR([could not find libsasl2]),)
+        AC_CHECK_LIB(sasl2, sasl_client_init,,
+                     AC_MSG_ERROR([could not find libsasl2]),)
 
-          MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_sasl.o"
-          MUTTLIBS="$MUTTLIBS -lsasl2"
-          LIBS="$saved_LIBS"
-          AC_DEFINE(USE_SASL,1,
-                  [ Define if want to use version 2 of the Cyrus SASL library. ])
-          need_sasl=yes
-        fi
-        ])
+        MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_sasl.o"
+        MUTTLIBS="$MUTTLIBS -lsasl2"
+        LIBS="$saved_LIBS"
+        AC_DEFINE(USE_SASL,1,
+                  [Define if want to use version 2 of the Cyrus SASL library.])
+        need_sasl=yes
+    fi
+])
 AM_CONDITIONAL(USE_SASL, test x$need_sasl = xyes)
 
-AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn=[PFX]], [Use GNU libidn for domain names]),
-                [
-                 if test "$with_idn" != "no" ; then
-                       if test "$with_idn" != "yes" ; then
-                          CPPFLAGS="$CPPFLAGS -I$with_idn/include"
-                          LDFLAGS="$LDFLAGS -L$with_idn/lib"
-                       fi
-                 fi
-                ]
-)
-
-if test "x$with_idn" != "xno"; then
-    AC_CHECK_LIB(idn, stringprep_check_version)
-    AC_CHECK_FUNCS(idna_to_unicode_utf8_from_utf8 idna_to_unicode_8z8z)
-    AC_CHECK_FUNCS(idna_to_ascii_from_utf8 idna_to_ascii_8z)
-    AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
-fi
+AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn=[PFX]], [Use GNU libidn for domain names]),[
+    if test x$with_idn != xno ; then
+        PKG_CHECK_MODULES(IDN,libidn,[
+            if $PKG_CONFIG --atleast-version=0.6; then
+                AC_MSG_ERROR([libidn is too old, want 0.6 at least])
+            fi
+            CPPFLAGS="$CPPFLAGS $IDN_CFLAGS"
+            LDFLAGS="$LDFLAGS $IDN_LIBS"
+        ],[AC_MSG_ERROR([could not find libidn])])
+    fi
+])
 
 dnl -- end socket --