diff -urNp kmod-2_orig/configure kmod-2/configure --- kmod-2_orig/configure 2011-12-20 20:48:00.170160687 -0500 +++ kmod-2/configure 2011-12-23 12:59:38.968930925 -0500 @@ -621,6 +621,7 @@ required_private_libs zlib_libs BUILD_TOOLS_FALSE BUILD_TOOLS_TRUE +rootlibdir rootprefix OTOOL64 OTOOL @@ -745,6 +746,7 @@ with_gnu_ld with_sysroot enable_libtool_lock with_rootprefix +with_rootlibdir enable_tools enable_logging enable_zlib @@ -1405,6 +1407,7 @@ Optional Packages: (or the compiler's sysroot if not specified). --with-rootprefix=DIR rootfs directory prefix for config files and kernel modules + --with-rootlibdir=DIR rootfs directory to install shared libraries Some influential environment variables: CC C compiler command @@ -13233,6 +13236,17 @@ fi rootprefix=$with_rootprefix + +# Check whether --with-rootlibdir was given. +if test "${with_rootlibdir+set}" = set; then : + withval=$with_rootlibdir; +else + with_rootlibdir=$libdir +fi + +rootlibdir=$with_rootlibdir + + # Check whether --enable-tools was given. if test "${enable_tools+set}" = set; then : enableval=$enable_tools; @@ -15828,6 +15842,7 @@ fi rootprefix: ${rootprefix} sysconfdir: ${sysconfdir} libdir: ${libdir} + rootlibdir: ${rootlibdir} includedir: ${includedir} bindir: ${bindir} @@ -15848,6 +15863,7 @@ $as_echo " rootprefix: ${rootprefix} sysconfdir: ${sysconfdir} libdir: ${libdir} + rootlibdir: ${rootlibdir} includedir: ${includedir} bindir: ${bindir} diff -urNp kmod-2_orig/configure.ac kmod-2/configure.ac --- kmod-2_orig/configure.ac 2011-12-20 20:36:37.036701029 -0500 +++ kmod-2/configure.ac 2011-12-23 12:59:39.035936076 -0500 @@ -32,6 +32,11 @@ AC_ARG_WITH([rootprefix], [], [with_rootprefix=""]) AC_SUBST([rootprefix], [$with_rootprefix]) +AC_ARG_WITH([rootlibdir], + AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), + [], [with_rootlibdir=$libdir]) +AC_SUBST([rootlibdir], [$with_rootlibdir]) + AC_ARG_ENABLE([tools], AS_HELP_STRING([--disable-tools], [disable building tools that provide same functionality as module-init-tools @<:@default=enabled@:>@]), [], enable_tools=yes) @@ -134,6 +139,7 @@ AC_MSG_RESULT([ rootprefix: ${rootprefix} sysconfdir: ${sysconfdir} libdir: ${libdir} + rootlibdir: ${rootlibdir} includedir: ${includedir} bindir: ${bindir} diff -urNp kmod-2_orig/Makefile.am kmod-2/Makefile.am --- kmod-2_orig/Makefile.am 2011-12-20 20:36:21.337897292 -0500 +++ kmod-2/Makefile.am 2011-12-23 12:59:39.036936153 -0500 @@ -53,6 +53,18 @@ libkmod_libkmod_la_LIBADD = @zlib_libs@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libkmod/libkmod.pc +install-exec-hook: + if test "$(libdir)" != "$(rootlibdir)"; then \ + mkdir -p $(DESTDIR)$(rootlibdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libkmod.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \ + mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \ + fi + +uninstall-hook: + rm -f $(DESTDIR)$(rootlibdir)/libkmod.so* + if BUILD_TOOLS bin_PROGRAMS = tools/kmod-insmod tools/kmod-rmmod tools/kmod-lsmod \ tools/kmod-modprobe tools/kmod-modinfo diff -urNp kmod-2_orig/Makefile.in kmod-2/Makefile.in --- kmod-2_orig/Makefile.in 2011-12-20 20:47:59.649167201 -0500 +++ kmod-2/Makefile.in 2011-12-23 13:00:18.694985405 -0500 @@ -322,6 +322,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ required_private_libs = @required_private_libs@ +rootlibdir = @rootlibdir@ rootprefix = @rootprefix@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ @@ -1174,7 +1175,8 @@ install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-libLTLIBRARIES - + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: @@ -1217,8 +1219,10 @@ ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ uninstall-libLTLIBRARIES uninstall-pkgconfigDATA - -.MAKE: all check-am install-am install-strip + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-hook +.MAKE: all check-am install-am install-exec-am install-strip \ + uninstall-am .PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ @@ -1230,7 +1234,7 @@ uninstall-am: uninstall-binPROGRAMS unin distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am \ + install-exec-am install-exec-hook install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-pkgconfigDATA install-ps install-ps-am install-strip \ @@ -1238,9 +1242,21 @@ uninstall-am: uninstall-binPROGRAMS unin maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-includeHEADERS uninstall-libLTLIBRARIES \ - uninstall-pkgconfigDATA + uninstall-hook uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA + + +install-exec-hook: + if test "$(libdir)" != "$(rootlibdir)"; then \ + mkdir -p $(DESTDIR)$(rootlibdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libkmod.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libkmod.so && \ + mv $(DESTDIR)$(libdir)/libkmod.so.* $(DESTDIR)$(rootlibdir); \ + fi +uninstall-hook: + rm -f $(DESTDIR)$(rootlibdir)/libkmod.so* # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded.