Given a package that uses autoconf (a configure script) to provide both a user-mode application and a kernel driver, with a directory structure like this:
configure.ac
configure
Makefile.am
user
    Makefile.am
    user.c
driver
    Makefile.am
    Kbuild.in
    driver.c
This successfully configures and builds both user and driver when configured locally (run ./configure --options).
However a useful feature of configure scripts is that you can have a separate source and build directory, simply by running the script from the build directory, eg:
mkdir build && cd build && ../configure --options
This works fine for the user app, but I'm having trouble getting the kernel driver to build in this context.  In the driver's Makefile.am I have the following, as suggested in this answer:
modules:
    $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_builddir@" src="@abs_srcdir@" modules
But this fails to compile, as it's expecting the Kbuild or Makefile to be in src, but they're actually in M.  Omitting src does let it find the Kbuild but it then fails to find the actual source files (no rule to make target //path/in/build//driver.o).
Using O= as some other answers suggest is not correct, as this specifies the path to find the kernel's output files (.config etc) and these are still in the LINUX_SOURCE_DIR.  (So trying to use it results in various other missing-file errors.)
I'm hoping for a solution that doesn't require modifying any actual Kbuild scripts, since those are outside my package's control.
Thus far the best option I've come up with is to copy/link all the module source files into the build directory before calling Kbuild, which is not ideal. I'm hoping there's a hidden setting that can be used for this.