libtool
[Top][All Lists]
Advanced

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

Re: C flags and headers in a C library


From: Joseph Wakeling
Subject: Re: C flags and headers in a C library
Date: Thu, 03 May 2007 13:02:49 +0100
User-agent: Thunderbird 1.5.0.10 (X11/20070403)

Noah Misch wrote:
> Add a line like this to Makefile.am:
> 
>   AM_CFLAGS = $(MINGA_CFLAGS)
> 
> or simply:
> 
>   AM_CFLAGS = -ansi -pedantic -Wall
> 
> Note that it's usually unwise to add such flags unconditionally; many 
> compilers
> do not support them.

Thanks very much.  I hadn't thought about the compiler issue; can you
suggest a conditional check that would sort this out?

Alternatively, is there some way I can just request the extra flags when
calling autoreconf or the ./configure script?  After all, it's only
really necessary for me, as the code author, to check ANSI compatibility.

I thought of placing a line in configure.ac,
CFLAGS="$USER_CFLAGS $CFLAGS"

where USER_CFLAGS is meant to be defined via
./configure USER_CFLAGS="..."

but I'm not sure that is an elegant or safe solution.

> Adding such a line is generally correct.  It sounds as though the headers do 
> not
> exist under the names you call them from Makefile.am.  If you do generate 
> these
> headers during your build process, look at documentation for BUILT_SOURCES in
> the GNU Automake manual.

I think you're right: the main Makefile.am was unable to see the
existence of the files, which are in a subdirectory.  But I was able to
include them via the sublibrary makefiles.

A last query.  When building a library, is it advisable to link to other
libraries when compiling?  e.g. if my library uses functions from
libmath, should I compile my library with -lm, or leave that to the
person creating executables linked with my library?

Thanks again for all the advice and suggestions,

    -- Joe




reply via email to

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