autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Correct use of CPPFLAGS, LIBS, and LDFLAGS


From: Steve M. Robbins
Subject: Re: Correct use of CPPFLAGS, LIBS, and LDFLAGS
Date: Thu, 19 Sep 2002 14:53:05 -0400
User-agent: Mutt/1.4i

On Thu, Sep 19, 2002 at 11:39:57AM -0700, Bill Moseley wrote:
> 
> In my current configure.in I create new substitution variables for each
> library that may be optionally included.  For example, a test might set:
> 
>   LIBFOO_CPPFLAGS = "-Ifoo/include"
>   LIBFOO_LDFLAGS  = "-Lfoo/lib"
>   LIB_FOO_LIBS    = "-lfoo"
> 
> The problem is then in Makefile.in I do something like
> 
>   libs = @LIBS@ @LIB_FOO_LIBS@ @LIB_OTHERLIB_LIBS@ ...
> 
> Is there any reason not to do this in configure.in:
> 
>   CPPFLAGS = "${CPPFLAGS} -Ifoo/include"
>   LDFLAGS  = "${LDFLAGS} -Lfoo/lib"
>   LIBS     = "${LIBS} -lfoo"
> 
> and then in Makefile.in simply:
>   
>   cppflags = @CPPFLAGS@
>   ldflags  = @LDFLAGS@
>   libs     = @LIBS@
> 
> Or is that setting myself up for problems if I need to use more than one
> Makefile (e.g. don't want the same @LIBS@ for various Makefiles)?

That's one problem.

The other problem is that there is a convention that says the
installer should be allowed to override CFLAGS, CPPFLAGS and LDFLAGS
when building.  Your second proposal will cause problems for people
who like to do that.  Incidentally, if you were using automake you'd
have AM_CFLAGS etc, that you (the code author) can use instead,
leaving CFLAGS free for the installer.

-S




reply via email to

[Prev in Thread] Current Thread [Next in Thread]