Autotools shared library test
Go to file
2015-02-07 22:16:45 +01:00
build Try to get TAP working 2015-02-07 21:20:08 +01:00
build-aux Use glib-tap.mk to setup LOG_DRIVER and LOG_COMPILER 2015-02-07 21:34:36 +01:00
src Change to non-recursive makefiles 2015-01-28 23:15:42 +01:00
tests Try to get TAP working 2015-02-07 21:20:08 +01:00
.gitignore Ignore .log and .trs 2015-02-07 21:22:35 +01:00
AUTHORS Initial commit 2015-01-26 21:17:24 +01:00
autogen.sh Use the --make options with autoreconf 2015-01-31 20:43:25 +01:00
ChangeLog Initial commit 2015-01-26 21:17:24 +01:00
configure.ac Add tap-test as required file 2015-02-07 21:47:55 +01:00
COPYING Initial commit 2015-01-26 21:17:24 +01:00
Makefile.am remove check_PROGRAMS and TESTS now defined in glib-tap.mk 2015-02-07 22:16:45 +01:00
NEWS Initial commit 2015-01-26 21:17:24 +01:00
README Try to get TAP working 2015-02-07 21:20:08 +01:00

# autotools-template
Template for an autotools (autoconf, automake) project

Introduction
============

Setting up an `Autotools` build system can be daunting. So I decided to 
create a template with the basics to use as the basis for my projects. 

It may be surprising to the novice that there is no `./configure` but
`./configure` is a generated file that it's shipped with the
distribution of your software  (the tarball that you get `make dist`). 
As such the `./configure` doesn't belong in the source control
repository. Running `autoreconf -f` will generate `./configure` and a
bunch of other files. 

To build from scrath you need to perform:

    autoreconf -i # Only needed if configure.ac or Makefile.am changes
    ./configure   # generates Makefiles and config.h
    make # build 
    make check # run the tests


I'm not an autotools expert by any means. So take my advice with a grain
of salt. 

There are two input files:

  * `configure.ac`: The `./configure` script will be generated from 
                    from it. Here is were you check for libraries,
                    headers, etc.
  * `Makefile.am`: This file will be transformed into `Makefile.in` that 
                   `./configure` will use to generate the `Makefile`.

Regarding tests, the basic aproach is to have multiple is to run some 
programs with the test and just check the exit code for those. This is
simple and functional but you only get a PASS / FAIL per executable. To
be able to get the individual tests results (asusming that there are 
several , potentially hundreds, of test on a single executable) you need
to use the TAP.

The TAP aproach is that the executables that you use for test will
output the test result on standard out so that `make check` will parse 
it, collect the results, and present them in a nice way. 

I opted to go for the TAP approach although it requires a more complex
setup.

What to do after cloning the repository
=======================================

configure.ac
------------

Edit configure.ac to change the FULL-PACKAGE-NAME, VERSION and 
BUG-REPORT-ADDRESS fields to match your project.

Makefile.am
-----------

Edit src/Makefile.am to say which "products" (executables, binaries) 
will be generated and what are the source files for each one. 

bin_PROGRAMS = executable1 executable2
executable1_SOURCES = sourcefile1.c sourcefile2.c
executable1_CFLAGS =  
executable2_SOURCES = sourcefile3.c sourcefile4.c
executable2_CFLAGS = 


Reference material
==================

Autotools: A Practitioner's Guide to GNU Autoconf, Automake, and Libtool by John Calcote
Autotools Mythbuster https://autotools.io/index.html