make bug on Solaris when using Sun CC

Scott Wilson <[email protected]> Wed, 7 Jan 2004 15:34:02 -0600 (CST)
Newsgroups gmane.network.bb4.devel
Message-ID <[email protected]>
Using Big Brother 1.9e with Solaris 9 I just ran into a make bug.

The file src/minimake/genmake tests to see which complier you are using
with the following lines:

-----
# IF gcc IS PRESENT, USE IT
if test -f "/usr/local/bin/gcc"
then
        CC="gcc"
else
        XX=`type gcc` 2>/dev/null
        if test "$XX" = ""
        then
                CC="cc"
        else
                CC="gcc"
        fi
fi
-----

However, the line:
        XX=`type gcc` 2>/dev/null

does not work as intended.  The ` character does not work exactly the same
in Bourne on Solaris as it does in other operating systems.  Standard
error does not seem to be redirectable.  If gcc is not installed on a
machine, the following lines:

XX=`type gcc`
XX=`type gcc` 2>/dev/null
XX=`type gcc 2>/dev/null `

all give the same results which is that XX is "gcc not found", which ends
up setting CC to "gcc" even though gcc is not installed on the system.


I'd recommend replacing the above code with:

-----
# IF gcc IS PRESENT, USE IT
if test -f "/usr/local/bin/gcc"
then
        CC="gcc"
else
        XX=`type gcc` 2>/dev/null
        if test "$XX" = "" -o "$XX" = "gcc not found"
        then
                CC="cc"   
        else
                CC="gcc"
        fi
fi
-----


That should fix the issue for Solaris, without breaking any other Unix.



Thanks!  I've been using the product for ages, and this is the first bug
I've run into myself.  Figured I should do my part to help.


Scott Wilson                    Manager / Lead System Administrator
[email protected]            NSIT - TaRT - Systems & Servers

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list send e-mail to mailto:[email protected]
with unsubscribe bbd in the BODY of the message.