configure: Download aspeed-lpc-ctrl.h if not present
However, don't download it if the file is already present in the local
directory. The AC_CHECK_HEADER macro can't test this case, so the
condition will always trigger if the header isn't installed on the
system.
Change-Id: I7de8ff24823fe2ce54add9a33125cee5ad0b53f0
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/configure.ac b/configure.ac
index c4f778f..68148a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,8 +14,9 @@
# Checks for header files.
AC_CHECK_HEADER(linux/aspeed-lpc-ctrl.h,[HAVE_UAPI_LINUX_LPC_CTRL_H=""],[HAVE_UAPI_LINUX_LPC_CTRL_H="-I linux/aspeed-lpc-ctrl.h"])
-AS_IF([test "$HAVE_UAPI_LINUX_LPC_CTRL_H" = ""],
- AC_MSG_WARN([Could not find linux/aspeed-lpc-ctrl.h])
+AS_IF([test "$HAVE_UAPI_LINUX_LPC_CTRL_H" != ""],
+ AC_MSG_WARN([Could not find linux/aspeed-lpc-ctrl.h: Attempting to download locally for building from https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/plain/include/uapi/linux/aspeed-lpc-ctrl.h?h=char-misc-next])
+ AC_SUBST([BT_BMC_DL],[`test ! -f linux/aspeed-lpc-ctrl.h && mkdir -p linux && wget --quiet https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/plain/include/uapi/linux/aspeed-lpc-ctrl.h?h=char-misc-next -O linux/aspeed-lpc-ctrl.h`])
)
# Checks for typedefs, structures, and compiler characteristics.