Eric Blake
2015-11-13 19:57:06 UTC
How does one properly make a build system install to the
system-preferred locations for 64-bit binaries? I'm wondering how to
properly make my build system choose "/usr/lib64" over simply "/usr/lib"
when configure is run. I know this can be done simply via
"--prefix=/usr --libdir=lib64", and maybe this is what it should be
Yes, that IS the preferred way (although autoconf's config.site can makesystem-preferred locations for 64-bit binaries? I'm wondering how to
properly make my build system choose "/usr/lib64" over simply "/usr/lib"
when configure is run. I know this can be done simply via
"--prefix=/usr --libdir=lib64", and maybe this is what it should be
it easier). Your configure script should not hard code any knowledge,
rather the user of your configure script should supply their knowledge.
It's also recommended that you convince your distro to install a
/usr/share/config.site file, which is the easiest way to get
'./configure --prefix=/usr' to just do the right things for all the
other variables. Fedora has already done so:
$ rpm -qf /usr/share/config.site
autoconf-2.69-20.fc22.noarch
$ cat /usr/share/config.site
# This is the config.site file to satisfy FHS defaults when installing below
# /usr.
#
# You may override this file by your config.site using the CONFIG_SITE env
# variable.
#
# 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}/lib' &&
libdir='${exec_prefix}/lib64'
break
fi
done
fi
(along with some type of bootstrap script). I was just wondering if
there are already elegant/"smiled upon" methods for doing this in
configure (i.e. configure.ac).
There's nothing for you to do in configure.ac (that doesn't scale -there are already elegant/"smiled upon" methods for doing this in
configure (i.e. configure.ac).
you'd have to modify every packages' configure.ac to get them to all act
the same). Rather, the work should be done by whoever wants
installation of things into /usr to just work.
See also the autoconf manual:
https://www.gnu.org/software/autoconf/manual/autoconf.html#Site-Defaults
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org