[前][次][番号順一覧][スレッド一覧]

ruby-changes:40121

From: nobu <ko1@a...>
Date: Tue, 20 Oct 2015 16:15:19 +0900 (JST)
Subject: [ruby-changes:40121] nobu:r52202 (trunk): highlight configure

nobu	2015-10-20 16:15:04 +0900 (Tue, 20 Oct 2015)

  New Revision: 52202

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52202

  Log:
    highlight configure
    
    * aclocal.m4 (COLORIZE_RESULT): highlight result messages.

  Added files:
    trunk/aclocal.m4
  Modified files:
    trunk/Makefile.in
    trunk/configure.in
    trunk/tool/ifchange
Index: configure.in
===================================================================
--- configure.in	(revision 52201)
+++ configure.in	(revision 52202)
@@ -4317,7 +4317,7 @@ AC_SUBST(BUILTIN_TRANSOBJS) https://github.com/ruby/ruby/blob/trunk/configure.in#L4317
 
 PACKAGE=$RUBY_BASE_NAME
 AC_SUBST(PACKAGE)
-AC_MSG_RESULT($PACKAGE library version = $ruby_version)
+AS_MESSAGE([$PACKAGE library version = $ruby_version])
 
 AS_CASE([" $CPP "], [*" $CC "*], [CPP=`echo " $CPP " | sed "s| $CC |"' $(CC) |;s/^ *//;s/  *$//'`])
 
Index: aclocal.m4
===================================================================
--- aclocal.m4	(revision 0)
+++ aclocal.m4	(revision 52202)
@@ -0,0 +1,46 @@ https://github.com/ruby/ruby/blob/trunk/aclocal.m4#L1
+# -*- autoconf -*-
+
+AC_DEFUN([_COLORIZE_RESULT_PREPARE], [
+    msg_checking= msg_result_yes= msg_result_no= msg_result_other= msg_reset=
+    AS_IF([test -t], [
+	msg_begin="`tput smso 2>/dev/null`"
+    	AS_CASE(["$msg_begin"], ['@<:@'*m],
+	    [msg_begin="`echo "$msg_begin" | sed ['s/[0-9]*m$//']`"
+	    msg_checking="${msg_begin}33m"
+	    AS_IF([test ${TEST_COLORS:+set}], [
+		msg_result_yes=[`expr ":$TEST_COLORS:" : ".*:pass=\([^:]*\):"`]
+		msg_result_no=[`expr ":$TEST_COLORS:" : ".*:fail=\([^:]*\):"`]
+		msg_result_other=[`expr ":$TEST_COLORS:" : ".*:skip=\([^:]*\):"`]
+	    ])
+	    msg_result_yes="${msg_begin}${msg_result_yes:-32;1}m"
+	    msg_result_no="${msg_begin}${msg_result_no:-31;1}m"
+	    msg_result_other="${msg_begin}${msg_result_other:-33;1}m"
+	    msg_reset="${msg_begin}m"
+	    ])
+	AS_UNSET(msg_begin)
+	])
+    AS_REQUIRE_SHELL_FN([colorize_result],
+	[AS_FUNCTION_DESCRIBE([colorize_result], [MSG], [Colorize result])],
+        [AS_CASE(["$[]1"],
+            [yes], [AS_ECHO(["${msg_result_yes}$[]1${msg_reset}]")],
+            [no], [AS_ECHO(["${msg_result_no}$[]1${msg_reset}]")],
+            [AS_ECHO(["${msg_result_other}$[]1${msg_reset}]")])])
+])
+
+AC_DEFUN([COLORIZE_RESULT], [AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl
+    AS_LITERAL_IF([$1],
+	[m4_case([$1],
+		[yes], [AS_ECHO(["${msg_result_yes}$1${msg_reset}"])],
+		[no], [AS_ECHO(["${msg_result_no}$1${msg_reset}"])],
+		[AS_ECHO(["${msg_result_other}$1${msg_reset}"])])],
+	[colorize_result "$1"]) dnl
+])
+
+AC_DEFUN([AC_CHECKING],[dnl
+AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl
+AS_MESSAGE([checking ${msg_checking}$1${msg_reset}...])])
+
+AC_DEFUN([AC_MSG_RESULT], [dnl
+{ _AS_ECHO_LOG([result: $1])
+COLORIZE_RESULT([$1]); dnl
+}])

Property changes on: aclocal.m4
___________________________________________________________________
Added: svn:eol-style
   + LF

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 52201)
+++ Makefile.in	(revision 52202)
@@ -307,7 +307,7 @@ reconfig config.status:	$(srcdir)/$(CONF https://github.com/ruby/ruby/blob/trunk/Makefile.in#L307
 	@PWD= MINIRUBY="$(MINIRUBY)"; export MINIRUBY; \
 	set $(SHELL) $($@-args); $(reconfig-exec-$(V))
 
-$(srcdir)/$(CONFIGURE): $(srcdir)/configure.in
+$(srcdir)/$(CONFIGURE): $(srcdir)/configure.in $(srcdir)/aclocal.m4
 	$(CHDIR) $(srcdir) && exec $(AUTOCONF) -o $(@F)
 
 incs: id.h
Index: tool/ifchange
===================================================================
--- tool/ifchange	(revision 52201)
+++ tool/ifchange	(revision 52202)
@@ -37,11 +37,29 @@ if [ "$temp" = - ]; then https://github.com/ruby/ruby/blob/trunk/tool/ifchange#L37
     trap 'rm -f "$temp"' 0
 fi
 
+msg_begin= msg_unchanged= msg_updated= msg_reset=
+if [ -t ]; then
+    msg_begin="`tput smso 2>/dev/null`"
+    case "$msg_begin" in
+	""*m)
+	    msg_begin="`echo "$msg_begin" | sed 's/[0-9]*m$//'`"
+	    if [ ${TEST_COLORS:+set} ]; then
+		msg_unchanged=`expr ":$TEST_COLORS:" : ".*:pass=\([^:]*\):"`
+		msg_updated=`expr ":$TEST_COLORS:" : ".*:fail=\([^:]*\):"`
+	    fi
+	    msg_unchanged="${msg_begin}${msg_unchanged:-32;1}m"
+	    msg_updated="${msg_begin}${msg_updated:-31;1}m"
+	    msg_reset="${msg_begin}m"
+	    ;;
+    esac
+    unset msg_begin
+fi
+
 if [ -f "$target" -a ! -${empty:+f}${empty:-s} "$temp" ] || cmp "$target" "$temp" >/dev/null 2>&1; then
-    echo "$target unchanged"
+    echo "$target ${msg_unchanged}unchanged${msg_reset}"
     rm -f "$temp"
 else
-    echo "$target updated"
+    echo "$target ${msg_updated}updated${msg_reset}"
     [ x"${keepsuffix}" = x ] || mv -f "$target" "${target}${keepsuffix}"
     mv -f "$temp" "$target"
 fi

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]