autoconf
[Top][All Lists]
Advanced

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

Re: How to enable/disable my debug code?


From: Gary V. Vaughan
Subject: Re: How to enable/disable my debug code?
Date: Sun, 31 Jul 2011 11:19:43 +0700

On 31 Jul 2011, at 06:57, NightStrike wrote:
> On Sat, Jul 30, 2011 at 3:26 PM, Gary V. Vaughan <address@hidden> wrote:
>> On 31 Jul 2011, at 02:04, NightStrike wrote:
>>> Unless I'm completely wrong, and there is in fact some sort of
>>> standard for compiler options other than "do whatever gcc does".
>> 
>> For example:
>> 
>>  AM_CPPFLAGS = -I../gnulib -I../libltdl
>>  AM_LDFLAGS = -L../libltdl @LIBTHREAD@
>> 
>> As in things that need to be there for your project to build, even if
>> the user passes flags of their own at make time.
> 
> My point was just that there's nothing that forces every compiler to
> make "-I<dir>" the way to set the include path.  It happens to be that
> way for a few popular ones like icc because people generally just do
> what GCC does.  But nothing stops someone from making a compiler where
> it uses lowercase i, for instance.  These options HAVE to be compiler
> specific.

You're not wrong.  But I was answering the original question be stating
that current best practice for Autotools using projects is to separate
the various build and link flags into two groups:

  i) my project won't build without this;
 ii) users might like to set this.

Group (i) goes into the AM_* prefixed automake macros and are set by the
developer in advance of the release; Group (ii) are entirely at the
discretion of the user and can be set arbitrarily at compile and/or
configure time.  That's just the way automake was designed.

>>> Consider, though, using cl.exe in an msys environment.  That uses /
>>> instead of - for switches, for instance.
>> 
>> I would be quite surprised if more that a very few Autotools using
>> projects compiled in that environment out of the box.
> 
> I'm trying to make that work, actually.  It's very hard.

Current best practice in this case is to make a compiler wrapper script
that translates the flags from what Autotools expect to be universally
available (-I, -L etc) into whatever unusual syntax cl.exe might prefer,
and then to pass the wrapper script as CC at configure time.

There is still some hair to untangle if you want Autotools to ship that
wrapper script and/or automatically set CC to use it.  But in principle
it shouldn't be too difficult to solve in the same way that Automake's
`compile` script works around the unportability of '-c -o' - infact it's
not a bad idea to patch `compile`  to take care of any other useful
command line rewriting problems...

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org) 



reply via email to

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