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

Message ID 20210318181258.89704-1-juliusz@wolfssl.com
State Accepted
Headers show
Series
  • [Openvpn-devel] Add PKG_CHECK_VAR compatibility definition for old autoconf versions
Related show

Commit Message

Juliusz Sosinowicz March 18, 2021, 6:12 p.m.
PKG_CHECK_VAR is not available on older versions of autoconf. This patch copies the definition generated by newer versions of autoconf to be used for compatibility with older versions. Tested with automake 1.14.1-2ubuntu1 and autoconf 2.69-6.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
---
 compat.m4 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

David Sommerseth March 18, 2021, 8:52 p.m. | #1
On 18/03/2021 19:12, Juliusz Sosinowicz wrote:
> PKG_CHECK_VAR is not available on older versions of autoconf. This
> patch copies the definition generated by newer versions of autoconf to
> be used for compatibility with older versions. Tested with automake
> 1.14.1-2ubuntu1 and autoconf 2.69-6.
> 
> Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>

I ended up doing some more investigation here, to better understand 
where this could fail.

So it seems this is not related to automake/autoconf versions.  It is 
related to pkg-config version, which is the one providing 
/usr/share/aclocal/pkg.m4 which provides the PKG_CHECK_VAR() macro.

<https://gitlab.freedesktop.org/pkg-config/pkg-config/-/commit/5b463c927b6caeb332bb147572ea82b1650ceb7d>

What surprises me is that this was added to pkg-config 0.28, which was 
released in 2013-01-24.  The latest release, 0.29.2 was released 2017-03-20.

<https://gitlab.freedesktop.org/pkg-config/pkg-config/-/commit/74ceac54ef6f9247c00f08eecd8cca811a3c5934>
<https://gitlab.freedesktop.org/pkg-config/pkg-config/-/tags>

It would be great to figure out if pkg-config is available on those 
build hosts failing without this change.  If it is present, it needs to 
be checked which version it is.

If this is due to an outdated pkg-config, I'm reluctant to give this 
patch an ACK.  Using properly up-to-date dependency stack should be a 
reasonable precondition to build OpenVPN.  If it is due to unavailable 
pkg-config, it's a different story.

Regardless, the commit message is incorrect.  But that can probably be 
fixed at commit time.
Juliusz Sosinowicz March 18, 2021, 11 p.m. | #2
For reference, the version of pkg-config shipped on my Ubuntu 14 vm is 
0.26-1ubuntu4. It looks like the default packages are very outdated.

Juliusz

On 18/03/2021 21:52, David Sommerseth wrote:
> On 18/03/2021 19:12, Juliusz Sosinowicz wrote:
>> PKG_CHECK_VAR is not available on older versions of autoconf. This
>> patch copies the definition generated by newer versions of autoconf to
>> be used for compatibility with older versions. Tested with automake
>> 1.14.1-2ubuntu1 and autoconf 2.69-6.
>>
>> Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
>
> I ended up doing some more investigation here, to better understand 
> where this could fail.
>
> So it seems this is not related to automake/autoconf versions.  It is 
> related to pkg-config version, which is the one providing 
> /usr/share/aclocal/pkg.m4 which provides the PKG_CHECK_VAR() macro.
>
> <https://gitlab.freedesktop.org/pkg-config/pkg-config/-/commit/5b463c927b6caeb332bb147572ea82b1650ceb7d> 
>
>
> What surprises me is that this was added to pkg-config 0.28, which was 
> released in 2013-01-24.  The latest release, 0.29.2 was released 
> 2017-03-20.
>
> <https://gitlab.freedesktop.org/pkg-config/pkg-config/-/commit/74ceac54ef6f9247c00f08eecd8cca811a3c5934> 
>
> <https://gitlab.freedesktop.org/pkg-config/pkg-config/-/tags>
>
> It would be great to figure out if pkg-config is available on those 
> build hosts failing without this change.  If it is present, it needs 
> to be checked which version it is.
>
> If this is due to an outdated pkg-config, I'm reluctant to give this 
> patch an ACK.  Using properly up-to-date dependency stack should be a 
> reasonable precondition to build OpenVPN.  If it is due to unavailable 
> pkg-config, it's a different story.
>
> Regardless, the commit message is incorrect.  But that can probably be 
> fixed at commit time.
>
>
David Sommerseth March 18, 2021, 11:12 p.m. | #3
On 18/03/2021 21:52, David Sommerseth wrote:
> It would be great to figure out if pkg-config is available on those 
> build hosts failing without this change.  If it is present, it needs to 
> be checked which version it is.
> 
> If this is due to an outdated pkg-config, I'm reluctant to give this 
> patch an ACK.  Using properly up-to-date dependency stack should be a 
> reasonable precondition to build OpenVPN.  If it is due to unavailable 
> pkg-config, it's a different story.

