autoconf
[Top][All Lists]
Advanced

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

Re: How to correctly generate 'foobar.h' from 'foobar.h.in'


From: Mike Frysinger
Subject: Re: How to correctly generate 'foobar.h' from 'foobar.h.in'
Date: Wed, 4 Aug 2010 03:19:30 -0400
User-agent: KMail/1.13.1 (Linux/2.6.34; KDE/4.4.5; x86_64; ; )

On Wednesday, August 04, 2010 01:36:34 Tao Wang wrote:
> I created 'src/foobar.h.in' with following content:
> 
> =========
> #define PATH_PREFIX    "@prefix@"
> #define PATH_DATADIR    "@datadir@"
> =========
> 
> And put 'src/foobar.h' in AC_CONFIG_FILES() in 'configure.ac'.
> 
> After I run 'autoreconf', the 'src/foobar.h' is generated, however, I got 2
> problem for it.
> 
> First, the generated content is:
> =========
> #define PATH_PREFIX    "/home/tao/unstable/stardict"
> #define PATH_DATADIR    "${prefix}/share"
> =========
> 
> "${prefix}" is definitely not working as a C/C++ header. How can I replace
> the ${prefix} with the real value?

this is why people put the define into CPPFLAGS and let the Makefile expand it

if you're using automake, then something like:
AM_CPPFLAGS = -DPATH_DATADIR='"$(datadir)"'

> Second, everytime I modified the file 'src/foobar.h.in', and run 'make
> all', it cannot regenerate 'src/foobar.h'. Is there anything wrong? Why
> make doesn't know the dependency?

are you using automake or your own makefile ?  if the former, it should take 
care of it for you.  if the latter, i think the autoconf manual gives tips 
about this.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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