xfs/linux/Makefile.in

Assar Westerlund assar at sics.se
Sun Dec 5 05:16:04 CET 1999


Dave Morrison <dave at bnl.gov> writes:
> % env CFLAGS="-O2 -I/usr/src/linux/include" ../arla-0.29pre1/configure
>
> ... and things stop there.  If I reinstall egcs-1.x, then things work
> again.  I've done a bit of include file spelunking and I'm pretty sure I
> can see where the conflict is coming from, but I can work around it if I
> have a way to tell xfs, "trust me - _this_ is where you should get system
> headers from", but as far as I can tell, you can't.  With the patch I sent
> along, at least method #2 works.

With the appended patch these two commands should work:

configure --with-sys=/usr/src/linux/include

env KERNEL_CFLAGS="-I /usr/src/linux/include" configure

> I think the change needed in xfs/linux/Makefile.in is pretty mild. It
> doesn't clobber any flags that are already being passed to gcc, so I don't
> see how it'd hurt other architectures.  If I'm missing something here, or
> if someone has a better sol'n, I'd be happy to hear it.

Keeping the user and kernel CFLAGS separate is probably good.  In your
particular case you want these flags to only be used when compiling
the kernel part, right?

/assar



Index: configure.in
===================================================================
RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/configure.in,v
retrieving revision 1.348
diff -u -w -u -w -r1.348 configure.in
--- configure.in	1999/12/04 18:35:25	1.348
+++ configure.in	1999/12/05 04:12:21
@@ -102,7 +102,7 @@
 [  --with-sys=dir          use dir as your kernel source code directory
                           default /sys],
 [SYS=$withval],
-[SYS=/sys])
+[SYS="no"])
 AC_SUBST(SYS)
 
 AC_MSG_CHECKING(for kernel stuff)
@@ -121,7 +121,7 @@
   KERNEL_HDRS=''
   XFS_SUBDIR=solaris
   KERNEL=/dev/ksyms
-  KERNEL_CFLAGS="-D_KERNEL"
+  KERNEL_CFLAGS="${KERNEL_CFLAGS} -D_KERNEL"
   AC_MSG_RESULT(Solaris)
   case "$target_cpu" in
   sparc64) AC_DEFINE(NEED_VICEIOCTL32, 1,
@@ -136,7 +136,7 @@
   KERNEL_HDRS=''
   ip=`hinv -c processor | awk '$4 ~ /IP/ { print $4}'`
   cpu=`hinv -t cpu | awk '{print $3}'`
-  KERNEL_CFLAGS="-D$ip -D$cpu -DR4000"
+  KERNEL_CFLAGS="${KERNEL_CFLAGS} -D$ip -D$cpu -DR4000"
   XFS_SUBDIR=irix
   KERNEL=/unix
   case "$target_os" in
@@ -166,8 +166,11 @@
   KERNEL_SRCS='bsd-subr.c'
   KERNEL_HDRS=''
   KERNEL_LD='ld'
-  KERNEL_CFLAGS="-DKERNEL -D_KERNEL -DLKM -D_LKM -DACTUALLY_LKM_NOT_KERNEL -I$SYS/arch -I$SYS"
-  test_KERNEL_CFLAGS=$KERNEL_CFLAGS
+  if test "$SYS" = "no"; then
+    SYS=/sys
+  fi
+  KERNEL_CFLAGS="${KERNEL_CFLAGS} -DKERNEL -D_KERNEL -DLKM -D_LKM -DACTUALLY_LKM_NOT_KERNEL -I$SYS/arch -I$SYS"
+  test_KERNEL_CFLAGS="$KERNEL_CFLAGS"
   XFS_SRCS='xfs_wrap-bsd.c xfs_common-bsd.c xfs_dev-common.c xfs_dev-bsd.c xfs_syscalls-common.c xfs_syscalls-wrap-bsd.c xfs_node-bsd.c xfs_vfsops-common.c xfs_vfsops-bsd.c xfs_vfsops-openbsd.c xfs_vnodeops-common.c xfs_vnodeops-bsd.c'
   XFS_SUBDIR=bsd
   KERNEL=/bsd
@@ -190,6 +193,9 @@
 echo:
 	@echo \$(CFLAGS)
 END
+  if test "$SYS" = "no"; then
+    SYS=/sys
+  fi
   ac_out=`/usr/bin/make S=$SYS -f conftest.mk echo 2> /dev/null`
   incl= defs= flags=
   for i in $ac_out; do
@@ -209,8 +215,8 @@
   then
 	flags="$flags${flags:+ }-mno-fp-regs"
   fi
-  KERNEL_CFLAGS="$defs${defs:+ }$flags${flags:+ }$incl"
-  test_KERNEL_CFLAGS=$KERNEL_CFLAGS
+  KERNEL_CFLAGS="${KERNEL_CFLAGS} $defs${defs:+ }$flags${flags:+ }$incl"
+  test_KERNEL_CFLAGS="$KERNEL_CFLAGS"
   KERNEL_LD='ld'
   XFS_SRCS='xfs_wrap-bsd.c xfs_common-bsd.c xfs_dev-common.c xfs_dev-bsd.c xfs_syscalls-common.c xfs_syscalls-wrap-bsd.c xfs_node-bsd.c xfs_vfsops-common.c xfs_vfsops-bsd.c xfs_vfsops-netbsd.c xfs_vnodeops-common.c xfs_vnodeops-bsd.c'
   XFS_SUBDIR=bsd
@@ -249,8 +255,11 @@
 	fi
 	;;
   esac
+  if test "$SYS" = "no"; then
+    SYS=/sys
+  fi
   if test "$kld" = "yes"; then
-    KERNEL_CFLAGS="$smp -DKERNEL -D_KERNEL -DVFS_KLD -DKLD_MODULE -I$SYS/arch -I$SYS -I."
+    KERNEL_CFLAGS="${KERNEL_CFLAGS} $smp -DKERNEL -D_KERNEL -DVFS_KLD -DKLD_MODULE -I$SYS/arch -I$SYS -I."
     test_KERNEL_CFLAGS="-$kernobjformat $KERNEL_CFLAGS"
     KERNEL_LD='ld'
     case "$kernobjformat" in
@@ -265,8 +274,8 @@
     if test "$kernobjformat" != "aout"; then
       AC_MSG_WARN([You cannot build LKMs against $kernobjformat kernels])
     fi
-    KERNEL_CFLAGS="-aout $smp -DKERNEL -D_KERNEL -DLKM -D_LKM -DVFS_LKM -DACTUALLY_LKM_NOT_KERNEL -I$SYS/arch -I$SYS -I."
-    test_KERNEL_CFLAGS=$KERNEL_CFLAGS
+    KERNEL_CFLAGS="${KERNEL_CFLAGS} -aout $smp -DKERNEL -D_KERNEL -DLKM -D_LKM -DVFS_LKM -DACTUALLY_LKM_NOT_KERNEL -I$SYS/arch -I$SYS -I."
+    test_KERNEL_CFLAGS="$KERNEL_CFLAGS"
     KERNEL_LD='ld -aout'
     ac_kernel_ld='${LD-ld} -aout -o conftest $LDFLAGS -A $KERNEL conftest.o -e _foo 1>&AC_FD_CC'
     MODULE=xfs_mod.o
@@ -284,8 +293,11 @@
   KERNEL_HDRS=''
   KERNEL_LD='ld'
   MODULE=xfs_mod.o
-  KERNEL_CFLAGS="-DKERNEL -D_KERNEL -DLKM -D_LKM -DACTUALLY_LKM_NOT_KERNEL -I$SYS/arch -I$SYS -I."
-  test_KERNEL_CFLAGS=$KERNEL_CFLAGS
+  if test "$SYS" = "no"; then
+    SYS=/sys
+  fi
+  KERNEL_CFLAGS="${KERNEL_CFLAGS} -DKERNEL -D_KERNEL -DLKM -D_LKM -DACTUALLY_LKM_NOT_KERNEL -I$SYS/arch -I$SYS -I."
+  test_KERNEL_CFLAGS="$KERNEL_CFLAGS"
   XFS_SUBDIR=bsd
   XFS_SRCS='xfs_wrap-bsd.c xfs_common-bsd.c xfs_dev-common.c xfs_dev-bsd.c xfs_syscalls-common.c xfs_syscalls-wrap-freebsd.c xfs_node-bsd.c xfs_vfsops-common.c xfs_vfsops-bsd.c xfs_vfsops-freebsd.c xfs_vnodeops-common.c xfs_vnodeops-bsd.c'
   /bin/sh $SYS/kern/vnode_if.sh $SYS/kern/vnode_if.src
@@ -324,8 +336,11 @@
      AC_MSG_RESULT(no)
   else
      AC_MSG_RESULT(yes)
+  fi
+  KERNEL_CFLAGS="${KERNEL_CFLAGS} -DMODULE -D__KERNEL__ $smp"
+  if test "$SYS" != "no"; then
+	KERNEL_CFLAGS="-I$SYS $KERNEL_CFLAGS"
   fi
-  KERNEL_CFLAGS="-DMODULE -D__KERNEL__ $smp"
   KERNEL_CC="$CC"
   case "$target_cpu" in
   alpha*)
