Working through the Openismus’s example code for Automake (Part 1)

I’m trying to spruce up my site a little bit.  I’ve been working on my favorites page.  I almost have it the way I like it.  I need figure out how to modify my WordPress  template so the page looks correct.
As good as a reason as any to give my sister(the web-design expert) a call to yak with..:)
Ok… I’m moving along here, I downloaded the example source from:
http://www.openismus.com/documents/linux/automake/automake.shtml
It basically has a very simple program with a whole bunch going on.

This whole project merits some close scrutiny.
Outside of the source source code the key files to focus on  are the configure.ac and Makefile.am‘s in the main directory and sub-directories of the project.  Here are the files in the project.

jonas@Ubuntu4:~/helloworld_cc-0.3$ ls -R
.:
aclocal.m4  ChangeLog     config.h.in    config.sub    COPYING  install-sh  Makefile     missing        README
AUTHORS     config.guess  config.log     configure     depcomp  libtool     Makefile.am mkinstalldirs  src
autogen.sh  config.h      config.status  configure.ac INSTALL  ltmain.sh   Makefile.in  NEWS           stamp-h1

./src:
foofiles  hello  hello.cc  hello.h  hello.o  main.cc  main.o  Makefile  Makefile.am Makefile.in

./src/foofiles:
foo.cc  foo.h  foo.o  libfoo.a  Makefile  Makefile.am Makefile.in
jonas@Ubuntu4:~/helloworld_cc-0.3$

The contents of the configure.ac are as follows. (I linked each macro to the appropriate  gnu help reference.)  I guess I should point out that italic macro commands  are deprecated.

configure.ac

AC_INIT(src/hello.cc)
AM_INIT_AUTOMAKE(helloworld_cc,0.3)
AM_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_OUTPUT(Makefile src/Makefile src/foofiles/Makefile)

So… I guess when I get done dissecting this stuff, I should know enough on how to redo to the  current state of the art..;)
A few points of interest in the gnu caught my eye an bear repeating so I can burn it into my brain.

  • A configure script will always begin with a AC_INIT and should end with a AC_OUTPUT.

The modified sample below is old school according to the gnu manual:

If your configure.ac has:

you can modernize it as follows:

  • The AC_CONFIG_SRCDIR is considered to be a safety check.
  • This is new school:AM_INIT_AUTOMAKE([OPTIONS])
  • This is old school: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
  • autoconf macros start with an "AC_"
  • automake macros start with an "AM_"

Ok… I got to AC_PROG_CC  which is the option of which c compiler to run.   I ran a interesting link that talks about this.  I guess it’s req’d to have the thing run correctly.  I suppose if you’re a geek supreme(I’m not), your going to have multiple compilers on your system.

AC_PROG_CXX is similar to AC_PROG_CC except for C++

Lets see what’s left,
AC_PROG_INSTALL
For me at the moment I’m just content running config and make… Sooner or later I suppose, I’ll need this but for now the explanation in the gnu help files works for me:
Set output variable INSTALL to the name of a BSD-compatible install program, if one is found in the current PATH. Otherwise, set INSTALL to dir/install-sh -c', checking the directories specified to AC_CONFIG_AUX_DIR (or its default directories) to determine dir (see Output). Also set the variables INSTALL_PROGRAM and INSTALL_SCRIPT to ${INSTALL}‘ and INSTALL_DATA to `${INSTALL} -m 644‘.
This Linux/Unix stuff is still relatively new to me, I was curious what the deal is with BSD
There’s an interesting factoid about the link.. The world owes one to the Lawyers.  According to the page, if BSD wasn’t mired in lawsuits Linus Torvadis, may not have had the need to create Linux… Funny how the world works..
— Macro: AC_PROG_LIBTOOL
(straight from gnu:”If you are using GNU Autoconf (or Automake), you should add a call to AC_PROG_LIBTOOL to your configure.in file. This macro adds many new tests to the configure script so that the generated libtool script will understand the characteristics of the host: “
Good enough for me.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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