Matt Wilson
2012-Jul-04 18:18 UTC
[PATCH v4] 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. The LIBLEAFDIR{,_x86_32,_x86_64} make variables and the LIB_PATH autoconf substition are no longer used, so this change removes m4/default_lib.m4 and regenerates configure. m4/pkg.m4 has been refreshed from pkg-config 0.26 to resolve an error, "possibly undefined macro: AS_MESSAGE_LOG_FDdnl" when running autoconf. Signed-off-by: Matt Wilson <msw@amazon.com> Changes since v3: * Correct $(XENFIRMWAREDIR) to point at $(PREFIX)/lib/xen/xen/boot Reported-by: Ian Campbell <Ian.Campbell@citrix.com> * Remove (now unneeded) DEFAULT_LIB checks from autoconf Reported-by: Roger Pau Monne <roger.pau@citrix.com> * Refresh pkg.m4 from pkg-config 0.26, which contains a fix for "error: possibly undefined macro: AS_MESSAGE_LOG_FDdnl" error when rerunning autoconf * Re-generate configure. Changes since v2: * Drop the #ifndef check for FSIMAGE_FSDIR, let the normal compiler error provide information that something is wrong. * Don''t include config/Tools.mk from the top level Config.mk. * Just assume that libraries specified via EXTRA_PREFIX live in $(EXTRA_LIB)/lib. EXTRA_PREFIX should probably just go away one day. diff -r 32034d1914a6 -r deb7e8599e78 Config.mk --- a/Config.mk Thu Jun 07 19:46:57 2012 +0100 +++ b/Config.mk Wed Jun 20 00:40:15 2012 +0000 @@ -67,7 +67,7 @@ endef ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include -EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR) +EXTRA_LIB += $(EXTRA_PREFIX)/lib endif PYTHON ?= python diff -r 32034d1914a6 -r deb7e8599e78 config/NetBSD.mk --- a/config/NetBSD.mk Thu Jun 07 19:46:57 2012 +0100 +++ b/config/NetBSD.mk Wed Jun 20 00:40:15 2012 +0000 @@ -1,7 +1,6 @@ include $(XEN_ROOT)/config/StdGNU.mk # Override settings for this OS -LIBLEAFDIR_x86_64 = lib LIBEXEC = $(PREFIX)/libexec PRIVATE_BINDIR = $(BINDIR) diff -r 32034d1914a6 -r deb7e8599e78 config/StdGNU.mk --- a/config/StdGNU.mk Thu Jun 07 19:46:57 2012 +0100 +++ b/config/StdGNU.mk Wed Jun 20 00:40:15 2012 +0000 @@ -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 diff -r 32034d1914a6 -r deb7e8599e78 config/SunOS.mk --- a/config/SunOS.mk Thu Jun 07 19:46:57 2012 +0100 +++ b/config/SunOS.mk Wed Jun 20 00:40:15 2012 +0000 @@ -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 diff -r 32034d1914a6 -r deb7e8599e78 config/Tools.mk.in --- a/config/Tools.mk.in Thu Jun 07 19:46:57 2012 +0100 +++ b/config/Tools.mk.in Wed Jun 20 00:40:15 2012 +0000 @@ -1,6 +1,7 @@ # Prefix and install folder PREFIX := @prefix@ -LIBLEAFDIR_x86_64 := @LIB_PATH@ +exec_prefix := @exec_prefix@ +LIBDIR := @libdir@ # A debug build of tools? debug := @debug@ diff -r 32034d1914a6 -r deb7e8599e78 config/x86_64.mk --- a/config/x86_64.mk Thu Jun 07 19:46:57 2012 +0100 +++ b/config/x86_64.mk Wed Jun 20 00:40:15 2012 +0000 @@ -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. diff -r 32034d1914a6 -r deb7e8599e78 tools/configure --- a/tools/configure Thu Jun 07 19:46:57 2012 +0100 +++ b/tools/configure Wed Jun 20 00:40:15 2012 +0000 @@ -606,7 +606,6 @@ libgcrypt libext2fs system_aio zlib -LIB_PATH glib_LIBS glib_CFLAGS PKG_CONFIG_LIBDIR @@ -2043,7 +2042,7 @@ do || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } fi done @@ -2227,8 +2226,6 @@ fi - - # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # @@ -2933,7 +2930,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3048,7 +3045,7 @@ sed ''s/^/| /'' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3091,7 +3088,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3150,7 +3147,7 @@ eval ac_try_echo="\"\$as_me:${as_lineno- $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host''. -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } fi fi fi @@ -3202,7 +3199,7 @@ sed ''s/^/| /'' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -4950,7 +4947,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } fi ac_ext=c @@ -5839,6 +5836,7 @@ fi + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. @@ -5967,6 +5965,7 @@ if test -n "$glib_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_glib_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -5983,6 +5982,7 @@ if test -n "$glib_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_glib_LIBS=`$PKG_CONFIG --libs "glib-2.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -6002,9 +6002,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - glib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "glib-2.0" 2>&1` + glib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0" 2>&1` else - glib_PKG_ERRORS=`$PKG_CONFIG --print-errors "glib-2.0" 2>&1` + glib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$glib_PKG_ERRORS" >&5 @@ -6033,7 +6033,7 @@ and glib_LIBS to avoid the need to call See the pkg-config man page for more details. To get pkg-config, see <http://pkg-config.freedesktop.org/>. -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } else glib_CFLAGS=$pkg_cv_glib_CFLAGS glib_LIBS=$pkg_cv_glib_LIBS @@ -6042,31 +6042,6 @@ else fi -# Check library path -if test "\${exec_prefix}/lib" = "$libdir"; then : - if test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"; then : - exec_prefix=$prefix -fi - if test "$exec_prefix" = "NONE"; then : - exec_prefix=$ac_default_prefix -fi - if test -d "${exec_prefix}/lib64"; then : - - LIB_PATH="lib64" - -else - - LIB_PATH="lib" - -fi - -else - - LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}" - -fi - - # Checks for libraries. ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default" if test "x$ac_cv_header_bzlib_h" = x""yes; then : @@ -6473,7 +6448,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} as_fn_error $? "Unable to find library for openpty and login_tty -See \`config.log'' for more details" "$LINENO" 5 ; } +See \`config.log'' for more details" "$LINENO" 5; } fi saved_LIBS="$LIBS" @@ -7354,7 +7329,7 @@ do "../config/Tools.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools.mk" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target''" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target''" "$LINENO" 5;; esac done @@ -7669,7 +7644,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag''" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag''" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -7697,7 +7672,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f''" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f''" "$LINENO" 5;; esac case $ac_f in *\''*) ac_f=`$as_echo "$ac_f" | sed "s/''/''\\\\\\\\''''/g"`;; esac as_fn_append ac_file_inputs " ''$ac_f''" @@ -7724,7 +7699,7 @@ do case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac diff -r 32034d1914a6 -r deb7e8599e78 tools/configure.ac --- a/tools/configure.ac Thu Jun 07 19:46:57 2012 +0100 +++ b/tools/configure.ac Wed Jun 20 00:40:15 2012 +0000 @@ -26,7 +26,6 @@ m4_include([m4/path_or_fail.m4]) m4_include([m4/python_version.m4]) m4_include([m4/python_devel.m4]) m4_include([m4/ocaml.m4]) -m4_include([m4/default_lib.m4]) m4_include([m4/set_cflags_ldflags.m4]) m4_include([m4/uuid.m4]) m4_include([m4/pkg.m4]) @@ -117,9 +116,6 @@ AX_CHECK_UUID AX_CHECK_CURSES PKG_CHECK_MODULES(glib, glib-2.0) -# Check library path -AX_DEFAULT_LIB - # Checks for libraries. AC_CHECK_HEADER([bzlib.h], [ AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [zlib="$zlib -DHAVE_BZLIB -lbz2"]) diff -r 32034d1914a6 -r deb7e8599e78 tools/libfsimage/Rules.mk --- a/tools/libfsimage/Rules.mk Thu Jun 07 19:46:57 2012 +0100 +++ b/tools/libfsimage/Rules.mk Wed Jun 20 00:40:15 2012 +0000 @@ -1,17 +1,12 @@ 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) diff -r 32034d1914a6 -r deb7e8599e78 tools/libfsimage/common/Makefile --- a/tools/libfsimage/common/Makefile Thu Jun 07 19:46:57 2012 +0100 +++ b/tools/libfsimage/common/Makefile Wed Jun 20 00:40:15 2012 +0000 @@ -1,5 +1,5 @@ XEN_ROOT = $(CURDIR)/../../.. -include $(XEN_ROOT)/tools/Rules.mk +include $(XEN_ROOT)/tools/libfsimage/Rules.mk MAJOR = 1.0 MINOR = 0 diff -r 32034d1914a6 -r deb7e8599e78 tools/libfsimage/common/fsimage_plugin.c --- a/tools/libfsimage/common/fsimage_plugin.c Thu Jun 07 19:46:57 2012 +0100 +++ b/tools/libfsimage/common/fsimage_plugin.c Wed Jun 20 00:40:15 2012 +0000 @@ -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; diff -r 32034d1914a6 -r deb7e8599e78 tools/m4/default_lib.m4 --- a/tools/m4/default_lib.m4 Thu Jun 07 19:46:57 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -AC_DEFUN([AX_DEFAULT_LIB], -[AS_IF([test "\${exec_prefix}/lib" = "$libdir"], - [AS_IF([test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"], - [exec_prefix=$prefix]) - AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix=$ac_default_prefix]) - AS_IF([test -d "${exec_prefix}/lib64"], [ - LIB_PATH="lib64" - ],[ - LIB_PATH="lib" - ]) -], [ - LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}" -]) -AC_SUBST(LIB_PATH)]) diff -r 32034d1914a6 -r deb7e8599e78 tools/m4/pkg.m4 --- a/tools/m4/pkg.m4 Thu Jun 07 19:46:57 2012 +0100 +++ b/tools/m4/pkg.m4 Wed Jun 20 00:40:15 2012 +0000 @@ -26,7 +26,8 @@ # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config''s search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config''s built-in search path]) @@ -72,7 +73,8 @@ m4_define([_PKG_CONFIG], pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried @@ -120,9 +122,9 @@ if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD @@ -135,7 +137,7 @@ if test $pkg_failed = yes; then Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -_PKG_TEXT])dnl +_PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) @@ -146,7 +148,7 @@ path to pkg-config. _PKG_TEXT -To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
Ian Campbell
2012-Jul-05 08:58 UTC
Re: [PATCH v4] tools: honour --libdir when it is passed to ./configure
On Wed, 2012-07-04 at 19:18 +0100, Matt Wilson wrote:> 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. > > The LIBLEAFDIR{,_x86_32,_x86_64} make variables and the LIB_PATH > autoconf substition are no longer used, so this change removes > m4/default_lib.m4 and regenerates configure. m4/pkg.m4 has been > refreshed from pkg-config 0.26 to resolve an error, > "possibly undefined macro: AS_MESSAGE_LOG_FDdnl" when running > autoconf.Was this required due to the removal of default_lib.m4?> Signed-off-by: Matt Wilson <msw@amazon.com>This time I get everything installed in /lib instead of /usr/lib. e.g. dist/install/lib/fs instead of the expected dist/install/usr/lib/fs dist/install/lib/libxenctrl.so and not dist/install/usr/lib/libxenctrl.so etc etc. I suspect this is due to: $ head -n 4 config/Tools.mk # Prefix and install folder PREFIX := /usr exec_prefix := ${prefix} LIBDIR := ${exec_prefix}/lib Note the case of prefix vs PREFIX. AFAICT $PREFIX is completely a Xen-ism while autoconf always uses $prefix. On a hunch I reverted the change to remove m4/default_lib.m4 and this lead to the expected result. I''m going to revert the m4/default_lib.m4 and by extension the m4/pkg.m4 changes and commit the result (after consulting with Ian J to make sure the test system can cope with this change). Please can you resubmit the other bits separately? I suspect the right answer will be to include prefix:=@prefix@ in config/Tools.mk.in, but I''ve not checked that. For reference my test procedure is to do a full "make dist" before and after each time doing: find dist | sort > FILE_LIST.BEFORE (or ....AFTER as appropriate) and then to do diff -u <(sed -e ''s/lib64/lib/'' ../FILE_LIST.BEFORE | sort) ../FILE_LIST.AFTER It''d be useful if you could do something similar as part of your testing. FYI I also tested live migration of PV (booted with pygrub), HVM (w/ qemu in dom0) and HVM (w/ stubdomains) with xl and PV migration and HVM migration with xend. Since pygrub and the various save herlpes are some of the things which have moved around. All seemed fine. Thanks, Ian.> > Changes since v3: > * Correct $(XENFIRMWAREDIR) to point at $(PREFIX)/lib/xen/xen/boot > Reported-by: Ian Campbell <Ian.Campbell@citrix.com> > * Remove (now unneeded) DEFAULT_LIB checks from autoconf > Reported-by: Roger Pau Monne <roger.pau@citrix.com> > * Refresh pkg.m4 from pkg-config 0.26, which contains a fix for > "error: possibly undefined macro: AS_MESSAGE_LOG_FDdnl" error > when rerunning autoconf > * Re-generate configure. > > Changes since v2: > * Drop the #ifndef check for FSIMAGE_FSDIR, let the normal compiler > error provide information that something is wrong. > * Don''t include config/Tools.mk from the top level Config.mk. > * Just assume that libraries specified via EXTRA_PREFIX live in > $(EXTRA_LIB)/lib. EXTRA_PREFIX should probably just go away one day. > > diff -r 32034d1914a6 -r deb7e8599e78 Config.mk > --- a/Config.mk Thu Jun 07 19:46:57 2012 +0100 > +++ b/Config.mk Wed Jun 20 00:40:15 2012 +0000 > @@ -67,7 +67,7 @@ endef > > ifneq ($(EXTRA_PREFIX),) > EXTRA_INCLUDES += $(EXTRA_PREFIX)/include > -EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR) > +EXTRA_LIB += $(EXTRA_PREFIX)/lib > endif > > PYTHON ?= python > diff -r 32034d1914a6 -r deb7e8599e78 config/NetBSD.mk > --- a/config/NetBSD.mk Thu Jun 07 19:46:57 2012 +0100 > +++ b/config/NetBSD.mk Wed Jun 20 00:40:15 2012 +0000 > @@ -1,7 +1,6 @@ > include $(XEN_ROOT)/config/StdGNU.mk > > # Override settings for this OS > -LIBLEAFDIR_x86_64 = lib > LIBEXEC = $(PREFIX)/libexec > PRIVATE_BINDIR = $(BINDIR) > > diff -r 32034d1914a6 -r deb7e8599e78 config/StdGNU.mk > --- a/config/StdGNU.mk Thu Jun 07 19:46:57 2012 +0100 > +++ b/config/StdGNU.mk Wed Jun 20 00:40:15 2012 +0000 > @@ -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 > diff -r 32034d1914a6 -r deb7e8599e78 config/SunOS.mk > --- a/config/SunOS.mk Thu Jun 07 19:46:57 2012 +0100 > +++ b/config/SunOS.mk Wed Jun 20 00:40:15 2012 +0000 > @@ -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 > diff -r 32034d1914a6 -r deb7e8599e78 config/Tools.mk.in > --- a/config/Tools.mk.in Thu Jun 07 19:46:57 2012 +0100 > +++ b/config/Tools.mk.in Wed Jun 20 00:40:15 2012 +0000 > @@ -1,6 +1,7 @@ > # Prefix and install folder > PREFIX := @prefix@ > -LIBLEAFDIR_x86_64 := @LIB_PATH@ > +exec_prefix := @exec_prefix@ > +LIBDIR := @libdir@ > > # A debug build of tools? > debug := @debug@ > diff -r 32034d1914a6 -r deb7e8599e78 config/x86_64.mk > --- a/config/x86_64.mk Thu Jun 07 19:46:57 2012 +0100 > +++ b/config/x86_64.mk Wed Jun 20 00:40:15 2012 +0000 > @@ -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. > diff -r 32034d1914a6 -r deb7e8599e78 tools/configure > --- a/tools/configure Thu Jun 07 19:46:57 2012 +0100 > +++ b/tools/configure Wed Jun 20 00:40:15 2012 +0000 > @@ -606,7 +606,6 @@ libgcrypt > libext2fs > system_aio > zlib > -LIB_PATH > glib_LIBS > glib_CFLAGS > PKG_CONFIG_LIBDIR > @@ -2043,7 +2042,7 @@ do > || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 > $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} > as_fn_error $? "failed to load site script $ac_site_file > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > fi > done > > @@ -2227,8 +2226,6 @@ fi > > > > - > - > # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- > # serial 1 (pkg-config-0.24) > # > @@ -2933,7 +2930,7 @@ fi > test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 > $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} > as_fn_error $? "no acceptable C compiler found in \$PATH > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > > # Provide some information about the compiler. > $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 > @@ -3048,7 +3045,7 @@ sed ''s/^/| /'' conftest.$ac_ext >&5 > { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 > $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} > as_fn_error 77 "C compiler cannot create executables > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > else > { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > $as_echo "yes" >&6; } > @@ -3091,7 +3088,7 @@ else > { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 > $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} > as_fn_error $? "cannot compute suffix of executables: cannot compile and link > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > fi > rm -f conftest conftest$ac_cv_exeext > { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 > @@ -3150,7 +3147,7 @@ eval ac_try_echo="\"\$as_me:${as_lineno- > $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} > as_fn_error $? "cannot run C compiled programs. > If you meant to cross compile, use \`--host''. > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > fi > fi > fi > @@ -3202,7 +3199,7 @@ sed ''s/^/| /'' conftest.$ac_ext >&5 > { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 > $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} > as_fn_error $? "cannot compute suffix of object files: cannot compile > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > fi > rm -f conftest.$ac_cv_objext conftest.$ac_ext > fi > @@ -4950,7 +4947,7 @@ else > { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 > $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} > as_fn_error $? "C preprocessor \"$CPP\" fails sanity check > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > fi > > ac_ext=c > @@ -5839,6 +5836,7 @@ fi > > > > + > if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then > if test -n "$ac_tool_prefix"; then > # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. > @@ -5967,6 +5965,7 @@ if test -n "$glib_CFLAGS"; then > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; then > pkg_cv_glib_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0" 2>/dev/null` > + test "x$?" != "x0" && pkg_failed=yes > else > pkg_failed=yes > fi > @@ -5983,6 +5982,7 @@ if test -n "$glib_LIBS"; then > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; then > pkg_cv_glib_LIBS=`$PKG_CONFIG --libs "glib-2.0" 2>/dev/null` > + test "x$?" != "x0" && pkg_failed=yes > else > pkg_failed=yes > fi > @@ -6002,9 +6002,9 @@ else > _pkg_short_errors_supported=no > fi > if test $_pkg_short_errors_supported = yes; then > - glib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "glib-2.0" 2>&1` > + glib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0" 2>&1` > else > - glib_PKG_ERRORS=`$PKG_CONFIG --print-errors "glib-2.0" 2>&1` > + glib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0" 2>&1` > fi > # Put the nasty error message in config.log where it belongs > echo "$glib_PKG_ERRORS" >&5 > @@ -6033,7 +6033,7 @@ and glib_LIBS to avoid the need to call > See the pkg-config man page for more details. > > To get pkg-config, see <http://pkg-config.freedesktop.org/>. > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > else > glib_CFLAGS=$pkg_cv_glib_CFLAGS > glib_LIBS=$pkg_cv_glib_LIBS > @@ -6042,31 +6042,6 @@ else > > fi > > -# Check library path > -if test "\${exec_prefix}/lib" = "$libdir"; then : > - if test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"; then : > - exec_prefix=$prefix > -fi > - if test "$exec_prefix" = "NONE"; then : > - exec_prefix=$ac_default_prefix > -fi > - if test -d "${exec_prefix}/lib64"; then : > - > - LIB_PATH="lib64" > - > -else > - > - LIB_PATH="lib" > - > -fi > - > -else > - > - LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}" > - > -fi > - > - > # Checks for libraries. > ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default" > if test "x$ac_cv_header_bzlib_h" = x""yes; then : > @@ -6473,7 +6448,7 @@ else > { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd'':" >&5 > $as_echo "$as_me: error: in \`$ac_pwd'':" >&2;} > as_fn_error $? "Unable to find library for openpty and login_tty > -See \`config.log'' for more details" "$LINENO" 5 ; } > +See \`config.log'' for more details" "$LINENO" 5; } > fi > > saved_LIBS="$LIBS" > @@ -7354,7 +7329,7 @@ do > "../config/Tools.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools.mk" ;; > "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; > > - *) as_fn_error $? "invalid argument: \`$ac_config_target''" "$LINENO" 5 ;; > + *) as_fn_error $? "invalid argument: \`$ac_config_target''" "$LINENO" 5;; > esac > done > > @@ -7669,7 +7644,7 @@ do > esac > case $ac_mode$ac_tag in > :[FHL]*:*);; > - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag''" "$LINENO" 5 ;; > + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag''" "$LINENO" 5;; > :[FH]-) ac_tag=-:-;; > :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; > esac > @@ -7697,7 +7672,7 @@ do > [\\/$]*) false;; > *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; > esac || > - as_fn_error 1 "cannot find input file: \`$ac_f''" "$LINENO" 5 ;; > + as_fn_error 1 "cannot find input file: \`$ac_f''" "$LINENO" 5;; > esac > case $ac_f in *\''*) ac_f=`$as_echo "$ac_f" | sed "s/''/''\\\\\\\\''''/g"`;; esac > as_fn_append ac_file_inputs " ''$ac_f''" > @@ -7724,7 +7699,7 @@ do > > case $ac_tag in > *:-:* | *:-) cat >"$tmp/stdin" \ > - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; > + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; > esac > ;; > esac > diff -r 32034d1914a6 -r deb7e8599e78 tools/configure.ac > --- a/tools/configure.ac Thu Jun 07 19:46:57 2012 +0100 > +++ b/tools/configure.ac Wed Jun 20 00:40:15 2012 +0000 > @@ -26,7 +26,6 @@ m4_include([m4/path_or_fail.m4]) > m4_include([m4/python_version.m4]) > m4_include([m4/python_devel.m4]) > m4_include([m4/ocaml.m4]) > -m4_include([m4/default_lib.m4]) > m4_include([m4/set_cflags_ldflags.m4]) > m4_include([m4/uuid.m4]) > m4_include([m4/pkg.m4]) > @@ -117,9 +116,6 @@ AX_CHECK_UUID > AX_CHECK_CURSES > PKG_CHECK_MODULES(glib, glib-2.0) > > -# Check library path > -AX_DEFAULT_LIB > - > # Checks for libraries. > AC_CHECK_HEADER([bzlib.h], [ > AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [zlib="$zlib -DHAVE_BZLIB -lbz2"]) > diff -r 32034d1914a6 -r deb7e8599e78 tools/libfsimage/Rules.mk > --- a/tools/libfsimage/Rules.mk Thu Jun 07 19:46:57 2012 +0100 > +++ b/tools/libfsimage/Rules.mk Wed Jun 20 00:40:15 2012 +0000 > @@ -1,17 +1,12 @@ > 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) > diff -r 32034d1914a6 -r deb7e8599e78 tools/libfsimage/common/Makefile > --- a/tools/libfsimage/common/Makefile Thu Jun 07 19:46:57 2012 +0100 > +++ b/tools/libfsimage/common/Makefile Wed Jun 20 00:40:15 2012 +0000 > @@ -1,5 +1,5 @@ > XEN_ROOT = $(CURDIR)/../../.. > -include $(XEN_ROOT)/tools/Rules.mk > +include $(XEN_ROOT)/tools/libfsimage/Rules.mk > > MAJOR = 1.0 > MINOR = 0 > diff -r 32034d1914a6 -r deb7e8599e78 tools/libfsimage/common/fsimage_plugin.c > --- a/tools/libfsimage/common/fsimage_plugin.c Thu Jun 07 19:46:57 2012 +0100 > +++ b/tools/libfsimage/common/fsimage_plugin.c Wed Jun 20 00:40:15 2012 +0000 > @@ -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; > diff -r 32034d1914a6 -r deb7e8599e78 tools/m4/default_lib.m4 > --- a/tools/m4/default_lib.m4 Thu Jun 07 19:46:57 2012 +0100 > +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 > @@ -1,14 +0,0 @@ > -AC_DEFUN([AX_DEFAULT_LIB], > -[AS_IF([test "\${exec_prefix}/lib" = "$libdir"], > - [AS_IF([test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"], > - [exec_prefix=$prefix]) > - AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix=$ac_default_prefix]) > - AS_IF([test -d "${exec_prefix}/lib64"], [ > - LIB_PATH="lib64" > - ],[ > - LIB_PATH="lib" > - ]) > -], [ > - LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}" > -]) > -AC_SUBST(LIB_PATH)]) > diff -r 32034d1914a6 -r deb7e8599e78 tools/m4/pkg.m4 > --- a/tools/m4/pkg.m4 Thu Jun 07 19:46:57 2012 +0100 > +++ b/tools/m4/pkg.m4 Wed Jun 20 00:40:15 2012 +0000 > @@ -26,7 +26,8 @@ > # ---------------------------------- > AC_DEFUN([PKG_PROG_PKG_CONFIG], > [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) > -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) > +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) > +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) > AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) > AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config''s search path]) > AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config''s built-in search path]) > @@ -72,7 +73,8 @@ m4_define([_PKG_CONFIG], > pkg_cv_[]$1="$$1" > elif test -n "$PKG_CONFIG"; then > PKG_CHECK_EXISTS([$3], > - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], > + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` > + test "x$?" != "x0" && pkg_failed=yes ], > [pkg_failed=yes]) > else > pkg_failed=untried > @@ -120,9 +122,9 @@ if test $pkg_failed = yes; then > AC_MSG_RESULT([no]) > _PKG_SHORT_ERRORS_SUPPORTED > if test $_pkg_short_errors_supported = yes; then > - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` > + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` > else > - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` > + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` > fi > # Put the nasty error message in config.log where it belongs > echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD > @@ -135,7 +137,7 @@ if test $pkg_failed = yes; then > Consider adjusting the PKG_CONFIG_PATH environment variable if you > installed software in a non-standard prefix. > > -_PKG_TEXT])dnl > +_PKG_TEXT])[]dnl > ]) > elif test $pkg_failed = untried; then > AC_MSG_RESULT([no]) > @@ -146,7 +148,7 @@ path to pkg-config. > > _PKG_TEXT > > -To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl > +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl > ]) > else > $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
Roger Pau Monne
2012-Jul-05 09:11 UTC
Re: [PATCH v4] tools: honour --libdir when it is passed to ./configure
Ian Campbell wrote:> On Wed, 2012-07-04 at 19:18 +0100, Matt Wilson wrote: >> 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. >> >> The LIBLEAFDIR{,_x86_32,_x86_64} make variables and the LIB_PATH >> autoconf substition are no longer used, so this change removes >> m4/default_lib.m4 and regenerates configure. m4/pkg.m4 has been >> refreshed from pkg-config 0.26 to resolve an error, >> "possibly undefined macro: AS_MESSAGE_LOG_FDdnl" when running >> autoconf. > > Was this required due to the removal of default_lib.m4? > >> Signed-off-by: Matt Wilson<msw@amazon.com> > > This time I get everything installed in /lib instead of /usr/lib. e.g. > > dist/install/lib/fs instead of the expected dist/install/usr/lib/fs > dist/install/lib/libxenctrl.so and not > dist/install/usr/lib/libxenctrl.so etc etc. > > I suspect this is due to: > > $ head -n 4 config/Tools.mk > # Prefix and install folder > PREFIX := /usr > exec_prefix := ${prefix} > LIBDIR := ${exec_prefix}/lib > > Note the case of prefix vs PREFIX. AFAICT $PREFIX is completely a > Xen-ism while autoconf always uses $prefix.The definitive solution is to convert everything to lowercase, since it''s much more comfortable if we are using autoconf. Anyway this is a 4.3 task.> On a hunch I reverted the change to remove m4/default_lib.m4 and this > lead to the expected result. > > I''m going to revert the m4/default_lib.m4 and by extension the m4/pkg.m4 > changes and commit the result (after consulting with Ian J to make sure > the test system can cope with this change). > > Please can you resubmit the other bits separately? I suspect the right > answer will be to include prefix:=@prefix@ in config/Tools.mk.in, but > I''ve not checked that. > > For reference my test procedure is to do a full "make dist" before and > after each time doing: > find dist | sort> FILE_LIST.BEFORE > (or ....AFTER as appropriate) and then to do > diff -u<(sed -e ''s/lib64/lib/'' ../FILE_LIST.BEFORE | sort) ../FILE_LIST.AFTER > It''d be useful if you could do something similar as part of your > testing. > > FYI I also tested live migration of PV (booted with pygrub), HVM (w/ > qemu in dom0) and HVM (w/ stubdomains) with xl and PV migration and HVM > migration with xend. Since pygrub and the various save herlpes are some > of the things which have moved around. All seemed fine. > > Thanks, > Ian.
Ian Campbell
2012-Jul-05 10:01 UTC
Re: [PATCH v4] tools: honour --libdir when it is passed to ./configure
On Thu, 2012-07-05 at 09:58 +0100, Ian Campbell wrote:> I''m going to revert the m4/default_lib.m4 and by extension the m4/pkg.m4 > changes and commit the result (after consulting with Ian J to make sure > the test system can cope with this change).Having consulted with Ian I have now pushed the following: # HG changeset patch # User Matt Wilson <msw@amazon.com> # Date 1341482428 -3600 # Node ID ad08cd8e7097ec6da6526cf8ac26f0fa72cd1e01 # Parent 7c0351dc41a5123241af27f4cb910b915647193c 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: Matt Wilson <msw@amazon.com> Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Acked-by: Ian 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: Ian Campbell <ian.campbell@citrix.com> diff -r 7c0351dc41a5 -r ad08cd8e7097 Config.mk --- a/Config.mk Wed Jul 04 15:46:17 2012 +0100 +++ b/Config.mk Thu Jul 05 11:00:28 2012 +0100 @@ -67,7 +67,7 @@ endef ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include -EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR) +EXTRA_LIB += $(EXTRA_PREFIX)/lib endif PYTHON ?= python diff -r 7c0351dc41a5 -r ad08cd8e7097 config/NetBSD.mk --- a/config/NetBSD.mk Wed Jul 04 15:46:17 2012 +0100 +++ b/config/NetBSD.mk Thu Jul 05 11:00:28 2012 +0100 @@ -1,7 +1,6 @@ include $(XEN_ROOT)/config/StdGNU.mk # Override settings for this OS -LIBLEAFDIR_x86_64 = lib LIBEXEC = $(PREFIX)/libexec PRIVATE_BINDIR = $(BINDIR) diff -r 7c0351dc41a5 -r ad08cd8e7097 config/StdGNU.mk --- a/config/StdGNU.mk Wed Jul 04 15:46:17 2012 +0100 +++ b/config/StdGNU.mk Thu Jul 05 11:00:28 2012 +0100 @@ -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 diff -r 7c0351dc41a5 -r ad08cd8e7097 config/SunOS.mk --- a/config/SunOS.mk Wed Jul 04 15:46:17 2012 +0100 +++ b/config/SunOS.mk Thu Jul 05 11:00:28 2012 +0100 @@ -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 diff -r 7c0351dc41a5 -r ad08cd8e7097 config/Tools.mk.in --- a/config/Tools.mk.in Wed Jul 04 15:46:17 2012 +0100 +++ b/config/Tools.mk.in Thu Jul 05 11:00:28 2012 +0100 @@ -1,6 +1,7 @@ # Prefix and install folder PREFIX := @prefix@ -LIBLEAFDIR_x86_64 := @LIB_PATH@ +exec_prefix := @exec_prefix@ +LIBDIR := @libdir@ # A debug build of tools? debug := @debug@ diff -r 7c0351dc41a5 -r ad08cd8e7097 config/x86_64.mk --- a/config/x86_64.mk Wed Jul 04 15:46:17 2012 +0100 +++ b/config/x86_64.mk Thu Jul 05 11:00:28 2012 +0100 @@ -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. diff -r 7c0351dc41a5 -r ad08cd8e7097 tools/libfsimage/Rules.mk --- a/tools/libfsimage/Rules.mk Wed Jul 04 15:46:17 2012 +0100 +++ b/tools/libfsimage/Rules.mk Thu Jul 05 11:00:28 2012 +0100 @@ -1,17 +1,12 @@ 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) diff -r 7c0351dc41a5 -r ad08cd8e7097 tools/libfsimage/common/Makefile --- a/tools/libfsimage/common/Makefile Wed Jul 04 15:46:17 2012 +0100 +++ b/tools/libfsimage/common/Makefile Thu Jul 05 11:00:28 2012 +0100 @@ -1,5 +1,5 @@ XEN_ROOT = $(CURDIR)/../../.. -include $(XEN_ROOT)/tools/Rules.mk +include $(XEN_ROOT)/tools/libfsimage/Rules.mk MAJOR = 1.0 MINOR = 0 diff -r 7c0351dc41a5 -r ad08cd8e7097 tools/libfsimage/common/fsimage_plugin.c --- a/tools/libfsimage/common/fsimage_plugin.c Wed Jul 04 15:46:17 2012 +0100 +++ b/tools/libfsimage/common/fsimage_plugin.c Thu Jul 05 11:00:28 2012 +0100 @@ -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;
Matt Wilson
2012-Jul-05 17:05 UTC
Re: [PATCH v4] tools: honour --libdir when it is passed to ./configure
On Thu, Jul 05, 2012 at 03:01:41AM -0700, Ian Campbell wrote:> On Thu, 2012-07-05 at 09:58 +0100, Ian Campbell wrote: > > I''m going to revert the m4/default_lib.m4 and by extension the m4/pkg.m4 > > changes and commit the result (after consulting with Ian J to make sure > > the test system can cope with this change). > > Having consulted with Ian I have now pushed the following:Thanks for fixing this up, and for all the iterations on what should have been a simple change. Matt> # HG changeset patch > # User Matt Wilson <msw@amazon.com> > # Date 1341482428 -3600 > # Node ID ad08cd8e7097ec6da6526cf8ac26f0fa72cd1e01 > # Parent 7c0351dc41a5123241af27f4cb910b915647193c > 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: Matt Wilson <msw@amazon.com> > Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com> > Acked-by: Ian 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 ]