[PATCH] Allow "make compare" to use "make gnucompare" automatically
Phil Edwards
phil@jaj.com
Tue Apr 29 21:20:00 GMT 2003
On Tue, Apr 29, 2003 at 09:52:32PM +0100, Joseph S. Myers wrote:
> On Tue, 29 Apr 2003, Phil Edwards wrote:
>
> > If we can't use ! inversion in 'if', then the patch under discussion looks
> > something like
[ugliness]
> > Right?
>
> Yes.
What a shame. Okay, then, I'll check this in later today. I've added
AC_MSG stuff to keep the user informed.
2003-04-29 Phil Edwards <pme@gcc.gnu.org>
* configure.in: More general test for cmp --ignore-initial.
* configure: Regenerate.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.663
diff -u -3 -p -r1.663 configure.in
--- configure.in 25 Apr 2003 21:15:00 -0000 1.663
+++ configure.in 29 Apr 2003 21:19:03 -0000
@@ -645,16 +645,25 @@ else
GENERATED_MANPAGES=
fi
-# If GNU cmp is present and recent enough, 'make compare' can be
-# significantly faster.
-gcc_AC_CHECK_PROG_VER(gnucmp, cmp, --version,
- [(GNU diffutils) \([0-9][0-9.]*\)], [2.[4-9]*])
-if test $gcc_cv_prog_cmp_modern = yes; then
- make_compare_target=gnucompare
+# 'make compare' can be significantly faster, if cmp itself can
+# skip bytes instead of using tail. The test being performed is
+# "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
+# but we need to sink errors and handle broken shells.
+AC_MSG_CHECKING([for cmp's capabilities])
+echo abfoo >t1
+echo cdfoo >t2
+if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
+ if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
+ make_compare_target=slowcompare
+ else
+ make_compare_target=gnucompare
+ fi
else
make_compare_target=slowcompare
fi
+rm t1 t2
AC_SUBST(make_compare_target)
+AC_MSG_RESULT($make_compare_target)
# How about lex?
dnl Don't use AC_PROG_LEX; we insist on flex.
More information about the Gcc-patches
mailing list