diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2018-11-14 20:08:40 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2018-11-14 20:08:40 +0900 |
commit | 4a92763a6e529824f1c6043b75ac1346af41a926 (patch) | |
tree | cd8a2d1623b3a66646bcba47c07b4fa70bb45f3f | |
parent | 4b41cf3bd16c8afcb4ba152ab9d5d679a7cb91e7 (diff) | |
download | libgpg-error-4a92763a6e529824f1c6043b75ac1346af41a926.tar.gz |
gpgrt-config: Prepend PKG_CONFIG_LIBDIR to PKG_CONFIG_PATH.
* src/gpgrt-config: Handle empty PKG_CONFIG_LIBDIR config, which
should ignore --libdir option. Otherwise, prepend
PKG_CONFIG_LIBDIR (instead of appending) to PKG_CONFIG_PATH.
--
Suggested-by: Andre Heinecke <aheinecke@intevation.de>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rwxr-xr-x | src/gpgrt-config | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/gpgrt-config b/src/gpgrt-config index 9aec4f6..3a76869 100755 --- a/src/gpgrt-config +++ b/src/gpgrt-config @@ -451,17 +451,32 @@ while test $# -gt 0; do esac done -# --libdir option has precedence over the env var. -if [ -n "$libdir" ]; then - PKG_CONFIG_LIBDIR=$libdir/pkgconfig -fi - -if [ x"$PKG_CONFIG_PATH" = x -a x"$PKG_CONFIG_LIBDIR" = x ]; then - echo "Please use --libdir=LIBDIR option or set PKG_CONFIG_LIBDIR" 1>&2 +if [ x"${PKG_CONFIG_LIBDIR:+set}" = xset -a -z "$PKG_CONFIG_LIBDIR" ]; then + # The variable set as empty, we use PKG_CONFIG_PATH in this case, + # ignoring --libdir option + if [ -z "$PKG_CONFIG_PATH" ]; then + echo "Please have valid PKG_CONFIG_PATH if PKG_CONFIG_LIBDIR is empty" 1>&2 exit 1 + fi +else + if [ -n "$libdir" ]; then + # --libdir option is available, it overrides existing PKG_CONFIG_LIBDIR + PKG_CONFIG_LIBDIR=$libdir/pkgconfig + fi + if [ -z "$PKG_CONFIG_LIBDIR" ]; then + if [ -z "$PKG_CONFIG_PATH" ]; then + echo "Please use --libdir=LIBDIR option or set PKG_CONFIG_LIBDIR" 1>&2 + echo "Or set PKG_CONFIG_PATH" 1>&2 + exit 1 + fi + else + # PKG_CONFIG_LIBDIR is available here + # Modify PKG_CONFIG_PATH, prepending PKG_CONFIG_LIBDIR + PKG_CONFIG_PATH="$PKG_CONFIG_LIBDIR${PKG_CONFIG_PATH:+:}$PKG_CONFIG_PATH" + fi fi +# PKG_CONFIG_PATH is ready here -PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}$PKG_CONFIG_LIBDIR" # if test $# -eq 0; then |