Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add --with-rootprefix and proper kmod detection

  • Loading branch information...
commit 6d9c026a441f969ea59d8371c31253db5614ecbd 1 parent c3f521c
@falconindy authored
Showing with 13 additions and 15 deletions.
  1. +5 −1 Makefile.am
  2. +7 −13 configure.ac
  3. +1 −1  src/modtree.c
View
6 Makefile.am
@@ -7,6 +7,7 @@ AM_CPPFLAGS = \
-imacros $(top_builddir)/config.h \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
+ -DROOTPREFIX=\""$(rootprefix)"\" \
-I${top_srcdir}/src
AM_CFLAGS = ${my_CFLAGS} \
@@ -37,7 +38,10 @@ src_modtree_SOURCES = \
src/tt.c src/tt.h \
src/widechar.h
+src_modtree_CFLAGS = \
+ $(KMOD_CFLAGS)
+
src_modtree_LDFLAGS = \
- -lkmod
+ $(KMOD_LIBS)
bin_PROGRAMS = src/modtree
View
20 configure.ac
@@ -22,6 +22,8 @@ AC_CHECK_HEADERS([ \
sys/ioctl.h
])
+PKG_CHECK_MODULES(KMOD, [ libkmod >= 5 ])
+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <wchar.h>
#include <wctype.h>
@@ -37,19 +39,10 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
[AC_DEFINE(HAVE_WIDECHAR, 1, Do we have wide character support?)
])
-#AC_ARG_ENABLE([logging],
-# AS_HELP_STRING([--disable-nls], [disable system logging @<:@default=enabled@:>@]),
-# [], enable_logging=yes)
-#AS_IF([test "x$enable_logging" = "xyes"], [
-# AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
-#])
-
-#AC_ARG_ENABLE([debug],
-# AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
-# [], [enable_debug=no])
-#AS_IF([test "x$enable_debug" = "xyes"], [
-# AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
-#])
+AC_ARG_WITH([rootprefix],
+ AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
+ [], [with_rootprefix=""])
+AC_SUBST([rootprefix], [$with_rootprefix])
my_CFLAGS="-Wall \
-Wmissing-declarations -Wmissing-prototypes \
@@ -70,6 +63,7 @@ AC_MSG_RESULT([
=====
prefix: ${prefix}
+ rootprefix ${rootprefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
includedir: ${includedir}
View
2  src/modtree.c
@@ -312,7 +312,7 @@ int main(int argc, char *argv[])
err(EXIT_FAILURE, "failed to get current kernel name");
kver = u.release;
}
- snprintf(kdir_buf, sizeof(kdir_buf), "/lib/modules/%s", kver);
+ snprintf(kdir_buf, sizeof(kdir_buf), ROOTPREFIX "/lib/modules/%s", kver);
kmod = kmod_new(kdir_buf, NULL);
if (kmod == NULL) {
Please sign in to comment.
Something went wrong with that request. Please try again.