"Fossies" - the Fresh Open Source Software Archive

Member "msmtp-1.8.5/configure.ac" (12 Jul 2019, 12038 Bytes) of package /linux/privat/msmtp-1.8.5.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 1.8.4_vs_1.8.5.

    1 dnl configure.ac
    2 dnl Process this file with autoconf to produce a configure script.
    3 #
    4 # This file is part of msmtp, an SMTP client.
    5 #
    6 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
    7 # 2013, 2014, 2015, 2016, 2017, 2018, 2019
    8 # Christophe Nowicki
    9 # Martin Lambers <marlam@marlam.de>
   10 # Jay Soffian <jaysoffian@gmail.com> (Mac OS X keychain support)
   11 #
   12 #   This program is free software; you can redistribute it and/or modify
   13 #   it under the terms of the GNU General Public License as published by
   14 #   the Free Software Foundation; either version 3 of the License, or
   15 #   (at your option) any later version.
   16 #
   17 #   This program is distributed in the hope that it will be useful,
   18 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
   19 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   20 #   GNU General Public License for more details.
   21 #
   22 #   You should have received a copy of the GNU General Public License
   23 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
   24 #
   25 
   26 dnl Autotools init stuff
   27 AC_INIT([msmtp], [1.8.5], [marlam@marlam.de], [msmtp], [https://marlam.de/msmtp])
   28 AC_CONFIG_SRCDIR([src/msmtp.c])
   29 AC_CONFIG_AUX_DIR([build-aux])
   30 AC_CONFIG_HEADERS([config.h])
   31 AC_CANONICAL_TARGET
   32 AC_USE_SYSTEM_EXTENSIONS
   33 AC_SYS_LARGEFILE
   34 AM_INIT_AUTOMAKE([1.11.1 silent-rules no-texinfo.tex -Wall])
   35 AM_SILENT_RULES([yes])
   36 AC_PROG_CC
   37 AC_PROG_INSTALL
   38 AC_LANG([C])
   39 
   40 dnl System
   41 build_msmtpd_default="yes"
   42 AC_DEFINE_UNQUOTED([PLATFORM], ["${target}"], [Platform triplet])
   43 case "${target}" in *-*-mingw*) LIBS="$LIBS -lws2_32"; build_msmtpd_default="no" ;; esac
   44 
   45 dnl Gettext
   46 AM_GNU_GETTEXT([external])
   47 
   48 dnl Headers, functions, and types
   49 AC_CHECK_HEADERS([sysexits.h netdb.h arpa/inet.h sys/socket.h sys/wait.h netinet/in.h])
   50 AC_CHECK_FUNCS([fmemopen fseeko fseeko64 getpass link signal strndup syslog])
   51 AC_SEARCH_LIBS([nanosleep], [rt posix4])
   52 AC_SEARCH_LIBS([socket], [socket])
   53 AC_CHECK_SIZEOF([long long])
   54 
   55 dnl Unfortunately AC_SEARCH_LIBS([res_query], [resolv]) does not work because we
   56 dnl apparently need to include the appropriate header files, so we use a double
   57 dnl AC_TRY_LINK instead.
   58 AC_MSG_CHECKING([for library containing res_query])
   59 AC_TRY_LINK([
   60     #include <netinet/in.h>
   61     #include <arpa/nameser.h>
   62     #include <resolv.h>
   63     ], [res_query(0, 0, 0, 0, 0);],
   64     found_res_query=yes,
   65     found_res_query=no)
   66 if test "$found_res_query" = "yes"; then
   67     AC_MSG_RESULT([none required])
   68 else
   69     LIBS_BAK="$LIBS"
   70     LIBS="$LIBS -lresolv"
   71     AC_TRY_LINK([
   72         #include <netinet/in.h>
   73         #include <arpa/nameser.h>
   74         #include <resolv.h>
   75         ], [res_query(0, 0, 0, 0, 0);],
   76         found_res_query=yes,
   77         found_res_query=no)
   78     if test "$found_res_query" = "yes"; then
   79         AC_MSG_RESULT([-lresolv])
   80     else
   81         LIBS="$LIBS_BAK"
   82         AC_MSG_RESULT([none])
   83     fi
   84 fi
   85 if test "$found_res_query" = "yes"; then
   86     AC_DEFINE([HAVE_LIBRESOLV], [1], [Define to 1 if libresolv is available])
   87 fi
   88 
   89 dnl pkg-config (required to detect libraries)
   90 PKG_PROG_PKG_CONFIG([])
   91 if test -z "$PKG_CONFIG"; then
   92     AC_MSG_ERROR([pkg-config not found])
   93 fi
   94 
   95 dnl TLS
   96 have_tls="no"
   97 tls_lib="none"
   98 want_tls="yes"
   99 want_gnutls="yes"
  100 want_openssl="no"
  101 tls_CFLAGS=""
  102 tls_LIBS=""
  103 with_ssl_was_used=no
  104 AC_ARG_WITH([tls], [AS_HELP_STRING([--with-tls=[gnutls|openssl|no]],
  105     [TLS support: GnuTLS (default), OpenSSL (discouraged), or none.])],
  106     if test "$withval" = "gnutls"; then
  107 	want_tls=yes
  108 	want_gnutls=yes
  109 	want_openssl=no
  110     elif test "$withval" = "openssl"; then
  111 	want_tls=yes
  112 	want_gnutls=no
  113 	want_openssl=yes
  114     elif test "$withval" = "no"; then
  115 	want_tls=no
  116 	want_gnutls=no
  117 	want_openssl=no
  118     else
  119 	AC_MSG_ERROR([Use --with-tls=gnutls or --with-tls=openssl or --with-tls=no])
  120     fi)
  121 if test "$want_gnutls" = "yes"; then
  122     PKG_CHECK_MODULES([libgnutls], [gnutls >= 0.0], [HAVE_LIBGNUTLS=1], [HAVE_LIBGNUTLS=0])
  123     if test "$HAVE_LIBGNUTLS" != "1"; then
  124 	AC_MSG_WARN([library libgnutls not found:])
  125 	AC_MSG_WARN([$libgnutls_PKG_ERRORS])
  126 	AC_MSG_WARN([libgnutls is provided by GnuTLS])
  127     else
  128 	have_tls="yes"
  129 	tls_lib="GnuTLS"
  130 	tls_CFLAGS="$libgnutls_CFLAGS"
  131 	tls_LIBS="$libgnutls_LIBS"
  132 	AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if libgnutls is available])
  133     fi
  134 fi
  135 if test "$want_openssl" = "yes" -a "$have_tls" = "no"; then
  136     AC_MSG_WARN([Using OpenSSL is discouraged; consider using GnuTLS instead])
  137     PKG_CHECK_MODULES([libssl], [openssl >= 0.0], [HAVE_LIBSSL=1], [HAVE_LIBSSL=0])
  138     if test "$HAVE_LIBSSL" != "1"; then
  139 	AC_MSG_WARN([library libssl not found:])
  140 	AC_MSG_WARN([$libssl_PKG_ERRORS])
  141 	AC_MSG_WARN([libssl is provided by OpenSSL])
  142     else
  143 	have_tls="yes"
  144 	tls_lib="OpenSSL (discouraged)"
  145 	tls_CFLAGS="$libssl_CFLAGS"
  146 	tls_LIBS="$libssl_LIBS"
  147 	AC_DEFINE([HAVE_LIBSSL], [1], [Define to 1 if libssl is available])
  148     fi
  149 fi
  150 if test "$have_tls" = "yes"; then
  151     AC_DEFINE([HAVE_TLS], [1], [Define to 1 to build with TLS/SSL support])
  152 elif test "$want_tls" = "yes"; then
  153     AC_MSG_WARN([Disabling TLS support, which is very bad. Consider using GnuTLS!])
  154 fi
  155 AM_CONDITIONAL([HAVE_TLS], [test "$have_tls" = "yes"])
  156 AC_SUBST([tls_CFLAGS])
  157 AC_SUBST([tls_LIBS])
  158 
  159 dnl GNU SASL
  160 AC_ARG_WITH([libgsasl], [AS_HELP_STRING([--with-libgsasl],
  161 	[Use GNU SASL authentication library.])],
  162     [libgsasl=$withval], [libgsasl=no])
  163 if test "$libgsasl" != "no"; then
  164     PKG_CHECK_MODULES([libgsasl], [libgsasl >= 0.0], [HAVE_LIBGSASL=1], [HAVE_LIBGSASL=0])
  165     if test "$HAVE_LIBGSASL" != "1"; then
  166 	AC_MSG_WARN([library libgsasl not found:])
  167 	AC_MSG_WARN([$libgsasl_PKG_ERRORS])
  168 	AC_MSG_WARN([libgsasl is provided by GNU SASL])
  169 	libgsasl="no"
  170     else
  171 	libgsasl="yes"
  172 	AC_DEFINE([HAVE_LIBGSASL], [1], [Define to 1 if libgsasl is available])
  173     fi
  174 fi
  175 AM_CONDITIONAL([HAVE_LIBGSASL], [test "$libgsasl" = "yes"])
  176 
  177 dnl Check if getaddrinfo() has IDN support (and we want to use it)
  178 AC_ARG_ENABLE([gai-idn],
  179     [AS_HELP_STRING([--enable-gai-idn], [Use IDN support from getaddrinfo if available. Enabled by default.])],
  180     [if test "$enableval" = "yes"; then want_gai_idn="yes"; else want_gai_idn="no"; fi], [want_gai_idn="yes"])
  181 have_gai_idn=no
  182 if test "$want_gai_idn" = "yes"; then
  183     dnl TODO: in the future there may be getaddrinfo() implementations that
  184     dnl support IDN without requiring AI_IDN
  185     AC_CHECK_DECL([AI_IDN], [], [],
  186     [
  187      #include <sys/types.h>
  188      #include <sys/socket.h>
  189      #include <netdb.h>
  190     ])
  191     if test "$ac_cv_have_decl_AI_IDN" = "yes"; then
  192 	dnl AI_IDN is defined, now check if it is actually supported
  193 	dnl (glibc without libidn will return EAI_BADFLAGS)
  194         AC_MSG_CHECKING([whether getaddrinfo accepts AI_IDN])
  195 	AC_RUN_IFELSE(
  196             [AC_LANG_PROGRAM(
  197             [[
  198              #include <sys/types.h>
  199              #include <sys/socket.h>
  200 	     #include <netdb.h>
  201             ]],
  202             [[
  203              struct addrinfo hints;
  204              struct addrinfo *res;
  205              int r;
  206              hints.ai_flags = AI_IDN;
  207              hints.ai_family = PF_UNSPEC;
  208              hints.ai_socktype = SOCK_STREAM;
  209              hints.ai_protocol = 0;
  210              hints.ai_addrlen = 0;
  211              hints.ai_addr = 0;
  212              hints.ai_canonname = 0;
  213              hints.ai_next = 0;
  214              r = getaddrinfo("localhost", "1234", &hints, &res);
  215              freeaddrinfo(res);
  216              return (r == EAI_BADFLAGS ? 1 : 0);
  217 	    ]])],
  218             [have_gai_idn="yes"],
  219 	    [have_gai_idn="no"],
  220 	    [have_gai_idn="assuming yes"])
  221         AC_MSG_RESULT([$have_gai_idn])
  222         if test "$have_gai_idn" = "assuming yes"; then
  223             AC_MSG_NOTICE([if this assumption is wrong, use --disable-gai-idn])
  224             have_gai_idn="yes"
  225         fi
  226         if test "$have_gai_idn" = "yes"; then
  227             AC_DEFINE([HAVE_GAI_IDN], [1], [Define to 1 if getaddrinfo supports IDN])
  228         fi
  229     fi
  230 fi
  231 
  232 dnl Check if the TLS library has IDN support
  233 have_tls_idn=no
  234 if test "$tls_lib" = "GnuTLS"; then
  235     AC_MSG_CHECKING([whether GnuTLS has builtin IDN support])
  236     CFLAGS_BAK="$CFLAGS"
  237     CFLAGS="$CFLAGS $tls_CFLAGS"
  238     AC_COMPILE_IFELSE(
  239         [AC_LANG_PROGRAM([[
  240          #include <gnutls/gnutls.h>
  241          #if GNUTLS_VERSION_NUMBER < 0x030400
  242           error: GnuTLS does not have builtin IDN support
  243          #endif]],
  244         [[int x = 0;]])],
  245         [have_tls_idn="yes"], [])
  246     CFLAGS="$CFLAGS_BAK"
  247     AC_MSG_RESULT([$have_tls_idn])
  248 fi
  249 
  250 dnl Do we need libidn for IDN support?
  251 AC_MSG_CHECKING([whether libidn is needed for IDN support])
  252 want_libidn=no
  253 if test "$have_gai_idn" = "no"; then
  254     want_libidn=yes
  255 elif test "$have_tls" = "yes" -a "$have_tls_idn" = "no"; then
  256     want_libidn=yes
  257 fi
  258 AC_MSG_RESULT([$want_libidn])
  259 
  260 dnl GNU Libidn
  261 AC_ARG_WITH([libidn], [AS_HELP_STRING([--with-libidn],
  262 	[Support IDN (needs GNU Libidn)])],
  263     [libidn=$withval], [libidn=yes])
  264 if test "$want_libidn" = "no"; then
  265     libidn=no
  266 fi
  267 if test "$libidn" != "no"; then
  268     PKG_CHECK_MODULES([libidn2], [libidn2 >= 0.0], [HAVE_LIBIDN=1], [HAVE_LIBIDN=0])
  269     if test "$HAVE_LIBIDN" != "1"; then
  270 	AC_MSG_WARN([library libidn not found:])
  271 	AC_MSG_WARN([$libidn_PKG_ERRORS])
  272 	AC_MSG_WARN([libidn is provided by GNU Libidn])
  273 	libidn="no"
  274     else
  275 	libidn="yes"
  276 	AC_DEFINE([HAVE_LIBIDN], [1], [Define to 1 if libidn is available])
  277     fi
  278 fi
  279 
  280 dnl libsecret support (requires pkg-config).
  281 AC_ARG_WITH([libsecret], [AS_HELP_STRING([--with-libsecret],
  282 	[Support libsecret (GNOME password management)])],
  283     [libsecret=$withval],[libsecret=yes])
  284 if test "$libsecret" != "no"; then
  285     PKG_CHECK_MODULES([libsecret], [libsecret-1], [HAVE_LIBSECRET=1], [HAVE_LIBSECRET=0])
  286     if test "$HAVE_LIBSECRET" != "1"; then
  287 	AC_MSG_WARN([library libsecret not found:])
  288 	AC_MSG_WARN([$libsecret_PKG_ERRORS])
  289 	AC_MSG_WARN([libsecret is provided by Gnome])
  290 	libsecret="no"
  291     else
  292 	libsecret="yes"
  293 	AC_DEFINE([HAVE_LIBSECRET], [1], [Define to 1 if libsecret is available])
  294     fi
  295 fi
  296 
  297 dnl MacOS X Keychain Services (Security Framework)
  298 AC_ARG_WITH([macosx-keyring], [AS_HELP_STRING([--with-macosx-keyring],
  299 	[Support Mac OS X Keyring])],
  300     [macosx_keyring=$withval],[macosx_keyring=yes])
  301 if test "$macosx_keyring" != "no"; then
  302     AC_CACHE_CHECK([for SecKeychainGetVersion],
  303 	ac_cv_func_SecKeychainGetVersion,
  304 	[ac_save_LIBS="$LIBS"
  305 	 LIBS="$LIBS -Wl,-framework -Wl,Security"
  306 	 AC_TRY_LINK([#include <Security/Security.h>],
  307 	    [SecKeychainGetVersion(NULL);],
  308 	    [ac_cv_func_SecKeychainGetVersion=yes],
  309 	    [ac_cv_func_SecKeychainGetVersion=no])
  310 	 LIBS="$ac_save_LIBS"])
  311     if test $ac_cv_func_SecKeychainGetVersion = yes; then
  312 	macosx_keyring=yes
  313 	AC_DEFINE([HAVE_MACOSXKEYRING], [1],
  314 	    [Define to 1 if you have the MacOS X Keychain Services API.])
  315 	LIBS="$LIBS -Wl,-framework -Wl,Security"
  316     else
  317 	macosx_keyring=no
  318     fi
  319 fi
  320 
  321 dnl Check if msmtpd should be built
  322 AC_ARG_WITH([msmtpd],
  323     [AS_HELP_STRING([--with-msmtpd], [Build msmtpd. Enabled by default.])],
  324     [if test "$withval" = "yes"; then build_msmtpd="yes"; else build_msmtpd="no"; fi], [build_msmtpd="$build_msmtpd_default"])
  325 AM_CONDITIONAL([BUILD_MSMTPD], [test "$build_msmtpd" = "yes"])
  326 
  327 dnl Global #defines for all source files
  328 AH_VERBATIM([W32_NATIVE],
  329 [/* Define to 1 if the native W32 API should be used. */
  330 #if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
  331 #define W32_NATIVE 1
  332 #endif])
  333 
  334 dnl End.
  335 AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in doc/Makefile scripts/Makefile])
  336 AC_OUTPUT
  337 
  338 echo
  339 echo "Install prefix ......... : $prefix"
  340 echo "NLS support ............ : $USE_NLS"
  341 echo "TLS support ............ : $have_tls (Library: $tls_lib)"
  342 if test "$want_libidn" = "no"; then
  343     echo "IDN support ............ : yes (no library required)"
  344 elif test "$libidn" = "yes"; then
  345     echo "IDN support ............ : yes (via GNU Libidn)"
  346 else
  347     echo "IDN support ............ : no"
  348 fi
  349 echo "GNU SASL support ....... : $libgsasl (most likely unnecessary)"
  350 echo "Libsecret support (GNOME): $libsecret"
  351 echo "MacOS X Keychain support : $macosx_keyring"
  352 echo "Build msmtpd ............: $build_msmtpd"