diff --git a/configure b/configure
index d59fc6fd1ae2914925ee61b195f49ddef827ba95..b91be3210284b33e42ead0203ac82b071ab2f24e 100755
--- a/configure
+++ b/configure
@@ -4211,7 +4211,10 @@ done
 
 check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
 
-require_cc "endian test" "" "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'"
+# The global variable ensures the bits appear unchanged in the object file.
+test_cc <<EOF || die "endian test failed"
+unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
+EOF
 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
 
 check_gas() {