From 544a81063c37b9387a7ecb2ee06c2624728eecdd Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 16 Oct 2014 12:05:43 +0200 Subject: [PATCH] Makefile.am: look for ioctl definitions in the kernel build tree by default While most of ioctl-related kernel headers are now exported by kernel's headers_install, some are still modules_install only. The kernel's headers installed into /usr/include/ are usually headers_install'ed and therefore don't contain some internal headers we need. The solution is to look for modules_install'ed headers for the running kernel, and fall back to old behavior if they aren't found. Signed-off-by: Lubomir Rintel Signed-off-by: Dmitry V. Levin --- Makefile.am | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index fd363656..5f98cd63 100644 --- a/Makefile.am +++ b/Makefile.am @@ -288,9 +288,16 @@ $(srcdir)/CREDITS: $(srcdir)/CREDITS.in $(srcdir)/.mailmap \ export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner --mode=go-w,go+rX -IOCTLDIR = /usr/include -IOCTLASM = asm -IOCTLSORT_INCLUDEDIR = $(IOCTLDIR) +INCLUDEDIR = /usr/include +KERNEL_RELEASE = $(shell uname -r) +# Candidates for the kernel headers tree. +KERNEL_INCLUDE = \ + /lib/modules/$(KERNEL_RELEASE)/build/include \ + /usr/src/linux-$(KERNEL_RELEASE)/include \ + $(INCLUDEDIR) +IOCTLDIR = $(shell find $(KERNEL_INCLUDE) -maxdepth 0 -type d -print -quit 2>/dev/null) +IOCTLASM = $(INCLUDEDIR)/asm +IOCTLSORT_INCLUDEDIR = $(INCLUDEDIR) ioctlent_h_in = linux/ioctlent.h.in -- 2.40.0