diff --git a/config/kernel.m4 b/config/kernel.m4 index 1adec975c0..b918f04534 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -601,9 +601,15 @@ dnl # dnl # Used internally by ZFS_LINUX_TEST_{COMPILE,MODPOST} dnl # AC_DEFUN([ZFS_LINUX_COMPILE], [ + AC_ARG_VAR([KERNEL_CC], [C compiler for + building kernel modules]) + AC_ARG_VAR([KERNEL_LD], [Linker for + building kernel modules]) + AC_ARG_VAR([KERNEL_LLVM], [Binary option to + build kernel modules with LLVM/CLANG toolchain]) AC_TRY_COMMAND([ KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6" - make modules -k -j$TEST_JOBS -C $LINUX_OBJ $ARCH_UM + make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC} ${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM} -C $LINUX_OBJ $ARCH_UM M=$PWD/$1 >$1/build.log 2>&1]) AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4]) ]) diff --git a/module/Makefile.in b/module/Makefile.in index 9cd075e685..b6338430e8 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -52,7 +52,9 @@ FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS) modules-Linux: list='$(SUBDIR_TARGETS)'; for td in $$list; do $(MAKE) -C $$td; done - $(MAKE) -C @LINUX_OBJ@ M="$$PWD" @KERNEL_MAKE@ CONFIG_ZFS=m modules + $(MAKE) -C @LINUX_OBJ@ $(if @KERNEL_CC@,CC=@KERNEL_CC@) \ + $(if @KERNEL_LD@,LD=@KERNEL_LD@) $(if @KERNEL_LLVM@,LLVM=@KERNEL_LLVM@) \ + M="$$PWD" @KERNEL_MAKE@ CONFIG_ZFS=m modules modules-FreeBSD: +$(FMAKE)