    .----------------------------------------------------------------------.
   /                                                                      /
  /     SpiderXML MEMO Autoconf, Automake, M4                            /
 /                                                                      / 
'----------------------------------------------------------------------'


>> STEP 1. Create empty file (touch filename) :

     * AUTHORS, 
     * ChangeLog, 
     * INSTALL, 
     * NEWS, 
     * README, 
     * TODO

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ ls * -la 
-rw-r--r-- 1 jack0e jack0e     0 2011-04-14 12:11 AUTHORS
-rw-r--r-- 1 jack0e jack0e    80 2011-04-15 11:34 ChangeLog
-rwxr-xr-x 1 jack0e jack0e 16517 2011-04-15 12:54 COPYING
-rw-r--r-- 1 jack0e jack0e  8747 2011-05-06 17:53 INSTALL
-rw-r--r-- 1 jack0e jack0e     0 2011-04-14 12:11 NEWS
-rw-r--r-- 1 jack0e jack0e  1311 2011-05-06 13:20 README
-rw-r--r-- 1 jack0e jack0e  3293 2011-05-06 12:46 TODO
drwxr-xr-x 3 jack0e jack0e  4096 2011-04-15 11:41 doc    /* manual, doc, etc */   
drwxr-xr-x 4 jack0e jack0e  4096 2011-04-15 12:28 src    /* source code */    





>> STEP 2. scanning software

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ autoscan
jack0e@jack0e-laptop:~/spiderxml-0.0.3$ ls -ltr
total 60
-rw-r--r-- 1 jack0e jack0e     0 2011-04-14 12:11 NEWS
-rw-r--r-- 1 jack0e jack0e     0 2011-04-14 12:11 AUTHORS
-rw-r--r-- 1 jack0e jack0e    80 2011-04-15 11:34 ChangeLog
drwxr-xr-x 4 jack0e jack0e  4096 2011-04-15 12:28 src
-rwxr-xr-x 1 jack0e jack0e 16517 2011-04-15 12:54 COPYING
-rw-r--r-- 1 jack0e jack0e  3293 2011-05-06 12:46 TODO
-rw-r--r-- 1 jack0e jack0e  1311 2011-05-06 13:20 README
-rw-r--r-- 1 jack0e jack0e  8747 2011-05-06 17:53 INSTALL
drwxr-xr-x 3 jack0e jack0e  4096 2011-05-10 13:09 doc
-rw-r--r-- 1 jack0e jack0e     0 2011-05-10 13:09 autoscan.log      /* NEWS */
-rw-r--r-- 1 jack0e jack0e   636 2011-05-10 13:09 configure.scan    /* NEWS */ 





>> STEP 3. Create configure.ac from configure.scan

I create configure.ac from configure.scan 
Setting FULL_PACKAGE-NAME, VERSION and BUG-REPORT-ADDRESS
Insert macro AM_INIT_AUTOMAKE and AC_PROG_CC
 
jack0e@jack0e-laptop:~/spiderxml-0.0.3$ cp configure.scan configure.ac
jack0e@jack0e-laptop:~/spiderxml-0.0.3$ vi configure.ac

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])

#Modify R.Granito (10/05/2011) 
#SETTING FULL-PACKAGE-NAME, VERSION and BUG-REPORT-ADDRESS
AC_INIT(spiderXML, 0.0.3, raffaele.granito@tiscali.it) 
#----AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])

