Unfortunately only tests the ./run version rather than the real one.
---
.gitignore | 1 +
configure.ac | 2 ++
tests/Makefile.am | 4 +++-
tests/pkgconf.sh.in | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 777471b..dea9274 100644
--- a/.gitignore
+++ b/.gitignore
@@ -159,6 +159,7 @@ Makefile.in
/tests/keys.psk
/tests/meta-base-allocation
/tests/oldstyle
+/tests/pkgconf.sh
/tests/pki/
/tests/read-only-flag
/tests/read-write-flag
diff --git a/configure.ac b/configure.ac
index 9fd284b..0200394 100644
--- a/configure.ac
+++ b/configure.ac
@@ -414,6 +414,8 @@ AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([sh/nbdsh],
[chmod +x,-w sh/nbdsh])
+AC_CONFIG_FILES([tests/pkgconf.sh],
+ [chmod +x,-w tests/pkgconf.sh])
AC_CONFIG_FILES([Makefile
bash/Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c720988..f0cbc2e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,5 @@
# nbd client library in userspace
-# Copyright (C) 2013-2019 Red Hat Inc.
+# Copyright (C) 2013-2020 Red Hat Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -36,6 +36,7 @@ EXTRA_DIST = \
functions.sh.in \
make-pki.sh \
meta-base-allocation.sh \
+ pkgconf.sh.in \
synch-parallel.sh \
synch-parallel-tls.sh \
$(NULL)
@@ -73,6 +74,7 @@ TESTS += \
debug-environment \
version \
export-name \
+ pkgconf.sh \
$(NULL)
# Even though we have a compile.c, we do not want make to create a 'compile'
diff --git a/tests/pkgconf.sh.in b/tests/pkgconf.sh.in
new file mode 100755
index 0000000..14b513b
--- /dev/null
+++ b/tests/pkgconf.sh.in
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+# nbd client library in userspace
+# @configure_input@
+# Copyright (C) 2019-2020 Red Hat Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is unfortunately only testing the local .pc file (in lib/local)
+# used by the ./run script, rather than the real .pc file (in lib).
+# It's hard to test the latter. XXX
+
+source ./functions.sh
+
+set -x
+set -e
+
+requires pkgconf --version
+
+aout=compile-pkgconf
+cleanup_fn rm -f $aout
+
+@CC@ @CFLAGS@ $(pkgconf libnbd --cflags) \
+ @srcdir(a)/compile.c \
+ -o $aout $(pkgconf libnbd --libs)
+
+./$aout
--
2.25.0