Re: AC_DEFINE_DIR in autoconf (was: Re: SYSCONFDIR: config.h vs. AM_CFLAGS)

2005-03-11 Thread Stepan Kasal
On Wed, Mar 09, 2005 at 08:06:18PM +0100, Baurjan Ismagulov wrote:
 What I don't understand is why the manual states that AC_DEFINE_DIR does
 not conform with GNU codings standards.
 
 If I define DATADIR in CPPFLAGS, it is hard-coded into the binary, and
 the user can override the prefix during make install. This behaviour is
 not declared non-conforming.

If you set
CPPFLAGS=$CPPFLAGS -DDATADIR='\$(datadir)'
or
CPPFLAGS=$CPPFLAGS '-DDATADIR=$(datadir)'

in your configure.ac, then the $(datadir) part is expanded by make.

So you can do

./configure --prefix=oneprefix

make prefix=anotherprefix

make prefix=yetanother install

Your config.h approach doesn't allow the user to redifine prefix for
make all, even though it allows them to redefine it for make install.

(Not that I know what is this requirment good for.  I don't advocate the
standard, I just explain what conforms to it and what doesn't.)

Have a nice day,
Stepan




AC_DEFINE_DIR in autoconf (was: Re: SYSCONFDIR: config.h vs. AM_CFLAGS)

2005-03-09 Thread Baurjan Ismagulov
[Taking the discussion to the autoconf list.]

On Mon, Mar 07, 2005 at 09:57:31AM -0400, Leonardo Boiko wrote:
 Isn't config.h created at configure time? AFAIK directory installation
 variables should only be defined at make time.  See
 ``info Autoconf Installation Directory Variables''.

I had read these sections before posting, but I understand them only now
:) .

What I don't understand is why the manual states that AC_DEFINE_DIR does
not conform with GNU codings standards.

If I define DATADIR in CPPFLAGS, it is hard-coded into the binary, and
the user can override the prefix during make install. This behaviour is
not declared non-conforming.

If I define DATADIR in config.h, it is hard-coded into the binary, and
the user can override the prefix during make install.

The section 7.2.4 of GCS states that prefix should be redefinable by
installers via make or configure. I couldn't find a place where it
requires that make prefix=xxx should cause hard-coding of the new
prefix, so I fail to see why AC_DEFINE_DIR is declared non-compliant.

I would really like that AC_DEFINE_DIR is included in automake, thus
making config.h the single compilation configuration file. Comments?


 Maybe you could use instead a dedicated header, created through the
 Makefile.  See ``info Autoconf Defining Directories''.[2]

I would ideally prefer to have a single configuration file, namely,
config.h. From my (naive autoconf user's) perspective, there is no
difference between PACKAGE_VERSION and DATADIR.


With kind regards,
Baurzhan.