[Openvpn-devel] Add PKG_CHECK_VAR compatibility definition for old autoconf versions

Message ID 20210318161609.76073-1-juliusz@wolfssl.com
State Superseded
Headers show
Series [Openvpn-devel] Add PKG_CHECK_VAR compatibility definition for old autoconf versions | expand

Commit Message

Juliusz Sosinowicz March 18, 2021, 5:16 a.m. UTC
Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
---
 compat.m4 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

David Sommerseth March 18, 2021, 6:25 a.m. UTC | #1
On 18/03/2021 17:16, Juliusz Sosinowicz wrote:
> Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
> ---
>   compat.m4 | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/compat.m4 b/compat.m4
> index e54a7203..47650f6d 100644
> --- a/compat.m4
> +++ b/compat.m4
> @@ -64,6 +64,22 @@ ifdef(
>   		AC_DEFUN([AC_TYPE_UINT64_T], [])
>   	]
>   )
> +ifdef(
> +	[PKG_CHECK_VAR],
> +	,
> +	[
> +		AC_DEFUN([PKG_CHECK_VAR],
> +		[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
> +		AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])
> +
> +		_PKG_CONFIG([$1], [variable="][$3]["], [$2])
> +		AS_VAR_COPY([$1], [pkg_cv_][$1])
> +
> +		AS_VAR_IF([$1], [""], [$5], [$4])
> +		])
> +	]
> +)
> +
>   if test -z "${docdir}"; then
>   	docdir="\$(datadir)/doc/\$(PACKAGE_NAME)"
>   	AC_SUBST([docdir])


I'm not seeing the rationale to why we need this; can you explain that?

The TL;DR version of Chris Beams "How to write a git commit message" [1] is:

git subject        --->>  _What_ this patch is about
git body message   --->>  _Why_  the change is needed
git diff           --->>  _How_  the change is solved

[1] <https://chris.beams.io/posts/git-commit/>
Gert Doering March 18, 2021, 6:56 a.m. UTC | #2
Hi,

On Thu, Mar 18, 2021 at 06:25:13PM +0100, David Sommerseth wrote:
> I'm not seeing the rationale to why we need this; can you explain that?

See my other mail: because the previous configure.ac patch (for WolfSSL
support) breaks some platforms.  Seems "some m4 bits" are not universally
there.

gert
David Sommerseth March 18, 2021, 7 a.m. UTC | #3
On 18/03/2021 18:56, Gert Doering wrote:
> Hi,
> 
> On Thu, Mar 18, 2021 at 06:25:13PM +0100, David Sommerseth wrote:
>> I'm not seeing the rationale to why we need this; can you explain that?
> 
> See my other mail: because the previous configure.ac patch (for WolfSSL
> support) breaks some platforms.  Seems "some m4 bits" are not universally
> there.

Right, I missed that context when looking at it ... but that context 
could still have been in the commit message, for the git history to 
explain why we needed it ;)

Patch

diff --git a/compat.m4 b/compat.m4
index e54a7203..47650f6d 100644
--- a/compat.m4
+++ b/compat.m4
@@ -64,6 +64,22 @@  ifdef(
 		AC_DEFUN([AC_TYPE_UINT64_T], [])
 	]
 )
+ifdef(
+	[PKG_CHECK_VAR],
+	,
+	[
+		AC_DEFUN([PKG_CHECK_VAR],
+		[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+		AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])
+
+		_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+		AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+		AS_VAR_IF([$1], [""], [$5], [$4])
+		])
+	]
+)
+
 if test -z "${docdir}"; then
 	docdir="\$(datadir)/doc/\$(PACKAGE_NAME)"
 	AC_SUBST([docdir])