Quando scrivo del codice, mi capita di doverlo far girare su macchine differenti per architettura (x86, PowerPC e Sparc ), sistema operativo ( GNU/Linux, Solaris, MacOSX, HP-UX, Mach/Hurd ) o solo semplicemente per vesioni/distribuzioni differenti di un medesimo sistema operativo ( Debian, Slackware, RedHat ). 

A volte il codice in fase di BUILD o a RUN-TIME effettua link statici|dinamici a librerie (e relativi header) di terze parti, e queste potrebbero essere posizionate tra un'ambiente ed un altro, su filesystem, in posizioni differenti. 

Il problema più frequente che mi trovo subito a dover ad affrontare in questi casi riguarda la procedura di BUILD. Ogni ambiente presenta le sue peculiarità, ossia piccole o grandi differenze che non permettono di scrivere ed avere un'unica procedura (o Makefile) che vada bene sempre e indipendentemente dall'ambiente utilizzato. La soluzione più semplice e naturale è quella di scrivere|adattare la procedura di BUILD ed INSTALLAZIONE iniziale per ogni architettura e sistema operativo utilizzato. Non sono pochi i progetti che distribuiscono un Makefile per ogni ambiente supportato, non è quindi una rarità aprire un pacchetto sorgenti e ritrovarsi all'internotanti Makefile (Makefile.solaris, Makefile.hpux, Makefile.linux etc.). Qual'è lo svantaggio di questa soluzione? sicuramente è necessario poter accedere ad ogni ambiente operativo che si vuole supportare, almeno momentaneamente per poter adattare il Makefile per quell'architettura. Gli hacker del progetto GNU ("GNU is *NOT* UNIX" progetto sponsorizzato da Free Software Foundation, il cui scopo è quello di reimplementare un intero sistema operativo unix-like completamente libero) per ovviare a questi tipi di problematiche ed anche ad altre che non intendo citare, si son inventati una soluzione molto funzionante anche se abbastanza antipatica e noiosa per chi si avvicina per la prima volta a strumenti appositamente implementati per risolvere la questione quali autoconf, automake, m4 ed altri. Adottando tale soluzione lo sviluppatore che vuole distribuire la sua applicazione su più sistemi differenti, non deve più preoccuparsi di adattare la propria procedura per ogni ambiente supportato, a questo ci pensa il software messo a disposizione dal progetto GNU. Questo è il primo grande vantaggio. Inoltre i software che adottano tale soluzioni risultano estremamente semplici da compilare ed installare. Il più delle volte l'utente se la cava con solemente 3 istruzioni: configure, make e make install. [1] Configure ha il compito di esplorare ed analizzare l'ambiente e di generare inultimo il Makefile su-misura per quell'ambiente. [2] Make processa il Makefile effettuando le operazioni di compilazione e link, generando quindi i binari. [3] Make Install infine si preoccupa di copiare binari, documentazione su filesystem nelle directory preposte ( /bin, /sbin,/usr/bin etc... ). Vedremo di seguito come dotare il nostro software appena sviluppato di una procedura di BUILD ed INSTALLAZIONE multipiattaforma funzionante su decine di sistemi operativi differenti. In particolare adotteremo la procedura proposta dal progetto GNU. E' necessario installare sulla macchina alcuni software, quali: autoconf, automake, m4, libtool e gettext, oltre ad avere chiaramente sulla macchina compilatore e linker. Prendo come riferimento un caso reale, un software scritto da me, e rilasciato con licenza GNU GPL versione 2: myTCPClient. E' una sorta di client universale, o mira ad essere questo. Al momento supporta i protocolli: TCP, SSL/TLS, HTTP e a breve TIBCO EMS (JMS). E' disponibile liberamente a questo indirizzo internet http://savannah.nongnu.org/projects/mytcpclient/. A me serviva per effettuare dei test di sicurezza, per verificare se la mia banca aveva configurato SSL correttamente, poi ho scoperto che il suo server si accordava anche se gli proponevo algoritmi di crifratura simmetrica *NON* troppo sicuri. Ho segnalato la cosa, gli ha dato un pò fastidio, del resto non tutti son furbi. Tornando a noi, di seguito proverò a scrivere una procedura di build per il myTCPClient secondo lo standard GNU.



<br><br><br>
<strong><strong><strong>myTCPClient su Filesystem</strong></strong></strong><br><br>

L'intero progetto è organizzato su filesystem, secondo le lineeguida di GNU, vale a dire :

<strong>1.</strong> Tutti i file che compongono il progetto son posizionati al di sotto di una home directory il cui nome è costruito dalla concatenazione del nome del progetto e la versione (nel formato a tre cifre puntate) ad esempio myTCPClient-0.0.5.

<strong>2.</strong> Nella home son stati creati i seguenti file: ChangeLOG, COPYING, INSTALL, README, TODO. Nel file <i>ChangeLOG</i> registro le variazioniapportate fino a questo momento per ogni versione rilasciata, <i>COPYING</i> riporta la licenza con cui è distribuito sia il software sia la documentazione, <i>INSTALL</i> riporta la proceduradi installazione, <i>README</i> una presentazionebreve del progetto enotizie importanti da sapere, <i>TODO</i> le attività previste per le successive versioniancora da rilasciare.

<strong>3.</strong> Son state create due directory: <i>doc</i> ed <i>src</i>. La prima per la documentazione e la secondo peril codice sorgente.

<strong>4.</strong> E' stata creata anche la directory <i>identity</i> (non prevista questa nello standard GNU) in cui è stata memorizzata un'identità digitale per i test con ssl, quindi contiene: chiave privata, certificato, certification autority (autogenerata) che ha emesso il certificato.

<strong>5.</strong> Tutti gli altri file presenti sotto la home son legati al processo di build di cui parleremo successivamente. Questo comprende anche tutti i file <i>Makefile.am</i>, <i>Makefile.in</i> presenti al di sotto della directori dei sorgenti <i>src</i>.

Ricapitolando l'applicazione su Filesystem si presenta così :

<pre>

   <strong>$HOME_PACKAGE</strong>/myTCPClient-0.0.5 [<strong>DIR</strong>] 
      \
      '--- ChangeLOG
      '--- COPYING
      '--- INSTALL
      '--- README
      '--- TODO
      '--- doc   [<strong>DIR</strong>]
      '--- src   [<strong>DIR</strong>]

</pre>



<br><br>
<strong><strong>Disposizione dei sorgenti</strong></strong><br><br>

I sorgenti come detto sono tutti conservati nella sotto directory <i>src</i>. Questa però al suo interno è strutturata in sottodirectory, una per ogni modulo applicativo, ognuno di questi tente ad implementare un protocollo di comunicazione. Ogni protocollo implementato ad esempio è memorizzato in una sottodirectory di <i>src</i>. Il modulo lo si può intendere quindi anche come estensione delle funzionalità base di un nucleo centrale. Nella directory principale src è presente il corpo principale del programma.

Di seguito il mio albero src :


<pre>

   <strong>$HOME_PACKAGE</strong>/myTCPClient-0.0.5 [<strong>DIR</strong>] 
      \
      '--- ChangeLOG
      '--- COPYING
      '--- INSTALL
      '--- README
      '--- TODO
      '--- doc   [<strong>DIR</strong>]
      '--- src   [<strong>DIR</strong>]
            /
            |
            '--- client   [<strong>DIR</strong>]
            '--- conf     [<strong>DIR</strong>] 
            '--- output   [<strong>DIR</strong>]
            '--- param    [<strong>DIR</strong>]  
            '--- protocol [<strong>DIR</strong>]
            |      \
            |      |   
            |      '--- tcp     [<strong>DIR</strong>] 
            |      '--- ssl     [<strong>DIR</strong>] 
            |      '--- http    [<strong>DIR</strong>]
            |      '--- ems     [<strong>DIR</strong>]  
            |
            |
            '--- include [<strong>DIR</strong>] 
            '--- myTCPClient.c

</pre>


Il file myTCPClient.c memorizza il main(). Questo a sua volta invoca le seguenti librerie generiche :

[conf] Per leggere i parametro di funzionamento da un file di configurazione.
[param] Per aquisire ed analzzare i parametridi funzionamento passati a riga di comando.
[client] Per inviare o ricevere messaggi dal server.
[output] Per trasmettererisultati e messaggi di errore all'utente.

oltre che, quelle che implementano protocolli di comunicazione : tcp, ssl,http, ems (protocollo proprietario tibco jms). I moduli HTTP ed SSL si servono a sua volta della libreria TCP, così come quella HTTP si serve anche del modulo SSL quando è necessario comunicare in HTTPS. Il modulo SSL non implementa da ZERO l'SSL ma si serve di OpenSSL. Quindi fa uso delle librerie libcrypto e libssl, anch'esse liberamente distribuibili.

E' possibile tracciare, un albero delle dipendenze. Ci servirà in seguito per scrivere la procedura di BUILD.

<pre>
                                   .---------------. 
                                   | myTCPClient.c |
                                   '---------------'   
                                           | 
                   .-----------------------o----------------------.
                   |                                              | 
           .-------o------.                               .-------o-------.   
           | modulo param |    .--------------------------| modulo client | 
           '--------------'    |                          '---------------'  
                   |           |                                  |
                   |           |                                  |
          .--------+---------. |                .-----------------+----------------.
          |                  | |                ||                |                |      
   .------o------.   .-------o-o-----.          ||         .------o------.   .-----o------.
   | modulo conf |   | modulo output |          ||         |             |   |            |   
   '-------------'   '---------------'          ||         | modulo http |   | modulo ems |
                                                ||         |             |   |            |   
                                                ||         '-------------'   '------------'
                                                ||                ||               ||
                                                ||                ||               ||                        
                                          .-----|o----------------|o---------------|o-----.
                     .--------------------|     |     modulo ssl  |                |      |            
                     |                    '-----|-----------------|----------------|------'                           
                     |           .--------------o-----------------o----------------o------.
                  extern         |                            modulo tcp                  |
            libssl, libcrypto    '--------------------------------------------------------'

</pre>

Ogni modulo è racchiuso in una sotto directory di <i>src</i> ed è composto da 2 file, un file .c in cui è implementata una collezione di funzioni (libreria) ed un file .h in cui son definiti le funzioni (prototipi).Il file degli header (.h) è memorizzato nella sotto directory include, quindi ogni modulo ha una directory include, così come ad esempio viene riportato di seguito per  la componente client.

