[lttng-dev] [PATCH urcu] Add report at the end of configure

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Mon Apr 24 21:58:54 UTC 2017


merged in master, thanks!

Mathieu

----- On Apr 19, 2017, at 4:47 PM, Michael Jeanson mjeanson at efficios.com wrote:

> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
> configure.ac |  66 ++++++++++++++++++----
> m4/pprint.m4 | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 233 insertions(+), 11 deletions(-)
> create mode 100644 m4/pprint.m4
> 
> diff --git a/configure.ac b/configure.ac
> index 5f61bdb..7032d88 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -213,8 +213,10 @@ AS_IF([test "x$ARCHTYPE" = "xx86"],[
> 	AS_IF([test "x$host_cpu" != "xi386" -a "x$host_cpu" != "xi486" -a "x$host_cpu"
> 	!= "xi586" -a "x$host_cpu" != "xi686" -a "x$host_vendor" != "xk1om" -a
> 	"x$host_cpu" != "xk1om"],[
> 		AC_MSG_RESULT([yes])
> 		AC_DEFINE([CONFIG_RCU_HAVE_FENCE], [1])
> +		config_rcu_have_fence=yes
> 	],[
> 		AC_MSG_RESULT([no])
> +		config_rcu_have_fence=no
> 	])
> ])
> 
> @@ -238,6 +240,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> # Search for clock_gettime
> AC_SEARCH_LIBS([clock_gettime], [rt], [
> 	AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1])
> +	config_rcu_have_clock_gettime=yes
> ], [])
> 
> AM_CONDITIONAL([COMPAT_FUTEX], [test "x$compat_futex_test" = "x1"])
> @@ -392,15 +395,56 @@ AC_CONFIG_FILES([
> ])
> AC_OUTPUT
> 
> -# Report on selected configure options
> -AS_IF([test "x$def_smp_support" = "xyes"],[
> -	AS_ECHO("SMP support enabled.")
> -],[
> -	AS_ECHO("SMP support disabled.")
> -])
> +#
> +# Mini-report on what will be built.
> +#
> +
> +PPRINT_INIT
> +PPRINT_SET_INDENT(1)
> +PPRINT_SET_TS(38)
> +
> +AS_ECHO
> +AS_ECHO("${PPRINT_COLOR_BLDBLU}Userspace-RCU
> $PACKAGE_VERSION${PPRINT_COLOR_RST}")
> +AS_ECHO
> +
> +PPRINT_SUBTITLE([Features])
> +
> +PPRINT_PROP_STRING([Target architecture], $host_cpu)
> +
> +# SMP support enabled/disabled
> +test "x$def_smp_support" = "xyes" && value=1 || value=0
> +PPRINT_PROP_BOOL([SMP support], $value)
> +
> +# Memory fence support available
> +test "x$config_rcu_have_fence" = "xyes" && value=1 || value=0
> +PPRINT_PROP_BOOL([Memory fence instructions], $value)
> +
> +# Futex support available
> +test "x$compat_futex_test" = "x0" && value=1 || value=0
> +PPRINT_PROP_BOOL([Futex support], $value)
> +
> +# TLS
> +test "x$def_tls_detect" = "x" && value="pthread_getspecific()" ||
> value="$def_tls_detect"
> +PPRINT_PROP_STRING([Thread Local Storage (TLS)], [$value])
> +
> +# clock_gettime() available
> +test "x$config_rcu_have_clock_gettime" = "xyes" && value=1 || value=0
> +PPRINT_PROP_BOOL([clock_gettime()], $value)
> +
> +# Require membarrier
> +test "x$def_sys_membarrier_fallback" != "xyes" && value=1 || value=0
> +PPRINT_PROP_BOOL([Require membarrier], $value)
> +
> +# RCU debug enabled/disabled
> +test "x$enable_rcu_debug" = "xyes" && value=1 || value=0
> +PPRINT_PROP_BOOL([Internal debugging], $value)
> +
> +report_bindir="`eval eval echo $bindir`"
> +report_libdir="`eval eval echo $libdir`"
> +
> +# Print the bindir and libdir this `make install' will install into.
> +AS_ECHO
> +PPRINT_SUBTITLE([Install directories])
> +PPRINT_PROP_STRING([Binaries], [$report_bindir])
> +PPRINT_PROP_STRING([Libraries], [$report_libdir])
> 
> -AS_IF([test "x$def_tls_detect" = "x"],[
> -	AS_ECHO("Thread Local Storage (TLS): pthread_getspecific().")
> -],[
> -	AS_ECHO("Thread Local Storage (TLS): $def_tls_detect.")
> -])
> diff --git a/m4/pprint.m4 b/m4/pprint.m4
> new file mode 100644
> index 0000000..c7024c3
> --- /dev/null
> +++ b/m4/pprint.m4
> @@ -0,0 +1,178 @@
> +# Pretty printing macros.
> +#
> +# Author: Philippe Proulx <pproulx at efficios.com>
> +
> +# PPRINT_INIT(): initializes the pretty printing system.
> +#
> +# Use this macro before using any other PPRINT_* macro.
> +AC_DEFUN([PPRINT_INIT], [
> +  m4_define([PPRINT_CONFIG_TS], [50])
> +  m4_define([PPRINT_CONFIG_INDENT], [2])
> +  PPRINT_YES_MSG=yes
> +  PPRINT_NO_MSG=no
> +
> +  # find tput, which tells us if colors are supported and gives us color codes
> +  AC_PATH_PROG([pprint_tput], [tput])
> +
> +  AS_IF([test -n "$pprint_tput"], [
> +    AS_IF([test -n "$PS1" && test `"$pprint_tput" colors` -ge 8 && test -t 1],
> [
> +      # interactive shell and colors supported and standard output
> +      # file descriptor is opened on a terminal
> +      PPRINT_COLOR_TXTBLK="`"$pprint_tput" setf 0`"
> +      PPRINT_COLOR_TXTBLU="`"$pprint_tput" setf 1`"
> +      PPRINT_COLOR_TXTGRN="`"$pprint_tput" setf 2`"
> +      PPRINT_COLOR_TXTCYN="`"$pprint_tput" setf 3`"
> +      PPRINT_COLOR_TXTRED="`"$pprint_tput" setf 4`"
> +      PPRINT_COLOR_TXTPUR="`"$pprint_tput" setf 5`"
> +      PPRINT_COLOR_TXTYLW="`"$pprint_tput" setf 6`"
> +      PPRINT_COLOR_TXTWHT="`"$pprint_tput" setf 7`"
> +      PPRINT_COLOR_BLD=`"$pprint_tput" bold`
> +      PPRINT_COLOR_BLDBLK="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTBLK"
> +      PPRINT_COLOR_BLDBLU="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTBLU"
> +      PPRINT_COLOR_BLDGRN="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTGRN"
> +      PPRINT_COLOR_BLDCYN="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTCYN"
> +      PPRINT_COLOR_BLDRED="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTRED"
> +      PPRINT_COLOR_BLDPUR="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTPUR"
> +      PPRINT_COLOR_BLDYLW="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTYLW"
> +      PPRINT_COLOR_BLDWHT="$PPRINT_COLOR_BLD$PPRINT_COLOR_TXTWHT"
> +      PPRINT_COLOR_RST="`"$pprint_tput" sgr0`"
> +
> +      # colored yes and no
> +      PPRINT_YES_MSG="$PPRINT_COLOR_BLDGRN$PPRINT_YES_MSG$PPRINT_COLOR_RST"
> +      PPRINT_NO_MSG="$PPRINT_COLOR_BLDRED$PPRINT_NO_MSG$PPRINT_COLOR_RST"
> +
> +      # subtitle color
> +      PPRINT_COLOR_SUBTITLE="$PPRINT_COLOR_BLDCYN"
> +    ])
> +  ])
> +])
> +
> +# PPRINT_SET_INDENT(indent): sets the current indentation.
> +#
> +# Use PPRINT_INIT() before using this macro.
> +AC_DEFUN([PPRINT_SET_INDENT], [
> +  m4_define([PPRINT_CONFIG_INDENT], [$1])
> +])
> +
> +# PPRINT_SET_TS(ts): sets the current tab stop.
> +#
> +# Use PPRINT_INIT() before using this macro.
> +AC_DEFUN([PPRINT_SET_TS], [
> +  m4_define([PPRINT_CONFIG_TS], [$1])
> +])
> +
> +# PPRINT_SUBTITLE(subtitle): pretty prints a subtitle.
> +#
> +# The subtitle is put as is in a double-quoted shell string so the user
> +# needs to escape ".
> +#
> +# Use PPRINT_INIT() before using this macro.
> +AC_DEFUN([PPRINT_SUBTITLE], [
> +  AS_ECHO(["${PPRINT_COLOR_SUBTITLE}$1$PPRINT_COLOR_RST"])
> +])
> +
> +AC_DEFUN([_PPRINT_INDENT], [
> +  m4_if(PPRINT_CONFIG_INDENT, 0, [
> +  ], [
> +    m4_for([pprint_i], [0], m4_eval(PPRINT_CONFIG_INDENT * 2 - 1), [1], [
> +      AS_ECHO_N([" "])
> +    ])
> +  ])
> +])
> +
> +# PPRINT_PROP_STRING(title, value, title_color?): pretty prints a
> +# string property.
> +#
> +# The title is put as is in a double-quoted shell string so the user
> +# needs to escape ".
> +#
> +# The $PPRINT_CONFIG_INDENT variable must be set to the desired indentation
> +# level.
> +#
> +# Use PPRINT_INIT() before using this macro.
> +AC_DEFUN([PPRINT_PROP_STRING], [
> +  m4_pushdef([pprint_title], [$1])
> +  m4_pushdef([pprint_value], [$2])
> +  m4_pushdef([pprint_title_color], m4_default([$3], []))
> +  m4_pushdef([pprint_title_len], m4_len(pprint_title))
> +  m4_pushdef([pprint_spaces_cnt], m4_eval(PPRINT_CONFIG_TS - pprint_title_len -
> (PPRINT_CONFIG_INDENT * 2) - 1))
> +
> +  m4_if(m4_eval(pprint_spaces_cnt <= 0), [1], [
> +    m4_define([pprint_spaces_cnt], [1])
> +  ])
> +
> +  m4_pushdef([pprint_spaces], [])
> +
> +  m4_for([pprint_i], 0, m4_eval(pprint_spaces_cnt - 1), [1], [
> +    m4_append([pprint_spaces], [ ])
> +  ])
> +
> +  _PPRINT_INDENT
> +
> +
> AS_ECHO_N(["pprint_title_color""pprint_title$PPRINT_COLOR_RST:pprint_spaces"])
> +  AS_ECHO(["${PPRINT_COLOR_BLD}pprint_value$PPRINT_COLOR_RST"])
> +
> +  m4_popdef([pprint_spaces])
> +  m4_popdef([pprint_spaces_cnt])
> +  m4_popdef([pprint_title_len])
> +  m4_popdef([pprint_title_color])
> +  m4_popdef([pprint_value])
> +  m4_popdef([pprint_title])
> +])
> +
> +# PPRINT_PROP_BOOL(title, value, title_color?): pretty prints a boolean
> +# property.
> +#
> +# The title is put as is in a double-quoted shell string so the user
> +# needs to escape ".
> +#
> +# The value is evaluated at shell runtime. Its evaluation must be
> +# 0 (false) or 1 (true).
> +#
> +# Uses the PPRINT_PROP_STRING() with the "yes" or "no" string.
> +#
> +# Use PPRINT_INIT() before using this macro.
> +AC_DEFUN([PPRINT_PROP_BOOL], [
> +  m4_pushdef([pprint_title], [$1])
> +  m4_pushdef([pprint_value], [$2])
> +
> +  test pprint_value -eq 0 && pprint_msg="$PPRINT_NO_MSG" ||
> pprint_msg="$PPRINT_YES_MSG"
> +
> +  m4_if([$#], [3], [
> +    PPRINT_PROP_STRING(pprint_title, [$pprint_msg], $3)
> +  ], [
> +    PPRINT_PROP_STRING(pprint_title, [$pprint_msg])
> +  ])
> +
> +  m4_popdef([pprint_value])
> +  m4_popdef([pprint_title])
> +])
> +
> +# PPRINT_WARN(msg): pretty prints a warning message.
> +#
> +# The message is put as is in a double-quoted shell string so the user
> +# needs to escape ".
> +#
> +# Use PPRINT_INIT() before using this macro.
> +AC_DEFUN([PPRINT_WARN], [
> +  m4_pushdef([pprint_msg], [$1])
> +
> +  _PPRINT_INDENT
> +  AS_ECHO(["${PPRINT_COLOR_TXTYLW}WARNING:$PPRINT_COLOR_RST
> ${PPRINT_COLOR_BLDYLW}pprint_msg$PPRINT_COLOR_RST"])
> +
> +  m4_popdef([pprint_msg])
> +])
> +
> +# PPRINT_ERROR(msg): pretty prints an error message and exits.
> +#
> +# The message is put as is in a double-quoted shell string so the user
> +# needs to escape ".
> +#
> +# Use PPRINT_INIT() before using this macro.
> +AC_DEFUN([PPRINT_ERROR], [
> +  m4_pushdef([pprint_msg], [$1])
> +
> +  AC_MSG_ERROR([${PPRINT_COLOR_BLDRED}pprint_msg$PPRINT_COLOR_RST])
> +
> +  m4_popdef([pprint_msg])
> +])
> --
> 2.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list