summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorRichard Yao <ryao@gentoo.org>2012-11-19 11:49:42 -0500
committerRichard Yao <ryao@cs.stonybrook.edu>2012-11-23 01:55:28 -0500
commitc4d1ce9b754e6eed60d2625cc4fff224898aa5d5 (patch)
treeb49d37e4dd0fc0c69686abf5c18ed8eb11369011 /configure.ac
parent135d61df6f66d0c0e67aec62f76ee7f2a409a3ce (diff)
Use libkmod only when requested
We support module loading through modprobe when libkmod is neither available nor wanted. Signed-off-by: Richard Yao <ryao@gentoo.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac29
1 files changed, 28 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 822a53044b..489733c94f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,6 @@ if test -z "$GPERF" ; then
AC_MSG_ERROR([*** gperf not found])
fi
-PKG_CHECK_MODULES(KMOD, [libkmod >= 5])
PKG_CHECK_MODULES(BLKID,[blkid >= 2.20])
# Checks for header files.
@@ -278,6 +277,34 @@ AC_SUBST([udevlibexecdir], [${with_rootlibdir}/udev])
# ------------------------------------------------------------------------------
+AC_ARG_ENABLE([libkmod], [AS_HELP_STRING([--enable-libkmod], [Enable module loading through kmod @<:@default=disabled@:>@])], [], [with_libkmod=no])
+
+LIBKMOD=
+AS_IF([test "x$with_libkmod" != xno],
+ [AC_CHECK_LIB([kmod], [main],
+ [PKG_CHECK_MODULES(KMOD, [libkmod >= 5])
+ AC_SUBST([LIBKMOD], ["-lkmod"])
+ AC_DEFINE([HAVE_LIBKMOD], [1],
+ [Define if you have libkmod])
+ ],
+ [AC_MSG_FAILURE(
+ [--with-libkmod was given, but test for kmod failed])],
+ [-lkmod])])
+
+AM_CONDITIONAL([HAVE_LIBKMOD], [test "$with_kmod" = "yes"])
+
+# ------------------------------------------------------------------------------
+
+AC_ARG_WITH([modprobe],
+ [AS_HELP_STRING([--with-modprobe=modprobe],
+ [specify location of modprobe when -- @<:@default=$sbindir/modprobe@:>@])],
+ [],
+ [with_modprobe="${sbindir}/modprobe"])
+
+AC_SUBST([MODPROBE], ["${with_modprobe}"])
+
+# ------------------------------------------------------------------------------
+
AC_CONFIG_FILES([Makefile
docs/Makefile
docs/gudev/Makefile