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

GNU Autotools




Tutorial?  that's a lot of work.  How about just an overview.
Read the docs then I'll answer questions.

Well, it _is_ easier to write and maintain the Makefile.am and
configure.ac then to write a Makefile that works on all platforms,
and compilers.

Overview:

Programer writes a "Makefile.am" file that simply lists the
names of the executables and the source files.  next he runs
"automake" which creates "Makefile.in"

Next he writes "configure.ac".  You can use "autoheader" to scan
your source code to make this file, then do some small edits.
So a minimal configure.ac is easy.

Finaly he runs "autoconf" which takes configure.ac and builds
"configure"

Programmer is done.  Now user comes along downloads and un-tars
the file

User runs "configure" on his system.  Configure will scan his
system to find out if required libraries exist, where they are,
figure out how to run the compiler and other tools like the linker
and so on.  It will use "Makefile.in" and results of the scan
to built a "Makefile" that should work on the user's system.

User then types "make" fllowed by "make install"

+++ program is installed +++

Reasons for using this system:

1) The resulting Makefiles are custom built and will run on
   systems the programmer has never seen or used.

2) Resulting Makefiles have +lots+ of cool targets, that would take
   weeks to write by hand.  "make check", "make depend" "make
uninstall"
   just tons of stuff you would never have time to do and it all
   works on any reasonable platform.

3) users expect this.  Now days after un-tarring a source file most
   people look for a "configure" script.  If they don't see one then
   they know they may be in for some unplesent Makefile hacking
   Users who don't understand Makefile see this as pure voodoo magic
   and may just give up on the first "foobar not found" error.

OK using GNU autotools is conceptually harder then just writting a
simple script because there is yet another set of tools he has to
learn to use, another 100 pages of documentation to read and so on
but the payoff comes quickly.  I'd say the first time you use
GNU Autotools on a project that has multiple source directories
and dynamic libraries.  I'll tell you, writting a system of makefiles
that decend a source tree by hand is, ah, as they say, "non-triveal".
And even less non-triveal if you need to install some libraries
along the way and have your stuff work on both Linux and Solaris.

A recursive Makefiles system _is_ nearly triveal using GNU autotools
Like I said the payback for reading 100 pages of docs comes at the
first use.

What makes the system so robust is that it does NOT depend on some
table of operating system characteristics.  It has not memory of
"Linux put libX11 here and Solaris puts it there."  No, instead
it hunts.  If it wants to know if a certain string function
exists it compiles a test program and tries to run it.  

To learn much more you need to get the tools 
  Autoconf, Automake, Autoheader, and Libtool
Print and read the user manuals.  These tools have been around a
while so the user manuals have been through a number of edit cycles
and are actually good



--- Robert Creager <Robert_Creager@LogicalChaos.org> wrote:
> 
> Hey Chris,
> 
> You make this sound so easy.  Would you be willing to give a short 
> tutorial if it is?  I've not tried to use automake/autoconf yet...
> 
> Cheers,
> Rob
> 
> Date sent:      	Tue, 4 Mar 2003 15:11:58 -0800 (PST)
> From:           	Chris Albertson <chrisalbertson90278@yahoo.com>
> Subject:        	Re: Setting Up xvista
> To:             	Tom Droege <tdroege2@earthlink.net>,
> tass@listserv.wwa.com
> 
> > 
> > It's looking for something called "libX11.so"  What's likely
> > missing is an -L option on the line that points to the
> > directory where libX11 lives.  I seriously doubt that Mandrake 9.0
> is
> > missing libX11, as not much would work if it were missing.
> > 
> > What happens is that they move stuff and Michael's Makefile,
> > has assumptions hard coded into it.  (Assumptions based on RedHat
> 7.x
> > if I had to guess.)
> > 
> > On my Solaris 8 system libX11 is in /usr/X/lib on some Linux
> > systems it is /usr/X11 or /usr/X11R4.  Older Sun systems put
> > it is /usr/openwin/lib of all the dumb things. 
> > 
> > Just fix up the Makefile so that you have an option like
> >  "-L/usr/X11/lib" every place there is a "-lX11"
> > 
> > 
> > The better fix, and I'll do this for Micheal if he wants, is to
> > use the GNU autotools "automake, autoconf" to build a ./cofigure
> > file.  Then his install instructions would have you run ./configure
> > which would scan your system and build a Makefile.  This is how
> most
> > open source software is done today.  Years ago READMEs used to say
> > "hack the Makefile as required then run make"  Now they read "run
> > configure then make".
> > 
> > 
> > 
> > --- Tom Droege <tdroege2@earthlink.net> wrote:
> > > Possibly I can't get in touch with Michael R. since my virus.
> > > 
> > > I am trying to get the new pipeline up and running.  I hang on
> the
> > > xvista "make".  It compiles the first six functions and hangs on
> > > "box" with a "cannot find -lX11" error message.
> > > 
> > > Has anyone seen this problem?  I have searched all the libraries
> for
> > > anything that seems to be related.  I have given it the old
> college
> > > try!  This includes going back one version of Mandrake to 8.1
> from
> > > 9.0.  There is something funny about 9.0.  I suspect that they
> > > rushed it out as they were having money problems.
> > > 
> > > Tom Droege
> > > 
> > > 
> > > 
> > 
> > 
> > =====
> > Chris Albertson
> >   Home:   310-376-1029  chrisalbertson90278@yahoo.com
> >   Cell:   310-990-7550
> >   Office: 310-336-5189  Christopher.J.Albertson@aero.org
> >   KG6OMK
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Tax Center - forms, calculators, tips, more
> > http://taxes.yahoo.com/
> > 
> > 
> 
> 
> 



=====
Chris Albertson
  Home:   310-376-1029  chrisalbertson90278@yahoo.com
  Cell:   310-990-7550
  Office: 310-336-5189  Christopher.J.Albertson@aero.org
  KG6OMK

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/