From 9c347d872fd7421b9c96bd1d4d25bda14979392b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 8 Jun 2009 16:07:43 -0700 Subject: [PATCH 1/2] Core target arch support for conditional compilation of SUBDIRs which is used by libspl for it's arch specific atomic implementations. --- autogen.sh | 2 +- config/user-arch.m4 | 21 +++++++++++++++++++++ config/user.m4 | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 config/user-arch.m4 diff --git a/autogen.sh b/autogen.sh index e5614cf326..728000ae4a 100644 --- a/autogen.sh +++ b/autogen.sh @@ -3,6 +3,6 @@ aclocal -I config && libtoolize --automake --copy autoheader && -automake --add-missing --include-deps --copy 2>/dev/null +automake --add-missing --include-deps --copy autoconf rm -rf autom4te.cache aclocal.m4 diff --git a/config/user-arch.m4 b/config/user-arch.m4 new file mode 100644 index 0000000000..7a09cbfe2b --- /dev/null +++ b/config/user-arch.m4 @@ -0,0 +1,21 @@ +dnl # +dnl # Set the target arch for libspl atomic implementation +dnl # +AC_DEFUN([ZFS_AC_CONFIG_USER_ARCH], [ + AC_MSG_CHECKING(for target arch) + TARGET_ARCH=`echo ${target_cpu} | sed -e s/i.86/i386/` + TARGET_ARCH_DIR=asm-$TARGET_ARCH + AC_MSG_RESULT([$TARGET_ARCH]) + + case $TARGET_ARCH in + i386|x86_64|powerpc) + AC_SUBST([TARGET_ARCH]) + AC_SUBST([TARGET_ARCH_DIR]) + ;; + *) + AC_MSG_ERROR([ + *** Unsupported architecture $TARGET_ARCH + *** Available architectures: x86, x86_64, powerpc]) + ;; + esac +]) diff --git a/config/user.m4 b/config/user.m4 index d9f9d621fe..063d582bbd 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -2,6 +2,7 @@ dnl # dnl # Default ZFS user configuration dnl # AC_DEFUN([ZFS_AC_CONFIG_USER], [ + ZFS_AC_CONFIG_USER_ARCH ZFS_AC_CONFIG_USER_LIBEFI ZFS_AC_CONFIG_USER_LIBDISKMGT ZFS_AC_CONFIG_USER_LIBSHARE From 3f3cebdcda4a9fdc145d50b3b90b1ca7a2aade22 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 8 Jun 2009 16:10:12 -0700 Subject: [PATCH 2/2] libspl support for conditional SUBDIRs based on target arch --- lib/libspl/Makefile.am | 7 ++++--- lib/libspl/asm-powerpc64/Makefile.am | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am index 2fd80975b2..7b89baee86 100644 --- a/lib/libspl/Makefile.am +++ b/lib/libspl/Makefile.am @@ -1,7 +1,8 @@ include $(top_srcdir)/config/Rules.am -target_arch = $(shell echo ${target_cpu} | sed -e s/i.86/i386/) -SUBDIRS = asm-i386 asm-x86_64 asm-powerpc64 include +SUBDIRS = include $(TARGET_ARCH_DIR) +DIST_SUBDIRS = include asm-i386 asm-x86_64 asm-powerpc64 + DEFAULT_INCLUDES += \ -I${top_srcdir}/lib/libspl/include @@ -21,6 +22,6 @@ libspl_la_SOURCES = \ ${top_srcdir}/lib/libspl/strnlen.c \ ${top_srcdir}/lib/libspl/zone.c \ ${top_srcdir}/lib/libspl/xdr.c \ - ${top_srcdir}/lib/libspl/asm-${target_arch}/atomic.S \ + ${top_srcdir}/lib/libspl/${TARGET_ARCH_DIR}/atomic.S \ ${top_srcdir}/lib/libspl/include/sys/list.h \ ${top_srcdir}/lib/libspl/include/sys/list_impl.h diff --git a/lib/libspl/asm-powerpc64/Makefile.am b/lib/libspl/asm-powerpc64/Makefile.am index f8f5b28856..38f3be8bd9 100644 --- a/lib/libspl/asm-powerpc64/Makefile.am +++ b/lib/libspl/asm-powerpc64/Makefile.am @@ -4,12 +4,12 @@ DEFAULT_INCLUDES += \ -I${top_srcdir}/lib/libspl/include COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -atomic_SOURCES = atomic.c +atomic_SOURCE = atomic.c atomic_ASM = atomic.S # Generates assembly to simplify inclusion in ../Makefile.am all-am: - $(COMPILE) -c -S ${atomic_SOURCES} -o ${atomic_ASM} + $(COMPILE) -c -S ${atomic_SOURCE} -o ${atomic_ASM} clean-generic: rm ${atomic_ASM}