So I managed to test this more properly on RHEL-7 and CentOS-7.  This 
major release is forked off from a mixture of Fedora 19 and 20.  And 
pkgconfig got upgraded from 0.27 in F19 to 0.28 in F20; but this was not 
pulled into RHEL-7 (which CentOS-7 builds on).

This is also the latest pkgconfig version available on RHEL-7, which is 
the oldest enterprise Linux distro we support.  So my concern about not 
up-to-date dependency stack is no longer valid.  We need this change.

If Gert is fine with updating the commit message at commit time, I'm 
ready to give it my ACK now.

I propose this commit message:
----------------------------------------------------------------------
build: Add support for pkg-config < 0.28

RHEL-7 ships pkgconfig-0.27-1 which is lacking the PKG_CHECK_VAR() m4 
macro.  This might be the situation on other OS distributions as well. 
Ship our own macro providing this support when not found on the build host.
----------------------------------------------------------------------

Acked-By: David Sommerseth <davids@openvpn.net>
David Sommerseth March 18, 2021, 11:16 p.m. | #4
On 19/03/2021 00:00, Juliusz Sosinowicz wrote:
> For reference, the version of pkg-config shipped on my Ubuntu 14 vm is 
> 0.26-1ubuntu4. It looks like the default packages are very outdated.

Thanks for checking.  You might want to reconsider if you want to 
support Ubuntu 14 these days; Ubuntu 16.04 LTS is the oldest one 
supported by Canonical, and after end of April this year only 16.04.4 is 
supported.

<https://endoflife.software/operating-systems/linux/ubuntu>
Arne Schwabe March 18, 2021, 11:18 p.m. | #5
Am 18.03.2021 um 21:52 schrieb David Sommerseth:
> If this is due to an outdated pkg-config, I'm reluctant to give this 
> patch an ACK.  Using properly up-to-date dependency stack should be a 
> reasonable precondition to build OpenVPN.  If it is due to unavailable 
> pkg-config, it's a different story. 

We support RHEL7, which also has pkgconfig 0.27. So that is also a 
problem. And even if RHEL7 shipped a version that was recent enough, 
denying Ubuntu 16 support because an old dependency that can be fixed 
with this small change like would be quite a hyprocrasy as we supported 
old RHEL versions for a long time in OpenVPN often needing a lot larger 
compromises. In fact RHEL7/CentOS 7 is currently in my opinion only 
reason to still support OpenSSL 1.0.2, which has has reached end of life 
on 2019-12-31.


Arne
Gert Doering March 19, 2021, 6:55 a.m. | #6
Hi,

On Fri, Mar 19, 2021 at 12:16:28AM +0100, David Sommerseth wrote:
> On 19/03/2021 00:00, Juliusz Sosinowicz wrote:
> > For reference, the version of pkg-config shipped on my Ubuntu 14 vm is 
> > 0.26-1ubuntu4. It looks like the default packages are very outdated.
> 
> Thanks for checking.  You might want to reconsider if you want to 
> support Ubuntu 14 these days; Ubuntu 16.04 LTS is the oldest one 
> supported by Canonical, and after end of April this year only 16.04.4 is 
> supported.
> 
> <https://endoflife.software/operating-systems/linux/ubuntu>

Ubuntu 16 and Ubuntu 18 (!) also have this old stuff and fail building,
so it seems "updating pkgconfig" is really not their prime priority.

I'll merge with the new commit message.

Thanks for the review.

gert
Gert Doering March 19, 2021, 7:53 a.m. | #7
Your patch has been applied to the master branch.

I have amended the commit message to point out what David found out, that 
this is related to pkg-config version and not autoconf itself.  The patch
itself is unchanged.

I have thrown this branch towards all our buildbots first, and everything
builds again (well, it builds syntactically correct "configure" scripts,
that then fail at "missing lz4", but that's not your fault).  THANKS!

commit 60c18b45c04f4c86241d9f6e4dc422c5c07405a1
Author: Juliusz Sosinowicz
Date:   Thu Mar 18 19:12:58 2021 +0100

     build: Add support for pkg-config < 0.28 for old autoconf versions

     Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
     Acked-by: David Sommerseth <davids@openvpn.net>
     Message-Id: <20210318181258.89704-1-juliusz@wolfssl.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21708.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

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])