diff options
author | Richard Yao <ryao@gentoo.org> | 2012-11-23 00:20:15 -0500 |
---|---|---|
committer | Richard Yao <ryao@cs.stonybrook.edu> | 2012-11-23 01:55:28 -0500 |
commit | 3bb4e05ce4a1c9ac1339b451c4c18cfef8bcbeb9 (patch) | |
tree | 2acd2e37eae53b80ed9b933fee254772246eb4ef /configure.ac | |
parent | c4d1ce9b754e6eed60d2625cc4fff224898aa5d5 (diff) |
Permit users to disable module loading support
Inspired by e30431623a7d871da123cc37055ac49abf2c20ea from systemd.
Signed-off-by: Richard Yao <ryao@gentoo.org>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index 489733c94f..73e82a947b 100644 --- a/configure.ac +++ b/configure.ac @@ -275,23 +275,33 @@ AC_SUBST([rootprefix], [$with_rootprefix]) AC_SUBST([rootlibdir], [$with_rootlibdir]) 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_ENABLE([modules], [AS_HELP_STRING([--disable-modules], [Disable loadable module support @<:@default=enabled@:>@])], [have_modules=no], [have_modules=yes]) +AC_ARG_ENABLE([libkmod], [AS_HELP_STRING([--enable-libkmod], [Enable module loading through kmod @<:@default=disabled@:>@])], [have_libkmod=yes], [have_libkmod=no]) + +if test "x$have_modules" == "xyes"; then + + AC_DEFINE([HAVE_MODULES], [1], [Define if we support loading modules]) + + AS_IF([test "x$have_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])]) + +fi + +AM_CONDITIONAL([HAVE_MODULES], [test "x$have_modules" == "xyes"]) +AM_CONDITIONAL([HAVE_LIBKMOD], [test "x$have_libkmod" == "xyes"]) + # ------------------------------------------------------------------------------ |