09-23-04 02:21 AM
hi,
i had a few question about porting a project to GNU standarts:
my program use libpcap and compile on latest linux with:
gcc -D_GNU_SOURCE -DPACKETS_TIME=-1 snif.c -o snif -lpcap
first question is simpliest :
how can i tell autotools to add -lpcap to use lipcap at linking, i
finally add this in Makefile.am:
LIBS = -lpcap
so my Makefile.am looks like that:
bin_PROGRAMS = snif
snif_SOURCES = snif.c snif.h ethernet.h tokenring.h ppp.h loopback.h
ip.h icmp.h tcp.h udp.h terminal.h color.h
LIBS = -lpcap
but isn't it an other solution?
second question is:
i have to change the value of PACKETS_TIME according to the
architecture, example : set it to -1 on linux and to 255 on Mac os X,
how can i do that with autotools again??
more :
on older linux system my program compile with this:
gcc -DNO_MULTI_HASH_TABLE -DPACKETS_TIME=-1 snif.c -o snif -lpcap
-I/usr/include/pcap/
how can i use autotools to add the include -I/usr/include/pcap/ if it
exist a directory /usr/include/pcap/ ?
and how can i add the definition of the macro NO_MULTI_HASH_TABLE if
it exist a function hcreate_r in the libc which is not on older linux
where only exist hcreate, i think i can test it whith autoconf with
running then C preprocessor but don't know exactly how.
i must add a file dnscache.h if the macro NO_MULTI_HASH_TABLE is
defined and my Makefile.am looks like that:
bin_PROGRAMS = snif
snif_SOURCES = snif.c snif.h ethernet.h tokenring.h ppp.h loopback.h
ip.h icmp.h tcp.h udp.h dnscache.h terminal.h color.h
LIBS = -lpcap
i read lots of howto and doc on autoconf and automake but it doesn't
bring light to my questions...
any helps greatly appreciate!
Damien
email: mattei@unice.fr , damien_mattei@yahoo.com
[ Post a follow-up to this message ]
|