使用 config.site 构建 *.pc 时 @libdir@ 不正确?

Incorrect @libdir@ when building *.pc using config.site?

我正在研究 Fedora x86_64。它使用 /lib64/usr/lib64 和朋友。我有以下 *.pc.in 文件:

$ cat libcryptopp.pc.in
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
...

我的 config.site 有以下内容。它是从 /usr/share/config.site 的 Fedora config.site 复制而来的。由于 .

使用了该副本
$ cat /usr/local/share/config.site
...

# Note: This file includes also RHEL/Fedora fix for installing libraries into
# "/lib/lib64" on 64bit systems.

if test -n "$host"; then
    # skip when cross-compiling
    return 0
fi

if test "$prefix" = /usr \
   || { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
then
    test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
    test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
    test "$localstatedir" = '${prefix}/var' && localstatedir=/var

    ARCH=`uname -m`
    for i in x86_64 ppc64 s390x aarch64; do
        if test $ARCH = $i; then
            test libdir='${exec_prefix}/lib64'
            break
        fi
    done
fi

然而,在 Autoconf 处理我的 *.pc.in 文件后:

$ autoreconf --install --force
...
$ ./configure
...

$ cat libcryptopp.pc
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
...

注意 libdir=${exec_prefix}/lib,而不是 libdir=${exec_prefix}/lib64

GCC 肯定正在为该包构建 64 位二进制文​​件。我没有添加 -mx32-m32:

$ gcc -dumpmachine
x86_64-redhat-linux

为什么使用了错误的 lib/ 目录,我该如何解决?

/usr/local/share/config.site 是错误的。虽然它是从 Fedora 的 config.site 复制并放在 /usr/local/share 中,但前缀目录是错误的。前缀测试应该使用 /usr/local 而不是 /usr.

下面是更正后的。

$ cat /usr/local/share/config.site
...

if test -n "$host"; then
    # skip when cross-compiling
    return 0
fi

if test "$prefix" = /usr/local \
   || { test "$prefix" = NONE && test "$ac_default_prefix" = /usr/local ; }
then
    test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
    test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
    test "$localstatedir" = '${prefix}/var' && localstatedir=/var

    ARCH=`uname -m`
    for i in x86_64 ppc64 s390x aarch64; do
        if test $ARCH = $i; then
            test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
            break
        fi
    done
fi

现在,下一个问题是,为什么 Fedora 的 /usr/share/config.site 没有正确处理 prefix=/usr/local。这是 Issue 1510073 : Autoconf does not honor libdir in config.site for "libdir=@libdir@" in *.pc file 上的一个悬而未决的问题,已作为 NOT A BUG.

关闭