[lttng-dev] [liburcu PATCH 1/3] Refresh autoconf files

Alexandre Montplaisir alexandre.montplaisir at gmail.com
Thu Jan 5 22:51:32 EST 2012


On 12-01-05 10:42 PM, Alexandre Montplaisir wrote:
> Use portable shell macros wherever possible.
>
> Change the mfence check to actually check for the assembly function,
> instead of relying on the architecture's name.
>
> Signed-off-by: Alexandre Montplaisir<alexandre.montplaisir at gmail.com>
> ---
>   Makefile.am  |    2 +
>   bootstrap    |    6 +-
>   configure.ac |  265 ++++++++++++++++++++++++++++------------------------------
>   3 files changed, 130 insertions(+), 143 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index a7d3316..a14029b 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1,3 +1,5 @@
> +ACLOCAL_AMFLAGS=-I config
> +
>   INCLUDES = -I$(top_builddir)/urcu
>
>   #Add the -version-info directly here since we are only building
> diff --git a/bootstrap b/bootstrap
> index c507425..c71b862 100755
> --- a/bootstrap
> +++ b/bootstrap
> @@ -4,9 +4,5 @@ set -x
>   if [ ! -e config ]; then
>   	mkdir config
>   fi
> -aclocal
> -libtoolize --force --copy
> -autoheader
> -automake --add-missing --copy
> -autoconf
>
> +autoreconf -i
> diff --git a/configure.ac b/configure.ac
> index 5a90008..0311246 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -9,23 +9,21 @@ AC_INIT([userspace-rcu],[0.6.7],[mathieu dot desnoyers at efficios dot com])
>   AC_SUBST([URCU_LIBRARY_VERSION], [1:0:0])
>
>   AC_CONFIG_AUX_DIR([config])
> +AC_CONFIG_MACRO_DIR([config])
>   AC_CANONICAL_TARGET
>   AC_CANONICAL_HOST
>   AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
>   m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
>
>   AC_CONFIG_SRCDIR([urcu.h])
> -AM_PROG_MKDIR_P
>
>   AC_CONFIG_HEADERS([config.h urcu/config.h])
>
> -# Keep at the end to do not pollute installed header.
>   AH_TEMPLATE([CONFIG_RCU_SMP], [Enable SMP support. With SMP support enabled, uniprocessors are also supported. With SMP support disabled, UP systems work fine, but the behavior of SMP systems is undefined.])
>   AH_TEMPLATE([CONFIG_RCU_HAVE_FENCE], [Defined when on a system that has memory fence instructions.])
>   AH_TEMPLATE([CONFIG_RCU_HAVE_FUTEX], [Defined when on a system with futex support.])
> -AH_TEMPLATE([CONFIG_RCU_COMPAT_ARCH], [Compatibility mode for i386 which lacks
> -cmpxchg instruction.])
> -AH_TEMPLATE([CONFIG_RCU_ARM_HAVE_DMB], [Use the dmb instruction is available for use on ARM.])
> +AH_TEMPLATE([CONFIG_RCU_COMPAT_ARCH], [Compatibility mode for i386 which lacks cmpxchg instruction.])
> +AH_TEMPLATE([CONFIG_RCU_ARM_HAVE_DMB], [Use the dmb instruction if available for use on ARM.])
>
>   # Checks for programs.
>   AC_PROG_CC
> @@ -43,105 +41,90 @@ AC_FUNC_MMAP
>   AC_CHECK_FUNCS([bzero gettimeofday munmap sched_getcpu strtoul sysconf])
>
>   # Find arch type
> -case $host_cpu in
> -	i386) ARCHTYPE="x86"; SUBARCHTYPE="x86compat" ;;
> -	i486) ARCHTYPE="x86";;
> -	i586) ARCHTYPE="x86";;
> -	i686) ARCHTYPE="x86";;
> -	amd64) ARCHTYPE="x86";;
> -	x86_64) ARCHTYPE="x86";;
> -	powerpc) ARCHTYPE="ppc" ;;
> -	ppc64) ARCHTYPE="ppc" ;;
> -	powerpc64) ARCHTYPE="ppc" ;;
> -	ppc) ARCHTYPE="ppc" ;;
> -	s390) ARCHTYPE="s390" ;;
> -	s390x) ARCHTYPE="s390" ;;
> -	sparc64) ARCHTYPE="sparc64" ;;
> -	alpha*) ARCHTYPE="alpha" ;;
> -	ia64) ARCHTYPE="gcc" ;;

ARCHTYPE = gcc? I left it as-is, but is this a typo? In any case it 
doesn't seem to be used anywhere.

> -	arm*) ARCHTYPE="arm" ;;
> -	*) ARCHTYPE="unknown";;
> -esac
> -
> -if test "x$ARCHTYPE" = "xarm" ; then
> -AC_MSG_CHECKING([checking for dmb instruction])
> -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> -]], [[
> -asm volatile("dmb":::"memory");
> -]])],[
> -	AC_MSG_RESULT([yes])
> -	AC_DEFINE([CONFIG_RCU_ARM_HAVE_DMB], [1])
> -
> -],[
> -	AC_MSG_RESULT([no])
> +AS_CASE([$host_cpu],
> +	[i386], [ARCHTYPE="x86"&&  SUBARCHTYPE="x86compat"],
> +	[i486], [ARCHTYPE="x86"],
> +	[i586], [ARCHTYPE="x86"],
> +	[i686], [ARCHTYPE="x86"],
> +	[amd64], [ARCHTYPE="x86"],
> +	[x86_64], [ARCHTYPE="x86"],
> +	[powerpc], [ARCHTYPE="ppc"],
> +	[ppc64], [ARCHTYPE="ppc"],
> +	[powerpc64], [ARCHTYPE="ppc"],
> +	[ppc], [ARCHTYPE="ppc"],
> +	[s390], [ARCHTYPE="s390"],
> +	[s390x], [ARCHTYPE="s390"],
> +	[sparc64], [ARCHTYPE="sparc64"],
> +	[alpha*], [ARCHTYPE="alpha"],
> +	[ia64], [ARCHTYPE="gcc"],
> +	[arm*], [ARCHTYPE="arm"],
> +	[ARCHTYPE="unknown"]
> +)
>
> -])
> -fi
> +AC_SUBST(ARCHTYPE)
> +AC_SUBST(SUBARCHTYPE)
>
>   UATOMICSRC=urcu/uatomic/$ARCHTYPE.h
>   ARCHSRC=urcu/arch/$ARCHTYPE.h
> -if test "$ARCHTYPE" == "armv7l"; then
> -	CFLAGS="-mcpu=cortex-a9 -mtune=cortex-a9 -O"
> -fi
>
> -AC_SUBST(ARCHTYPE)
> -AC_SUBST(SUBARCHTYPE)
> +AS_IF([test "x$SUBARCHTYPE" = xx86compat],[
> +	AC_DEFINE([CONFIG_RCU_COMPAT_ARCH], [1])
> +])
> +
> +AS_IF([test "$host_cpu" = "armv7l"],[

I assumed we did not want ARCHTYPE here, that can't be set to "armv7l".
But shouldn't we use $target_cpu instead (here and in the test above)?

> +	CFLAGS="$CFLAGS -mcpu=cortex-a9 -mtune=cortex-a9 -O1"
> +])
>
> [...]




More information about the lttng-dev mailing list