autoconf
[Top][All Lists]
Advanced

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

Re: How to add directory to CFLAGS (or CXXFLAGS) search path?


From: Mike Frysinger
Subject: Re: How to add directory to CFLAGS (or CXXFLAGS) search path?
Date: Mon, 10 Nov 2014 12:59:48 -0500

On 09 Nov 2014 22:06, Patrick Doyle wrote:
> I am very new to developing autotools maintained projects, but like (a
> lot) what I've read so far.  So, I would like to use autotools on
> projects going forward, but have a large body of legacy code to
> maintain.  I would like to reference an include directory from some of
> that legacy code in my new, autotools maintained, program.
> 
> What is the best way to do this?  Is there an existing macro I can use
> to say "Search the filesystem for somedir/custominclude.h and add
> -Isomedir to CFLAGS"?
> 
> I know I can write a custom macro, or just plain m4sh code myself, to
> do this (once I learn a little more), but I figured I should ask if
> this has already been done.
> 
> Thanks for any pointers you care to give me...

preprocess flags (like -I) go in CPPFLAGS, not CFLAGS/CXXFLAGS

if you're just using autoconf, you can merely append CPPFLAGS:
  CPPFLAGS="$CPPFLAGS -Ifoo"

however, assuming you're trying to use a source or build directory, you should 
do it in your automake files instead so you can leverage $(top_srcdir) and 
$(top_builddir).  see this page for details:
http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html#Program-Variables
-mike

Attachment: signature.asc
Description: Digital signature


reply via email to

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