Commit 4282ee8d authored by Matt Wilson's avatar Matt Wilson

tools: honour --libdir when it is passed to ./configure

Currently shared libraries are automatically installed into /usr/lib
or /usr/lib64, depending on the supplied --prefix value and
$(XEN_TARGET_ARCH). Some systems, like recent Debian and Ubuntu releases,
do not use /usr/lib64, but instead /usr/lib/x86_64-linux-gnu.

With this change, packagers can supply the desired location for shared
libraries on the ./configure command line. Packagers need to note that
the default behaviour on 64-bit Linux systems will be to install shared
libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided
to ./configure.

Additionally, the libfsimage plugins are now loaded explicitly from
$LIBDIR/fs, removing platform-based decision trees in code.
Signed-off-by: default avatarMatt Wilson <msw@amazon.com>
Acked-by: default avatarIan Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: default avatarIan Campbell <ian.campbell@citrix.com>
[ ijc -- resolve rejects in configure by rerunning autogen.sh. Dropped changes
to remove m4/default_lib.m4 and update m4/pkg.m4 since they cause LIBDIR=/lib
instead of /usr/lib. Reran ./autogen.sh after that too ]
Committed-by: default avatarIan Campbell <ian.campbell@citrix.com>
parent cc338c2f
......@@ -67,7 +67,7 @@ $(eval $(call setvar_dir,INITD_DIR,/etc,/rc.d/init.d,/rc.d/init.d,/init.d))
ifneq ($(EXTRA_PREFIX),)
EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
EXTRA_LIB += $(EXTRA_PREFIX)/lib
endif
PYTHON ?= python
......
include $(XEN_ROOT)/config/StdGNU.mk
# Override settings for this OS
LIBLEAFDIR_x86_64 = lib
LIBEXEC = $(PREFIX)/libexec
PRIVATE_BINDIR = $(BINDIR)
......
......@@ -32,19 +32,13 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
PREFIX ?= /usr
BINDIR = $(PREFIX)/bin
INCLUDEDIR = $(PREFIX)/include
LIBLEAFDIR = lib
LIBLEAFDIR_x86_32 = lib
LIBLEAFDIR_x86_64 ?= lib64
LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
LIBDIR_x86_32 = $(PREFIX)/$(LIBLEAFDIR_x86_32)
LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
LIBEXEC = $(LIBDIR_x86_32)/xen/bin
LIBEXEC = $(PREFIX)/lib/xen/bin
SHAREDIR = $(PREFIX)/share
MANDIR = $(SHAREDIR)/man
MAN1DIR = $(MANDIR)/man1
MAN8DIR = $(MANDIR)/man8
SBINDIR = $(PREFIX)/sbin
XENFIRMWAREDIR = $(LIBDIR_x86_32)/xen/boot
XENFIRMWAREDIR = $(PREFIX)/lib/xen/boot
PRIVATE_PREFIX = $(LIBDIR)/xen
PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
......
......@@ -22,10 +22,6 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
PREFIX ?= /usr
BINDIR = $(PREFIX)/bin
INCLUDEDIR = $(PREFIX)/include
LIBLEAFDIR = lib
LIBLEAFDIR_x86_64 = lib/amd64
LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
MANDIR = $(PREFIX)/share/man
MAN1DIR = $(MANDIR)/man1
MAN8DIR = $(MANDIR)/man8
......
# Prefix and install folder
PREFIX := @prefix@
LIBLEAFDIR_x86_64 := @LIB_PATH@
exec_prefix := @exec_prefix@
LIBDIR := @libdir@
# A debug build of tools?
debug := @debug@
......
......@@ -10,9 +10,6 @@ CONFIG_IOEMU := y
CFLAGS += -m64
LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
LIBDIR = $(LIBDIR_x86_64)
SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
# Use only if calling $(LD) directly.
......
include $(XEN_ROOT)/tools/Rules.mk
CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/
CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
CFLAGS += -Werror -D_GNU_SOURCE
LDFLAGS += -L../common/
PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
FSDIR-$(CONFIG_Linux) = $(LIBDIR)/fs/$(FS)
FSDIR-$(CONFIG_SunOS)-x86_64 = $(PREFIX)/lib/fs/$(FS)/64
FSDIR-$(CONFIG_SunOS)-x86_32 = $(PREFIX)/lib/fs/$(FS)/
FSDIR-$(CONFIG_SunOS) = $(FSDIR-$(CONFIG_SunOS)-$(XEN_TARGET_ARCH))
FSDIR-$(CONFIG_NetBSD) = $(LIBDIR)/fs/$(FS)
FSDIR = $(FSDIR-y)
FSDIR = $(LIBDIR)/fs
FSLIB = fsimage.so
......@@ -20,8 +15,8 @@ fs-all: $(FSLIB)
.PHONY: fs-install
fs-install: fs-all
$(INSTALL_DIR) $(DESTDIR)$(FSDIR)
$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
$(FSLIB): $(PIC_OBJS)
$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)
......
XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
include $(XEN_ROOT)/tools/libfsimage/Rules.mk
MAJOR = 1.0
MINOR = 0
......
......@@ -122,7 +122,6 @@ fail:
static int load_plugins(void)
{
const char *fsdir = getenv("FSIMAGE_FSDIR");
const char *isadir = "";
struct dirent *dp = NULL;
struct dirent *dpp;
DIR *dir = NULL;
......@@ -131,26 +130,8 @@ static int load_plugins(void)
int err;
int ret = -1;
#if defined(FSIMAGE_FSDIR)
if (fsdir == NULL)
fsdir = FSIMAGE_FSDIR;
#elif defined(__sun__)
if (fsdir == NULL)
fsdir = "/usr/lib/fs";
if (sizeof(void *) == 8)
isadir = "64/";
#elif defined(__ia64__)
if (fsdir == NULL)
fsdir = "/usr/lib/fs";
#else
if (fsdir == NULL) {
if (sizeof(void *) == 8)
fsdir = "/usr/lib64/fs";
else
fsdir = "/usr/lib/fs";
}
#endif
if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
goto fail;
......@@ -172,8 +153,8 @@ static int load_plugins(void)
if (strcmp(dpp->d_name, "..") == 0)
continue;
(void) snprintf(tmp, name_max, "%s/%s/%sfsimage.so", fsdir,
dpp->d_name, isadir);
(void) snprintf(tmp, name_max, "%s/%s/fsimage.so", fsdir,
dpp->d_name);
if (init_plugin(tmp) != 0)
goto fail;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment