Running through the autotools tutorial

Picking up from my last post:
http://www.lrde.epita.fr/~adl/autotools.html
Hm…. Page 95 of the tutorial gets interesting with a hello world example…

This make, autotools stuff is really confusing to me and the way I look at it is that I’m better offer getting a handle on this sooner rather than later.

Btw.. This pdf tutorial works much nicer with an adobe reader(which I downloaded from Medibuntu rather than Evince document viewer.  Carriage return works with adobe and the pages will page rather than scroll.   You need to flip through the pages to understand whats going on since its drawn like a cartoon.
Anyway back to business.
I’m starting out around page 95 of this tutorial..
I created a main.c program which I copied from the text (which by the way everything had spacing between the letters(I too figure out why one day)).
So….. Things look like this..

jonas@Ubuntu4:~/Hello_world_gnu$ ls -R
.:
src

./src:
main.c  main.c~
jonas@Ubuntu4:~/Hello_world_gnu$

Now.. Now the page that interests me is the slide titled: “‘autoreconf’ is Your Friend” on page 143.
Friends are a good thing…. Supposedly to get started you need to use “autoreconf –install” to setup the package initially… Well…. Lets see what happens for me.

jonas@Ubuntu4:~/Hello_world_gnu$ autoreconf –install
autoreconf: configure.ac' or configure.in’ is required
jonas@Ubuntu4:~/Hello_world_gnu$

You know, I kind of thought that was going to happen… Really I did…
I haven’t run across the configure.in in the tutorial  I just did a search through the document… Nada…. I have seen a bunch with this configure.ac though. (178 hits to be exact).

Now pages 97-106 seems to be the meat and potatoes of what I’m looking for.  In particular:

  • configure.ac,
  • Makefile.am,
  • src/Makefile.am

It looks like these are the three critical files to get the Autotools to work(I think but do not know at this point).
I’m getting the impression that I’m on the hook to compose these manually myself..
@#%, I’m running out of time here…. Need to get to work…
I want to first try making the configure.ac and see what happens:

jonas@Ubuntu4:~/Hello_world_gnu$ autoreconf –install
configure:1987: error: possibly undefined macro: AC_PACKAGE_TARNAME
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure:1988: error: possibly undefined macro: AC_PACKAGE_VERSION
autoreconf: /usr/bin/autoconf failed with exit status: 1
jonas@Ubuntu4:~/Hello_world_gnu$ ls -R
.:
aclocal.m4  autom4te.cache  configure  configure.ac  configure.ac~  src

./autom4te.cache:
output.0  output.1  requests  traces.0  traces.1

./src:
main.c  main.c~
jonas@Ubuntu4:~/Hello_world_gnu$

I’m not sure I like where this is heading… I’m going to delete everything that got auto created and add the

  • Makefile.am,
  • src/Makefile.am

Per the tutorial instructions and see if I get an altered result..

jonas@Ubuntu4:~/amhello$ ls
configure.ac  Makefile.am  src
jonas@Ubuntu4:~/amhello$ autoreconf –install
configure:1987: error: possibly undefined macro: AC_PACKAGE_TARNAME
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure:1988: error: possibly undefined macro: AC_PACKAGE_VERSION
autoreconf: /usr/bin/autoconf failed with exit status: 1
jonas@Ubuntu4:~/amhello$ ls -R
.:
aclocal.m4  autom4te.cache  configure  configure.ac  Makefile.am  src

./autom4te.cache:
output.0  output.1  requests  traces.0  traces.1

./src:
main.c  Makefile.am
jonas@Ubuntu4:~/amhello$

Not exactly whats in the tutorial….(So what else is new.)
Ok.. So nothing in the tutorial on the following terms:
I make a bunch of silly mistakes setting up config.ac
Just ran accross another nice ref site.. http://www.cppreference.com/

This entry was posted in Ubuntu, Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *