Re: AM_CFLAGS usage

2006-06-12 Thread Ralf Wildenhues
Hello Norbert,

* Norbert Sendetzky wrote on Mon, Jun 12, 2006 at 06:42:15PM CEST:
> 
> Ehm, where do I find the documentation to config.site?

Oh, sorry, I forgot to mention that config.site is an Autoconf feature.
Its manual has the information.  (The current manual isn't online, but
let's hope that changes next week...)

Cheers,
Ralf




Re: AM_CFLAGS usage

2006-06-12 Thread Norbert Sendetzky
On Monday 12 June 2006 12:53, Ralf Wildenhues wrote:
>   : ${CFLAGS='-Wall -ansi -pedantic'}
>
> before AC_PROG_CC in configure.ac.  Users with non-GCC compilers won't
> like you because they will have to set CFLAGS to override this, and
> users (with any kind of compiler) won't like you because you take away
> the default (set -g if possible, add -O2 if possible) setting they

OK, not the best option ;-)

> FWIW, I prefer that packages don't override CFLAGS at all.  For specific
> settings, I keep a long-term build tree with a working config.status
> file (and of course a config.cache as well) around.  Or a config.site
> file (if you don't know what this is, read up on it in the Autoconf
> manual).

Ehm, where do I find the documentation to config.site? I couldn't find it in 
the automake manual
http://sources.redhat.com/automake/automake.html

and in the autobook is only a short notice about this
http://sources.redhat.com/autobook/autobook/autobook_281.html

Google does also not reveal any useful information on the first pages.


Norbert
-- 
OpenPGP public key
http://www.linuxnetworks.de/norbert.pubkey.asc



pgpYjcZMRwCrQ.pgp
Description: PGP signature


Re: AM_CFLAGS usage

2006-06-12 Thread Ralf Wildenhues
* Norbert Sendetzky wrote on Mon, Jun 12, 2006 at 11:06:36AM CEST:
> On Monday 12 June 2006 10:28, Ralf Corsepius wrote:
> > > > Note though that
> > > >   -Wall -ansi -pedantic
> > > >
> > > > is pretty GCC specific, and will make many other compilers barf
> > > > heavily.  So if your package targets portability, it'd be nice
> > > > to allow your users to override these flags (preferably by
> > > > ./configure CFLAGS='...').
> > >
> > > How can I do this?
> >
> > NOTE: CFLAGS !!

> Ralf (Wildenhues) refers to OVERRIDING flags set if I understood him 
> correctly.

Yes.  Maybe this should be in a FAQ or so:  you can put
  : ${CFLAGS='-Wall -ansi -pedantic'}

before AC_PROG_CC in configure.ac.  Users with non-GCC compilers won't
like you because they will have to set CFLAGS to override this, and
users (with any kind of compiler) won't like you because you take away
the default (set -g if possible, add -O2 if possible) setting they
expect from packages using Autoconf.  (I first through of
http://lists.gnu.org/archive/html/automake/2005-09/msg00108.html but
that tackles a slightly different problem setting.)

FWIW, I prefer that packages don't override CFLAGS at all.  For specific
settings, I keep a long-term build tree with a working config.status
file (and of course a config.cache as well) around.  Or a config.site
file (if you don't know what this is, read up on it in the Autoconf
manual).

Cheers,
Ralf




Re: AM_CFLAGS usage

2006-06-12 Thread Norbert Sendetzky
On Monday 12 June 2006 10:28, Ralf Corsepius wrote:
> > > Note though that
> > >   -Wall -ansi -pedantic
> > >
> > > is pretty GCC specific, and will make many other compilers barf
> > > heavily.  So if your package targets portability, it'd be nice
> > > to allow your users to override these flags (preferably by
> > > ./configure CFLAGS='...').
> >
> > How can I do this?
>
> NOTE: CFLAGS !!
>
> Not using AM_CFLAGS=-Wall -ansi -pedantic
>
> and
> ./configure CFLAGS="-Wall -ansi -pedantic"
>
> is what Ralf W. is referring to.

Ralf (Wildenhues) refers to OVERRIDING flags set if I understood him 
correctly. If rewrite my files to support only

./configure CFLAGS="-Wall -ansi -pedantic"

these flags are never set by default if only ./configure is called.


Norbert
-- 
OpenPGP public key
http://www.linuxnetworks.de/norbert.pubkey.asc



pgp5924OffuBx.pgp
Description: PGP signature


Re: AM_CFLAGS usage

2006-06-12 Thread Ralf Corsepius
On Mon, 2006-06-12 at 10:16 +0200, Norbert Sendetzky wrote:
> Hi Ralf
> 
> > > Norbert Sendetzky wrote:
> > > > This works, but as soon as I move AM_CFLAGS to the Makefile.am in the
> > > > parent directory, they aren't set any more. Is this the way it was
> > > > intended and the only way to set them globally is to AC_SUBST them or
> > > > is there something wrong in my files?
> >
> > Besides the information Marc already gave you, what's wrong with
> > globally setting it by AC_SUBSTing?  You can still override it per
> > Makefile.am.
> >
> > Note though that
> >   -Wall -ansi -pedantic
> >
> > is pretty GCC specific, and will make many other compilers barf
> > heavily.  So if your package targets portability, it'd be nice
> > to allow your users to override these flags (preferably by
> > ./configure CFLAGS='...').
> 
> How can I do this?

NOTE: CFLAGS !!

Not using AM_CFLAGS=-Wall -ansi -pedantic

and 
./configure CFLAGS="-Wall -ansi -pedantic"

is what Ralf W. is referring to.

> According to the docs, AM_CFLAGS will be overwritten by package specific 
> flags 
> but not by flags provided by the user.
Nope. CFLAGS and AM_CFLAGS are being concatenated inside of a Makefile
using AM_CFLAGS.

Ralf






Re: AM_CFLAGS usage

2006-06-12 Thread Norbert Sendetzky
Hi Ralf

> > Norbert Sendetzky wrote:
> > > This works, but as soon as I move AM_CFLAGS to the Makefile.am in the
> > > parent directory, they aren't set any more. Is this the way it was
> > > intended and the only way to set them globally is to AC_SUBST them or
> > > is there something wrong in my files?
>
> Besides the information Marc already gave you, what's wrong with
> globally setting it by AC_SUBSTing?  You can still override it per
> Makefile.am.
>
> Note though that
>   -Wall -ansi -pedantic
>
> is pretty GCC specific, and will make many other compilers barf
> heavily.  So if your package targets portability, it'd be nice
> to allow your users to override these flags (preferably by
> ./configure CFLAGS='...').

How can I do this?
According to the docs, AM_CFLAGS will be overwritten by package specific flags 
but not by flags provided by the user.

Thanks


Norbert
-- 
OpenPGP public key
http://www.linuxnetworks.de/norbert.pubkey.asc



pgpL8sGQvKzJd.pgp
Description: PGP signature


Re: AM_CFLAGS usage

2006-06-11 Thread Ralf Wildenhues
Hello Norbert, Marc,

> Norbert Sendetzky wrote:
> >
> > This works, but as soon as I move AM_CFLAGS to the Makefile.am in the 
> > parent 
> > directory, they aren't set any more. Is this the way it was intended and 
> > the 
> > only way to set them globally is to AC_SUBST them or is there something 
> > wrong 
> > in my files?

Besides the information Marc already gave you, what's wrong with
globally setting it by AC_SUBSTing?  You can still override it per
Makefile.am.

Note though that
  -Wall -ansi -pedantic

is pretty GCC specific, and will make many other compilers barf
heavily.  So if your package targets portability, it'd be nice
to allow your users to override these flags (preferably by
./configure CFLAGS='...').

Cheers,
Ralf




Re: AM_CFLAGS usage

2006-06-11 Thread Marc Alff

Hi


Norbert Sendetzky wrote:
> Hi all
>
> I've tried to set the C flags for my package globally and used AM_CLFAGS for 
> this. Unfortunately AM_CLFAGS is only honored if it is defined in the same 
> Makefile.am.
>
> AM_CFLAGS = -Wall -ansi -pedantic
> pkglib_LTLIBRARIES = libmysqlbackend.la
> libmysqlbackend_la_SOURCES = mysqlbackend.c
> libmysqlbackend_la_CFLAGS = $(AM_CFLAGS)
>
> This works, but as soon as I move AM_CFLAGS to the Makefile.am in the parent 
> directory, they aren't set any more. Is this the way it was intended and the 
> only way to set them globally is to AC_SUBST them or is there something wrong 
> in my files?
>
>   
As far as I know, this is intended.

If you need to share common code in multiple Makefile.am within the same
project,
you can also try :

common.am :
(AM_CFLAGS goes here)

dir1/subdir2/Makefile.am :
include ../../common.am

Personally, I do things like this :

dir1/subdir2/Makefile.am :

include $(top_srcdir)/PreRules.am
(... content of Makefile.am goes here ...)
include $(top_srcdir)/PostRules.am

where PreRules.am contains among other things common compilation flags,
and PostRules contains common rules that depends on variables set (or
not) in the body of each Makefile.am

Hope this helps,
Marc Alff





AM_CFLAGS usage

2006-06-11 Thread Norbert Sendetzky
Hi all

I've tried to set the C flags for my package globally and used AM_CLFAGS for 
this. Unfortunately AM_CLFAGS is only honored if it is defined in the same 
Makefile.am.

AM_CFLAGS = -Wall -ansi -pedantic
pkglib_LTLIBRARIES = libmysqlbackend.la
libmysqlbackend_la_SOURCES = mysqlbackend.c
libmysqlbackend_la_CFLAGS = $(AM_CFLAGS)

This works, but as soon as I move AM_CFLAGS to the Makefile.am in the parent 
directory, they aren't set any more. Is this the way it was intended and the 
only way to set them globally is to AC_SUBST them or is there something wrong 
in my files?

Thanks for your help


Norbert
-- 
OpenPGP public key
http://www.linuxnetworks.de/norbert.pubkey.asc



pgpT9rYZMha6u.pgp
Description: PGP signature


AM_CFLAGS usage

2006-06-10 Thread Norbert Sendetzky
Hi all

I've tried to set the C flags for my package globally and used AM_CLFAGS for 
this. Unfortunately AM_CLFAGS is only honored if it is defined in the same 
Makefile.am.

AM_CFLAGS = -Wall -ansi -pedantic
pkglib_LTLIBRARIES = libmysqlbackend.la
libmysqlbackend_la_SOURCES = mysqlbackend.c
libmysqlbackend_la_CFLAGS = $(AM_CFLAGS)

This works, but as soon as I move AM_CFLAGS to the Makefile.am in the parent 
directory, they aren't set any more. Is this the way it was intended and the 
only way to set them globally is to AC_SUBST them or is there something wrong 
in my files?

Thanks for your help


Norbert
-- 
OpenPGP public key
http://www.linuxnetworks.de/norbert.pubkey.asc



pgpxkPTCwaabm.pgp
Description: PGP signature