@@ -337,7 +352,7 @@
     AC_DEFINE(NEED_VICEIOCTL32, 1,
 	[define if you need 32 bit compat pioctl]);;
   esac
-  test_KERNEL_CFLAGS=$KERNEL_CFLAGS
+  test_KERNEL_CFLAGS="$KERNEL_CFLAGS"
   XFS_SUBDIR=linux
   KERNEL=/dev/null
   ;;
@@ -345,11 +360,14 @@
   KERNEL_INCLUDE=-I`(cd $srcdir; pwd)`/xfs/bsd
   KERNEL_SRCS=bsd-subr.c
   KERNEL_HDRS=
-  KERNEL_CFLAGS='-DKERNEL -D_KERNEL -DMACH'
-  test_KERNEL_CFLAGS=$KERNEL_CFLAGS
+  KERNEL_CFLAGS="${KERNEL_CFLAGS} -DKERNEL -D_KERNEL -DMACH"
+  test_KERNEL_CFLAGS="$KERNEL_CFLAGS"
   XFS_SRCS='xfs_wrap-osf.c xfs_common-osf.c xfs_dev-common.c xfs_dev-osf.c xfs_syscalls-common.c xfs_syscalls-wrap-osf.c xfs_node-osf.c xfs_vfsops-common.c xfs_vfsops-osf.c xfs_vnodeops-common.c xfs_vnodeops-osf.c'
   # XXX find kernel include dir
   nodename=`hostname | sed 's/\..*//' | tr 'a-z' 'A-Z'`
+  if test "$SYS" = "no"; then
+    SYS=/sys
+  fi
   foo=`ls $SYS/GENERIC/cpus.h $SYS/$nodename/cpus.h $SYS/*/cpus.h 2> /dev/null | head -1 | sed -e 's,/cpus.h,,'`
   KERNEL_CFLAGS="$KERNEL_CFLAGS -I/usr/sys/include -I$foo"
   KERNEL_LD='ld'





More information about the Arla-drinkers mailing list