AC_PROG_MAKE_SET
AC_PROG_SED
AC_PROG_YACC
+AC_PATH_PROG(report_fold, fold)
LT_INIT
# Check for objcopy, required by the base address statedump and dynamic linker tests
major_version=$(echo AC_PACKAGE_VERSION | $SED 's/^\([[0-9]]\)*\.[[0-9]]*\.[[0-9]]*.*$/\1/')
minor_version=$(echo AC_PACKAGE_VERSION | $SED 's/^[[0-9]]*\.\([[0-9]]*\)\.[[0-9]]*.*$/\1/')
patchlevel_version=$(echo AC_PACKAGE_VERSION | $SED 's/^[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\).*$/\1/')
+
AC_SUBST([MAJOR_VERSION], [$major_version])
AC_SUBST([MINOR_VERSION], [$minor_version])
AC_SUBST([PATCHLEVEL_VERSION], [$patchlevel_version])
#
# Mini-report on what will be built.
#
-AS_ECHO()
-AS_ECHO("Version name: $version_name")
-AS_ECHO("$version_description")
+PPRINT_INIT
+PPRINT_SET_INDENT(1)
+PPRINT_SET_TS(38)
+
+AS_ECHO
+AS_ECHO("${PPRINT_COLOR_BLDBLU}LTTng-tools $PACKAGE_VERSION \"$version_name\"$PPRINT_COLOR_RST")
+AS_ECHO
+
+AS_IF([test -n "$report_fold"], [
+ AS_ECHO("`AS_ECHO("$version_description") | $report_fold -s`")
+], [
+ AS_ECHO("$version_description")
+])
-AS_ECHO()
+AS_ECHO
+PPRINT_SUBTITLE([Features])
# Target architecture we're building for.
target_arch=$host_cpu
fi
done
]
-AS_ECHO_N("Target architecture: ")
-AS_ECHO($target_arch)
+PPRINT_PROP_STRING([Target architecture], $target_arch)
# kmod enabled/disabled
-AS_ECHO_N("libkmod support: ")
-AS_IF([test "x$kmod_found" = "xyes"],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test "x$kmod_found" = "xyes" && value=1 || value=0
+PPRINT_PROP_BOOL([libkmod support], $value)
# LTTng-UST enabled/disabled
-AS_ECHO_N("Lttng-UST support: ")
-AS_IF([test "x$lttng_ust_support" = "xyes"],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test "x$lttng_ust_support" = "xyes" && value=1 || value=0
+PPRINT_PROP_BOOL([LTTng-UST support], $value)
-AS_ECHO()
-AS_ECHO("Binaries:")
+AS_ECHO
+PPRINT_SUBTITLE([Binaries])
# List binaries to be built
-AS_ECHO_N("lttng: ")
-AS_IF([test x$enable_bin_lttng != xno],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test x$enable_bin_lttng != xno && value=1 || value=0
+PPRINT_PROP_BOOL([lttng], $value)
-AS_ECHO_N("lttng-consumerd: ")
-AS_IF([test x$enable_bin_lttng_consumerd != xno],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test x$enable_bin_lttng_consumerd != xno && value=1 || value=0
+PPRINT_PROP_BOOL([lttng-consumerd], $value)
-AS_ECHO_N("lttng-crash: ")
-AS_IF([test x$enable_bin_lttng_crash != xno],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test x$enable_bin_lttng_crash != xno && value=1 || value=0
+PPRINT_PROP_BOOL([lttng-crash], $value)
-AS_ECHO_N("lttng-relayd: ")
-AS_IF([test x$enable_bin_lttng_relayd != xno],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test x$enable_bin_lttng_relayd != xno && value=1 || value=0
+PPRINT_PROP_BOOL([lttng-relayd], $value)
-AS_ECHO_N("lttng-sessiond: ")
-AS_IF([test x$enable_bin_lttng_sessiond != xno],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test x$enable_bin_lttng_sessiond != xno && value=1 || value=0
+PPRINT_PROP_BOOL([lttng-sessiond], $value)
-AS_ECHO_N("Extras: ")
-AS_IF([test x$enable_extras != xno],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+# Extras
+test x$enable_extras != xno && value=1 || value=0
+AS_ECHO
+PPRINT_SET_INDENT(0)
+PPRINT_PROP_BOOL([Extras], $value, $PPRINT_COLOR_SUBTITLE)
+PPRINT_SET_INDENT(1)
-# Print the bindir and libdir this `make install' will install into.
-AS_ECHO()
-AS_ECHO_N("Binaries will be installed in: ")
-AS_ECHO("`eval eval echo $bindir`")
-AS_ECHO_N("Libraries will be installed in: ")
-AS_ECHO("`eval eval echo $libdir`")
-
-
-AS_ECHO()
+AS_ECHO
+PPRINT_SUBTITLE([Tests])
# Print clear message that tests won't be built
AS_IF([test "x$build_tests" = "xno"],[
- AS_ECHO("WARNING: Tests won't be built since some binaries were disabled")
+ PPRINT_WARN([Tests won't be built since some binaries were disabled])
])
-AS_ECHO("Tests:")
-
# LTTng UST Java agent JUL tests enabled/disabled
-AS_ECHO_N("LTTng-UST Java agent JUL tests: ")
-AS_IF([test "x$test_java_agent_jul" = "xyes"],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test "x$test_java_agent_jul" = "xyes" && value=1 || value=0
+PPRINT_PROP_BOOL([LTTng-UST Java agent JUL tests], $value)
# LTTng UST Java agent Log4j tests enabled/disabled
-AS_ECHO_N("LTTng-UST Java agent Log4j tests: ")
-AS_IF([test "x$test_java_agent_log4j" = "xyes"],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test "x$test_java_agent_log4j" = "xyes" && value=1 || value=0
+PPRINT_PROP_BOOL([LTTng-UST Java agent Log4j tests], $value)
-AS_ECHO_N("LTTng-UST Python2 agent tests: ")
-AS_IF([test ! -z "$PYTHON2_AGENT"],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test ! -z "$PYTHON2_AGENT" && value=1 || value=0
+PPRINT_PROP_BOOL([LTTng-UST Python2 agent tests], $value)
-AS_ECHO_N("LTTng-UST Python3 agent tests: ")
-AS_IF([test ! -z "$PYTHON3_AGENT"],[
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
-
-AS_ECHO()
+test ! -z "$PYTHON3_AGENT" && value=1 || value=0
+PPRINT_PROP_BOOL([LTTng-UST Python3 agent tests], $value)
#Python binding enabled/disabled
-AS_ECHO_N("Python binding: ")
-AS_IF([test "x${enable_python_binding:-yes}" = xyes], [
- AS_ECHO("Enabled")
-],[
- AS_ECHO("Disabled")
-])
+test "x${enable_python_binding:-yes}" = xyes && value=1 || value=0
+AS_ECHO
+PPRINT_SET_INDENT(0)
+PPRINT_PROP_BOOL([Python binding], $value, $PPRINT_COLOR_SUBTITLE)
+PPRINT_SET_INDENT(1)
-AS_ECHO()
+AS_ECHO
+PPRINT_SUBTITLE([Man pages])
# man pages build enabled/disabled
-AS_ECHO_N("Build man pages: ")
+test "x$enable_build_man_pages" = "xyes" && value=1 || value=0
AS_IF([test "x$enable_build_man_pages" = "xyes"], [
- AS_ECHO("Yes")
+ PPRINT_PROP_BOOL([Build man pages], 1)
], [
AS_IF([test "x$in_git_repo" = "xyes"], [
- AS_ECHO("No")
+ PPRINT_PROP_BOOL([Build man pages], 0)
], [
- AS_ECHO("Already built")
+ PPRINT_PROP_STRING([Build man pages], [${PPRINT_COLOR_BLDGRN}Already built])
])
])
# man pages install enabled/disabled (always true in tarball)
-AS_ECHO_N("Install man pages: ")
-AS_IF([test "x$enable_build_man_pages" = "xno" && test "x$in_git_repo" = "xyes"], [
- AS_ECHO("No")
-], [
- AS_ECHO("Yes")
-])
+test "x$enable_build_man_pages" = "xno" && test "x$in_git_repo" = "xyes" && value=0 || value=1
+PPRINT_PROP_BOOL([Install man pages], $value)
-AS_ECHO()
+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_ECHO
+PPRINT_SUBTITLE([Search directories])
# If we build the sessiond, print the paths it will use
-AS_ECHO_N("The lttng command will search for the lttng-sessiond executable at: ")
AS_IF([test "$SESSIOND_BIN" = ""],[
- AS_ECHO_N("`eval eval echo $bindir`")
- AS_ECHO("/lttng-sessiond")
+ path="$report_bindir/lttng-sessiond"
],[
- AS_ECHO("$SESSIOND_BIN")
+ path="$SESSIOND_BIN"
])
+PPRINT_PROP_STRING([lttng-sessiond executable], [$path])
-AS_ECHO()
-AS_ECHO("The sessiond daemon will search the following directories: ")
-AS_ECHO_N("32-bit consumerd executable: ")
AS_IF([test "$CONSUMERD32_BIN" = ""],[
- AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
- AS_ECHO("/lttng-consumerd")
+ path="`eval eval echo $lttnglibexecdir`/lttng-consumerd"
],[
- AS_ECHO("$CONSUMERD32_BIN")
+ path="$CONSUMERD32_BIN"
])
+PPRINT_PROP_STRING([32-bit lttng-consumerd executable], [$path])
-AS_ECHO_N("32-bit consumer libraries: ")
AS_IF([test "$CONSUMERD32_LIBDIR" = ""],[
- AS_ECHO("`eval eval echo $libdir`")
+ path="`eval eval echo $libdir`"
],[
- AS_ECHO("$CONSUMERD32_LIBDIR")
+ path="$CONSUMERD32_LIBDIR"
])
+PPRINT_PROP_STRING([32-bit consumer libraries], [$path])
-AS_ECHO_N("64-bit consumerd executable: ")
AS_IF([test "$CONSUMERD64_BIN" = ""],[
- AS_ECHO_N("`eval eval echo $lttnglibexecdir`")
- AS_ECHO("/lttng-consumerd")
+ path="`eval eval echo $lttnglibexecdir`/lttng-consumerd"
],[
- AS_ECHO("$CONSUMERD64_BIN")
+ path="$CONSUMERD64_BIN"
])
+PPRINT_PROP_STRING([64-bit lttng-consumerd executable], [$path])
-AS_ECHO_N("64-bit consumer libraries: ")
AS_IF([test "$CONSUMERD64_LIBDIR" = ""],[
- AS_ECHO("`eval eval echo $libdir`")
+ path="`eval eval echo $libdir`"
],[
- AS_ECHO("$CONSUMERD64_LIBDIR")
+ path="$CONSUMERD64_LIBDIR"
])
-
-AS_ECHO()
-
+PPRINT_PROP_STRING([64-bit consumer libraries], [$path])
--- /dev/null
+# Pretty printing macros.
+#
+# Author: Philippe Proulx <pproulx@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_if([$#], 3, [
+ m4_pushdef([pprint_title_color], [$3])
+ ], [
+ m4_pushdef([pprint_title_color], [])
+ ])
+
+ 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])
+])