Whamcloud - gitweb
LU-8389 kernel: kernel update RHEL6.8 [2.6.32-642.3.1.el6]
[fs/lustre-release.git] / config / lustre-build-linux.m4
1 #
2 # LB_LINUX_VERSION
3 #
4 # Set things accordingly for a linux kernel
5 #
6 AC_DEFUN([LB_LINUX_VERSION], [
7 KMODEXT=".ko"
8 AC_SUBST(KMODEXT)
9
10 makerule="$PWD/build"
11 AC_CACHE_CHECK([for external module build target], lb_cv_module_target, [
12 lb_cv_module_target=""
13 MODULE_TARGET="SUBDIRS"
14 rm -f build/conftest.i
15 LB_LINUX_TRY_MAKE([], [],
16         [$makerule LUSTRE_KERNEL_TEST=conftest.i],
17         [test -s build/conftest.i],
18         [lb_cv_module_target="SUBDIRS"], [
19                 MODULE_TARGET="M"
20                 makerule="_module_$PWD/build"
21                 LB_LINUX_TRY_MAKE([], [],
22                         [$makerule LUSTRE_KERNEL_TEST=conftest.i],
23                         [test -s build/conftest.i],
24                         [lb_cv_module_target="M"], [
25                                 AC_MSG_ERROR([unknown; check config.log for details])
26                         ])
27         ])
28 ])
29 AS_IF([test -z "$lb_cv_module_target"],
30         [AC_MSG_ERROR([unknown external module build target])],
31 [test "x$lb_cv_module_target" = "xM"],
32         [makerule="_module_$PWD/build"])
33 MODULE_TARGET=$lb_cv_module_target
34 AC_SUBST(MODULE_TARGET)
35 ])
36
37 #
38 # LB_LINUX_UTSRELEASE
39 #
40 # Determine the Linux kernel version string from the utsrelease
41 #
42 AC_DEFUN([LB_LINUX_UTSRELEASE], [
43 AC_CACHE_CHECK([for Linux kernel utsrelease], lb_cv_utsrelease, [
44 lb_cv_utsrelease=""
45 utsrelease1=$LINUX_OBJ/include/generated/utsrelease.h
46 utsrelease2=$LINUX_OBJ/include/linux/utsrelease.h
47 utsrelease3=$LINUX_OBJ/include/linux/version.h
48 AS_IF([test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1],
49         [utsrelease=$utsrelease1],
50 [test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2],
51         [utsrelease=$utsrelease2],
52 [test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3],
53         [utsrelease=$utsrelease3])
54 AS_IF([test -n "$utsrelease"],
55         [lb_cv_utsrelease=$(awk -F \" '/ UTS_RELEASE / { print [$]2 }' $utsrelease)],
56         [AC_MSG_ERROR([
57
58 Cannot find UTS_RELEASE definition.
59
60 This is often provided by the kernel-devel package.
61 ])
62         ])
63 ])
64 AS_IF([test -z "$lb_cv_utsrelease"],
65         [AC_MSG_ERROR([Cannot determine Linux kernel version.])])
66 LINUXRELEASE=$lb_cv_utsrelease
67 AC_SUBST(LINUXRELEASE)
68 ])
69
70 #
71 # LB_LINUX_RELEASE
72 #
73 # get the release version of linux
74 #
75 AC_DEFUN([LB_LINUX_RELEASE], [
76 LB_LINUX_UTSRELEASE
77
78 # check if the kernel is one from RHEL or SUSE
79 AC_CACHE_CHECK([for RedHat kernel release number], lb_cv_rhel_kernel_version, [
80 lb_cv_rhel_kernel_version=""
81 AS_IF([fgrep -q RHEL_RELEASE $LINUX_OBJ/include/$VERSION_HDIR/version.h], [
82         lb_cv_rhel_kernel_version=$(awk '/ RHEL_MAJOR / { print [$]3 }' \
83                 $LINUX_OBJ/include/$VERSION_HDIR/version.h)$(awk \
84                 '/ RHEL_MINOR / { print [$]3 }' \
85                 $LINUX_OBJ/include/$VERSION_HDIR/version.h)
86 ])
87 ])
88 AS_IF([test -n "$lb_cv_rhel_kernel_version"], [
89         RHEL_KERNEL="yes"
90         RHEL_RELEASE_NO=$lb_cv_rhel_kernel_version
91 ], [
92         RHEL_KERNEL="no"
93         LB_CHECK_CONFIG([SUSE_KERNEL], [SUSE_KERNEL="yes"], [SUSE_KERNEL="no"])
94 ])
95
96 AC_MSG_CHECKING([for Linux kernel module package directory])
97 AC_ARG_WITH([kmp-moddir],
98         AC_HELP_STRING([--with-kmp-moddir=string],
99                 [set the kmod updates or extra directory]),
100         [KMP_MODDIR=$withval
101          IN_KERNEL=''],[
102         AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra/kernel"],
103               [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates/kernel"])
104         IN_KERNEL="${PACKAGE}"])
105 AC_MSG_RESULT($KMP_MODDIR)
106
107 moduledir="/lib/modules/${LINUXRELEASE}/${KMP_MODDIR}"
108
109 modulefsdir="${moduledir}/fs/${IN_KERNEL}"
110 AC_SUBST(modulefsdir)
111
112 modulenetdir="${moduledir}/net/${IN_KERNEL}"
113 AC_SUBST(modulenetdir)
114 ])
115
116 #
117 # LB_LINUX_SYMVERFILE
118 #
119 # SLES 9 uses a different name for this file - unsure about vanilla kernels
120 # around this version, but it matters for servers only.
121 AC_DEFUN([LB_LINUX_SYMVERFILE], [
122 AC_CACHE_CHECK([for the name of module symbol version file], lb_cv_module_symvers, [
123 AS_IF([grep -q Modules.symvers $LINUX/scripts/Makefile.modpost],
124         [lb_cv_module_symvers=Modules.symvers],
125         [lb_cv_module_symvers=Module.symvers])
126 ])
127 SYMVERFILE=$lb_cv_module_symvers
128 AC_SUBST(SYMVERFILE)
129 ])
130
131 #
132 # LB_ARG_REPLACE_PATH(PACKAGE, PATH)
133 #
134 AC_DEFUN([LB_ARG_REPLACE_PATH], [
135 new_configure_args=
136 eval set -- $ac_configure_args
137 for arg; do
138         case $arg in
139                 --with-[$1]=*)
140                         arg=--with-[$1]=[$2] ;;
141                 *\'*)
142                         arg=$(printf %s\n ["$arg"] | sed "s/'/'\\\\\\\\''/g") ;;
143         esac
144         dnl AS_VAR_APPEND([new_configure_args], [" '$arg'"])
145         new_configure_args="$new_configure_args '$arg'"
146 done
147 ac_configure_args=$new_configure_args
148 ])
149
150 #
151 # __LB_ARG_CANON_PATH
152 #
153 # this is the work-horse of the next function
154 #
155 AC_DEFUN([__LB_ARG_CANON_PATH], [
156         [$3]=$(readlink -f $with_$2)
157         LB_ARG_REPLACE_PATH([$1], $[$3])
158 ])
159
160 #
161 # LB_ARG_CANON_PATH
162 #
163 # a front-end for the above function that transforms - and . in the
164 # PACKAGE portion of --with-PACKAGE into _ suitable for variable names
165 #
166 AC_DEFUN([LB_ARG_CANON_PATH], [
167         __LB_ARG_CANON_PATH([$1], m4_translit([$1], [-.], [__]), [$2])
168 ])
169
170 #
171 # LB_LINUX_PATH
172 #
173 # Find paths for linux, handling kernel-source rpms
174 #
175 AC_DEFUN([LB_LINUX_PATH], [
176 for DEFAULT_LINUX in /lib/modules/$(uname -r)/{source,build} /usr/src/linux; do
177         AS_IF([readlink -q -e $DEFAULT_LINUX >/dev/null], [break])
178 done
179 if test "$DEFAULT_LINUX" = "/lib/modules/$(uname -r)/source"; then
180         PATHS="/lib/modules/$(uname -r)/build"
181 fi
182 PATHS+=" $DEFAULT_LINUX"
183 for DEFAULT_LINUX_OBJ in $PATHS; do
184         AS_IF([readlink -q -e $DEFAULT_LINUX_OBJ >/dev/null], [break])
185 done
186
187 AC_MSG_CHECKING([for Linux sources])
188 AC_ARG_WITH([linux],
189         AC_HELP_STRING([--with-linux=path],
190                        [set path to Linux source (default=/lib/modules/$(uname -r)/{source,build},/usr/src/linux)]),
191         [LB_ARG_CANON_PATH([linux], [LINUX])
192         DEFAULT_LINUX_OBJ=$LINUX],
193         [LINUX=$DEFAULT_LINUX])
194 AC_MSG_RESULT([$LINUX])
195 AC_SUBST(LINUX)
196
197 # -------- check for linux --------
198 LB_CHECK_FILE([$LINUX], [],
199         [AC_MSG_ERROR([Kernel source $LINUX could not be found.])])
200
201 # -------- linux objects (for 2.6) --
202 AC_MSG_CHECKING([for Linux objects])
203 AC_ARG_WITH([linux-obj],
204         AC_HELP_STRING([--with-linux-obj=path],
205                         [set path to Linux objects (default=/lib/modules/$(uname -r)/build,/usr/src/linux)]),
206         [LB_ARG_CANON_PATH([linux-obj], [LINUX_OBJ])],
207         [LINUX_OBJ=$DEFAULT_LINUX_OBJ])
208 AC_MSG_RESULT([$LINUX_OBJ])
209 AC_SUBST(LINUX_OBJ)
210
211 # -------- check for .config --------
212 AC_ARG_WITH([linux-config],
213         [AC_HELP_STRING([--with-linux-config=path],
214                         [set path to Linux .conf (default=$LINUX_OBJ/.config)])],
215         [LB_ARG_CANON_PATH([linux-config], [LINUX_CONFIG])],
216         [LINUX_CONFIG=$LINUX_OBJ/.config])
217
218 # -------- check if .config exists --
219 LB_CHECK_FILE([$LINUX_CONFIG], [],
220         [AC_MSG_ERROR([
221
222 Kernel config could not be found.
223
224 If you are building from a kernel-source rpm consult build/README.kernel-source
225 ])
226 ])
227 AC_SUBST(LINUX_CONFIG)
228
229 LB_CHECK_FILE([/boot/kernel.h],
230         [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
231         [LB_CHECK_FILE([/var/adm/running-kernel.h],
232                 [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h'])])
233
234 AC_ARG_WITH([kernel-source-header],
235         AC_HELP_STRING([--with-kernel-source-header=path],
236                         [Use a different kernel version header.  Consult build/README.kernel-source for details.]),
237         [LB_ARG_CANON_PATH([kernel-source-header], [KERNEL_SOURCE_HEADER])])
238
239 # ----------- make dep run? ------------------
240 # at 2.6.19 # $LINUX/include/linux/config.h is removed
241 # and at more old has only one line include <autoconf.h>
242 #
243 LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],
244         [AUTOCONF_HDIR=generated],
245         [LB_CHECK_FILE([$LINUX_OBJ/include/linux/autoconf.h],
246                 [AUTOCONF_HDIR=linux],
247                 [AC_MSG_ERROR([Run make config in $LINUX.])])])
248 AC_SUBST(AUTOCONF_HDIR)
249
250 LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h],
251         [VERSION_HDIR=linux],
252         [LB_CHECK_FILE([$LINUX_OBJ/include/generated/uapi/linux/version.h],
253                 [VERSION_HDIR=generated/uapi/linux],
254                 [AC_MSG_ERROR([Run make config in $LINUX.])])])
255 AC_SUBST(VERSION_HDIR)
256
257 # ----------- kconfig.h exists ---------------
258 # kernel 3.1, $LINUX/include/linux/kconfig.h is added
259 # see kernel commit 2a11c8ea20bf850b3a2c60db8c2e7497d28aba99
260 #
261 LB_CHECK_FILE([$LINUX/include/linux/kconfig.h],
262               [CONFIG_INCLUDE=$LINUX/include/linux/kconfig.h],
263               [CONFIG_INCLUDE=include/$AUTOCONF_HDIR/autoconf.h])
264 AC_SUBST(CONFIG_INCLUDE)
265
266 # ------------ rhconfig.h includes runtime-generated bits --
267 # RedHat kernel-source checks
268
269 # we know this exists after the check above.  if the user
270 # tarred up the tree and ran make dep etc. in it, then
271 # version.h gets overwritten with a standard linux one.
272
273 AS_IF([grep rhconfig $LINUX_OBJ/include/$VERSION_HDIR/version.h >/dev/null], [
274         # This is a clean kernel-source tree, we need to
275         # enable extensive workarounds to get this to build modules
276         LB_CHECK_FILE([$KERNEL_SOURCE_HEADER], [
277                 AS_IF([test $KERNEL_SOURCE_HEADER = '/boot/kernel.h'],
278                         [AC_MSG_WARN([
279
280 Using /boot/kernel.h from RUNNING kernel.
281
282 If this is not what you want, use --with-kernel-source-header.
283 Consult build/README.kernel-source for details.
284 ])
285                 ])],
286                 [AC_MSG_ERROR([
287
288 $KERNEL_SOURCE_HEADER not found.
289
290 Consult build/README.kernel-source for details.
291 ])
292                 ])
293         EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
294 ])
295
296 # this is needed before we can build modules
297 LB_LINUX_VERSION
298
299 # --- check that we can build modules at all
300 LB_CHECK_COMPILE([that modules can be built at all], build_modules,
301         [], [], [], [
302         AC_MSG_ERROR([
303
304 Kernel modules cannot be built. Consult config.log for details.
305
306 If you are trying to build with a kernel-source rpm,
307 consult build/README.kernel-source
308 ])
309 ])
310
311 LB_LINUX_RELEASE
312 ]) # end of LB_LINUX_PATH
313
314 #
315 # LC_MODULE_LOADING
316 #
317 # after 2.6.28 CONFIG_KMOD is removed, and only CONFIG_MODULES remains
318 # so we test if request_module is implemented or not
319 AC_DEFUN([LC_MODULE_LOADING], [
320 AC_CACHE_CHECK([if Linux kernel module loading is possible], lb_cv_module_loading, [
321 LB_LINUX_TRY_MAKE([
322         #include <linux/kmod.h>
323 ], [
324         int myretval=ENOSYS ;
325         return myretval;
326 ], [
327         $makerule LUSTRE_KERNEL_TEST=conftest.i
328 ], [dnl
329         grep request_module build/conftest.i |dnl
330                 grep -v `grep "int myretval=" build/conftest.i |dnl
331                         cut -d= -f2 | cut -d" "  -f1`dnl
332                 >/dev/null dnl
333 ], [lb_cv_module_loading="yes"], [lb_cv_module_loading="no"])
334 ])
335 AS_IF([test "$lb_cv_module_loading" = yes],
336         [AC_DEFINE(HAVE_MODULE_LOADING_SUPPORT, 1,
337                 [kernel module loading is possible])],
338         [AC_MSG_WARN([
339
340 Kernel module loading support is highly recommended.
341
342 ])
343         ])
344 ])
345
346 #
347 # LB_PROG_LINUX
348 #
349 # linux tests
350 #
351 AC_DEFUN([LB_PROG_LINUX], [
352 LB_LINUX_PATH
353 LB_LINUX_SYMVERFILE
354
355 LB_CHECK_CONFIG([MODULES], [], [
356         AC_MSG_ERROR([
357
358 module support is required to build Lustre kernel modules.
359 ])
360         ])
361
362 LB_CHECK_CONFIG([MODVERSIONS])
363
364 LB_CHECK_CONFIG([KALLSYMS], [], [
365         AC_MSG_ERROR([
366
367 Lustre requires that CONFIG_KALLSYMS is enabled in your kernel.
368 ])
369         ])
370
371 # 2.6.28
372 LC_MODULE_LOADING
373 ])
374
375 #
376 # LB_USES_DPKG
377 #
378 # Determine if the target is a dpkg system or rpm
379 #
380 AC_DEFUN([LB_USES_DPKG], [
381 AC_CACHE_CHECK([if this distro uses dpkg], lb_cv_uses_dpkg, [
382 lb_cv_uses_dpkg="no"
383 AS_CASE([$(lsb_release -i -s 2>/dev/null)],
384         [Ubuntu | Debian], [lb_cv_uses_dpkg="yes"])
385 ])
386 uses_dpkg=$lb_cv_uses_dpkg
387 ])
388
389 #
390 # LB_CHECK_EXPORT
391 #
392 # check symbol exported or not
393 # $1 - symbol
394 # $2 - file(s) for find.
395 # $3 - do 'yes'
396 # $4 - do 'no'
397 #
398 # 2.6 based kernels - put modversion info into $LINUX/Module.modvers or check
399 #
400 AC_DEFUN([LB_CHECK_EXPORT], [
401 AS_VAR_PUSHDEF([lb_export], [lb_cv_export_$1])dnl
402 AC_CACHE_CHECK([if Linux kernel exports '$1'], lb_export, [
403 AS_VAR_SET([lb_export], [no])
404 AS_IF([grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX_OBJ/$SYMVERFILE 2>/dev/null],
405         [AS_VAR_SET([lb_export], [yes])],
406         [for file in $2; do
407                 AS_IF([grep -q -E "EXPORT_SYMBOL.*\($1\)" "$LINUX/$file" 2>/dev/null], [
408                         AS_VAR_SET([lb_export], [yes])
409                         break
410                 ])
411         done])
412 ])
413 AS_VAR_IF([lb_export], [yes], [$3], [$4])[]dnl
414 AS_VAR_POPDEF([lb_export])dnl
415 ]) # LB_CHECK_EXPORT
416
417 #
418 # LB_CHECK_CONFIG
419 #
420 # check if a given config option is defined
421 # $1 - CONFIG_<name>
422 # $2 - do 'yes'
423 # $3 - do 'no'
424 #
425 AC_DEFUN([LB_CHECK_CONFIG], [
426 LB_CHECK_COMPILE([if Linux kernel was built with CONFIG_$1],
427 config_$1, [
428         #include <$AUTOCONF_HDIR/autoconf.h>
429 ], [
430         #ifndef CONFIG_$1
431         #error CONFIG_$1 not #defined
432         #endif
433 ], [$2], [$3])
434 ]) # LB_CHECK_CONFIG
435
436 #
437 # LB_CHECK_CONFIG_IM
438 #
439 # check if a given config option is builtin or as module
440 # $1 - CONFIG_<name> or CONFIG_<name>_MODULE
441 # $2 - do 'yes'
442 # $3 - do 'no'
443 #
444 AC_DEFUN([LB_CHECK_CONFIG_IM], [
445 LB_CHECK_COMPILE([if Linux kernel was built with CONFIG_$1 in or as module],
446 config_im_$1, [
447         #include <$AUTOCONF_HDIR/autoconf.h>
448 ], [
449         #if !(defined(CONFIG_$1) || defined(CONFIG_$1_MODULE))
450         #error CONFIG_$1 and CONFIG_$1_MODULE not #defined
451         #endif
452 ], [$2], [$3])
453 ]) # LB_CHECK_CONFIG_IM
454
455 #
456 # these are like AC_TRY_COMPILE, but try to build modules against the
457 # kernel, inside the build directory
458 #
459
460 #
461 # LB_LANG_PROGRAM(C)([PROLOGUE], [BODY])
462 # --------------------------------------
463 #
464 m4_define([LB_LANG_PROGRAM],
465 [
466 #include <linux/kernel.h>
467 $1
468 int
469 main (void)
470 {
471 dnl Do *not* indent the following line: there may be CPP directives.
472 dnl Don't move the `;' right after for the same reason.
473 $2
474   ;
475   return 0;
476 }])
477
478 #
479 # LB_LINUX_COMPILE_IFELSE
480 #
481 # like AC_COMPILE_IFELSE
482 #
483 # $1 - AC_LANG_SOURCE()
484 # $2 - make target
485 # $3 - check command
486 # $4 - do 'yes'
487 # $5 - do 'no'
488 #
489 AC_DEFUN([LB_LINUX_COMPILE_IFELSE],
490 [m4_ifvaln([$1], [AC_LANG_CONFTEST([AC_LANG_SOURCE([$1])])])dnl
491 rm -f build/conftest.o build/conftest.mod.c build/conftest.ko
492 SUBARCH=$(echo $target_cpu | sed -e 's/powerpc.*/powerpc/' -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/' -e 's/aarch64.*/arm64/')
493 AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] LDFLAGS= ${LD:+LD="$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_CHECK_INCLUDE -I$LINUX/arch/$SUBARCH/include -Iinclude -Iarch/$SUBARCH/include/generated -I$LINUX/include -Iinclude2 -I$LINUX/include/uapi -Iinclude/generated -I$LINUX/arch/$SUBARCH/include/uapi -Iarch/$SUBARCH/include/generated/uapi -I$LINUX/include/uapi -Iinclude/generated/uapi ${SPL_OBJ:+-include $SPL_OBJ/spl_config.h} ${ZFS_OBJ:+-include $ZFS_OBJ/zfs_config.h} ${SPL:+-I$SPL -I$SPL/include } ${ZFS:+-I$ZFS -I$ZFS/include} -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
494         [$4],
495         [_AC_MSG_LOG_CONFTEST
496 m4_ifvaln([$5],[$5])dnl])
497 rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.ko m4_ifval([$1], [build/conftest.c conftest.c])[]dnl
498 ])
499
500 #
501 # LB_LINUX_TRY_COMPILE
502 #
503 # like AC_TRY_COMPILE
504 #
505 AC_DEFUN([LB_LINUX_TRY_COMPILE], [
506 LB_LINUX_COMPILE_IFELSE(
507         [AC_LANG_SOURCE([LB_LANG_PROGRAM([[$1]], [[$2]])])],
508         [modules], [test -s build/conftest.o],
509         [$3], [$4])
510 ])
511
512 #
513 # LB_LINUX_TRY_MAKE
514 #
515 # like LB_LINUX_TRY_COMPILE, but with different arguments
516 #
517 AC_DEFUN([LB_LINUX_TRY_MAKE], [
518 LB_LINUX_COMPILE_IFELSE(
519         [AC_LANG_SOURCE([LB_LANG_PROGRAM([[$1]], [[$2]])])],
520         [$3], [$4], [$5], [$6])
521 ])
522
523 #
524 # LB_CHECK_COMPILE
525 # $1 - checking message
526 # $2 - variable name
527 # $3 - header
528 # $4 - body
529 # $5 - do 'yes'
530 # $6 - do 'no'
531 #
532 AC_DEFUN([LB_CHECK_COMPILE], [
533 AS_VAR_PUSHDEF([lb_compile], [lb_cv_compile_$2])dnl
534 AC_CACHE_CHECK([$1], lb_compile, [
535         LB_LINUX_TRY_COMPILE([$3], [$4],
536                 [AS_VAR_SET([lb_compile], [yes])],
537                 [AS_VAR_SET([lb_compile], [no])])
538 ])
539 AS_VAR_IF([lb_compile], [yes], [$5], [$6])[]dnl
540 AS_VAR_POPDEF([lb_compile])dnl
541 ]) # LB_CHECK_COMPILE
542
543 #
544 # LB_CHECK_LINUX_HEADER
545 #
546 # Like AC_CHECK_HEADER but checks for a kernel-space header
547 #
548 m4_define([LB_CHECK_LINUX_HEADER], [
549 AS_VAR_PUSHDEF([lb_header], [lb_cv_header_$1])dnl
550 AC_CACHE_CHECK([for $1], lb_header, [
551         LB_LINUX_COMPILE_IFELSE([LB_LANG_PROGRAM([@%:@include <$1>])],
552                 [modules], [test -s build/conftest.o],
553                 [AS_VAR_SET([lb_header], [yes])],
554                 [AS_VAR_SET([lb_header], [no])])
555 ])
556 AS_VAR_IF([lb_header], [yes], [$2], [$3])[]dnl
557 AS_VAR_POPDEF([lb_header])dnl
558 ]) # LB_CHECK_LINUX_HEADER