]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
bootstrap: honor COLORTERM and USE_ANSI_COLORS.
authorGary V. Vaughan <gary@gnu.org>
Thu, 25 Oct 2012 06:29:28 +0000 (01:29 -0500)
committerGary V. Vaughan <gary@gnu.org>
Thu, 25 Oct 2012 08:32:35 +0000 (03:32 -0500)
Plenty of machines use a terminfo database that doesn't have
entries for color escape sequences, even though the terminal
itself most likely supports ANSI color escapes.
* gl/build-aux/funclib.sh (require_term_colors): If COLORTERM
or USE_ANSI_COLORS are set, then ignore what terminfo says,
and use standard ANSI color escape sequences.
* bootstrap: Regenerate.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
bootstrap
gl/build-aux/funclib.sh

index 6a6fce9a400da1069a3eb5e4e0eec7c15f5728ce..b897f20711472c6788e7128add6784b4c480a5af 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -321,18 +321,32 @@ func_require_term_colors ()
 {
     $debug_cmd
 
-    test -t 1 && {
-      test -n "`tput sgr0 2>/dev/null`" && {
-        tc_reset=`tput sgr0`
-        test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
-          tc_standout=$tc_bold
-      test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
-        test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
-        test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
-        test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
-        test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
-      }
-    }
+    test -t 1 && {                                                       
+      # COLORTERM and USE_ANSI_COLORS environment variables take         
+      # precedence, because most terminfo databases neglect to describe  
+      # whether color sequences are supported.                           
+      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}             
+                                                                       
+      if test 1 = "$USE_ANSI_COLORS"; then                             
+        # Standard ANSI escape sequences                                 
+        tc_reset='\e[0m'                                                 
+        tc_bold='\e[1m';   tc_standout='\e[7m'                           
+        tc_red='\e[31m';   tc_green='\e[32m'                             
+        tc_blue='\e[34m';  tc_cyan='\e[36m'                              
+      else                                                               
+        # Otherwise trust the terminfo database after all.               
+        test -n "`tput sgr0 2>/dev/null`" && {                           
+          tc_reset=`tput sgr0`                                           
+          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`       
+          tc_standout=$tc_bold                                           
+          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`   
+          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`  
+          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
+          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` 
+          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` 
+        }                                                                
+      fi                                                                 
+    }                                                                    
 
     require_term_colors=:
 }
index 9d880447d40d1db849abd816dc997870fe1eda67..1203d83e92a066df849f50660947985a7f3ef749 100644 (file)
@@ -311,18 +311,32 @@ func_require_term_colors ()
 {
     $debug_cmd
 
-    test -t 1 && {
-      test -n "`tput sgr0 2>/dev/null`" && {
-        tc_reset=`tput sgr0`
-        test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
-          tc_standout=$tc_bold
-      test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
-        test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
-        test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
-        test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
-        test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
-      }
-    }
+    test -t 1 && {                                                       
+      # COLORTERM and USE_ANSI_COLORS environment variables take         
+      # precedence, because most terminfo databases neglect to describe  
+      # whether color sequences are supported.                           
+      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}             
+                                                                       
+      if test 1 = "$USE_ANSI_COLORS"; then                             
+        # Standard ANSI escape sequences                                 
+        tc_reset='\e[0m'                                                 
+        tc_bold='\e[1m';   tc_standout='\e[7m'                           
+        tc_red='\e[31m';   tc_green='\e[32m'                             
+        tc_blue='\e[34m';  tc_cyan='\e[36m'                              
+      else                                                               
+        # Otherwise trust the terminfo database after all.               
+        test -n "`tput sgr0 2>/dev/null`" && {                           
+          tc_reset=`tput sgr0`                                           
+          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`       
+          tc_standout=$tc_bold                                           
+          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`   
+          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`  
+          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
+          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` 
+          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` 
+        }                                                                
+      fi                                                                 
+    }                                                                    
 
     require_term_colors=:
 }