[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

configure scripts rely on "diff"; could use "cmp" instead if available

From: Josh Triplett
Subject: configure scripts rely on "diff"; could use "cmp" instead if available
Date: Tue, 24 May 2011 10:41:39 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

In trying to bootstrap a minimal environment, I ended up trying to run a
configure script using just busybox (specifically, Debian's
busybox-static).  This almost worked, except that the configure script
used diff several times.  configure just uses diff for its exit code, to
check for identical files.  The version of busybox-static in Debian
doesn't provide diff, but does provide cmp.

This issue manifested as configure complaining that it could not find a
usable grep, due to the test for grep using diff.

As far as I can tell, configure scripts never actually need the output
of diff; they just need a program that can detect whether files differ
and provide an appropriate exit status for use in conditionals.

Rather than unconditionally using diff, please consider detecting and
using an appropriate $ac_files_identical program; either diff or cmp
would work.  For that matter, such detection would also provide a good
opportunity to check for a working diff -q or cmp -s, which run faster
since they can stop at the first difference and don't have to generate

Does this seem like a reasonable addition to autoconf?  (If it falls
under "OK, if someone provides a patch", I can do so.)

- Josh Triplett

reply via email to

[Prev in Thread] Current Thread [Next in Thread]