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

时间:2017-11-05 16:46:09

标签: configuration libraries autoconf

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

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

我的config.site有以下内容。它是从Fedora的config.site /usr/share/config.site复制的。由于config.site for vendor libs on Fedora x86_64而使用了该副本。

$ 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/目录,我该如何解决?

1 个答案:

答案 0 :(得分:0)

/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