<pre>
   <strong>$HOME_PACKAGE</strong>/myTCPClient-0.05 [<strong>DIR</strong>] 
      /
      |
      '--- ChangeLOG
      '--- COPYING
      '--- INSTALL
      '--- README
      '--- TODO
      '--- doc  [<strong>DIR</strong>]
      '--- src  [<strong>DIR</strong>]
            /
            |
            '--- client  [<strong>DIR</strong>]
            |      \
            |      '--- client.c
            |      '--- include [<strong>DIR</strong>]
            |            \
            |            '--- client.h
            |
            '--- conf     [<strong>DIR</strong>] 
            '--- output   [<strong>DIR</strong>]
            '--- param    [<strong>DIR</strong>]  
            '--- protocol [<strong>DIR</strong>]
            |      \
            |      |   
            |      '--- tcp     [<strong>DIR</strong>] 
            |      '--- ssl     [<strong>DIR</strong>] 
            |      '--- http    [<strong>DIR</strong>]
            |      '--- ems     [<strong>DIR</strong>]  
            |      '--- tems    [<strong>DIR</strong>]
            |
            |
            '--- include [<strong>DIR</strong>] 
            '--- myTCPClient.c
         
         
</pre>






<br><br>
<strong><strong><strong>Procedura di BUILD classica</strong></strong></strong><br><br>

Normalmente per effettuare il build (compilazione + link) di un'intera applicazione si usa il comando make, a cui si da in pasto un file di configurazione il cui nome di default è "Makefile". Make è software molto potente che permette di definire (tramite appunto il suo file di configurazione) azioni da svolgere e dipendenze. Altra caratteristica importante è la sua capacità di ripartire, nel caso di blocco, dal punto in cui si era fermato, e ancora se rieseguito di svolgere solamente le operazioni che produrrebbero un risultato differente rispetto all'ultima esecuzione. Ci sono dei progetti software molto grossi, penso ad esempio ad interi sistemi operativi che impiegano anche giornate intere per essere compilati. Ricominciare nuovamente a ricompilare dopo 10 ore sarebbe molto frustrante. no? col rischio che la procedura di fermi nuovamente per qualche erroruccio, e ricominciare ancora. Bene, Make è furbo, sa che deve riprendere dal punto in cui si è fermato. 

Riporto di seguito un possibile Makefile posizionato nella directory src che effettua il buil dell'intero progetto preso in esame, generando in ultimo l'eseguibile myTCPClient. Non passo a spiegare i dettagli perchè non è questa la finalità di questo paper. Diciamo che eseguendo il comando make, questo inizia a processare il file Makefile. Di default prova risolvere il target all, questo ha come dipendenza il target myTCPClient, a sua volta myTCPlient ha come dipendenza i rimanenti target: output.o, param.o, conf.o,tcp.o, ssl.o, http.o, ems.o eclient.o. In poche parole la compilazione inizia dai moduli (foglie) per finire alla main (radice). L'ultimo comando GCC effettua il linkaggio. La prima versione rilasciata del software utilizzava questa procedura. La procedura di compilazione funzionava bene sul mio x86 con ubuntu. Quando ho avuto la necessità di usare il sofwtare su una sparc64 con Solaris, ho dovuto inserire una libreria di sistema per le socket. 

<pre>
<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5/src$</strong> cat Makefile 
 
#.-----------------------------------------------------------.#
#|                                                           |#
#|                  Makefile per myTCPClient                 |#
#'-----------------------------------------------------------'#
 
#.-----------------------------------------------------------.#
#|      Riferimento a OpenSSL: libssl, libcrypto             |# 
#'-----------------------------------------------------------'#
SSL_INC=-I/home/jack0e/Desktop/stunnelHack/test01/openssl/include
SSL_LIB=-L/home/jack0e/Desktop/stunnelHack/test01/openssl/lib 
 
# -- -- - -
all:  myTCPClient  
 
# - -- - - -
myTCPClient: output.o param.o conf.o tcp.o ssl.o http.o ems.o client.o
        gcc 
-ldl 
myTCPClient.c 
$(SSL_LIB)
$(SSL_INC)  
output/output.o
param/param.o 
conf/conf.o 
tcp/tcp.o 
ssl/ssl.o 
http/http.o 
ems/ems.o 
client/client.o 
-lpthread 
-lssl 
-lcrypto 
-o ../bin/myTCPClient
 
output.o:
gcc -c output/output.c -ooutput/output.o    
 
param.o:
        gcc -c param/param.c   -o param/param.o  
 
conf.o: 
        gcc -c conf/conf.c     -o conf/conf.o    
 
tcp.o:
        gcc -c tcp/tcp.c       -o tcp/tcp.o     
 
ssl.o:
        gcc -c ssl/ssl.c       -o ssl/ssl.o      $(SSL_INC)   
 
http.o:
        gcc -c http/http.c     -o http/http.o               
 
ems.o:
        gcc -c ems/ems.c       -o ems/ems.o 
 
client.o:
        gcc -c client/client.c -o client/client.o      
</pre>

E' abbastanza facile scrivere una procedura di build in questo modo. Si è tentati ad usare questo metodo, o comunque sempre la strada più facile. Quella che ti risolve il problema che hai al momento e non quella ottimale. 




<br><br>
<strong><strong><strong>Procedura di BUILD multipiattaforma</strong></strong></strong><br><br>

Di seguito un metodo per creare Makefile dinamicamente e su misura per l'ambiente su cui si vuole effettuare il build. Credo di averci messo dei secoli per capire il meccanismo, e sono solamente all'inizio, però devo dire che, comprese le potenzialità di questo sistema è difficile tornare indietro. Ok iniziamo.

E' necessario prima di tutto avere sulla propria macchina i seguenti software GNU: automake, autoconf, libtool, m4 oltre a make, gcc e libc chiaramente e poi successivamente eseguire i seguenti passi :<br><br><br>


[<strong>PASSO 1</strong>] scanning del software per individuare le sue dipendenze.<br><br>

AUTOSCAN è uno script in Perl parte del pacchetto GNU Autoconf.
Mi posiziono nell'albero dei sorgenti del pacchetto ed eseguo autoscan. Questo generera un configure.scan, che andrò a rinominare in configure.in

<pre>
-----------------------------------------------------------------------
Sorgenti --> [autoscan*] --> [configure.scan] --> configure.ac|in
-----------------------------------------------------------------------
 
<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong> ./autoscan 
 
</pre>


Questo crea il file configure.scan ed un file di LOG vuoto autoscan.log :

<pre>
<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong> ls -ltr
total 108
-rwxr-xr-x 1 jack0e jack0e 16510 2008-09-03 17:23 COPYING
-rw-r--r-- 1 jack0e jack0e  1103 2009-01-07 17:56 TODO
drwxr-xr-x 3 jack0e jack0e  4096 2009-01-26 11:37 identity
-rw-r--r-- 1 jack0e jack0e  1365 2009-01-26 11:40 README
-rw-r--r-- 1 jack0e jack0e  1180 2009-01-26 11:41 ChangeLog
-rw-r--r-- 1 jack0e jack0e  5364 2009-01-27 00:11 INSTALL
drwxr-xr-x 2 jack0e jack0e  4096 2009-04-06 03:17 conf
drwxr-xr-x 8 jack0e jack0e  4096 2009-04-10 15:36 src
drwxr-xr-x 4 jack0e jack0e  4096 2009-04-10 15:50 doc
-rw-r--r-- 1 jack0e jack0e  1321 2009-04-10 14:54 configure.scan   <strong>*NEWS*</strong>
-rw-r--r-- 1 jack0e jack0e     0 2009-04-10 14:54 autoscan.log     <strong>*NEWS*</strong>

</pre>

L'autoscan.log risulta al momento vuoto, di seguito invece il contenuto del file configure.scan

<pre>
<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong>  cat configure.scan
 
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CONFIG_SRCDIR([src/myTCPClient.c])
AC_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lcrypto':
AC_CHECK_LIB([crypto], [main])
# FIXME: Replace `main' with a function in `-lssl':
AC_CHECK_LIB([ssl], [main])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

# Checks for library functions.
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([gethostbyname memset socket strcasecmp])

AC_CONFIG_FILES([Makefile
                 src/Makefile
                 src/client/Makefile
                 src/conf/Makefile
                 src/output/Makefile
                 src/param/Makefile
                 src/protocol/tems/Makefile
                 src/protocol/ems/Makefile
                 src/protocol/http/Makefile
                 src/protocol/ssl/Makefile
                 src/protocol/tcp/Makefile])
AC_OUTPUT
 
</pre>


a questo punto vado a duplicare tale file in <u>configure.ac</u> (avrei potuto rinominarlo per convenzione anche <u>configure.in</u>). Nella copia vado quindi a modificare <u>AC_INIT</u>, impostando: nome del pacchetto (FULL-PACKAGE-NAME), versione (VERSION) ed indirizzo di posta elettronica dell'autore del codice per la segnalazione dei BUG da parte dell'utente (BUG-REPORT-ADDRESS). Infine aggiungo anche le direttiva AM_INIT_AUTOMAKE e AC_PROG_RANLIB. Al momento non so bene a cosa servino. Se non si aggiungono vanno male i passi successivi (autoconf richiede mi sembra la direttiva AM_INIT_AUTOMAKE e automake richiede la direttica AC_PROG_RANLIB). Le direttive aggiunte vanno posizionate tra i due blocchi etichettati: "Checks for programs" e "Checks for libraries". Inizialmente avevo provato a posizionarle alla fine del file, ma ho avuto degli errori siccessivamente durante la compilazione del software (passo: make). Inoltre ho dovuto eliminare dal blocco definito dalla macro AC_CONFIG_FILE la riga "src/protocol/tems/Makefile", nella directory "tems" è implementato un client TIBCO EMS che sfrutta le api di TIBCO a sorgente chiuso. Non voglio che il pacchetto dipenda da software chiuso, quindi elimino tale codice dal processo di BUILD.

<pre>
<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong> cp configure.scan configure.ac
<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong> cat configure.ac 
 
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(myTCPClient, 0.0.5, raffaele.granito@tiscali.it)
AC_CONFIG_SRCDIR([src/myTCPClient.c])
AC_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

#Aggiunto amano successivamente. R.Granito (20/01/2009)           <strong>*NEWS*</strong>
AM_INIT_AUTOMAKE                                                  <strong>*NEWS*</strong>
AC_PROG_RANLIB                                                    <strong>*NEWS*</strong>

