]> diplodocus.org Git - nmh/blobdiff - configure.ac
Note curl dependencies for Linux and FreeBSD.
[nmh] / configure.ac
index 0e7d604f65f87c959908b2cdb971baee1b07b263..507e4eae92802cc7403b849876ae5b12f4087b95 100644 (file)
@@ -40,6 +40,15 @@ AS_IF([test x"$with_cyrus_sasl" != x -a x"$with_cyrus_sasl" != x"no"],[
            AC_MSG_WARN([Please pass the appropriate arguments to CPPFLAGS/LDFLAGS])])
       sasl_support=yes], [sasl_support=no])
 
+dnl Do you want client-side support for using OAuth2 for SMTP authentication?
+AC_ARG_WITH([oauth], AS_HELP_STRING([--with-oauth],
+  [Enable OAuth2 support in SMTP auth]))
+AS_IF([test x"$with_oauth" != x -a x"$with_oauth" != x"no"],[
+      AC_DEFINE([OAUTH_SUPPORT], [1],
+               [Support OAuth2 in SMTP auth.])dnl
+      OAUTH_SUPPORT=1; oauth_support=yes], [OAUTH_SUPPORT=0; oauth_support=no])
+AC_SUBST(OAUTH_SUPPORT)
+
 dnl Do you want client-side support for encryption with TLS?
 AC_ARG_WITH([tls], AS_HELP_STRING([--with-tls], [Enable TLS support]))
 AS_IF([test x"$with_tls" != x"no"],[
@@ -74,10 +83,12 @@ AS_IF([test -n "$with_smtpservers"], [smtpservers="$with_smtpservers"],
       [smtpservers="localhost"])
 AC_SUBST([smtpservers])dnl
 
-dnl ----------------------------------------------------
-dnl Default location is /usr/local/nmh/{bin,etc,lib,man}
-dnl ----------------------------------------------------
+dnl -------------------------------------------------------------------
+dnl Default location is /usr/local/nmh/{bin,etc,libexec,man}, unless we
+dnl find an existing installation, in which case we use its location.
+dnl -------------------------------------------------------------------
 AC_PREFIX_DEFAULT([/usr/local/nmh])
+AC_PREFIX_PROGRAM([mhparam])
 
 dnl ------------------
 dnl CHECK THE COMPILER
@@ -153,13 +164,18 @@ dnl FreeBSD needs a bit of magic to bring getline() into scope.
 dnl We do this here rather than in (say) h/mh.h because this macro must
 dnl be defined before <stdio.h> is pulled in.
 dnl
-dnl And while we're here, add the ports tree to the cpp and ld search
-dnl paths.
+dnl And while we're here, add the packages tree to the cpp and ld search
+dnl paths.  Note that FreeBSD's pkg(8) seems to be hardwired to use /usr/local.
+dnl If /usr/ports is installed, we use its idea of where things are installed,
+dnl otherwise we assume /usr/local.
+
 AS_IF([test `uname` = FreeBSD],
        [CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-D_WITH_GETLINE"
-        nmh_cv_freebsd_portsdir=`echo '.include <bsd.port.mk>' | make -f /dev/stdin -V PREFIX`
-        CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-I$nmh_cv_freebsd_portsdir/include"
-        LDFLAGS="${LDFLAGS:+$LDFLAGS }-L$nmh_cv_freebsd_portsdir/lib"
+        nmh_cv_freebsd_localbase=`echo '.include <bsd.port.mk>' \
+               | make -k -f /dev/stdin -V LOCALBASE 2>/dev/null | sed 1q`
+        test -z "$nmh_cv_freebsd_localbase" && nmh_cv_freebsd_localbase=/usr/local
+        CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-I$nmh_cv_freebsd_localbase/include"
+        LDFLAGS="${LDFLAGS:+$LDFLAGS }-L$nmh_cv_freebsd_localbase/lib"
 ])
 
 dnl --------------
@@ -494,6 +510,22 @@ AS_IF([test x"$tls_support" = x"yes"],[
   [TLSLIB=])
 AC_SUBST([TLSLIB])
 
+dnl -----------------
+dnl CHECK FOR CURL
+dnl -----------------
+AS_IF([test x"$OAUTH_SUPPORT" = x"1"],[
+  AC_PATH_PROG([curl_config], [curl-config])
+  AC_CHECK_HEADER([curl/curl.h], [], [AC_MSG_ERROR([curl/curl.h not found])])
+  AC_CHECK_LIB([curl], [curl_easy_init], [CURLLIB="`$curl_config --libs`"],
+    [AC_MSG_ERROR([curl library not found])],[$CURLLIB])
+  CURL_USER_AGENT=`$curl_config --version | sed 's| |/|'`
+  ],
+  [CURLLIB=
+   CURL_USER_AGENT=
+])
+AC_SUBST([CURLLIB])
+AC_SUBST([CURL_USER_AGENT])
+
 dnl ----------------
 dnl CHECK FLEX FIXUP
 dnl ----------------
@@ -558,7 +590,7 @@ dnl the final summary and should use them nowhere else (see the autoconf
 dnl docs for the rationale for bindir etc being unexpanded).
 eval "nmhbin=${bindir}";         eval "nmhbin=${nmhbin}"
 eval "nmhsysconf=${sysconfdir}"; eval "nmhsysconf=${nmhsysconf}"
-eval "nmhlib=${libdir}";         eval "nmhlib=${nmhlib}"
+eval "nmhlibexec=${libexecdir}"; eval "nmhlibexec=${nmhlibexec}"
 eval "nmhman=${mandir}";         eval "nmhman=${nmhman}"
 eval "nmhrpm=${nmhrpm}";
 
@@ -573,8 +605,8 @@ linker flags               : ${LDFLAGS}
 preprocessor flags         : ${CPPFLAGS}
 source code location       : ${srcdir}
 binary install path        : ${nmhbin}
-library install path       : ${nmhlib}
-config files install path  : ${nmhsysconf}
+libexec install path       : ${nmhlibexec}/nmh
+config files install path  : ${nmhsysconf}/nmh
 man page install path      : ${nmhman}
 RPM build root             : ${nmhrpm}
 backup prefix              : ${backup_prefix}
@@ -583,6 +615,7 @@ spool default locking type : ${with_locking}
 default smtp servers       : ${smtpservers}
 SASL support               : ${sasl_support}
 TLS support                : ${tls_support}
+OAuth support              : ${oauth_support}
 ])])dnl
 
 dnl ---------------