On Thu, Sep 09, 2004 at 07:12:03PM +0900, Michal 'hramrach' Suchanek wrote:
> 
> A better fix adding LDFLAGS also for mkmf link tests:
> 
> --- ruby-1.8.2/lib/mkmf.rb~     Tue Sep  7 17:30:59 2004
> +++ ruby-1.8.2/lib/mkmf.rb      Thu Sep  9 11:08:59 2004
> @@ -960,7 +960,7 @@
>    $CFLAGS = with_config("cflags", arg_config("CFLAGS",
> config["CFLAGS"])).dup
>    $ARCH_FLAG = with_config("arch_flag", arg_config("ARCH_FLAG",
> config["ARCH_FLAG"])).dup
>    $CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS",
> config["CPPFLAGS"])).dup
> -  $LDFLAGS = (with_config("ldflags") || "").dup
> +  $LDFLAGS = with_config("ldflags", arg_config("LDFLAGS",
> config["LDFLAGS"])).dup
>    $INCFLAGS = "-I$(topdir)"
>    $DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS",
> config["DLDFLAGS"])).dup
>    $LIBEXT = config['LIBEXT'].dup
> 

Since nobody seems interested I should probably add some
explanation. I am in the situation that I have some set of libraries in
/usr/lib and other in /somewhere-else/lib.

The libraries in somewhere-else are newer than those in /usr and include
some that are not in /usr at all.

Now I run
CPPFLAGS=/somewhere-else/include LDFLAGS=/somewhere-else/lib ./configure
and make.
The CPPFLAGS are propagated into extension builds (by mkmf.rb) but the
ldflags are not.
One of the problems that results from this is caused by my other change
that removes the -undefined suppress or similar option that causes linker
to ignore unresolved symbols. Now if the lib is not found the extension
won't link.
I am not sure it is possible to suppress undefined symbols on all
platforms and in general I do not like the idea but this is mostly just
a matter of taste.

However, the ldflags aren't passed to test either. So the tests in
extensions will find only the libraries in /usr although they will see
the headers in /somewhere-else. This is going to cause linking with
different library than the one for which headers were included and
failure to detect libraries in /somewhere-else completely.

Thanks

Michal Suchanek