# Checks for libraries.
# Replace -lcrypto and -lssl  R.Granito (10/04/2009)  <strong>*Update*</strong> 
AC_CHECK_LIB([crypto], [-lcrypto])                    <strong>*Update*</strong> 
AC_CHECK_LIB([ssl], [-lssl])                          <strong>*Update*</strong> 

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

# Checks for library functions.
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([gethostbyname memset socket strcasecmp])

AC_CONFIG_FILES([Makefile
                 src/Makefile
                 src/client/Makefile
                 src/conf/Makefile
                 src/output/Makefile
                 src/param/Makefile
                 src/protocol/ems/Makefile
                 src/protocol/http/Makefile
                 src/protocol/ssl/Makefile
                 src/protocol/tcp/Makefile])
AC_OUTPUT

</pre>


è necessario però prima di eseguire il passo successivo (autoconf per la creazione dello script configure, eseguire aclocal che serve per generare|copiare il file aclocal.m4 in cui è definita la macro M4 appena aggiunta AM_INIT_AUTOMAKE

<pre>
 
<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong> aclocal
<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong> ls -ltr
total 108
-rwxr-xr-x 1 jack0e jack0e 16510 2008-09-03 17:23 COPYING
-rw-r--r-- 1 jack0e jack0e  1103 2009-01-07 17:56 TODO
drwxr-xr-x 3 jack0e jack0e  4096 2009-01-26 11:37 identity
-rw-r--r-- 1 jack0e jack0e  1365 2009-01-26 11:40 README
-rw-r--r-- 1 jack0e jack0e  1180 2009-01-26 11:41 ChangeLog
-rw-r--r-- 1 jack0e jack0e  5364 2009-01-27 00:11 INSTALL
drwxr-xr-x 2 jack0e jack0e  4096 2009-04-06 03:17 conf
drwxr-xr-x 8 jack0e jack0e  4096 2009-04-10 15:36 src
drwxr-xr-x 4 jack0e jack0e  4096 2009-04-10 15:50 doc
-rw-r--r-- 1 jack0e jack0e  1321 2009-04-10 14:54 configure.scan
-rw-r--r-- 1 jack0e jack0e     0 2009-04-10 14:54 autoscan.log
-rw-r--r-- 1 jack0e jack0e  1445 2009-04-10 16:10 configure.ac     
drwxr-xr-x 2 jack0e jack0e  4096 2009-04-10 16:10 autom4te.cache   <strong>*NEWS*</strong>
-rw-r--r-- 1 jack0e jack0e 31848 2009-04-10 16:10 aclocal.m4       <strong>*NEWS*</strong>

</pre>


La directory autom4te contiene al suo interno altre directory, la tralascio al momento.
Quella di seguito è la definizione della macro AM_INI_AUTOMAKE nel file aclocal.m4

<pre>
 
<strong>jack0e@jack0e-laptop:~/Desktop/PdS/Collaudo/SSL/myTCPClient/src$</strong> cat aclocal.m4
 
[ <strong>__CUT__</strong> ] 
 
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call(pre autoconf-2.50), which is being phased out.  PACKAGE
# and VERSION should now bepassed to AC_INIT and removed from
# the call toAM_INIT_AUTOMAKE.
# We support both call styles forthe transition.  After
# the next Automake release, Autoconfcan makethe AC_INIT
# arguments mandatory, and then we can depend on a newAutoconf
# release and drop the old call support.</i>
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.60])dnl
dnlAutoconf wants to disallow AM_ names.  Weexplicitlyallow
dnl the ones wecare about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test"`cd $srcdir && pwd`" != "`pwd`"; then
   # Use -I$(srcdir) only when $(srcdir)!= .,so that make's output
   # is not pollutedwith repeated "-I."
   AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
   # test to see if srcdir already configured
   if test -f $srcdir/config.status; then
     AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
  fi
fi
 
[ <strong>__CUT__</strong> ] 
 
</pre>


<br><br><br>
[<strong>PASSO 2</strong>] Creazione del file config.h.in<br><br>
 
