From f0e648ca02f55bb2c4bc328656769a0c529f683a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 26 Nov 2008 14:29:45 -0800 Subject: [PATCH] Make everything a M4 macro, it's just cleaner that way --- config/kernel | 51 ----------------------------- config/kernel.m4 | 63 ++++++++++++++++++++++++++++++++++++ config/{lustre => lustre.m4} | 0 config/{user => user.m4} | 0 config/zfs-build.m4 | 35 ++++++++++---------- 5 files changed, 80 insertions(+), 69 deletions(-) delete mode 100644 config/kernel create mode 100644 config/kernel.m4 rename config/{lustre => lustre.m4} (100%) rename config/{user => user.m4} (100%) diff --git a/config/kernel b/config/kernel deleted file mode 100644 index d7d52ad07f..0000000000 --- a/config/kernel +++ /dev/null @@ -1,51 +0,0 @@ -# Default ZFS kernel mode configuration - -# Kernel build make options -KERNELMAKE_PARAMS= -#KERNELMAKE_PARAMS="V=1" # Enable verbose module build - -# Kernel build cpp flags -KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL " -KERNELCPPFLAGS="$KERNELCPPFLAGS -I$splsrc -I$splsrc/include -I$TOPDIR" - -# Minimally required for pread() functionality an other GNU goodness -HOSTCFLAGS="$HOSTCFLAGS -ggdb -O2 -std=c99 -D_GNU_SOURCE -D__EXTENSIONS__ " - -# XXX: Quiet warnings not covered by the gcc-* patches -# XXX: Once all the warnings are resolved these flags should be removed -HOSTCFLAGS="$HOSTCFLAGS -Wno-switch -Wno-unused -Wno-missing-braces -Wno-parentheses " -HOSTCFLAGS="$HOSTCFLAGS -Wno-uninitialized -fno-strict-aliasing " - -# Expected defines not covered by zfs_config.h or spl_config.h -HOSTCFLAGS="$HOSTCFLAGS -DHAVE_SPL -D_POSIX_PTHREAD_SEMANTICS " -HOSTCFLAGS="$HOSTCFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT " -HOSTCFLAGS="$HOSTCFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\" " - -# Expected default include paths additional paths added by Makefiles -HOSTCFLAGS="$HOSTCFLAGS -I$TOPDIR " - -if test "$kernelbuild" != "$kernelsrc"; then - KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild" -fi - -# XXX: I really, really hate this... but to ensure the kernel build -# system compiles C files shared between a library and a kernel module, -# we need to ensure each file has a unique make target. To do that -# I'm creating symlinks for each shared file at configure time. It -# may be possible something better can be done in the Makefile but it -# will take some serious investigation and I don't have the time now. - -echo "Creating symlinks for additional make targets" -ln -f -s $LIBDIR/libport/u8_textprep.c $LIBDIR/libport/ku8_textprep.c -ln -f -s $LIBDIR/libavl/avl.c $LIBDIR/libavl/kavl.c -ln -f -s $LIBDIR/libavl/avl.c $LIBDIR/libavl/uavl.c -ln -f -s $LIBDIR/libnvpair/nvpair.c $LIBDIR/libnvpair/knvpair.c -ln -f -s $LIBDIR/libnvpair/nvpair.c $LIBDIR/libnvpair/unvpair.c -ln -f -s $LIBDIR/libzcommon/zfs_deleg.c $LIBDIR/libzcommon/kzfs_deleg.c -ln -f -s $LIBDIR/libzcommon/zfs_prop.c $LIBDIR/libzcommon/kzfs_prop.c -ln -f -s $LIBDIR/libzcommon/zprop_common.c $LIBDIR/libzcommon/kzprop_common.c -ln -f -s $LIBDIR/libzcommon/compress.c $LIBDIR/libzcommon/kcompress.c -ln -f -s $LIBDIR/libzcommon/list.c $LIBDIR/libzcommon/klist.c -ln -f -s $LIBDIR/libzcommon/zfs_namecheck.c $LIBDIR/libzcommon/kzfs_namecheck.c -ln -f -s $LIBDIR/libzcommon/zfs_comutil.c $LIBDIR/libzcommon/kzfs_comutil.c -ln -f -s $LIBDIR/libzcommon/zpool_prop.c $LIBDIR/libzcommon/kzpool_prop.c diff --git a/config/kernel.m4 b/config/kernel.m4 new file mode 100644 index 0000000000..de557a18aa --- /dev/null +++ b/config/kernel.m4 @@ -0,0 +1,63 @@ +dnl # +dnl # Default ZFS kernel mode configuration +dnl # +AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [ + dnl # Kernel build make options + KERNELMAKE_PARAMS= + dnl #KERNELMAKE_PARAMS="V=1" # Enable verbose module build + + dnl # Kernel build cpp flags + KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL " + KERNELCPPFLAGS="$KERNELCPPFLAGS -I$splsrc -I$splsrc/include -I$TOPDIR" + + dnl # Required for pread() functionality an other GNU goodness + HOSTCFLAGS="$HOSTCFLAGS -ggdb -O2 -std=c99 " + HOSTCFLAGS="$HOSTCFLAGS -D_GNU_SOURCE -D__EXTENSIONS__ " + + dnl # XXX: Quiet warnings not covered by the gcc-* patches + dnl # XXX: Remove once all the warnings are resolved + HOSTCFLAGS="$HOSTCFLAGS -Wno-switch -Wno-unused -Wno-missing-braces " + HOSTCFLAGS="$HOSTCFLAGS -Wno-parentheses " + HOSTCFLAGS="$HOSTCFLAGS -Wno-uninitialized -fno-strict-aliasing " + + dnl # Expected defines not covered by zfs_config.h or spl_config.h + HOSTCFLAGS="$HOSTCFLAGS -DHAVE_SPL -D_POSIX_PTHREAD_SEMANTICS " + HOSTCFLAGS="$HOSTCFLAGS -D_FILE_OFFSET_BITS=64 " + HOSTCFLAGS="$HOSTCFLAGS -D_LARGEFILE64_SOURCE -D_REENTRANT " + HOSTCFLAGS="$HOSTCFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\" " + + dnl # Expected default include path + HOSTCFLAGS="$HOSTCFLAGS -I$TOPDIR " + + if test "$kernelbuild" != "$kernelsrc"; then + KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild" + fi + + AC_SUBST(KERNELMAKE_PARAMS) + AC_SUBST(KERNELCPPFLAGS) + AC_SUBST(HOSTCFLAGS) + + dnl # XXX: I really, really hate this... but to ensure the kernel + dnl # build system compiles C files shared between a library and a + dnl # kernel module, we need to ensure each file has a unique make + dnl # target. To do that I'm creating symlinks for each shared + dnl # file at configure time. It may be possible something better + dnl # can be done in the Makefile but it will take some serious + dnl # investigation and I don't have the time now. + + echo "Creating symlinks for additional make targets" + ln -f -s $LIBDIR/libport/u8_textprep.c $LIBDIR/libport/ku8_textprep.c + ln -f -s $LIBDIR/libavl/avl.c $LIBDIR/libavl/kavl.c + ln -f -s $LIBDIR/libavl/avl.c $LIBDIR/libavl/uavl.c + ln -f -s $LIBDIR/libnvpair/nvpair.c $LIBDIR/libnvpair/knvpair.c + ln -f -s $LIBDIR/libnvpair/nvpair.c $LIBDIR/libnvpair/unvpair.c + ln -f -s $LIBDIR/libzcommon/zfs_deleg.c $LIBDIR/libzcommon/kzfs_deleg.c + ln -f -s $LIBDIR/libzcommon/zfs_prop.c $LIBDIR/libzcommon/kzfs_prop.c + ln -f -s $LIBDIR/libzcommon/zprop_common.c $LIBDIR/libzcommon/kzprop_common.c + ln -f -s $LIBDIR/libzcommon/compress.c $LIBDIR/libzcommon/kcompress.c + ln -f -s $LIBDIR/libzcommon/list.c $LIBDIR/libzcommon/klist.c + ln -f -s $LIBDIR/libzcommon/zfs_namecheck.c $LIBDIR/libzcommon/kzfs_namecheck.c + ln -f -s $LIBDIR/libzcommon/zfs_comutil.c $LIBDIR/libzcommon/kzfs_comutil.c + ln -f -s $LIBDIR/libzcommon/zpool_prop.c $LIBDIR/libzcommon/kzpool_prop.c + ] +) diff --git a/config/lustre b/config/lustre.m4 similarity index 100% rename from config/lustre rename to config/lustre.m4 diff --git a/config/user b/config/user.m4 similarity index 100% rename from config/user rename to config/user.m4 diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index badb8b69e1..61b0c2953b 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -1,18 +1,5 @@ AC_DEFUN([ZFS_AC_CONFIG], [ - AC_ARG_WITH([zfs-config], - AS_HELP_STRING([--with-config=CONFIG], - [Config file 'kernel|user|lustre']), - [zfsconfig="$withval"]) - - AC_MSG_CHECKING([zfs config file]) - if test -z "$zfsconfig" || test ! -r config/$zfsconfig; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([ - *** Please specify one of the valid config files located - *** in ./config/ with the '--with-zfs-config=CONFIG' option]) - fi - TOPDIR=`/bin/pwd` BUILDDIR=$ZFS_META_NAME #+$zfsconfig ZFSDIR=$TOPDIR/$BUILDDIR @@ -28,12 +15,24 @@ AC_DEFUN([ZFS_AC_CONFIG], [ AC_SUBST(CMDDIR) AC_SUBST(UNAME) - AC_MSG_RESULT([$zfsconfig]); - . ./config/$zfsconfig + AC_ARG_WITH([zfs-config], + AS_HELP_STRING([--with-config=CONFIG], + [Config file 'kernel|user|lustre']), + [zfsconfig="$withval"]) - AC_SUBST(KERNELMAKE_PARAMS) - AC_SUBST(KERNELCPPFLAGS) - AC_SUBST(HOSTCFLAGS) + AC_MSG_CHECKING([zfs config file]) + + [ case "$zfsconfig" in + kernel) ZFS_AC_KERNEL_CONFIG ;; + user) ZFS_AC_USER_CONFIG ;; + lustre) ZFS_AC_LUSTRE_CONFIG ;; + *) + AC_MSG_RESULT([Error!]) + AC_MSG_ERROR([Bad value "$zfsconfig" for --with-config, + user kernel|user|lustre]) ;; + esac ] + + AC_MSG_RESULT([$zfsconfig]); ]) AC_DEFUN([ZFS_AC_KERNEL], [