Hi,

I missed this patch -- must have deleted from the inbox by mistake. So that
explains my silly comment about pkg.m4 in a previous mail.

On Mon, Aug 8, 2016 at 3:28 PM, David Sommerseth <dav...@openvpn.net> wrote:

> This patch adds extracting the pkg-config --modversion output into a
> variable configure.ac can consume.  The extracted content is put
> into ${pkgname}_MODVERSION.  See config.log for details after
> ./configure have run.
>
> The patch also modifies slightly how the pkg-config result is
> processed.  Pkg-config can in some situations report more than one
> line of information if more pkg-config meta-data files are available
> for the same package.  This can cause automake to choke as certain
> variables may be split over more lines.  A simple fix was chosen,
> using 'tail' to ensure only one line is being processed.
>

Keeping aside the drawbacks of pkg-config, this is not optimal. First,
pkg.m4 macro works fine  without the piping to tail for --cflags and --libs
even with multiple modules by design: With those options pkg-config
explicitly does duplicate removal and merges the result onto a single line
suitable for setting the LIBS and CFLAGS variables. The option
--modversion, on the other hand, is not designed for such a use and is
documented to print the version for each module on a separate line. Thus
this 'tail hack' is necessitated by trying to use --modversion like
--cflags.

Secondly, customizing  a well known m4 macro (PKG_CHECK_MODULES) without
renaming it doesn't look ideal. Thirdly, the version checking needed to
find whether --echo is supported can be done without editing the macro at
all. Something like the following added after the PKG_CHECK_MODULES will do

PKG_CHECK_EXISTS( [libsystemd > 216],
                     [AC_DEFINE([SYSTEMD_ASKPASS_HAS_ECHO], [1],
                           [systemd-ask-password supports --echo option])]
                    )

Then add --echo only if SYSTEMD_ASKPASS_HAS_ECHO is defined.

Selva

Reply via email to