autoconf
[Top][All Lists]
Advanced

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

Re: problem to use autoconf/automake


From: Ralf Wildenhues
Subject: Re: problem to use autoconf/automake
Date: Mon, 25 Apr 2005 22:45:56 +0200
User-agent: Mutt/1.5.6+20040907i

Hi Nicolas,

* Nicolas Haller wrote on Mon, Apr 25, 2005 at 08:43:40PM CEST:
> 
> I am writing a program in C++ and I want to use autotools to help me
> to build my program.

> I have organized my "working directory" in some subdirectory. It's look
> like this:

Don't do it like this.  Don't have a build directory (yet).
Put Makefile.am under your source tree, either only one, or one per
directory, like this:

RSA/
- configure.ac
- Makefile.am  
- src/
  - *.cc *.hh
  - Makefile.am
- doc/
  - Makefile.am
  - ...
- config/
- test/

Then run the autotools in your top source directory.

Then create a build directory anywhere, preferably outside your source
tree, configure and make from there:

mkdir build
cd build
../configure [OPTIONS]
make
make check
make install

That way you can have many build directories.  Like: one for testing
(without optimization, CFLAGS=-g), one per system you export your NFS
to, whatever.

Does this make it any clearer?

Regarding header inclusion: if your C/C++ header files will live only in
your source directory, you can just set AM_CPPFLAGS accordingly
(something like -I$(srcdir)/interface or similar), and then
  #include "file.h"
without a path.  If on the other hand your header files form part of
your interface you export to other software, then I would include them
the way the other software should do as well.  Many people do
  #include "package/file.h"
And remember: files like config.h are not to be installed!

The autoconf and the automake manual have lots of details.

Regards,
Ralf




reply via email to

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