On Sun, 28 May 2006, Stephen Thorne wrote:

> On a basic level, I need a way of detecting if ranlib is gnu ranlib or
> apple ranlib. The detection method currently employed is insufficient
> and fragile.
> 
> Perhaps using grep on ranlib -V would be better:
> 
> $ ranlib -V 2>/dev/null| grep Apple
> Apple Computer, Inc. version cctools-590.18
>

Let's go one step back and understand why do we need to know ranlib 
version ? If this is a matter of having '-c' as a switch or not then
we should find a way to test for '-c' correct. Maybe the best way would
be to build actual archive and run ranlib on it ?

Let's test following on OSX:

create test.c:

int test_func (void)
{
    return 1;
}

compile with gcc -c test.c
archive with ar -cru test.a test.c
run OSX ranlib -c test.a and check the exit code

If the exit code is 0 then we're good and such test should satisfy both
OSX and others, because on every other system (except ones with ranlib
substituted with 'exit 0') it'll return non zero. On the systems with
'exit 0' ranlib this test won't matter because 'ar' will create the index
by default and ranlib will do nothing.
 
Testing for ranlib version using -V is not good way IMO.

Stas.

> -- 
> Stephen Thorne
> 
> "Give me enough bandwidth and a place to sit and I will move the world."
>   --Jonathan Lange
> 
> _______________________________________________
> netrek-dev mailing list
> netrek-dev at us.netrek.org
> http://mailman.us.netrek.org/mailman/listinfo/netrek-dev
>