diff options
author | NIIBE Yutaka <[email protected]> | 2018-10-23 02:50:45 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2018-10-23 03:04:37 +0000 |
commit | 40e22c774afebca23fdaa6dec2b8698572501c32 (patch) | |
tree | 54a525d36fe71329b1bb67ee19afed21cc903c15 /src | |
parent | yat2m: Avoid compiler warnings. (diff) | |
download | libgpg-error-40e22c774afebca23fdaa6dec2b8698572501c32.tar.gz libgpg-error-40e22c774afebca23fdaa6dec2b8698572501c32.zip |
gpg-error-config: Fix cross build support.
* configure.ac: Fix regexp matching multiarch environment.
* src/gpg-error-config-new.in: Support standard cross build.
Handle the case where $multiarch != $triplet.
--
For standard cross build, use @exec_prefix@/$triplet/lib/pkgconfig.
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpg-error-config-new.in | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/src/gpg-error-config-new.in b/src/gpg-error-config-new.in index 0ccf55a..b8b7328 100644 --- a/src/gpg-error-config-new.in +++ b/src/gpg-error-config-new.in @@ -12,21 +12,48 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ -pkg_config_libdir=${PKG_CONFIG_LIBDIR:-@pkg_config_libdir@} -if [ "$pkg_config_libdir" = auto ]; then - # "auto" supports multiarch environment +pkg_config_libdir=@pkg_config_libdir@ +if [ x"${PKG_CONFIG_LIBDIR+set}" = x ]; then + # If PKG_CONFIG_LIBDIR is not specified, detect the directory. + + # We supports standard cross build with $CC triplet="" case "$CC" in *-*-*) triplet=${CC%-*} ;; *) ;; esac - if [ -z "$triplet" ]; then - triplet=$(gcc -dumpmachine) + if [ "$pkg_config_libdir" = auto ]; then + # It's multiarch environment. + # It may be standard cross build, native multiarch build, or + # multiarch-cross build + multiarch="" + if [ -n "$triplet" ]; then + triplet1=$triplet + else + triplet1=$(gcc -dumpmachine) + fi + # Follow existing practice for multiarch name + if expr $triplet1 : "^i[4567]86-" >/dev/null; then + multiarch="i386-${triplet1#*-}" + else + multiarch=$triplet1 + fi + if [ -n "$triplet" ]; then + PKG_CONFIG_LIBDIR="@exec_prefix@/$triplet/lib/pkgconfig:@exec_prefix@/lib/$multiarch/pkgconfig" + else + PKG_CONFIG_LIBDIR="@exec_prefix@/lib/$multiarch/pkgconfig" + fi + unset multiarch triplet1 + elif [ -n "$triplet" ]; then + # It's cross build + PKG_CONFIG_LIBDIR="@exec_prefix@/$triplet/lib/pkgconfig" + else + # Native build in standard (non-multiarch) environment + PKG_CONFIG_LIBDIR="$pkg_config_libdir" fi - pkg_config_libdir=@exec_prefix@/lib/$triplet/pkgconfig unset triplet fi -PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}$pkg_config_libdir" +PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}$PKG_CONFIG_LIBDIR" # #### start of functions for this script |