--- /dev/null
+Fetched from upstream git and tweaked for the release:
+https://gitlab.com/fetchmail/fetchmail/commit/a2ae6f8d15d7caf815d7bdd13df833fd1b2af5cc
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura fetchmail-6.3.26.orig/config.h.in fetchmail-6.3.26/config.h.in
+--- fetchmail-6.3.26.orig/config.h.in 2015-12-30 10:44:33.467746835 -0300
++++ fetchmail-6.3.26/config.h.in 2015-12-30 10:45:50.271403589 -0300
+@@ -53,6 +53,10 @@
+ if you don't. */
+ #undef HAVE_DECL_SSLV2_CLIENT_METHOD
+
++/* Define to 1 if you have the declaration of `SSLv3_client_method', and to 0
++ if you don't. */
++#undef HAVE_DECL_SSLV3_CLIENT_METHOD
++
+ /* Define to 1 if you have the declaration of `strerror', and to 0 if you
+ don't. */
+ #undef HAVE_DECL_STRERROR
+diff -Nura fetchmail-6.3.26.orig/configure.ac fetchmail-6.3.26/configure.ac
+--- fetchmail-6.3.26.orig/configure.ac 2015-12-30 10:44:33.465746766 -0300
++++ fetchmail-6.3.26/configure.ac 2015-12-30 10:46:03.708868409 -0300
+@@ -803,6 +803,7 @@
+
+ case "$LIBS" in *-lssl*)
+ AC_CHECK_DECLS([SSLv2_client_method],,,[#include <openssl/ssl.h>])
++ AC_CHECK_DECLS([SSLv3_client_method],,,[#include <openssl/ssl.h>])
+ ;;
+ esac
+
+diff -Nura fetchmail-6.3.26.orig/fetchmail.c fetchmail-6.3.26/fetchmail.c
+--- fetchmail-6.3.26.orig/fetchmail.c 2015-12-30 10:44:33.469746904 -0300
++++ fetchmail-6.3.26/fetchmail.c 2015-12-30 10:46:03.708868409 -0300
+@@ -263,6 +263,12 @@
+ #ifdef SSL_ENABLE
+ "+SSL"
+ #endif
++#if HAVE_DECL_SSLV2_CLIENT_METHOD + 0 == 0
++ "-SSLv2"
++#endif
++#if HAVE_DECL_SSLV3_CLIENT_METHOD + 0 == 0
++ "-SSLv3"
++#endif
+ #ifdef OPIE_ENABLE
+ "+OPIE"
+ #endif /* OPIE_ENABLE */
+diff -Nura fetchmail-6.3.26.orig/socket.c fetchmail-6.3.26/socket.c
+--- fetchmail-6.3.26.orig/socket.c 2015-12-30 10:44:33.464746731 -0300
++++ fetchmail-6.3.26/socket.c 2015-12-30 10:46:03.709868443 -0300
+@@ -910,11 +910,16 @@
+ #if HAVE_DECL_SSLV2_CLIENT_METHOD + 0 > 0
+ _ctx[sock] = SSL_CTX_new(SSLv2_client_method());
+ #else
+- report(stderr, GT_("Your operating system does not support SSLv2.\n"));
++ report(stderr, GT_("Your OpenSSL version does not support SSLv2.\n"));
+ return -1;
+ #endif
+ } else if(!strcasecmp("ssl3",myproto)) {
++#if HAVE_DECL_SSLV3_CLIENT_METHOD + 0 > 0
+ _ctx[sock] = SSL_CTX_new(SSLv3_client_method());
++#else
++ report(stderr, GT_("Your OpenSSL version does not support SSLv3.\n"));
++ return -1;
++#endif
+ } else if(!strcasecmp("tls1",myproto)) {
+ _ctx[sock] = SSL_CTX_new(TLSv1_client_method());
+ } else if (!strcasecmp("ssl23",myproto)) {
+++ /dev/null
-Fix checking for statically build OpenSSL with libz dependency
-
-Fixes
-http://autobuild.buildroot.net/results/48a/48ad6d3659cf1f04581b7e3d115bebf454ff17fd/
-
-configure: Enabling OpenSSL support in /home/br/br/output/host/usr/i486-buildroot-linux-uclibc/sysroot/usr.
-checking for additional library dependencies of SSL... error
-configure: error: cannot link with SSL - check config.log
-
-In config.log multiple linking errors to libz can be found:
-
-configure:10099: /home/br/br/output/host/usr/bin/i486-ctng-linux-uclibc-gcc -o
- conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64
- /home/br/br/output/host/usr/i486-buildroot-linux-uclibc/sysroot/usr/lib/libcrypto.a(c_zlib.o):
- In function `zlib_stateful_c_zlib.c:(.text+0x56): undefined reference to `inflate'
-
-Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
-
-diff -uNr fetchmail-6.3.26.org/configure.ac fetchmail-6.3.26/configure.ac
---- fetchmail-6.3.26.org/configure.ac 2013-04-23 22:51:10.000000000 +0200
-+++ fetchmail-6.3.26/configure.ac 2014-07-27 09:20:25.000000000 +0200
-@@ -778,7 +778,7 @@
- AC_MSG_ERROR([SSL support enabled, but OpenSSL not found])
- fi
- LDFLAGS="$LDFLAGS -L$with_ssl/lib"
-- LIBS="$LIBS -lssl -lcrypto"
-+ LIBS="-lssl -lcrypto $LIBS"
- dnl check if -ldl is needed
- AC_MSG_CHECKING([for additional library dependencies of SSL])
- found=0
--- /dev/null
+From 1ed0af7f1bbcaccbd7356bd90596f5c942b64720 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Fri, 22 Mar 2019 20:24:54 +0100
+Subject: [PATCH 1/1] configure.ac: use pkg-config to find openssl
+
+openssl can have multiples dependencies such as libatomic on sparcv8
+32 bits
+
+Fixes:
+ - http://autobuild.buildroot.org/results/58e5aa7c6ba8fe7474071d7a3cba6ed3a1b4cff4
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status:
+https://gitlab.com/fetchmail/fetchmail/merge_requests/14]
+---
+ configure.ac | 37 +++++++++++++++++++------------------
+ 1 file changed, 19 insertions(+), 18 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 16b0fcba..3a75ec6e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -778,24 +778,25 @@ then
+ else
+ AC_MSG_ERROR([SSL support enabled, but OpenSSL not found])
+ fi
+- LDFLAGS="$LDFLAGS -L$with_ssl/lib"
+- LIBS="$LIBS -lssl -lcrypto"
+- dnl check if -ldl is needed
+- AC_MSG_CHECKING([for additional library dependencies of SSL])
+- found=0
+- save_LIBS="$LIBS"
+- for i in "" "-ldl" ; do
+- LIBS="$LDFLAGS $save_LIBS $i"
+- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/ssl.h>],[SSL_library_init()])],[found=1; break])
+- done
+- if test $found = 0 ; then
+- AC_MSG_RESULT([error])
+- AC_MSG_ERROR([cannot link with SSL - check config.log])
+- fi
+- LIBS="$save_LIBS $i"
+- if test "$i" = "" ; then i="(none)" ; fi
+- AC_MSG_RESULT($i)
+- dnl XXX FIXME: use pkg-config if available!
++ PKG_CHECK_MODULES([SSL],[libssl],[LIBS="$LIBS $SSL_LIBS"],[
++ LDFLAGS="$LDFLAGS -L$with_ssl/lib"
++ LIBS="$LIBS -lssl -lcrypto"
++ dnl check if -ldl is needed
++ AC_MSG_CHECKING([for additional library dependencies of SSL])
++ found=0
++ save_LIBS="$LIBS"
++ for i in "" "-ldl" ; do
++ LIBS="$LDFLAGS $save_LIBS $i"
++ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/ssl.h>],[SSL_library_init()])],[found=1; break])
++ done
++ if test $found = 0 ; then
++ AC_MSG_RESULT([error])
++ AC_MSG_ERROR([cannot link with SSL - check config.log])
++ fi
++ LIBS="$save_LIBS $i"
++ if test "$i" = "" ; then i="(none)" ; fi
++ AC_MSG_RESULT($i)
++ ])
+ AC_DEFINE(SSL_ENABLE)
+ else
+ AC_MSG_WARN(Disabling SSL support.)
+--
+2.20.1
+
+++ /dev/null
-Fetched from upstream git and tweaked for the release:
-https://gitlab.com/fetchmail/fetchmail/commit/a2ae6f8d15d7caf815d7bdd13df833fd1b2af5cc
-
-Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
-
-diff -Nura fetchmail-6.3.26.orig/config.h.in fetchmail-6.3.26/config.h.in
---- fetchmail-6.3.26.orig/config.h.in 2015-12-30 10:44:33.467746835 -0300
-+++ fetchmail-6.3.26/config.h.in 2015-12-30 10:45:50.271403589 -0300
-@@ -53,6 +53,10 @@
- if you don't. */
- #undef HAVE_DECL_SSLV2_CLIENT_METHOD
-
-+/* Define to 1 if you have the declaration of `SSLv3_client_method', and to 0
-+ if you don't. */
-+#undef HAVE_DECL_SSLV3_CLIENT_METHOD
-+
- /* Define to 1 if you have the declaration of `strerror', and to 0 if you
- don't. */
- #undef HAVE_DECL_STRERROR
-diff -Nura fetchmail-6.3.26.orig/configure.ac fetchmail-6.3.26/configure.ac
---- fetchmail-6.3.26.orig/configure.ac 2015-12-30 10:44:33.465746766 -0300
-+++ fetchmail-6.3.26/configure.ac 2015-12-30 10:46:03.708868409 -0300
-@@ -803,6 +803,7 @@
-
- case "$LIBS" in *-lssl*)
- AC_CHECK_DECLS([SSLv2_client_method],,,[#include <openssl/ssl.h>])
-+ AC_CHECK_DECLS([SSLv3_client_method],,,[#include <openssl/ssl.h>])
- ;;
- esac
-
-diff -Nura fetchmail-6.3.26.orig/fetchmail.c fetchmail-6.3.26/fetchmail.c
---- fetchmail-6.3.26.orig/fetchmail.c 2015-12-30 10:44:33.469746904 -0300
-+++ fetchmail-6.3.26/fetchmail.c 2015-12-30 10:46:03.708868409 -0300
-@@ -263,6 +263,12 @@
- #ifdef SSL_ENABLE
- "+SSL"
- #endif
-+#if HAVE_DECL_SSLV2_CLIENT_METHOD + 0 == 0
-+ "-SSLv2"
-+#endif
-+#if HAVE_DECL_SSLV3_CLIENT_METHOD + 0 == 0
-+ "-SSLv3"
-+#endif
- #ifdef OPIE_ENABLE
- "+OPIE"
- #endif /* OPIE_ENABLE */
-diff -Nura fetchmail-6.3.26.orig/socket.c fetchmail-6.3.26/socket.c
---- fetchmail-6.3.26.orig/socket.c 2015-12-30 10:44:33.464746731 -0300
-+++ fetchmail-6.3.26/socket.c 2015-12-30 10:46:03.709868443 -0300
-@@ -910,11 +910,16 @@
- #if HAVE_DECL_SSLV2_CLIENT_METHOD + 0 > 0
- _ctx[sock] = SSL_CTX_new(SSLv2_client_method());
- #else
-- report(stderr, GT_("Your operating system does not support SSLv2.\n"));
-+ report(stderr, GT_("Your OpenSSL version does not support SSLv2.\n"));
- return -1;
- #endif
- } else if(!strcasecmp("ssl3",myproto)) {
-+#if HAVE_DECL_SSLV3_CLIENT_METHOD + 0 > 0
- _ctx[sock] = SSL_CTX_new(SSLv3_client_method());
-+#else
-+ report(stderr, GT_("Your OpenSSL version does not support SSLv3.\n"));
-+ return -1;
-+#endif
- } else if(!strcasecmp("tls1",myproto)) {
- _ctx[sock] = SSL_CTX_new(TLSv1_client_method());
- } else if (!strcasecmp("ssl23",myproto)) {
FETCHMAIL_AUTORECONF = YES
FETCHMAIL_GETTEXTIZE = YES
-# needed to help fetchmail detecting the availability of openssl,
-# because it doesn't use pkg-config
-ifeq ($(BR2_STATIC_LIBS),y)
-FETCHMAIL_CONF_ENV += LIBS="-lz"
-endif
-
FETCHMAIL_CONF_OPTS = \
--with-ssl=$(STAGING_DIR)/usr
FETCHMAIL_DEPENDENCIES = \
ca-certificates \
+ host-pkgconf \
openssl \
$(TARGET_NLS_DEPENDENCIES)