AC_CONFIG_SRCDIR([src/lib/libSpiderXML.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

#ADD+ R.Granito (10/05/2011)                                                      
AM_INIT_AUTOMAKE                                                                  
AC_PROG_RANLIB                                                     

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_FUNC_MALLOC

AC_CONFIG_FILES([Makefile
                 src/frontend/Makefile
                 src/lib/Makefile])
AC_OUTPUT






>> STEP 4. create configure script: aclocal, autoheader and autoconf 

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ aclocal
jack0e@jack0e-laptop:~/spiderxml-0.0.3$ autoheader
jack0e@jack0e-laptop:~/spiderxml-0.0.3$ autoconf
jack0e@jack0e-laptop:~/spiderxml-0.0.3$ ls -ltr
total 280
-rw-r--r-- 1 jack0e jack0e      0 2011-04-14 12:11 NEWS
-rw-r--r-- 1 jack0e jack0e      0 2011-04-14 12:11 AUTHORS
-rw-r--r-- 1 jack0e jack0e     80 2011-04-15 11:34 ChangeLog
drwxr-xr-x 4 jack0e jack0e   4096 2011-04-15 12:28 src
-rwxr-xr-x 1 jack0e jack0e  16517 2011-04-15 12:54 COPYING
-rw-r--r-- 1 jack0e jack0e   3293 2011-05-06 12:46 TODO
-rw-r--r-- 1 jack0e jack0e   1311 2011-05-06 13:20 README
-rw-r--r-- 1 jack0e jack0e   8747 2011-05-06 17:53 INSTALL
-rw-r--r-- 1 jack0e jack0e      0 2011-05-10 13:09 autoscan.log
-rw-r--r-- 1 jack0e jack0e    636 2011-05-10 13:09 configure.scan
-rw-r--r-- 1 jack0e jack0e    899 2011-05-10 13:28 configure.ac
-rw-r--r-- 1 jack0e jack0e  32612 2011-05-10 13:33 aclocal.m4
-rw-r--r-- 1 jack0e jack0e   1576 2011-05-10 13:33 config.h.in
drwxr-xr-x 2 jack0e jack0e   4096 2011-05-10 13:33 autom4te.cache
drwxr-xr-x 3 jack0e jack0e   4096 2011-05-10 13:41 doc
-rwxr-xr-x 1 jack0e jack0e 172692 2011-05-10 13:41 configure      





>> STEP 5. create the Makefile.am files

    /
    |
    '--- Makefile.am (main)
    '--- src <dir>
           \
           '--- lib <dir>
           |      \
           |      '--- Makefile.am (branch)
           |
           '--- frontend <dir>
                  \
                  '--- Makefile.am (branch)

O /Makefile.am

# Copyright (C) 2009-2011
# Raffaele Granito <raffaele.granito@tiscali.it>
#
# This file is part of GnuLibXML :
# Other XML Library ;)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

SUBDIRS = \
src/lib \
src/frontend

EXTRA_DIST = doc 

- - - - 

O /src/lib/Makefile.am 

# Copyright (C) 2009-2011 
# Raffaele Granito <raffaele.granito@tiscali.it>
#
# This file is part of GnuLibXML :
# Other XML Library ;) 
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

INCLUDES = \
-I$(top_srcdir)/src/lib/include 

noinst_LIBRARIES = libSpiderXML.a
libSpiderXML_a_SOURCES = libSpiderXML.c

EXTRA_DIST = include/libSpiderXML.h

- - - - 

O /src/frontend/Makefile.am

# Copyright (C) 2009-2011
# Raffaele Granito <raffaele.granito@tiscali.it>
#
# This file is part of GnuLibXML :
# Other XML Library ;)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

INCLUDES = \
-I$(top_srcdir)/src/lib/include \
-I$(top_srcdir)/src/frontend/include

bin_PROGRAMS = parseXML

parseXML_SOURCES = parseXML.c

parseXML_LDADD = \
$(top_builddir)/src/lib/libSpiderXML.o 





>> STEP 6. Create (Makefile.am =>) Makefile.in

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ automake --add-missing --copy
configure.ac:18: installing `./install-sh'
configure.ac:18: installing `./missing'
src/frontend/Makefile.am: installing `./depcomp'

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ ls -ltr
total 348
-rw-r--r-- 1 jack0e jack0e      0 2011-04-14 12:11 NEWS
-rw-r--r-- 1 jack0e jack0e      0 2011-04-14 12:11 AUTHORS
-rw-r--r-- 1 jack0e jack0e     80 2011-04-15 11:34 ChangeLog
drwxr-xr-x 4 jack0e jack0e   4096 2011-04-15 12:28 src
-rwxr-xr-x 1 jack0e jack0e  16517 2011-04-15 12:54 COPYING
-rw-r--r-- 1 jack0e jack0e   3293 2011-05-06 12:46 TODO
-rw-r--r-- 1 jack0e jack0e   1311 2011-05-06 13:20 README
-rw-r--r-- 1 jack0e jack0e   8747 2011-05-06 17:53 INSTALL
-rw-r--r-- 1 jack0e jack0e      0 2011-05-10 13:09 autoscan.log
-rw-r--r-- 1 jack0e jack0e    636 2011-05-10 13:09 configure.scan
-rw-r--r-- 1 jack0e jack0e    899 2011-05-10 13:28 configure.ac
-rw-r--r-- 1 jack0e jack0e  32612 2011-05-10 13:33 aclocal.m4
-rw-r--r-- 1 jack0e jack0e   1576 2011-05-10 13:33 config.h.in
drwxr-xr-x 2 jack0e jack0e   4096 2011-05-10 13:33 autom4te.cache
-rwxr-xr-x 1 jack0e jack0e 172692 2011-05-10 13:41 configure
-rw-r--r-- 1 jack0e jack0e    895 2011-05-10 17:08 Makefile.am
drwxr-xr-x 3 jack0e jack0e   4096 2011-05-10 17:14 doc
-rwxr-xr-x 1 jack0e jack0e  11135 2011-05-10 17:14 missing
-rwxr-xr-x 1 jack0e jack0e  13620 2011-05-10 17:14 install-sh
-rwxr-xr-x 1 jack0e jack0e  17867 2011-05-10 17:14 depcomp
-rw-r--r-- 1 jack0e jack0e  19777 2011-05-10 17:14 Makefile.in

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ ls -ltr src/lib/
total 260
drwxr-xr-x 2 jack0e jack0e   4096 2011-05-10 12:50 include
-rw-r--r-- 1 jack0e jack0e 235912 2011-05-10 12:50 libSpiderXML.c
-rw-r--r-- 1 jack0e jack0e   1000 2011-05-10 12:50 Makefile.am
-rw-r--r-- 1 jack0e jack0e  12718 2011-05-10 17:14 Makefile.in

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ ls -ltr src/frontend/
total 40
-rw-r--r-- 1 jack0e jack0e 18576 2011-05-10 12:51 parseXML.c
-rw-r--r-- 1 jack0e jack0e  1041 2011-05-10 12:51 Makefile.am
-rw-r--r-- 1 jack0e jack0e 13672 2011-05-10 17:14 Makefile.in

Ok. I test buil now.






>> STEP 7. TEST Build. Create Makefile (run configure) 

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/frontend/Makefile
config.status: creating src/lib/Makefile
config.status: creating config.h
config.status: executing depfiles commands

Ok.




>> STEP 8. TEST Build. 

jack0e@jack0e-laptop:~/spiderxml-0.0.3$ make
make  all-recursive
make[1]: Entering directory `/home/jack0e/spiderxml-0.0.3'
Making all in src/lib
make[2]: Entering directory `/home/jack0e/spiderxml-0.0.3/src/lib'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include     
    -g -O2 -MT libSpiderXML.o -MD -MP -MF .deps/libSpiderXML.Tpo 
           -c -o libSpiderXML.o libSpiderXML.c
mv -f .deps/libSpiderXML.Tpo .deps/libSpiderXML.Po
rm -f libSpiderXML.a
ar cru libSpiderXML.a libSpiderXML.o 
ranlib libSpiderXML.a
make[2]: Leaving directory `/home/jack0e/spiderxml-0.0.3/src/lib'
Making all in src/frontend
make[2]: Entering directory `/home/jack0e/spiderxml-0.0.3/src/frontend'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include 
      -I../../src/frontend/include    -g -O2 -MT parseXML.o 
          -MD -MP -MF .deps/parseXML.Tpo -c -o parseXML.o parseXML.c
mv -f .deps/parseXML.Tpo .deps/parseXML.Po
gcc  -g -O2   -o parseXML parseXML.o ../../src/lib/libSpiderXML.o  
make[2]: Leaving directory `/home/jack0e/spiderxml-0.0.3/src/frontend'
make[2]: Entering directory `/home/jack0e/spiderxml-0.0.3'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/home/jack0e/spiderxml-0.0.3'
make[1]: Leaving directory `/home/jack0e/spiderxml-0.0.3' 

Ok.




>> STEP 9. Run TEST

jack0e@jack0e-laptop:~/spiderxml-0.0.3/src/frontend$ ./parseXML ../../doc/samples/sample.TOMCAT.xml 
parsed [../../doc/samples/sample.TOMCAT.xml] Ok.






>> STEP 10. Package *.tar.gz (GNU Compliance ;)


jack0e@jack0e-laptop:~/spiderxml-0.0.3$ make distcheck

__CUT__
make[2]: Entering directory `/home/jack0e/spiderxml-0.0.3/_build/src/lib'
test -z "libSpiderXML.a" || rm -f libSpiderXML.a
rm -f *.o
rm -f *.tab.c
test -z "" || rm -f 
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
rm -rf ./.deps
rm -f Makefile
make[2]: Leaving directory `/home/jack0e/spiderxml-0.0.3/_build/src/lib'
Making distclean in .
make[2]: Entering directory `/home/jack0e/spiderxml-0.0.3/_build'
test -z "" || rm -f 
rm -f config.h stamp-h1
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
make[2]: Leaving directory `/home/jack0e/spiderxml-0.0.3/_build'
rm -f config.status config.cache config.log configure.lineno config.status.lineno
rm -f Makefile
make[1]: Leaving directory `/home/jack0e/spiderxml-0.0.3/_build'
{ test ! -d spiderxml-0.0.3 || { find spiderxml-0.0.3 -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr spiderxml-0.0.3; }; }
=================================================
spiderxml-0.0.3 archives ready for distribution: 
spiderxml-0.0.3.tar.gz
=================================================


;) Ok happy hacking




  
