Blame SOURCES/0001-build-add-with-vendor-error-message-configure-option.patch

02b4cc
From 0353d704879f20983184f8bded4f16538d72f7cc Mon Sep 17 00:00:00 2001
02b4cc
From: Sumit Bose <sbose@redhat.com>
02b4cc
Date: Wed, 10 Mar 2021 18:12:09 +0100
02b4cc
Subject: [PATCH] build: add --with-vendor-error-message configure option
02b4cc
02b4cc
With the new configure option --with-vendor-error-message a packager or
02b4cc
a distribution can add a message if adcli returns with an error.
02b4cc
02b4cc
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1889386
02b4cc
---
02b4cc
 configure.ac  | 15 +++++++++++++++
02b4cc
 tools/tools.c |  6 ++++++
02b4cc
 2 files changed, 21 insertions(+)
02b4cc
02b4cc
diff --git a/configure.ac b/configure.ac
02b4cc
index baa0d3b..7dfba97 100644
02b4cc
--- a/configure.ac
02b4cc
+++ b/configure.ac
02b4cc
@@ -123,6 +123,21 @@ if test "$sasl_invalid" = "yes"; then
02b4cc
 	AC_MSG_ERROR([Couldn't find Cyrus SASL headers])
02b4cc
 fi
02b4cc
 
02b4cc
+# --------------------------------------------------------------------
02b4cc
+# Vendor error message
02b4cc
+
02b4cc
+AC_ARG_WITH([vendor-error-message],
02b4cc
+              [AS_HELP_STRING([--with-vendor-error-message=ARG],
02b4cc
+                            [Add a vendor specific error message shown if a adcli command fails]
02b4cc
+                           )],
02b4cc
+              [AS_IF([test "x$withval" != "x"],
02b4cc
+                     [AC_DEFINE_UNQUOTED([VENDOR_MSG],
02b4cc
+                                         ["$withval"],
02b4cc
+                                         [Vendor specific error message])],
02b4cc
+                     [AC_MSG_ERROR([--with-vendor-error-message requires an argument])]
02b4cc
+                    )],
02b4cc
+              [])
02b4cc
+
02b4cc
 # --------------------------------------------------------------------
02b4cc
 # Documentation options
02b4cc
 
02b4cc
diff --git a/tools/tools.c b/tools/tools.c
02b4cc
index d0dcf98..84bbba9 100644
02b4cc
--- a/tools/tools.c
02b4cc
+++ b/tools/tools.c
02b4cc
@@ -538,6 +538,12 @@ main (int argc,
02b4cc
 
02b4cc
 		if (conn)
02b4cc
 			adcli_conn_unref (conn);
02b4cc
+#ifdef VENDOR_MSG
02b4cc
+		if (ret != 0) {
02b4cc
+			fprintf (stderr, VENDOR_MSG"\n");
02b4cc
+		}
02b4cc
+#endif
02b4cc
+
02b4cc
 		return ret;
02b4cc
 	}
02b4cc
 
02b4cc
-- 
02b4cc
2.30.2
02b4cc