Table of Contents

Quick autotools

Start from Zero

1. Prepare project source:

 mkdir src
 cp -r ../src/* src

2. Autoscan and generate configure.scan

  1. Rename configure.scan to configure.ac rm autoscan.log mv configure.scan configure.ac
    4. Edit Makefile.am

Root Makefile.am

cat ./Makefile.am 
# $Id$

ACLOCAL_AMFLAGS = -I m4

SUBDIRS = src tests tools examples

src/Makefile.am

    cd src
    # update SRCS
    find . -name *.cpp
    find . -name *.h
    vim Makefile.am
    
    cat Makefile.am
    
    # $Id$

ACLOCAL_AMFLAGS = -I m4

SUBDIRS = src tests tools examples
[dang@localhost libdaiutil]$ ls
examples  Makefile.am  src  svn_update_ext_src.sh  tests  tools
[dang@localhost libdaiutil]$ cat src/Makefile.am 
# $Id$

#AM_CFLAGS = @LIBNFC_CFLAGS@
#AM_LDFLAGS = @LIBNFC_LIBS@ -lrt

daiutil_HEADERS = \
./include/util/Monitoring.h \
./include/util/Modbus.h \
./include/util/MemDebug.h \
./include/util/DaiLogger.h \
./include/util/Uid.h \
./include/util/SnepTransmitter.h \
./include/util/Timer.h \
./include/util/Uart.h \
./include/util/Exception.h \
./include/util/Snep.h \
./include/util/SnepSM.h \
./include/util/StateMachine.h \
./include/util/Event.h \
./include/util/Thread.h \
./include/util/Config.h \
./include/util/RfidSnepLibNfc.h \
./include/util/Snmp.h \
./include/util/Gpio.h

daiutil = $(includedir)/util

lib_LTLIBRARIES = libdaiutil.la

libdaiutil_la_SOURCES = \
./util/Monitoring.cpp \
./util/Uid.cpp \
./util/Timer.cpp \
./util/DaiLogger.cpp \
./util/Config.cpp \
./util/Thread.cpp \
./util/Snmp.cpp \
./util/StateMachine.cpp \
./util/Modbus.cpp \
./util/SnepTransmitter.cpp \
./util/SnepSM.cpp \
./util/Uart.cpp \
./util/Snep.cpp \
./util/MemDebug.cpp \
./util/Gpio.cpp \
./util/RfidSnepLibNfc.cpp \
./util/Event.cpp \
./util/Exception.cpp

if WITH_DEBUG
#libnfc_llcp_la_SOURCES += llcp_log.c
endif

#EXTRA_DIST = \

Level 2 Headline

  1. autoscan, mv configure.scan configure.ac
  2. $ aclocal $ autoheader
  3. libtoolize –force –copy

As the result:

  libtoolize: Remember to add `LT_INIT' to configure.ac.
  libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
  libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.

8. $ automake –add-missing –copy –foreign

  AM_INIT_AUTOMAKE >> configure.ac
  aclocal --> aclocal.m4, define Macros
  autoconf now understands configure.ac
  
  AC_CONFIG_SRCDIR(src)
  AM_INIT_AUTOMAKE([foreign -Wall -Werror])
  AM_INIT_AUTOMAKE([subdir-objects])
  
 ...
 $ autoconf
 ...
 $ ./configure
 ...
 $ make
 ...
 $ make DESTDIR=`pwd`/inst/ install

Eclipse autotools

Enabling autotools:

Using CDT autotools: