Subject: bug#9728: Incorrect -L flags order for HP-UX

From: Vincent Lefevre <[email-masked]>
Date: Fri, 14 Oct 2011 01:06:29 +0200

Hi,

On 2011-10-13 09:06:22 -0500, Peter O'Gorman wrote:
> Well, if this is a bug at all, it is an automake/autoconf one,
> libtool does not set the order of flags in Makefile.in, but I don't
> believe that it is a bug.

The autoconf manual says to use LDFLAGS for the -L options. So, it
is either a bug in the autoconf manual or in automake.

> LDFLAGS, CFLAGS, etc are for the user to set.

And this is what MPFR does with --with-gmp, which is a shorthand
for updating CPPFLAGS and LDFLAGS.

> It should be possible for the user to build a package doing
> ./configure ..options..; make LDFLAGS=-fancyflag
> CPPFLAGS=-I/want/coffee;

I don't think this should be allowed: MPFR does some tests at
configure time based on the current environment. If the user
modifies the environment at make time, the configure tests no
longer make sense (e.g. modifying LDFLAGS at make time can select
a different GMP version). So, if the user does this, it is up to
him to make sure that the changes are equivalent to what was set
at configure time.

> Something like the attached patch should work for mpfr.

There are several problems with it. First, I assume that LOADLIBES
should contain $(AM_CPPFLAGS) too. But the main problem is the
inconsistent flags order: in the compile command, $(AM_CPPFLAGS)
appears before $(CPPFLAGS), while in the link command, $(GMP_LIBS)
appears after $(LDFLAGS). This means that if the user uses both
--with-gmp and CPPFLAGS/LDFLAGS to provide search directories,
the include and library search paths will be inconsistent.

-- 
Vincent Lefèvre <[email-masked]> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)