tests: new requirement 'grep-nonprint'
[platform/upstream/automake.git] / t / ax / test-init.sh
index 01d4584..ca606b5 100644 (file)
@@ -63,6 +63,8 @@ tab=' '
 # A newline character.
 nl='
 '
+# A literal escape character.  Used by test checking colored output.
+esc='\e'
 
 # As autoconf-generated configure scripts do, ensure that IFS
 # is defined initially, so that saving and restoring $IFS works.
@@ -754,6 +756,15 @@ do
         *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
       esac
       ;;
+    grep-nonprint)
+      # Check that grep can parse nonprinting characters correctly.
+      # BSD 'grep' works from a pipe, but not a seekable file.
+      # GNU or BSD 'grep -a' works on files, but is not portable.
+      case $(echo "$esc" | grep .)$(echo "$esc" | grep "$esc") in
+        "$esc$esc") ;;
+        *) skip_ "grep can't handle nonprinting characters correctly";;
+      esac
+      ;;
     javac)
       # The Java compiler from JDK 1.5 (and presumably earlier versions)
       # cannot handle the '-version' option by itself: it bails out