diff mbox

[1/1] configure: robustify big/little check

Message ID 1401266785-31760-2-git-send-email-cornelia.huck@de.ibm.com
State New
Headers show

Commit Message

Cornelia Huck May 28, 2014, 8:46 a.m. UTC
The check for big or little endianness relies on grep reporting
match/non-match on the generated binary. If the user specified
--binary-files=without-match in their GREP_OPTIONS, this will fail.
Let's just explicitly specify --binary-files=binary, which will
override any user settings and do what we want.

Reported-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peter Maydell May 28, 2014, 8:52 a.m. UTC | #1
On 28 May 2014 09:46, Cornelia Huck <cornelia.huck@de.ibm.com> wrote:
> The check for big or little endianness relies on grep reporting
> match/non-match on the generated binary. If the user specified
> --binary-files=without-match in their GREP_OPTIONS, this will fail.
> Let's just explicitly specify --binary-files=binary, which will
> override any user settings and do what we want.

This grep option isn't specified by POSIX so I'm not sure all the hosts
we build on will have it. Maybe it would be better to just unset
GREP_OPTIONS at the top of configure ?

thanks
-- PMM
Cornelia Huck May 28, 2014, 9:01 a.m. UTC | #2
On Wed, 28 May 2014 09:52:38 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:

> On 28 May 2014 09:46, Cornelia Huck <cornelia.huck@de.ibm.com> wrote:
> > The check for big or little endianness relies on grep reporting
> > match/non-match on the generated binary. If the user specified
> > --binary-files=without-match in their GREP_OPTIONS, this will fail.
> > Let's just explicitly specify --binary-files=binary, which will
> > override any user settings and do what we want.
> 
> This grep option isn't specified by POSIX so I'm not sure all the hosts
> we build on will have it. Maybe it would be better to just unset
> GREP_OPTIONS at the top of configure ?
> 
> thanks
> -- PMM
> 

Fair enough, I'll try that instead.
Markus Armbruster May 28, 2014, 9:16 a.m. UTC | #3
Peter Maydell <peter.maydell@linaro.org> writes:

> On 28 May 2014 09:46, Cornelia Huck <cornelia.huck@de.ibm.com> wrote:
>> The check for big or little endianness relies on grep reporting
>> match/non-match on the generated binary. If the user specified
>> --binary-files=without-match in their GREP_OPTIONS, this will fail.
>> Let's just explicitly specify --binary-files=binary, which will
>> override any user settings and do what we want.
>
> This grep option isn't specified by POSIX so I'm not sure all the hosts
> we build on will have it. Maybe it would be better to just unset
> GREP_OPTIONS at the top of configure ?

That's what autoconf does:

    # Unset more variables known to interfere with behavior of common tools.
    CLICOLOR_FORCE= GREP_OPTIONS=
    unset CLICOLOR_FORCE GREP_OPTIONS
Cornelia Huck May 28, 2014, 10:27 a.m. UTC | #4
On Wed, 28 May 2014 11:16:09 +0200
Markus Armbruster <armbru@redhat.com> wrote:

> Peter Maydell <peter.maydell@linaro.org> writes:
> 
> > On 28 May 2014 09:46, Cornelia Huck <cornelia.huck@de.ibm.com> wrote:
> >> The check for big or little endianness relies on grep reporting
> >> match/non-match on the generated binary. If the user specified
> >> --binary-files=without-match in their GREP_OPTIONS, this will fail.
> >> Let's just explicitly specify --binary-files=binary, which will
> >> override any user settings and do what we want.
> >
> > This grep option isn't specified by POSIX so I'm not sure all the hosts
> > we build on will have it. Maybe it would be better to just unset
> > GREP_OPTIONS at the top of configure ?
> 
> That's what autoconf does:
> 
>     # Unset more variables known to interfere with behavior of common tools.
>     CLICOLOR_FORCE= GREP_OPTIONS=
>     unset CLICOLOR_FORCE GREP_OPTIONS
> 
So let's do this for CLICOLOR_FORCE as well, just to be on the safe
side.
diff mbox

Patch

diff --git a/configure b/configure
index 0e516f9..0fad0e1 100755
--- a/configure
+++ b/configure
@@ -1666,9 +1666,9 @@  int main(int argc, char *argv[]) {
 EOF
 
 if compile_object ; then
-    if grep -q BiGeNdIaN $TMPO ; then
+    if grep -q --binary-files=binary BiGeNdIaN $TMPO ; then
         bigendian="yes"
-    elif grep -q LiTtLeEnDiAn $TMPO ; then
+    elif grep -q --binary-files=binary LiTtLeEnDiAn $TMPO ; then
         bigendian="no"
     else
         echo big/little test failed