Eseguo autoheader che genera il config.h.in a partire dai 3 file precedentemente creati, ossia: <u>configure.ac</u>, <u>aclocal.m4</u> e <u>acsite.m4</u>. Ho notato che autoheader il file aclocal.m4 in effetti nel mio caso non lo usa. (Sto leggendo degli scarabocchi in questo momento in cui mi ero segnato tutto quello che mi era capitato durante la procedura, ho difficoltà anch'io a tradurre disegni e freccette, sarà per questo che scrivo i paper, e poi con la memoria mi ritrovo :P)

<pre>
 
   configure.ac -----.
                     |   
   [aclocal.m4] -----+----- [autoheader*]-- [config.h.in] 
                     |  
   [acsite.m4]  -----'
 
 
 
<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong> autoheader


<strong>jack0e@jack0e-laptop:~/myTCPClient$</strong> ls -ltr
total 112
-rwxr-xr-x 1 jack0e jack0e 16510 2008-09-03 17:23 COPYING
-rw-r--r-- 1 jack0e jack0e  1103 2009-01-07 17:56 TODO
drwxr-xr-x 3 jack0e jack0e  4096 2009-01-26 11:37 identity
-rw-r--r-- 1 jack0e jack0e  1365 2009-01-26 11:40 README
-rw-r--r-- 1 jack0e jack0e  1180 2009-01-26 11:41 ChangeLog
-rw-r--r-- 1 jack0e jack0e  5364 2009-01-27 00:11 INSTALL
drwxr-xr-x 2 jack0e jack0e  4096 2009-04-06 03:17 conf
-rw-r--r-- 1 jack0e jack0e  1321 2009-04-10 14:54 configure.scan
-rw-r--r-- 1 jack0e jack0e     0 2009-04-10 14:54 autoscan.log
drwxr-xr-x 8 jack0e jack0e  4096 2009-04-10 15:36 src
drwxr-xr-x 4 jack0e jack0e  4096 2009-04-10 16:27 doc
-rw-r--r-- 1 jack0e jack0e  1445 2009-04-10 16:10 configure.ac
-rw-r--r-- 1 jack0e jack0e 31848 2009-04-10 16:10 aclocal.m4
-rw-r--r-- 1 jack0e jack0e  2817 2009-04-10 16:22 config.h.in      <strong>*NEW*</strong>
drwxr-xr-x 2 jack0e jack0e  4096 2009-04-10 16:22 autom4te.cache   <strong>*Update*</strong>
 

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat config.h.in 

/* config.h.in.  Generated from configure.ac by autoheader.  */

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H

/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO

/* Define to 1 if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
   to 0 otherwise. */
#undef HAVE_MALLOC

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET

/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H

/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H

/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET

/* Define to 1 if `stat' has the bug that it succeeds when given the
   zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
   slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK

/* Name of package */
#undef PACKAGE

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Version number of package */
#undef VERSION

/* Define to empty if `const' does not conform to ANSI C. */
#undef const

/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
jack0e@jack0e-laptop:~/Desktop/PdS/Collaudo/SSL/myTCPClient-0.0.5$ cat config.h.in 
/* config.h.in.  Generated from configure.ac by autoheader.  */

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H

/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO

/* Define to 1 if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
   to 0 otherwise. */
#undef HAVE_MALLOC

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET

/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H

/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H

/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET

/* Define to 1 if `stat' has the bug that it succeeds when given the
   zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
   slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK

/* Name of package */
#undef PACKAGE

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Version number of package */
#undef VERSION

/* Define to empty if `const' does not conform to ANSI C. */
#undef const

/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc

</pre>


<br><br><br>
[<strong>PASSO 3</strong>] Creazione dello script configure.<br><br>
 
Lancio autoconf che legge il configure.ac|in, aclocal.m4 e acsite.m4 e genererà i file: [1] configure, [2] autom4te.cache, [3] config.status and [4] config.log.

<pre>
 
   configure.ac -----. 
                     |   
   [aclocal.m4] -----+----- autoconf* ----- configure
                     |
   [acsite.m4]  -----'


<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> autoconf
<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> ls -ltr
total 300
-rwxr-xr-x 1 jack0e jack0e  16510 2008-09-03 17:23 COPYING
-rw-r--r-- 1 jack0e jack0e   1103 2009-01-07 17:56 TODO
drwxr-xr-x 3 jack0e jack0e   4096 2009-01-26 11:37 identity
-rw-r--r-- 1 jack0e jack0e   1365 2009-01-26 11:40 README
-rw-r--r-- 1 jack0e jack0e   1180 2009-01-26 11:41 ChangeLog
-rw-r--r-- 1 jack0e jack0e   5364 2009-01-27 00:11 INSTALL
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-06 03:17 conf
drwxr-xr-x 8 jack0e jack0e   4096 2009-04-10 15:36 src
drwxr-xr-x 4 jack0e jack0e   4096 2009-04-10 16:30 doc
-rw-r--r-- 1 jack0e jack0e   1321 2009-04-10 14:54 configure.scan
-rw-r--r-- 1 jack0e jack0e   1445 2009-04-10 16:10 configure.ac
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 14:54 autoscan.log
-rw-r--r-- 1 jack0e jack0e  31848 2009-04-10 16:10 aclocal.m4
-rw-r--r-- 1 jack0e jack0e   2817 2009-04-10 16:22 config.h.in
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-10 16:22 autom4te.cache
-rwxr-xr-x 1 jack0e jack0e 186236 2009-04-10 16:30 configure        <strong>*NEW*</strong>
 
</pre>


<br><br><br>
[<strong>PASSO 4</strong>] Creazione dei modelli di Makefile (Makefile.am)<br><br>
 
E' necessario creare un modello di Makefile per ogni modulo applicativo. Tali file dovranno essere chiamati Makefile.am.
Torniamo un attimo all'albero delle dipendenze e alla struttura a directory su filesystem.
Se tutto vi è chiaro non dovreste avere problemi ad individuare i Makefile.am da creare :

<pre>

~/myTCPClient-0.0.5/Makefile.am
~/myTCPClient-0.0.5/src/Makefile.am
~/myTCPClient-0.0.5/src/client/Makefile.am
~/myTCPClient-0.0.5/src/conf/Makefile.am
~/myTCPClient-0.0.5/src/output/Makefile.am
~/myTCPClient-0.0.5/src/param/Makefile.am
~/myTCPClient-0.0.5/src/protocol/tems/Makefile.am
~/myTCPClient-0.0.5/src/protocol/ems/Makefile.am
~/myTCPClient-0.0.5/src/protocol/http/Makefile.am
~/myTCPClient-0.0.5/src/protocol/ssl/Makefile.am
~/myTCPClient-0.0.5/src/protocol/tcp/Makefile.am

</pre>

Il file Makefile.am principale (quello da posizionare nella home dell'albero applicativo) si dovrà limitare ad elencare la posizione di tutti gli altri Makefile.am. Ho ordito dalle foglie alla root, per essere sicuro di soddisfare le dipendenze. 

<pre>

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat Makefile.am 
SUBDIRS = \
src/protocol/tcp \
src/protocol/ssl \
src/protocol/http \
src/protocol/ems \
src/client \
src/conf \
src/output \
src/param \
src

EXTRA_DIST = doc identity

</pre>

di seguito tutti quanti gli altri. In ognuno di essi bisogna definire le dipendenze in maniera tale che da permettere al comando <strong>automake</strong> (che vedremo successivamente, sia in grado di creare da questi i corrispondenti <strong>Makefile.in</strong>. Con la variabile EXTRA_DIST è necessario specificare tutti i file che non verrebero presi dal processo di distribuzione del software (che vedremo successivamente). Spero siano chiari. Io meglio di così non mi riesco proprio a spiegare, non sono bravo a scrivere :P (Voi però tenete sempre sotto occhio l'albero delle dipendenze vi sarà più facile comprendere.

<pre>

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/protocol/tcp/Makefile.am 
INCLUDES = -I$(top_srcdir)/src/protocol/tcp/include

noinst_LIBRARIES = libtcp.a
libtcp_a_SOURCES = tcp.c

EXTRA_DIST = include/tcp.h

~ ~ ~ ~ ~ ~

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/protocol/ssl/Makefile.am 

#
# note. required openssl/ssl.h and openssl/crypto.h
#

INCLUDES = \
-I$(top_srcdir)/src/protocol/tcp/include \
-I$(top_srcdir)/src/protocol/ssl/include

noinst_LIBRARIES = libssl.a
libssl_a_SOURCES = ssl.c

EXTRA_DIST = include/ssl.h

~ ~ ~ ~ ~ ~

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/protocol/http/Makefile.am 

#
# note. required openssl/ssl.h and openssl/crypto.h
#

INCLUDES = \
-I$(top_srcdir)/src/protocol/tcp/include \
-I$(top_srcdir)/src/protocol/ssl/include \
-I$(top_srcdir)/src/protocol/http/include 

noinst_LIBRARIES = libhttp.a
libhttp_a_SOURCES = http.c

EXTRA_DIST = include/http.h

~ ~ ~ ~ ~ ~

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/protocol/ems/Makefile.am 

#
# note. required openssl/ssl.h and openssl/crypto.h
#

INCLUDES = \
-I$(top_srcdir)/src/protocol/tcp/include \
-I$(top_srcdir)/src/protocol/ssl/include \
-I$(top_srcdir)/src/protocol/ems/include 

noinst_LIBRARIES = libems.a
libems_a_SOURCES = ems.c

EXTRA_DIST = include/ems.h

~ ~ ~ ~ ~ ~ 

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/protocol/tems/Makefile.am

#
# note. required $TIBCO_INSTALL_HOME/tibems/tibems.h 
#

INCLUDES = -I$(top_srcdir)/src/protocol/tems/include

noinst_LIBRARIES = libtems.a
libtems_a_SOURCES = tems.c

EXTRA_DIST = include/tems.h

~ ~ ~ ~ ~ ~

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/output/Makefile.am 
INCLUDES = -I$(top_srcdir)/src/output/include

noinst_LIBRARIES = liboutput.a
liboutput_a_SOURCES = output.c

EXTRA_DIST = include/output.h

~ ~ ~ ~ ~ ~

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/client/Makefile.am 

#
# note. required openssl/ssl.h and openssl/crypto.h
#

INCLUDES = \
-I$(top_srcdir)/src/client/include \
-I$(top_srcdir)/src/protocol/tcp/include \
-I$(top_srcdir)/src/protocol/ssl/include \
-I$(top_srcdir)/src/protocol/http/include \
-I$(top_srcdir)/src/protocol/ems/include \
-I$(top_srcdir)/src/output/include 

noinst_LIBRARIES = libclient.a
libclient_a_SOURCES = client.c

EXTRA_DIST = include/client.h

~ ~ ~ ~ ~ ~

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/conf/Makefile.am 
INCLUDES = -I$(top_srcdir)/src/conf/include

noinst_LIBRARIES = libconf.a
libconf_a_SOURCES = conf.c

EXTRA_DIST = include/conf.h

~ ~ ~ ~ ~ ~

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/param/Makefile.am 
INCLUDES = \
-I$(top_srcdir)/src/param/include \
-I$(top_srcdir)/src/conf/include \
-I$(top_srcdir)/src/output/include

noinst_LIBRARIES = libparam.a
libparam_a_SOURCES = param.c

EXTRA_DIST = include/param.h

~ ~ ~ ~ ~ ~

#
# note. required openssl/libssl.a and openssl/libcrypto.a
#

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> cat src/Makefile.am 
INCLUDES = \
-I$(top_srcdir)/src/include \
-I$(top_srcdir)/src/client/include \
-I$(top_srcdir)/src/param/include

bin_PROGRAMS = myTCPClient

myTCPClient_SOURCES = myTCPClient.c

myTCPClient_LDADD = \
$(top_builddir)/src/conf/conf.o           \
$(top_builddir)/src/param/param.o         \
$(top_builddir)/src/client/client.o       \
$(top_builddir)/src/output/output.o       \
$(top_builddir)/src/protocol/tcp/tcp.o    \
$(top_builddir)/src/protocol/ssl/ssl.o    \
$(top_builddir)/src/protocol/http/http.o  \
$(top_builddir)/src/protocol/ems/ems.o    \
$(top_builddir)/src/protocol/tems/tems.o  \
-lssl \
-lcrypto \
-lems 

EXTRA_DIST = include/myTCPClient.h

</pre>


<br><br><br>
[<strong>PASSO 5</strong>] Creazione dei modelli di Makefile (Makefile.in)<br><br>

A questo punto è necessario eseguire il comendo *automake* per generare i Makefile.in a patire dai corrispettivi Makefile.am. Ilparametro --add-missing serve per generare i corrispondenti Makefile.in. Prima però è necessario creare a mano due file: NEWS e AUTHORS altrimenti, che ancora mancano, prerequisito per eseguire l'operazione e previsti dallo standard GNU. Come potrete notare la directory autom4te.cache si movimenta ad ogni operazione fatta.

<pre>

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> touch NEWS
<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> touch AUTHORS

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> automake --add-missing
configure.ac:47: installing `./missing'
configure.ac:12: installing `./install-sh'
src/Makefile.am: installing `./depcomp'


<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> ls -ltr
total 300
-rwxr-xr-x 1 jack0e jack0e  16510 2008-09-03 17:23 COPYING
-rw-r--r-- 1 jack0e jack0e   1103 2009-01-07 17:56 TODO
drwxr-xr-x 3 jack0e jack0e   4096 2009-01-26 11:37 identity
-rw-r--r-- 1 jack0e jack0e   1365 2009-01-26 11:40 README
-rw-r--r-- 1 jack0e jack0e   1180 2009-01-26 11:41 ChangeLog
-rw-r--r-- 1 jack0e jack0e   5364 2009-01-27 00:11 INSTALL
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-06 03:17 conf
drwxr-xr-x 8 jack0e jack0e   4096 2009-04-10 15:36 src
drwxr-xr-x 4 jack0e jack0e   4096 2009-04-10 16:30 doc
-rw-r--r-- 1 jack0e jack0e   1321 2009-04-10 14:54 configure.scan
-rw-r--r-- 1 jack0e jack0e   1445 2009-04-10 16:10 configure.ac
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 14:54 autoscan.log
-rw-r--r-- 1 jack0e jack0e  31848 2009-04-10 16:10 aclocal.m4
-rw-r--r-- 1 jack0e jack0e   2817 2009-04-10 16:22 config.h.in
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-10 16:22 autom4te.cache
-rwxr-xr-x 1 jack0e jack0e 186236 2009-04-10 16:30 configure        
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 18:55 NEWS
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 18:55 AUTHORS
lrwxrwxrwx 1 jack0e jack0e     32 2009-04-10 18:55 missing -> /usr/share/automake-1.10/missing <strong>*NEW*</strong>
-rw-r--r-- 1 jack0e jack0e  18848 2009-04-10 18:55 Makefile.in <strong>*NEW*</strong>
lrwxrwxrwx 1 jack0e jack0e     35 2009-04-10 18:55 install-sh -> /usr/share/automake-1.10/install-sh <strong>*NEW*</strong>
lrwxrwxrwx 1 jack0e jack0e     32 2009-04-10 18:55 depcomp -> /usr/share/automake-1.10/depcomp <strong>*NEW*</strong>
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-10 18:55 autom4te.cache <strong>*UPDATE*</strong>

</pre>

come potete notare i file mancanti missing, install-sh e depcomp non sono altro dei link simbolici a quelli fisici installati già nel mio sistema. Mi chiedevo... e se l'utente non dovesse avere tali file o li dovesse avere in directory differenti che succede? Ho scoperto che automake ha un ulteriore parametro per installare fisicamente i file mancanti. Al comando precedente, quindi, meglio usare questo con l'aggiunta dell'opzione --copy (prima però cancello 3 link simbolici) :

<pre>

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> rm missing install-sh decomp

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> automake --add-missing --copy
configure.ac:47: installing `./missing'
configure.ac:12: installing `./install-sh'
src/Makefile.am: installing `./depcomp'

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> ls -ltr
total 300
-rwxr-xr-x 1 jack0e jack0e  16510 2008-09-03 17:23 COPYING
-rw-r--r-- 1 jack0e jack0e   1103 2009-01-07 17:56 TODO
drwxr-xr-x 3 jack0e jack0e   4096 2009-01-26 11:37 identity
-rw-r--r-- 1 jack0e jack0e   1365 2009-01-26 11:40 README
-rw-r--r-- 1 jack0e jack0e   1180 2009-01-26 11:41 ChangeLog
-rw-r--r-- 1 jack0e jack0e   5364 2009-01-27 00:11 INSTALL
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-06 03:17 conf
drwxr-xr-x 8 jack0e jack0e   4096 2009-04-10 15:36 src
drwxr-xr-x 4 jack0e jack0e   4096 2009-04-10 16:30 doc
-rw-r--r-- 1 jack0e jack0e   1321 2009-04-10 14:54 configure.scan
-rw-r--r-- 1 jack0e jack0e   1445 2009-04-10 16:10 configure.ac
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 14:54 autoscan.log
-rw-r--r-- 1 jack0e jack0e  31848 2009-04-10 16:10 aclocal.m4
-rw-r--r-- 1 jack0e jack0e   2817 2009-04-10 16:22 config.h.in
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-10 16:22 autom4te.cache
-rwxr-xr-x 1 jack0e jack0e 186236 2009-04-10 16:30 configure        
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 18:55 NEWS
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 18:55 AUTHORS
-rw-r--r-- 1 jack0e jack0e  18848 2009-04-10 18:55 Makefile.in <strong>*NEW*</strong>
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-10 18:55 autom4te.cache <strong>*UPDATE*</strong>
-rwxr-xr-x 1 jack0e jack0e  11135 2009-04-14 15:42 missing <strong>*NEW NOLINK*</strong>
-rwxr-xr-x 1 jack0e jack0e  13184 2009-04-14 15:42 install-sh <strong>*NEW NOLINK*</strong>
-rwxr-xr-x 1 jack0e jack0e  17574 2009-04-14 15:42 depcomp <strong>*NEW NOLINK*</strong>

</pre>

Ora proviamo a compilarlo.

<pre>



<br><br><br>
[<strong>PASSO 6</strong>] Test di compilazione.<br><br>

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> ./configure
checking for g++... g++
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 g++ accepts -g... yes
checking for gcc... gcc
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 make sets $(MAKE)... yes
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking for -lcrypto in -lcrypto... no
checking for -lssl in -lssl... no
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 fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking return type of signal handlers... void
checking whether lstat dereferences a symlink specified with a trailing slash... yes
checking whether stat accepts an empty string... no
checking for gethostbyname... yes
checking for memset... yes
checking for socket... yes
checking for strcasecmp... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/client/Makefile
config.status: creating src/conf/Makefile
config.status: creating src/output/Makefile
config.status: creating src/param/Makefile
config.status: creating src/protocol/tems/Makefile
config.status: creating src/protocol/ems/Makefile
config.status: creating src/protocol/http/Makefile
config.status: creating src/protocol/ssl/Makefile
config.status: creating src/protocol/tcp/Makefile
config.status: creating config.h
config.status: executing depfiles commands


<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> make
make  all-recursive
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5'
Making all in src/protocol/tcp
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/tcp'
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/protocol/tcp/include    
               -g -O2 -MT tcp.o -MD -MP -MF .deps/tcp.Tpo -c -o tcp.o tcp.c
tcp.c: In function ‘TCPReceive’:
tcp.c:188: warning: incompatible implicit declaration of built-in function ‘printf’
mv -f .deps/tcp.Tpo .deps/tcp.Po
rm -f libtcp.a
ar cru libtcp.a tcp.o 
ranlib libtcp.a
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/tcp'
Making all in src/protocol/ssl
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ssl'
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/protocol/tcp/include 
          -I../../../src/protocol/ssl/include -I/home/jack0e/Desktop/stunnelHack/test01/include     
          -g -O2 -MT ssl.o -MD -MP -MF .deps/ssl.Tpo -c -o ssl.o ssl.c
mv -f .deps/ssl.Tpo .deps/ssl.Po
rm -f libssl.a
ar cru libssl.a ssl.o 
ranlib libssl.a
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ssl'
Making all in src/protocol/http
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/http'
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/protocol/tcp/include 
            -I../../../src/protocol/ssl/include -I../../../src/protocol/http/include 
            -I/home/jack0e/Desktop/stunnelHack/test01/include     
            -g -O2 -MT http.o -MD -MP -MF .deps/http.Tpo -c -o http.o http.c
mv -f .deps/http.Tpo .deps/http.Po
rm -f libhttp.a
ar cru libhttp.a http.o 
ranlib libhttp.a
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/http'
Making all in src/protocol/ems
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ems'
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/protocol/tcp/include 
            -I../../../src/protocol/ssl/include -I../../../src/protocol/ems/include 
            -I/home/jack0e/Desktop/stunnelHack/test01/include     
            -g -O2 -MT ems.o -MD -MP -MF .deps/ems.Tpo -c -o ems.o ems.c
mv -f .deps/ems.Tpo .deps/ems.Po
rm -f libems.a
ar cru libems.a ems.o 
ranlib libems.a
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ems'
Making all in src/client
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/client'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/client/include -I../../src/protocol/tcp/include 
                        -I../../src/protocol/ssl/include -I../../src/protocol/http/include 
                        -I../../src/protocol/ems/include -I../../src/output/include 
                        -I/home/jack0e/Desktop/stunnelHack/test01/include    
                        -g -O2 -MT client.o -MD -MP -MF .deps/client.Tpo -c -o client.o client.c
mv -f .deps/client.Tpo .deps/client.Po
rm -f libclient.a
ar cru libclient.a client.o 
ranlib libclient.a
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/client'
Making all in src/conf
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/conf'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/conf/include    
                        -g -O2 -MT conf.o -MD -MP -MF .deps/conf.Tpo -c -o conf.o conf.c
mv -f .deps/conf.Tpo .deps/conf.Po
rm -f libconf.a
ar cru libconf.a conf.o 
ranlib libconf.a
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/conf'
Making all in src/output
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/output'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/output/include     
                        -g -O2 -MT output.o -MD -MP -MF .deps/output.Tpo -c -o output.o output.c
mv -f .deps/output.Tpo .deps/output.Po
rm -f liboutput.a
ar cru liboutput.a output.o 
ranlib liboutput.a
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/output'
Making all in src/param
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/param'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/param/include -I../../src/conf/include 
                        -I../../src/output/include    
                        -g -O2 -MT param.o -MD -MP -MF .deps/param.Tpo -c -o param.o param.c
mv -f .deps/param.Tpo .deps/param.Po
rm -f libparam.a
ar cru libparam.a param.o 
ranlib libparam.a
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/param'
Making all in src
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src'
gcc -DHAVE_CONFIG_H -I. -I.. -I../src/include -I../src/client/include 
                    -I../src/param/include    -g -O2 -MT myTCPClient.o -MD -MP -MF 
                    .deps/myTCPClient.Tpo -c -o myTCPClient.o myTCPClient.c
mv -f .deps/myTCPClient.Tpo .deps/myTCPClient.Po
gcc  -g -O2   -o myTCPClient myTCPClient.o -L/home/jack0e/Desktop/stunnelHack/source/openssl-0.9.8g 
                    ../src/conf/conf.o ../src/param/param.o ../src/client/client.o 
                    ../src/output/output.o ../src/protocol/tcp/tcp.o ../src/protocol/ssl/ssl.o 
                    ../src/protocol/http/http.o ../src/protocol/ems/ems.o -lssl -lcrypto  
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src'
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/home/jack0e/myTCPClient-0.0.5'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5'

</pre>

sembra che sia andato tutto bene. Non ha dato nessun errore. In alterativa al make (all) è possibile usare anche il target check (make check). In ultimo è possibile, per essere sicuri che il tutto sia andato bene, verificare la presenza dell'eseguibile myTCPClient.

<pre>

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> src/./myTCPClient 

Universal Client TCP version 0.0.5
Raffaele Granito (c) 2008 Licence GPLv2

formato: myClientTCP [-c|--connect] protocollo://host:port/directory
                     [-U|--auth-user user] [-P|--auth-password]
                     [-k|--keystore filename] [-p|--password password]
                     [-t|--truststore filename
                     [-C|--ciphersuite {cipher1,cipher2,...,cipherN}]
                     [-s|--ssl-version version]
                     [-T|--type-operation {GET|PUT|GETDEL}]
                     [-M|--message message]
                     [-m|--max-request max-value]
                     [-o|--output-file filename]
         myClientTCP [-f|--config filename]
         myClientTCP [-h|--help]
         myClientTCP [-v|--version]

</pre>

Ora, che abbiamo verificato la correttezza del processo di BUILD, possiamo ripulire il nostro albero di tutti quei file prodotti per effettuare tale TEST, in maniera tale da distribuire un albero pulito. A tal proposito, il Makefile generato secondo lo standard GNU prevede 4 target standard: clean, mostlyclean, distclean e maintainer-clean. Ognuno di questi ha il suo specifico compito. Dovrebbe fare il mio caso il target distclean. Non ho ben capito la differenza con il target maintainer-clean, devo approfondire. Di seguito una breve descrizione dei 4 target :

<strong>clean</strong>	
        
Elimina i file risultanti della compilazione (file oggetto ed eseguibili), ma non elimina altri file generati che vengono forniti con la distribuzione.


<strong>mostlyclean</strong>

Effetto simile a clean, ma tralascia i file oggetti che non richiedono di essere ricompilati.


<strong>distclean</strong>

Funzione inversa dello script configure e del target all. Ripristina in pratica un pacchetto al suo stadio iniziale.


<strong>maintainer-clean</strong>  

Più efficace di clean: può cancellare file che richiedono l'uso di particolari strumenti per ricompilare il pacchetto, come il codice sorgente generato dal sistema.

<pre>

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> make distclean
Making distclean in src
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src'
test -z "myTCPClient" || rm -f myTCPClient
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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src'
Making distclean in src/param
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/param'
test -z "libparam.a" || rm -f libparam.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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/param'
Making distclean in src/output
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/output'
test -z "liboutput.a" || rm -f liboutput.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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/output'
Making distclean in src/conf
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/conf'
test -z "libconf.a" || rm -f libconf.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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/conf'
Making distclean in src/client
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/client'
test -z "libclient.a" || rm -f libclient.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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/client'
Making distclean in src/protocol/ems
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ems'
test -z "libems.a" || rm -f libems.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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ems'
Making distclean in src/protocol/http
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/http'
test -z "libhttp.a" || rm -f libhttp.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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/http'
Making distclean in src/protocol/ssl
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ssl'
test -z "libssl.a" || rm -f libssl.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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ssl'
Making distclean in src/protocol/tcp
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/tcp'
test -z "libtcp.a" || rm -f libtcp.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[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/tcp'
Making distclean in .
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5'
test -z "" || rm -f  
rm -f config.h stamp-h1
rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5'
rm -f config.status config.cache config.log configure.lineno config.status.lineno
rm -f Makefile

</pre>

Siamo pronti ad impacchettare il nostro codice.



<br><br><br>
[<strong>PASSO 7</strong>] Procedura di impacchettamento.<br><br>

Il Makefile generato secondo lo standard GNU prevede due target che ci vengono in aiuto per impacchettare: dist e distcheck. Il primo genera il pacchetto ed il secondo dopo aver generato il pacchetto prova anche a compilarlo, quindi effettua un ulteriore test.

<pre>
 
<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> ./configure

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> make dist
{ test ! -d mytcpclient-0.0.5 || { find mytcpclient-0.0.5 -type d ! -perm -200 
            -exec chmod u+w {} ';' && rm -fr mytcpclient-0.0.5; }; }
test -d mytcpclient-0.0.5 || mkdir mytcpclient-0.0.5
list='src/protocol/tcp src/protocol/ssl src/protocol/http src/protocol/ems 
            src/client src/conf src/output src/param src '; for subdir in $list; do \
          if test "$subdir" = .; then :; else \
            test -d "mytcpclient-0.0.5/$subdir" \
            || /bin/mkdir -p "mytcpclient-0.0.5/$subdir" \
            || exit 1; \
            distdir=`CDPATH="${ZSH_VERSION+.}:" && cd mytcpclient-0.0.5 && pwd`; \
            top_distdir=`CDPATH="${ZSH_VERSION+.}:" && cd mytcpclient-0.0.5 && pwd`; \
            (cd $subdir && \
              make  \
                top_distdir="$top_distdir" \
                distdir="$distdir/$subdir" \
                am__remove_distdir=: \
                am__skip_length_check=: \
                distdir) \
              || exit 1; \
          fi; \
        done
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/tcp'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/tcp'
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ssl'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ssl'
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/http'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/http'
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ems'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/protocol/ems'
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/client'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/client'
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/conf'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/conf'
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/output'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/output'
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src/param'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src/param'
make[1]: Entering directory `/home/jack0e/myTCPClient-0.0.5/src'
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/src'
find mytcpclient-0.0.5 -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
          ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
          ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
          ! -type d ! -perm -444 -exec /bin/sh /home/jack0e/myTCPClient-0.0.5/install-sh 
                                                                 -c -m a+r {} {} \; \
        || chmod -R a+r mytcpclient-0.0.5
tardir=mytcpclient-0.0.5 && /bin/sh /home/jack0e/myTCPClient-0.0.5/missing 
                --run tar chof - "$tardir" | GZIP=--best gzip -c >mytcpclient-0.0.5.tar.gz
{ test ! -d mytcpclient-0.0.5 || { find mytcpclient-0.0.5 -type d ! -perm -200 
                -exec chmod u+w {} ';' && rm -fr mytcpclient-0.0.5; }; }


<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> ls -ltr
total 600
-rw-r--r-- 1 jack0e jack0e   1103 2009-04-10 19:30 TODO
-rw-r--r-- 1 jack0e jack0e   1365 2009-04-10 19:30 README
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 19:30 NEWS
-rw-r--r-- 1 jack0e jack0e   5364 2009-04-10 19:30 INSTALL
drwxr-xr-x 3 jack0e jack0e   4096 2009-04-10 19:30 identity
-rwxr-xr-x 1 jack0e jack0e  16510 2009-04-10 19:30 COPYING
-rw-r--r-- 1 jack0e jack0e   1321 2009-04-10 19:30 configure.scan
drwxr-xr-x 2 jack0e jack0e   4096 2009-04-10 19:30 conf
-rwxr-xr-x 1 jack0e jack0e   1573 2009-04-10 19:30 clean.sh
-rw-r--r-- 1 jack0e jack0e   1180 2009-04-10 19:30 ChangeLog
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 19:30 autoscan.log
-rw-r--r-- 1 jack0e jack0e      0 2009-04-10 19:30 AUTHORS
-rw-r--r-- 1 jack0e jack0e    143 2009-04-14 13:40 Makefile.am
-rw-r--r-- 1 jack0e jack0e   1416 2009-04-14 13:56 configure.ac
-rw-r--r-- 1 jack0e jack0e  31848 2009-04-14 13:57 aclocal.m4
-rwxr-xr-x 1 jack0e jack0e 195577 2009-04-14 13:57 configure
-rw-r--r-- 1 jack0e jack0e   2817 2009-04-14 13:57 config.h.in
-rwxr-xr-x 1 jack0e jack0e  11135 2009-04-14 15:42 missing
-rwxr-xr-x 1 jack0e jack0e  13184 2009-04-14 15:42 install-sh
-rwxr-xr-x 1 jack0e jack0e  17574 2009-04-14 15:42 depcomp
-rw-r--r-- 1 jack0e jack0e  18801 2009-04-14 17:12 Makefile.in
drwxr-xr-x 3 jack0e jack0e   4096 2009-04-14 18:51 doc
-rw-r--r-- 1 jack0e jack0e  19361 2009-04-14 18:53 Makefile
-rwxr-xr-x 1 jack0e jack0e  32155 2009-04-14 18:53 config.status
-rw-r--r-- 1 jack0e jack0e     23 2009-04-14 18:53 stamp-h1
-rw-r--r-- 1 jack0e jack0e  20722 2009-04-14 18:53 config.log
-rw-r--r-- 1 jack0e jack0e   3087 2009-04-14 18:53 config.h
drwxr-xr-x 9 jack0e jack0e   4096 2009-04-14 18:54 src
-rw-r--r-- 1 jack0e jack0e 142316 2009-04-14 18:59 mytcpclient-0.0.5.tar.gz   <strong>*NEWS* Eureka!!!</strong>

</pre>

ancora meglio se il pacchetto lo si crea utilizzando il target distcheck, il quale effetta anche una verifica sul pacchetto creato. A me ad esempio ha dato un pò di errori anche se il "make dist" era andato bene. Problemi di path che avevo sbagliato, consiglio vivamente di eseguire il distcheck, per una sicurezza totale che il build vada bene ovunque.

<pre>

<strong>jack0e@jack0e-laptop:~/myTCPClient-0.0.5$</strong> make distcheck

<strong>__CUT__</strong>

test -z "libssl.a" || rm -f libssl.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/myTCPClient-0.0.5/mytcpclient-0.0.5/_build/src/protocol/ssl'
Making distclean in src/protocol/tcp
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/mytcpclient-0.0.5/_build/src/protocol/tcp'
test -z "libtcp.a" || rm -f libtcp.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/mytcpclient-0.0.5/_build/src/protocol/tcp'
Making distclean in .
make[2]: Entering directory `/home/jack0e/myTCPClient-0.0.5/mytcpclient-0.0.5/_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/myTCPClient-0.0.5/mytcpclient-0.0.5/_build'
rm -f config.status config.cache config.log configure.lineno config.status.lineno
rm -f Makefile
make[1]: Leaving directory `/home/jack0e/myTCPClient-0.0.5/mytcpclient-0.0.5/_build'
{ test ! -d mytcpclient-0.0.5 || { find mytcpclient-0.0.5 -type d ! -perm -200 -exec chmod u+w {} 
                                          ';' && rm -fr mytcpclient-0.0.5; }; }
<strong>
===================================================
mytcpclient-0.0.5 archives ready for distribution: 
mytcpclient-0.0.5.tar.gz
===================================================</strong>

</pre>

Eureka! Evviva" Bene! :) Abbiamo sfornato una nuova versione del nostro hack da depositare ad esempio su <a href=http://savannah.gnu.org">http://savannah.gnu.org</a> o <a href="http://www.sourceforge.net">http://www.sourceforge.net</a>. Io preferisco il primo, ma è uguale. L'importante è rendere pubblico il proprio codice libero. 

Quel che bisogna distribuire è semplicemente il file mytcpclient-0.0.5.tar.gz. E' tutto conservato li dentro: codice, documentazione, procedura di build.

Al momento il versione 0.0.5 è in beta-test e non ancora depositata in nessun repository di quelli citati sopra. E' reperibile sul mio server se volete farci dei test, a questo indirizzo <a href="http://granito.org.uk/objphp/users/raffaele.granito/documentale/allegati/mytcpclient-0.0.5.beta.1.tar.gz">mytcpclient-0.0.5.beta.1.tar.gz</a>.



<br><br><br>
[<strong>PASSO 8</strong>] Procedura che dovrà eseguire l'utente finale.<br><br>

Come si sa, il web è una finestra sul mondo. Supponiamo che a Michael serva un software per effettuare dei test per verificare le configurazioni ssl del proprio webserver apache httpd, e che voglia utilizzare il mio codice, anzichè scriverne un'altro. Può tranquillamente utilizzarlo, la licenza con cui è accompagnato (GNU GPLv2) il codice gli garantisce tale libertà. Michael lavora in un data center e necessità di un software multipiattaforma, perchè amministra macchine sia macchine CISC sia macchine RISC e con i più svariati dialetti di UNIX/Linux montati: HP-UX, Solaris, GNU/Linux, FreeBSD. La procedura di BUILD e DISTRIBUZIONE di GNU gli garantisce tutto questo. Bene! Vuole provarlo, magari si unirà all'autore per correggere qualche BUG o solo per segnalarlo. Si unirà all'autore del codice magari per tradurre la documentazione in tedesco, diventando a sua volta co-autore di quel codice. Forse.

Per il momento decide di provare il codice.

Di seguito i passi per reperire, compilare e installare il codice.


<pre>

<strong>michael@trashware.org:/tmp$</strong> 
wget http://granito.org.uk/objphp/users/raffaele.granito/documentale/allegati/mytcpclient-0.0.5.beta.1.tar.gz 

<strong>michael@trashware.org:/tmp$</strong> tar xfvz mytcpclient-0.0.5.beta.1.tar.gz
mytcpclient-0.0.5/
mytcpclient-0.0.5/README
mytcpclient-0.0.5/configure.ac
mytcpclient-0.0.5/aclocal.m4
mytcpclient-0.0.5/Makefile.am
mytcpclient-0.0.5/Makefile.in
mytcpclient-0.0.5/config.h.in
mytcpclient-0.0.5/configure
mytcpclient-0.0.5/AUTHORS
mytcpclient-0.0.5/COPYING
mytcpclient-0.0.5/ChangeLog
mytcpclient-0.0.5/INSTALL
mytcpclient-0.0.5/NEWS
mytcpclient-0.0.5/TODO
mytcpclient-0.0.5/depcomp
mytcpclient-0.0.5/install-sh
mytcpclient-0.0.5/missing
mytcpclient-0.0.5/doc/
mytcpclient-0.0.5/doc/UserManual.txt
mytcpclient-0.0.5/doc/DevelopConfigureScript2.txt~
mytcpclient-0.0.5/doc/DevelopConfigureScript.txt
mytcpclient-0.0.5/doc/note/
mytcpclient-0.0.5/doc/note/MicrosoftIISStrongMessage.html
mytcpclient-0.0.5/doc/note/HttpUriComplicate.html
mytcpclient-0.0.5/doc/DevelopConfigureScript2.txt
mytcpclient-0.0.5/doc/FreeHackTibEms.txt
mytcpclient-0.0.5/identity/
mytcpclient-0.0.5/identity/www.alice.org.crt
mytcpclient-0.0.5/identity/CA.www.alice.org.pem
mytcpclient-0.0.5/identity/www.alice.org.key
mytcpclient-0.0.5/identity/www.alice.org.keystore.pem
mytcpclient-0.0.5/identity/demoCA/
mytcpclient-0.0.5/identity/demoCA/serial
mytcpclient-0.0.5/identity/demoCA/serial.old
mytcpclient-0.0.5/identity/demoCA/index.txt.attr.old
mytcpclient-0.0.5/identity/demoCA/index.txt.old
mytcpclient-0.0.5/identity/demoCA/index.txt.attr
mytcpclient-0.0.5/identity/demoCA/newcerts/
mytcpclient-0.0.5/identity/demoCA/newcerts/DCBE980A2E09E9E6.pem
mytcpclient-0.0.5/identity/demoCA/newcerts/DCBE980A2E09E9E7.pem
mytcpclient-0.0.5/identity/demoCA/certs/
mytcpclient-0.0.5/identity/demoCA/private/
mytcpclient-0.0.5/identity/demoCA/private/cakey.pem
mytcpclient-0.0.5/identity/demoCA/crlnumber
mytcpclient-0.0.5/identity/demoCA/cacert.pem
mytcpclient-0.0.5/identity/demoCA/crl/
mytcpclient-0.0.5/identity/demoCA/careq.pem
mytcpclient-0.0.5/identity/demoCA/index.txt
mytcpclient-0.0.5/identity/www.alice.org.csr
mytcpclient-0.0.5/src/
mytcpclient-0.0.5/src/protocol/
mytcpclient-0.0.5/src/protocol/tcp/
mytcpclient-0.0.5/src/protocol/tcp/include/
mytcpclient-0.0.5/src/protocol/tcp/include/tcp.h
mytcpclient-0.0.5/src/protocol/tcp/Makefile.am
mytcpclient-0.0.5/src/protocol/tcp/Makefile.in
mytcpclient-0.0.5/src/protocol/tcp/tcp.c
mytcpclient-0.0.5/src/protocol/ssl/
mytcpclient-0.0.5/src/protocol/ssl/include/
mytcpclient-0.0.5/src/protocol/ssl/include/ssl.h
mytcpclient-0.0.5/src/protocol/ssl/Makefile.am
mytcpclient-0.0.5/src/protocol/ssl/Makefile.in
mytcpclient-0.0.5/src/protocol/ssl/ssl.c
mytcpclient-0.0.5/src/protocol/http/
mytcpclient-0.0.5/src/protocol/http/include/
mytcpclient-0.0.5/src/protocol/http/include/http.h
mytcpclient-0.0.5/src/protocol/http/Makefile.am
mytcpclient-0.0.5/src/protocol/http/Makefile.in
mytcpclient-0.0.5/src/protocol/http/http.c
mytcpclient-0.0.5/src/protocol/ems/
mytcpclient-0.0.5/src/protocol/ems/include/
mytcpclient-0.0.5/src/protocol/ems/include/ems.h
mytcpclient-0.0.5/src/protocol/ems/Makefile.am
mytcpclient-0.0.5/src/protocol/ems/Makefile.in
mytcpclient-0.0.5/src/protocol/ems/ems.c
mytcpclient-0.0.5/src/client/
mytcpclient-0.0.5/src/client/include/
mytcpclient-0.0.5/src/client/include/client.h
mytcpclient-0.0.5/src/client/Makefile.am
mytcpclient-0.0.5/src/client/Makefile.in
mytcpclient-0.0.5/src/client/client.c
mytcpclient-0.0.5/src/conf/
mytcpclient-0.0.5/src/conf/include/
mytcpclient-0.0.5/src/conf/include/conf.h
mytcpclient-0.0.5/src/conf/Makefile.am
mytcpclient-0.0.5/src/conf/Makefile.in
mytcpclient-0.0.5/src/conf/conf.c
mytcpclient-0.0.5/src/output/
mytcpclient-0.0.5/src/output/include/
mytcpclient-0.0.5/src/output/include/output.h
mytcpclient-0.0.5/src/output/Makefile.am
mytcpclient-0.0.5/src/output/Makefile.in
mytcpclient-0.0.5/src/output/output.c
mytcpclient-0.0.5/src/param/
mytcpclient-0.0.5/src/param/include/
mytcpclient-0.0.5/src/param/include/param.h
mytcpclient-0.0.5/src/param/Makefile.am
mytcpclient-0.0.5/src/param/Makefile.in
mytcpclient-0.0.5/src/param/param.c
mytcpclient-0.0.5/src/include/
mytcpclient-0.0.5/src/include/myTCPClient.h
mytcpclient-0.0.5/src/Makefile.am
mytcpclient-0.0.5/src/Makefile.in
mytcpclient-0.0.5/src/myTCPClient.c
jack0e@jack0e-laptop:/tmp$  

<strong>michael@trashware.org:/tmp$</strong> cd /myTCPClient-0.0.5
<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> ls -ltr
-rw-r--r-- 1 michael michael   1103 2009-04-10 19:30 TODO
-rw-r--r-- 1 michael michael   1365 2009-04-10 19:30 README
-rw-r--r-- 1 michael michael      0 2009-04-10 19:30 NEWS
-rw-r--r-- 1 michael michael   5364 2009-04-10 19:30 INSTALL
drwxr-xr-x 3 michael michael   4096 2009-04-10 19:30 identity
-rwxr-xr-x 1 michael michael  16510 2009-04-10 19:30 COPYING
-rw-r--r-- 1 michael michael   1180 2009-04-10 19:30 ChangeLog
-rw-r--r-- 1 michael michael      0 2009-04-10 19:30 AUTHORS
-rwxr-xr-x 1 michael michael  11135 2009-04-14 15:42 missing
-rwxr-xr-x 1 michael michael  13184 2009-04-14 15:42 install-sh
-rwxr-xr-x 1 michael michael  17574 2009-04-14 15:42 depcomp
-rw-r--r-- 1 michael michael   1365 2009-04-14 19:16 configure.ac
-rw-r--r-- 1 michael michael  31848 2009-04-14 19:18 aclocal.m4
-rwxr-xr-x 1 michael michael 195436 2009-04-14 19:18 configure
-rw-r--r-- 1 michael michael   2817 2009-04-14 19:18 config.h.in
drwxr-xr-x 3 michael michael   4096 2009-04-15 13:17 doc
-rw-r--r-- 1 michael michael   1006 2009-04-15 13:18 Makefile.am
-rw-r--r-- 1 michael michael  19662 2009-04-15 13:21 Makefile.in
drwxr-xr-x 8 michael michael   4096 2009-04-15 13:22 src

</pre>

decide di installare il software in una directory temporanea, ad esempio /tmp/test, che al momento non esiste. In fase di configure può specificarlo col parametro --prefix. Di seguito lo schema che fa GNU per descrivere lo script di configure.

<pre>

                           .------------- [config.cache]
                           |
    configure* ------------+------------- config.log
                           |
  [config.h.in]  -.        v          .-> [config.h] -.
                  +-- config.status* -+               +--make*
   Makefile.in ---'                   `-> Makefile ---'


<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> 
LDFLAGS="-L/home/jack0e/Desktop/stunnelHack/source/openssl-0.9.8g 
         -L/home/jack0e/lavoro/suite_tibco/suite/ems/clients/c/lib/"

<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> 
CPPFLAGS="-I/home/jack0e/Desktop/stunnelHack/test01/include 
          -I/home/jack0e/lavoro/suite_tibco/suite/ems/clients/c/include"

<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> export LDFLAGS CPPFLAGS
<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> ./configure --prefix=/tmp/test
checking for g++... g++
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 g++ accepts -g... yes
checking for gcc... gcc
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 make sets $(MAKE)... yes
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking for -lcrypto in -lcrypto... no
checking for -lssl in -lssl... no
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 fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking return type of signal handlers... void
checking whether lstat dereferences a symlink specified with a trailing slash... yes
checking whether stat accepts an empty string... no
checking for gethostbyname... yes
checking for memset... yes
checking for socket... yes
checking for strcasecmp... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/client/Makefile
config.status: creating src/conf/Makefile
config.status: creating src/output/Makefile
config.status: creating src/param/Makefile
config.status: creating src/protocol/ems/Makefile
config.status: creating src/protocol/http/Makefile
config.status: creating src/protocol/ssl/Makefile
config.status: creating src/protocol/tcp/Makefile
config.status: creating config.h
config.status: executing depfiles commands

</pre>

Compilazione del software su-misura per la macchina (hardware e sistema opertivo) sul quale è stato eseguito il passo di configure.

<pre>

<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> make
make  all-recursive
make[1]: Entering directory `/tmp/mytcpclient-0.0.5'
Making all in src/protocol/tcp
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/tcp'
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/protocol/tcp/include   
                    -I/home/jack0e/Desktop/stunnelHack/test01/include  
                    -g -O2 -MT tcp.o -MD -MP -MF .deps/tcp.Tpo -c -o tcp.o tcp.c
tcp.c: In function ‘TCPReceive’:
tcp.c:188: warning: incompatible implicit declaration of built-in function ‘printf’
mv -f .deps/tcp.Tpo .deps/tcp.Po
rm -f libtcp.a
ar cru libtcp.a tcp.o 
ranlib libtcp.a
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/tcp'
Making all in src/protocol/ssl
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/ssl'
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/protocol/tcp/include 
                    -I../../../src/protocol/ssl/include   
                    -I/home/jack0e/Desktop/stunnelHack/test01/include  
                    -g -O2 -MT ssl.o -MD -MP -MF .deps/ssl.Tpo -c -o ssl.o ssl.c
mv -f .deps/ssl.Tpo .deps/ssl.Po
rm -f libssl.a
ar cru libssl.a ssl.o 
ranlib libssl.a
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/ssl'
Making all in src/protocol/http
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/http'
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/protocol/tcp/include 
                        -I../../../src/protocol/ssl/include -I../../../src/protocol/http/include   
                        -I/home/jack0e/Desktop/stunnelHack/test01/include  
                        -g -O2 -MT http.o -MD -MP -MF .deps/http.Tpo -c -o http.o http.c
mv -f .deps/http.Tpo .deps/http.Po
rm -f libhttp.a
ar cru libhttp.a http.o 
ranlib libhttp.a
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/http'
Making all in src/protocol/ems
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/ems'
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/protocol/tcp/include 
                        -I../../../src/protocol/ssl/include -I../../../src/protocol/ems/include   
                        -I/home/jack0e/Desktop/stunnelHack/test01/include  
                        -g -O2 -MT ems.o -MD -MP -MF .deps/ems.Tpo -c -o ems.o ems.c
mv -f .deps/ems.Tpo .deps/ems.Po
rm -f libems.a
ar cru libems.a ems.o 
ranlib libems.a
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/ems'
Making all in src/client
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/client'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/client/include -I../../src/protocol/tcp/include 
                        -I../../src/protocol/ssl/include -I../../src/protocol/http/include 
                        -I../../src/protocol/ems/include -I../../src/output/include   
                        -I/home/jack0e/Desktop/stunnelHack/test01/include  -g -O2 -MT client.o 
                               -MD -MP -MF .deps/client.Tpo -c -o client.o client.c
mv -f .deps/client.Tpo .deps/client.Po
rm -f libclient.a
ar cru libclient.a client.o 
ranlib libclient.a
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/client'
Making all in src/conf
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/conf'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/conf/include  
                        -I/home/jack0e/Desktop/stunnelHack/test01/include  -g -O2 -MT conf.o 
                           -MD -MP -MF .deps/conf.Tpo -c -o conf.o conf.c
mv -f .deps/conf.Tpo .deps/conf.Po
rm -f libconf.a
ar cru libconf.a conf.o 
ranlib libconf.a
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/conf'
Making all in src/output
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/output'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/output/include   
                                -I/home/jack0e/Desktop/stunnelHack/test01/include  
                                -g -O2 -MT output.o -MD -MP -MF .deps/output.Tpo -c 
                                -o output.o output.c
mv -f .deps/output.Tpo .deps/output.Po
rm -f liboutput.a
ar cru liboutput.a output.o 
ranlib liboutput.a
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/output'
Making all in src/param
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/param'
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/param/include 
                                -I../../src/conf/include 
                                -I../../src/output/include  
                                -I/home/jack0e/Desktop/stunnelHack/test01/include  
                                -g -O2 -MT param.o -MD -MP -MF .deps/param.Tpo -c 
                                -o param.o param.c
mv -f .deps/param.Tpo .deps/param.Po
rm -f libparam.a
ar cru libparam.a param.o 
ranlib libparam.a
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/param'
Making all in src
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src'
gcc -DHAVE_CONFIG_H -I. -I.. -I../src/include -I../src/client/include 
                        -I../src/param/include  -I/home/jack0e/Desktop/stunnelHack/test01/include  
                        -g -O2 -MT myTCPClient.o -MD -MP -MF .deps/myTCPClient.Tpo 
                                -c -o myTCPClient.o myTCPClient.c
mv -f .deps/myTCPClient.Tpo .deps/myTCPClient.Po
gcc  -g -O2  -L/home/jack0e/Desktop/stunnelHack/source/openssl-0.9.8g -o myTCPClient myTCPClient.o 
                   ../src/conf/conf.o ../src/param/param.o ../src/client/client.o 
                   ../src/output/output.o ../src/protocol/tcp/tcp.o ../src/protocol/ssl/ssl.o 
                   ../src/protocol/http/http.o ../src/protocol/ems/ems.o -lssl -lcrypto  
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5'

</pre>

Segue, il passo di installazione del software. La home di installazione è quella specificata nel passo di configure con il parametro --prefix.

<pre>

<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> make install
Making install in src/protocol/tcp
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/tcp'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/tcp'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/tcp'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/tcp'
Making install in src/protocol/ssl
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/ssl'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/ssl'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/ssl'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/ssl'
Making install in src/protocol/http
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/http'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/http'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/http'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/http'
Making install in src/protocol/ems
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/ems'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/protocol/ems'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/ems'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src/protocol/ems'
Making install in src/client
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src/client'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/client'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/client'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src/client'
Making install in src/conf
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src/conf'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/conf'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/conf'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src/conf'
Making install in src/output
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src/output'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/output'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/output'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src/output'
Making install in src/param
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src/param'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src/param'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src/param'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src/param'
Making install in src
make[1]: Entering directory `/tmp/mytcpclient-0.0.5/src'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5/src'
test -z "/tmp/test/bin" || /bin/mkdir -p "/tmp/test/bin"
  /usr/bin/install -c 'myTCPClient' '/tmp/test/bin/myTCPClient'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5/src'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5/src'
make[1]: Entering directory `/tmp/mytcpclient-0.0.5'
make[2]: Entering directory `/tmp/mytcpclient-0.0.5'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/tmp/mytcpclient-0.0.5'
make[1]: Leaving directory `/tmp/mytcpclient-0.0.5'

<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> ls /tmp/test/
bin

<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> ls /tmp/test/bin/
myTCPClient

<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> /tmp/test/bin/myTCPClient 
Universal Client TCP version 0.0.5
Raffaele Granito (c) 2008 Licence GPLv2

formato: myClientTCP [-c|--connect] protocollo://host:port/directory
                     [-U|--auth-user user] [-P|--auth-password]
                     [-k|--keystore filename] [-p|--password password]
                     [-t|--truststore filename
                     [-C|--ciphersuite {cipher1,cipher2,...,cipherN}]
                     [-s|--ssl-version version]
                     [-T|--type-operation {GET|PUT|GETDEL}]
                     [-M|--message message]
                     [-m|--max-request max-value]
                     [-o|--output-file filename]
         myClientTCP [-f|--config filename]
         myClientTCP [-h|--help]
         myClientTCP [-v|--version]


<strong>michael@trashware.org:/tmp/myTCPClient-0.0.5$</strong> /tmp/test/bin/myTCPClient \
--connect ssl://127.0.0.1:631

Universal Client TCP version 0.0.5
Raffaele Granito (c) 2008 Licence GPLv2

connecting to ssl://127.0.0.1:631 ... 
The client did not specify its digital identity. No mutual authentication *Warning*
The client did not specify any truststore (null) *Warning*
The client has proposed the following ciphersuite +ALL *Warning*
The client use ssl version +ALL (SSLv2, SSLv3 and TLSv1) *Warning*
TCP::connection... ok
SSL::Context::create context client... ok
SSL::Handeshake::Getting version on server... [TLSv1] ok
SSL::Handeshake::Getting ciphersuite proposals... [DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:
AES256-SHA:EDH-RSA-DES-CBC3-SHA:EDH-DSS-DES-CBC3-SHA:DES-CBC3-SHA:DES-CBC3-MD5:
DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA:AES128-SHA:IDEA-CBC-SHA:IDEA-CBC-MD5:RC2-CBC-MD5:
RC4-SHA:RC4-MD5:RC4-MD5:EDH-RSA-DES-CBC-SHA:EDH-DSS-DES-CBC-SHA:DES-CBC-SHA:DES-CBC-MD5:
EXP-EDH-RSA-DES-CBC-SHA:EXP-EDH-DSS-DES-CBC-SHA:EXP-DES-CBC-SHA:EXP-RC2-CBC-MD5:
EXP-RC2-CBC-MD5:EXP-RC4-MD5:EXP-RC4-MD5] ok
SSL::Handeshake::Getting ciphersuite negotiated... [DES-CBC3-SHA] ok
+The symmetric encryption algorithm used is implemented in the following versions [TLSv1/SSLv3]
+The symmetric encryption algorithm used provides provides key length of [168]
SSL::Handeshake::ServerAuthentication::Getting certificate server... ok
+The certificate received from the server is not entitled to the sender. *Warning*

SSL::Handeshake::ServerAuthentication::X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
The passed certificate is self-signed and the same certificate
cannot be found in the list of trusted certificates.

.----------------------------------------.
|                                        |
|        Certificate X.509 Server        |
|                                        |
'----------------------------------------'
Version             | 0
Serial Number       | -1
Signature Type      | 0
Issuer              | /C=XX
                    | /ST=There is no such thing outside US
                    | /L=Everywhere
                    | /O=OCOSA
                    | /OU=Office for Complication of Otherwise Simple Affairs
                    | /CN=terranova
                    | /emailAddress=root@terranova
not Before          | 25/10/06 13:31
not After           | 24/11/06 13:31
Subject             | /C=XX
                    | /ST=There is no such thing outside US
                    | /L=Everywhere
                    | /O=OCOSA
                    | /OU=Office for Complication of Otherwise Simple Affairs
                    | /CN=terranova
                    | /emailAddress=root@terranova
Type                | 4145

SSL::Handeshake... ok
SSL::disconnect... ok
TCP::disconnect... ok
 
</pre> 


<br><br><br>
------
<br><br>
Spero vi abbia fatto incuriosire... era questo il mio obbiettivo con questo POST.
Io ho ridotto al minimo, ma strumento quali autoconf, automake etc. implementano tante altre funzionalità che agevolano la vita del programmatore. Quelli visti sono software liberi implementati nell'ambito del progetto <a href="www.gnu.org">gnu</a>. Questo non vieta che lo standard proposto non possa essere usato per effettuare il build di software proprietario, molte aziende lo utilizzano e non distribuiscono in GPL. L'hanno scelto perchè è un buon sistema ed è molto diffuso.
<br><br>
Ultima cosa: nel mio esempio, il mio codice preso come esempio era scritto in C. E' un caso. Automake, Autoconf, M4 etc. funzionano bene anche con altri linguaggi di programmazione: perl, shell, c++, java, lisp, ada etc.

<br><br><br>
alcuni riferimenti, almeno quelli su cui ho studiato io :
<br><br>
autoconf: <a href="http://www.gnu.org/software/autoconf/">http://www.gnu.org/software/autoconf/</a><br>
automake: <a href="http://www.gnu.org/software/automake/">http://www.gnu.org/software/automake/</a><br>
standard GNU: <a href="http://www.gnu.org/prep/standards_toc.html">http://www.gnu.org/prep/standards_toc.html</a><br><br>

Commenti? 

<br><br><br>
happy hacking ;)


<br><br><br><br>
~~~~~~~~~~~~~~~
<br><br>
Questo documento è distribuito con licenza GPLv2<br> 
versione doc. 0.2 (15/04/2009)<br><br><br>



