diff --git a/Kbuild.in b/Kbuild.in index 4cc9eb9f..c6469ce7 100644 --- a/Kbuild.in +++ b/Kbuild.in @@ -21,7 +21,11 @@ # #----------------------------------------------------------------------------- -obj-m := examples/ master/ devices/ +obj-m := master/ devices/ + +ifeq (@ENABLE_EXAMPLES@,1) + obj-m += examples/ +endif ifeq (@ENABLE_TTY@,1) obj-m += tty/ diff --git a/configure.ac b/configure.ac index b7d63911..42099e74 100644 --- a/configure.ac +++ b/configure.ac @@ -1209,6 +1209,37 @@ fi AM_CONDITIONAL(ENABLE_FAKEUSERLIB, test "x$fakeuserlib" = "x1") +#----------------------------------------------------------------------------- +# example programs +#----------------------------------------------------------------------------- + +AC_MSG_CHECKING([whether to build the examples]) + +AC_ARG_ENABLE([examples], + AS_HELP_STRING([--enable-examples], + [Generation of example modules (default: yes)]), + [ + case "${enableval}" in + yes) examples=1 + ;; + no) examples=0 + ;; + *) AC_MSG_ERROR([Invalid value for --enable-examples]) + ;; + esac + ], + [examples=1] +) + +if test "x${examples}" = "x1"; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +AM_CONDITIONAL(ENABLE_EXAMPLES, test "x$examples" = "x1") +AC_SUBST(ENABLE_EXAMPLES,[$examples]) + #----------------------------------------------------------------------------- # TTY driver #-----------------------------------------------------------------------------