diff --git a/configure b/configure
index f283e9652a343ca3d0f481ecf7ddbd570ed6e550..b352513917daa2f8e4f9d8df104096e0c05f8829 100755
--- a/configure
+++ b/configure
@@ -1580,7 +1580,7 @@ enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
 check_cc <<EOF || die "endian test failed"
 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
 EOF
-grep -q BIGE $TMPO && enable bigendian
+tr -c -d BIGE < $TMPO | grep -q BIGE && enable bigendian
 
 # ---
 # check availability of some header files