3 # Check for file existance even when cross compiling
5 AC_DEFUN([LB_CHECK_FILE],
6 [AS_VAR_PUSHDEF([lb_File], [lb_cv_file_$1])dnl
7 AC_CACHE_CHECK([for $1], lb_File,
9 AS_VAR_SET(lb_File, yes)
11 AS_VAR_SET(lb_File, no)
13 AS_IF([test AS_VAR_GET(lb_File) = yes], [$2], [$3])[]dnl
14 AS_VAR_POPDEF([lb_File])dnl
21 # Set things accordingly for a linux kernel
23 AC_DEFUN([LB_LINUX_VERSION],[
26 MODULE_TARGET="SUBDIRS"
28 AC_MSG_CHECKING([for external module build support])
31 LB_LINUX_CONFIG([XEN],[XEN_INCLUDES="-I$LINUX/arch/x86/include/mach-xen"],[])
32 LB_LINUX_CONFIG_VALUE([XEN_INTERFACE_VERSION],[XEN_INCLUDES="$XEN_INCLUDES -D__XEN_INTERFACE_VERSION__=$res"],[XEN_INCLUDES="$XEN_INCLUDES -D__XEN_INTERFACE_VERSION__=$res"])
34 rm -f build/conftest.i
35 LB_LINUX_TRY_MAKE([],[],
36 [$makerule OFA_KERNEL_TEST=conftest.i],
37 [test -s build/conftest.i],
41 makerule="_module_$makerule"
43 LB_LINUX_TRY_MAKE([],[],
44 [$makerule OFA_KERNEL_TEST=conftest.i],
45 [test -s build/conftest.i],
49 AC_MSG_ERROR([unknown; check config.log for details])
53 AC_SUBST(MODULE_TARGET)
60 # get the release version of linux
62 AC_DEFUN([LB_LINUX_RELEASE],
64 rm -f build/conftest.i
65 AC_MSG_CHECKING([for Linux release])
66 if test -s $LINUX_OBJ/include/$AUTOCONF_HDIR/utsrelease.h ; then
67 LINUXRELEASEHEADER=$AUTOCONF_HDIR/utsrelease.h
69 LINUXRELEASEHEADER=linux/version.h
72 #include <$LINUXRELEASEHEADER>
75 LINUXRELEASE=UTS_RELEASE;
77 $makerule OFA_KERNEL_TEST=conftest.i
79 test -s build/conftest.i
81 # LINUXRELEASE="UTS_RELEASE"
82 eval $(grep "LINUXRELEASE=" build/conftest.i)
84 AC_MSG_RESULT([unknown])
85 AC_MSG_ERROR([Could not preprocess test program. Consult config.log for details.])
87 rm -f build/conftest.i
88 if test x$LINUXRELEASE = x ; then
89 AC_MSG_RESULT([unknown])
90 AC_MSG_ERROR([Could not determine Linux release version from linux/version.h.])
92 AC_MSG_RESULT([$LINUXRELEASE])
93 AC_SUBST(LINUXRELEASE)
95 moduledir='/lib/modules/'$LINUXRELEASE/updates/kernel
98 modulefsdir='$(moduledir)/fs/$(PACKAGE)'
101 modulenetdir='$(moduledir)/net/$(PACKAGE)'
102 AC_SUBST(modulenetdir)
104 # ------------ RELEASE --------------------------------
105 AC_MSG_CHECKING([for OFA release])
106 AC_ARG_WITH([release],
107 AC_HELP_STRING([--with-release=string],
108 [set the release string (default=$kvers_YYYYMMDDhhmm)]),
111 if test -n "$DOWNSTREAM_RELEASE"; then
112 RELEASE="${DOWNSTREAM_RELEASE}_"
114 RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID")
115 AC_MSG_RESULT($RELEASE)
118 # check is redhat/suse kernels
119 AC_MSG_CHECKING([that RedHat kernel])
120 LB_LINUX_TRY_COMPILE([
121 #include <linux/version.h>
123 #ifndef RHEL_RELEASE_CODE
124 #error "not redhat kernel"
133 LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[])
137 # LB_ARG_REPLACE_PATH(PACKAGE, PATH)
138 AC_DEFUN([LB_ARG_REPLACE_PATH],[
140 eval "set x $ac_configure_args"
148 arg=$(printf %s\n ["$arg"] | \
149 sed "s/'/'\\\\\\\\''/g")
152 dnl AS_VAR_APPEND([new_configure_args], [" '$arg'"])
153 new_configure_args="$new_configure_args \"$arg\""
155 ac_configure_args=$new_configure_args
158 # this is the work-horse of the next function
159 AC_DEFUN([__LB_ARG_CANON_PATH], [
160 [$3]=$(readlink -f $with_$2)
161 LB_ARG_REPLACE_PATH([$1], $[$3])
164 # a front-end for the above function that transforms - and . in the
165 # PACKAGE portion of --with-PACKAGE into _ suitable for variable names
166 AC_DEFUN([LB_ARG_CANON_PATH], [
167 __LB_ARG_CANON_PATH([$1], m4_translit([$1], [-.], [__]), [$2])
174 # Find paths for linux, handling kernel-source rpms
176 AC_DEFUN([LB_LINUX_PATH],
177 [# prep some default values
178 for DEFAULT_LINUX in /lib/modules/$(uname -r)/{source,build} /usr/src/linux; do
179 if readlink -q -e $DEFAULT_LINUX; then
183 if test "$DEFAULT_LINUX" = "/lib/modules/$(uname -r)/source"; then
184 PATHS="/lib/modules/$(uname -r)/build"
186 PATHS+=" $DEFAULT_LINUX"
187 for DEFAULT_LINUX_OBJ in $PATHS; do
188 if readlink -q -e $DEFAULT_LINUX_OBJ; then
192 AC_MSG_CHECKING([for Linux sources])
194 AC_HELP_STRING([--with-linux=path],
195 [set path to Linux source (default=/lib/modules/$(uname -r)/{source,build},/usr/src/linux)]),
196 [LB_ARG_CANON_PATH([linux], [LINUX])
197 DEFAULT_LINUX_OBJ=$LINUX],
198 [LINUX=$DEFAULT_LINUX])
199 AC_MSG_RESULT([$LINUX])
202 # -------- check for linux --------
203 LB_CHECK_FILE([$LINUX],[],
204 [AC_MSG_ERROR([Kernel source $LINUX could not be found.])])
206 # -------- linux objects (for 2.6) --
207 AC_MSG_CHECKING([for Linux objects dir])
208 AC_ARG_WITH([linux-obj],
209 AC_HELP_STRING([--with-linux-obj=path],
210 [set path to Linux objects dir (default=/lib/modules/$(uname -r)/build,/usr/src/linux)]),
211 [LB_ARG_CANON_PATH([linux-obj], [LINUX_OBJ])],
212 [LINUX_OBJ=$DEFAULT_LINUX_OBJ])
214 AC_MSG_RESULT([$LINUX_OBJ])
217 # -------- check for .config --------
218 AC_ARG_WITH([linux-config],
219 [AC_HELP_STRING([--with-linux-config=path],
220 [set path to Linux .conf (default=$LINUX_OBJ/.config)])],
221 [LB_ARG_CANON_PATH([linux-config], [LINUX_CONFIG])],
222 [LINUX_CONFIG=$LINUX_OBJ/.config])
223 AC_SUBST(LINUX_CONFIG)
225 LB_CHECK_FILE([/boot/kernel.h],
226 [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
227 [LB_CHECK_FILE([/var/adm/running-kernel.h],
228 [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h'])])
230 AC_ARG_WITH([kernel-source-header],
231 AC_HELP_STRING([--with-kernel-source-header=path],
232 [Use a different kernel version header. Consult build/README.kernel-source for details.]),
233 [LB_ARG_CANON_PATH([kernel-source-header], [KERNEL_SOURCE_HEADER])])
235 # ------------ .config exists ----------------
236 LB_CHECK_FILE([$LINUX_CONFIG],[],
237 [AC_MSG_ERROR([Kernel config could not be found. If you are building from a kernel-source rpm consult build/README.kernel-source])])
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
242 # include <autoconf.h>
243 LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated],
244 [LB_CHECK_FILE([$LINUX_OBJ/include/linux/autoconf.h],[AUTOCONF_HDIR=linux],
245 [AC_MSG_ERROR([Run make config in $LINUX.])])])
246 AC_SUBST(AUTOCONF_HDIR)
248 # ----------- kconfig.h exists ---------------
249 # kernel 3.1, $LINUX/include/linux/kconfig.h is added
250 # see kernel commit 2a11c8ea20bf850b3a2c60db8c2e7497d28aba99
251 LB_CHECK_FILE([$LINUX/include/linux/kconfig.h],
252 [CONFIG_INCLUDE=$LINUX/include/linux/kconfig.h],
253 [CONFIG_INCLUDE=$LINUX/include/$AUTOCONF_HDIR/kconfig.h])
254 AC_SUBST(CONFIG_INCLUDE)
256 if test -e $CONFIG_INCLUDE; then
257 CONFIG_INCLUDE_FLAG="-include $CONFIG_INCLUDE"
260 # ------------ rhconfig.h includes runtime-generated bits --
261 # red hat kernel-source checks
263 # we know this exists after the check above. if the user
264 # tarred up the tree and ran make dep etc. in it, then
265 # version.h gets overwritten with a standard linux one.
267 if (grep -q rhconfig $LINUX_OBJ/include/linux/version.h 2>/dev/null) ||
268 (grep -q rhconfig $LINUX_OBJ/include/generated/uapi/linux/version.h 2>/dev/null) ; then
269 # This is a clean kernel-source tree, we need to
270 # enable extensive workarounds to get this to build
272 LB_CHECK_FILE([$KERNEL_SOURCE_HEADER],
273 [if test $KERNEL_SOURCE_HEADER = '/boot/kernel.h' ; then
274 AC_MSG_WARN([Using /boot/kernel.h from RUNNING kernel.])
275 AC_MSG_WARN([If this is not what you want, use --with-kernel-source-header.])
276 AC_MSG_WARN([Consult build/README.kernel-source for details.])
278 [AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found. Consult build/README.kernel-source for details.])])
279 EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
282 # this is needed before we can build modules
287 # --- check that we can build modules at all
288 AC_MSG_CHECKING([that modules can be built at all])
289 LB_LINUX_TRY_COMPILE([],[],[
293 AC_MSG_WARN([Consult config.log for details.])
294 AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult build/README.kernel-source])
295 AC_MSG_ERROR([Kernel modules cannot be built.])
299 ]) # end of LB_LINUX_PATH
301 # LB_LINUX_SYMVERFILE
302 # SLES 9 uses a different name for this file - unsure about vanilla kernels
303 # around this version, but it matters for servers only.
304 AC_DEFUN([LB_LINUX_SYMVERFILE],
305 [AC_MSG_CHECKING([name of module symbol version file])
306 if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost ; then
307 SYMVERFILE=Modules.symvers
309 SYMVERFILE=Module.symvers
311 AC_MSG_RESULT($SYMVERFILE)
318 # check for cross compilation
320 AC_DEFUN([LB_LINUX_CROSS],
321 [AC_MSG_CHECKING([for cross compilation])
323 case $target_vendor in
324 # The K1OM architecture is an extension of the x86 architecture.
325 # So, the $target_arch is x86_64.
327 AC_MSG_RESULT([Intel(R) Xeon Phi(TM)])
328 CC_TARGET_ARCH=`$CC -v 2>&1 | grep Target: | sed -e 's/Target: //'`
329 if test $CC_TARGET_ARCH != x86_64-$target_vendor-linux ; then
330 AC_MSG_ERROR([Cross compiler not found in PATH.])
332 CROSS_VARS="ARCH=$target_vendor CROSS_COMPILE=x86_64-$target_vendor-linux-"
334 if test x$enable_server = xyes ; then
335 AC_MSG_WARN([Disabling server (not supported for x86_64-$target_vendor-linux).])
340 CROSS_VARS="CROSS_COMPILE=$CROSS_COMPILE"
347 # these are like AC_TRY_COMPILE, but try to build modules against the
348 # kernel, inside the build directory
350 # LB_LANG_PROGRAM(C)([PROLOGUE], [BODY])
351 # --------------------------------------
352 m4_define([LB_LANG_PROGRAM],
354 #include <linux/kernel.h>
359 dnl Do *not* indent the following line: there may be CPP directives.
360 dnl Don't move the `;' right after for the same reason.
367 # LB_LINUX_COMPILE_IFELSE
369 # like AC_COMPILE_IFELSE
371 AC_DEFUN([LB_LINUX_COMPILE_IFELSE],
372 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
374 rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/output.log
375 AS_IF([AC_TRY_COMMAND(cp conftest.c build && env $CROSS_VARS $MAKE -d [$2] ${LD:+"LD=$CROSS_COMPILE$LD"} CC="$CROSS_COMPILE$CC" -f $PWD/build/Makefile OFA_LINUX_CONFIG=$LINUX_CONFIG CONFIG_CC_STACKPROTECTOR_STRONG= LINUXINCLUDE="-include $AUTOCONF_HDIR/autoconf.h $XEN_INCLUDES $EXTRA_OFA_INCLUDE -I$LINUX/arch/$SRCARCH/include -Iarch/$SRCARCH/include/generated -Iinclude -I$LINUX/arch/$SRCARCH/include/uapi -Iarch/$SRCARCH/include/generated/uapi -I$LINUX/include -I$LINUX/include/uapi -Iinclude/generated/uapi -I$LINUX/arch/$SRCARCH/include -Iarch/$SRCARCH/include/generated -I$LINUX/arch/$SRCARCH/include -I$LINUX/arch/$SRCARCH/include/generated -I$LINUX_OBJ/include -I$LINUX/include -I$LINUX_OBJ/include2 $CONFIG_INCLUDE_FLAG" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $CROSS_VARS $MODULE_TARGET=$PWD/build >/dev/null 2>build/output.log; [[[ $? -ne 0 ]]] && cat build/output.log 1>&2 && false || config/warning_filter.sh build/output.log) >/dev/null && AC_TRY_COMMAND([$3])],
377 [_AC_MSG_LOG_CONFTEST
378 m4_ifvaln([$5],[$5])dnl])
379 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
385 # Determine the kernel's idea of the current architecture
387 AC_DEFUN([LB_LINUX_ARCH],
388 [AC_MSG_CHECKING([Linux kernel architecture])
389 AS_IF([rm -f $PWD/build/arch
390 make -s --no-print-directory echoarch -f $PWD/build/Makefile \
391 OFA_LINUX_CONFIG=$LINUX_CONFIG -C $LINUX $CROSS_VARS \
392 ARCHFILE=$PWD/build/arch && LINUX_ARCH=`cat $PWD/build/arch`],
393 [AC_MSG_RESULT([$LINUX_ARCH])],
394 [AC_MSG_ERROR([Could not determine the kernel architecture.])])
398 # LB_LINUX_TRY_COMPILE
400 # like AC_TRY_COMPILE
402 AC_DEFUN([LB_LINUX_TRY_COMPILE],
403 [LB_LINUX_COMPILE_IFELSE(
404 [AC_LANG_SOURCE([LB_LANG_PROGRAM([[$1]], [[$2]])])],
406 [test -s build/conftest.o],
412 # check if a given config option is defined
414 AC_DEFUN([LB_LINUX_CONFIG],[
415 AC_MSG_CHECKING([if Linux was built with CONFIG_$1])
416 LB_LINUX_TRY_COMPILE([
417 #include <$AUTOCONF_HDIR/autoconf.h>
420 #error CONFIG_$1 not #defined
434 # check if a given config option is builtin or as module
436 AC_DEFUN([LB_LINUX_CONFIG_IM],[
437 AC_MSG_CHECKING([if Linux was built with CONFIG_$1 in or as module])
438 LB_LINUX_TRY_COMPILE([
439 #include <$AUTOCONF_HDIR/autoconf.h>
441 #if !(defined(CONFIG_$1) || defined(CONFIG_$1_MODULE))
442 #error CONFIG_$1 and CONFIG_$1_MODULE not #defined
456 # like LB_LINUX_TRY_COMPILE, but with different arguments
458 AC_DEFUN([LB_LINUX_TRY_MAKE],
459 [LB_LINUX_COMPILE_IFELSE(
460 [AC_LANG_SOURCE([LB_LANG_PROGRAM([[$1]], [[$2]])])],
461 [$3], [$4], [$5], [$6]
466 # LB_CONFIG_COMPAT_RDMA
468 AC_DEFUN([LB_CONFIG_COMPAT_RDMA],
469 [AC_MSG_CHECKING([whether to use Compat RDMA])
472 AC_HELP_STRING([--with-o2ib=path],
473 [build o2iblnd against path]),
476 yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
481 *) O2IBPATHS=$with_o2ib
486 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
489 if test $ENABLEO2IB -eq 0; then
493 for O2IBPATH in $O2IBPATHS; do
494 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
495 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
496 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
497 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
502 compatrdma_found=false
504 if test \( -f ${O2IBPATH}/include/linux/compat-2.6.h \); then
505 compatrdma_found=true
507 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
516 # LB_CONFIG_OFED_BACKPORTS
518 # include any OFED backport headers in all compile commands
519 # NOTE: this does only include the backport paths, not the OFED headers
520 # adding the OFED headers is done in the lnet portion
521 AC_DEFUN([LB_CONFIG_OFED_BACKPORTS],
522 [AC_MSG_CHECKING([whether to use any OFED backport headers])
523 if test $ENABLEO2IB -eq 0; then
526 if ! $o2ib_found; then
530 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
531 3) AC_MSG_ERROR([bad --with-o2ib path]);;
532 *) AC_MSG_ERROR([internal error]);;
535 if ! $compatrdma_found; then
536 if test -f $O2IBPATH/config.mk; then
537 . $O2IBPATH/config.mk
538 elif test -f $O2IBPATH/ofed_patch.mk; then
539 . $O2IBPATH/ofed_patch.mk
542 if test -n "$BACKPORT_INCLUDES"; then
543 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
544 EXTRA_LNET_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_LNET_INCLUDE"
554 # after 2.6.28 CONFIG_KMOD is removed, and only CONFIG_MODULES remains
555 # so we test if request_module is implemented or not
556 AC_DEFUN([LC_MODULE_LOADING],
557 [AC_MSG_CHECKING([if kernel module loading is possible])
559 #include <linux/kmod.h>
561 int myretval=ENOSYS ;
564 $makerule OFA_KERNEL_TEST=conftest.i
566 grep request_module build/conftest.i |dnl
567 grep -v `grep "int myretval=" build/conftest.i |dnl
568 cut -d= -f2 | cut -d" " -f1`dnl
572 AC_DEFINE(HAVE_MODULE_LOADING_SUPPORT, 1,
573 [kernel module loading is possible])
577 AC_MSG_WARN([Kernel module loading support is highly recommended.])
587 AC_DEFUN([LB_PROG_LINUX],
593 LB_LINUX_CONFIG([MODULES],[],[
594 AC_MSG_ERROR([module support is required to build OFA kernel modules.])
597 LB_LINUX_CONFIG([MODVERSIONS])
599 LB_LINUX_CONFIG([KALLSYMS],[],[
600 AC_MSG_ERROR([compat_mlnx requires that CONFIG_KALLSYMS is enabled in your kernel.])
606 LB_CONFIG_COMPAT_RDMA
608 # it's ugly to be doing anything with OFED outside of the lnet module, but
609 # this has to be done here so that the backports path is set before all of
610 # the LN_PROG_LINUX checks are done
611 LB_CONFIG_OFED_BACKPORTS
615 # LB_CHECK_SYMBOL_EXPORT
616 # check symbol exported or not
618 # $2 - file(s) for find.
622 # 2.6 based kernels - put modversion info into $LINUX/Module.modvers
624 AC_DEFUN([LB_CHECK_SYMBOL_EXPORT],
625 [AC_MSG_CHECKING([if Linux was built with symbol $1 exported])
626 grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/$SYMVERFILE 2>/dev/null
628 if test $rc -ne 0; then
631 grep -q -E "EXPORT_SYMBOL.*\($1\)" "$LINUX/$file" 2>/dev/null
633 if test $rc -eq 0; then
638 if test $export -eq 0; then
652 # Like AC_CHECK_HEADER but checks for a kernel-space header
654 m4_define([LB_CHECK_LINUX_HEADER],
655 [AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
656 AC_CACHE_CHECK([for $1], ac_Header,
657 [LB_LINUX_COMPILE_IFELSE([LB_LANG_PROGRAM([@%:@include <$1>])],
659 [test -s build/conftest.o],
660 [AS_VAR_SET(ac_Header, [yes])],
661 [AS_VAR_SET(ac_Header, [no])])])
662 AS_IF([test AS_VAR_GET(ac_Header) = yes], [$2], [$3])[]dnl
663 AS_VAR_POPDEF([ac_Header])dnl
669 # Determine if the target is a dpkg system or rpm
671 AC_DEFUN([LB_USES_DPKG],
673 AC_MSG_CHECKING([if this distro uses dpkg])
674 case `lsb_release -i -s 2>/dev/null` in
689 # checks on the C compiler
691 AC_DEFUN([LB_PROG_CC],
693 AC_CHECK_TOOL(LD, ld, [no])
694 AC_CHECK_TOOL(OBJDUMP, objdump, [no])
695 AC_CHECK_TOOL(STRIP, strip, [no])
697 # --------- unsigned long long sane? -------
698 AC_CHECK_SIZEOF(unsigned long long, 0)
699 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
700 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
701 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
702 AC_MSG_ERROR([** we assume that sizeof(long long) == 8.])
705 if test $target_cpu == "powerpc64"; then
706 AC_MSG_WARN([set compiler with -m64])
707 CFLAGS="$CFLAGS -m64"
714 AC_DEFUN([LB_CONDITIONALS],
716 AM_CONDITIONAL(ARCH_x86, test x$target_cpu = "xx86_64" -o x$target_cpu = "xi686")
725 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
727 Type 'make' to build kernel modules.
734 AC_DEFUN([SET_BUILD_ARCH],
736 AC_MSG_CHECKING([for build ARCH])
737 SRCARCH=${ARCH:-$(uname -m)}
738 SRCARCH=$(echo $SRCARCH | sed -e s/i.86/x86/ \
740 -e s/ppc.*/powerpc/ \
741 -e 's/powerpc64/powerpc/' \
742 -e s/aarch64.*/arm64/ \
745 # very old kernels had different strucure under arch dir
746 if [[ "X$SRCARCH" == "Xx86" ]] && ! [[ -d "$LINUX/arch/x86" ]]; then
750 AC_MSG_RESULT([ARCH=$ARCH, SRCARCH=$SRCARCH])
754 # LB_LINUX_CONFIG_VALUE
756 # get a given config's option value
758 AC_DEFUN([LB_LINUX_CONFIG_VALUE],[
759 AC_MSG_CHECKING([get value of CONFIG_$1])
760 if (grep -q "^#define CONFIG_$1 " $LINUX_OBJ/include/$AUTOCONF_HDIR/autoconf.h 2>/dev/null); then
761 res=$(grep "^#define CONFIG_$1 " $LINUX_OBJ/include/$AUTOCONF_HDIR/autoconf.h 2>/dev/null | cut -d' ' -f'3')
762 AC_MSG_RESULT([$1 value is '$res'])
765 AC_MSG_RESULT([$1 in not defined in autoconf.h])