diff options
author | pdw <> | 2014-01-19 20:11:39 +0000 |
---|---|---|
committer | pdw <> | 2014-01-19 20:11:39 +0000 |
commit | 687861284d75260c17ff285557c12b0f2ad996f6 (patch) | |
tree | c9c1b970e33a45c1c73c95e894522efae099dda6 | |
parent | 40add9566d8a4bd97c5c299391984c095861b3fb (diff) | |
download | iftop-687861284d75260c17ff285557c12b0f2ad996f6.zip |
Patches from Robert Scheck <robert@fedoraproject.org>
* enable building iftop with more recent versions of autoconf/automake
* patch to remove compile time warnings (mostly already applied).
-rw-r--r-- | INSTALL | 10 | ||||
-rw-r--r-- | Makefile.OLD | 145 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac (renamed from configure.in) | 28 | ||||
-rw-r--r-- | options.c | 3 | ||||
-rw-r--r-- | resolver.c | 4 | ||||
-rw-r--r-- | ui.c | 4 |
7 files changed, 21 insertions, 175 deletions
@@ -11,13 +11,3 @@ such systems, you may want to use the --with-resolver=ares configure option to build a version of iftop which uses the ARES asynchronous DNS library for name resolution. An alternative is to use --with-resolver=netdb_1thread, which will make iftop run only one name resolution thread. This is not recommended. - -On some systems (notably Red Hat Linux) the libpcap header files are installed -under /usr/include/pcap; on these systems, you should manually specify this -when running configure, like this: - - $ CPPFLAGS=-I/usr/include/pcap ./configure - - -For historical interest, the old iftop makefile is included in Makefile.OLD. - diff --git a/Makefile.OLD b/Makefile.OLD deleted file mode 100644 index e965a0c..0000000 --- a/Makefile.OLD +++ /dev/null @@ -1,145 +0,0 @@ -# -# Makefile: -# Makefile for iftop. -# -# $Id$ -# - -VERSION = 0.11pre1 - -# C compiler to use. -#CC = gcc - -# Give the location of pcap.h here: -CFLAGS += -I/usr/include/pcap -g -# CFLAGS += -I/usr/pkg/include -# CFLAGS += -pg -a - -# Give the location of libpcap here if it's not in one of the standard -# directories: -# LDFLAGS += -L/usr/local/lib -# LDFLAGS += -pg -a - -# Do you want to use curses or ncurses? Probably ncurses, unless curses -# is ncurses on your machine. -# CURSES = -lncurses -#CURSES = -lcurses - -# -# Name resolution. Sensible systems have gethostbyaddr_r, which is reentrant -# and can be called from several threads of a multithreaded program. Other -# systems don't, or their implementations don't work ([cough] FreeBSD). For -# these you can use gethostbyaddr (not recommended, since then only one thread -# can resolve a name at once), libresolv (not recommended and may not work -# depending on which header files you have), or ares, an asynchronous DNS -# resolution library from -# ftp://athena-dist.mit.edu/pub/ATHENA/ares/ -# For systems without a working gethostbyaddr_r, this is recommended. -# -# Leave exactly one of these uncommented, or comment all of them out if you -# don't care about name resolution at all. -# -CFLAGS += -DUSE_GETHOSTBYADDR_R -#CFLAGS += -DUSE_GETHOSTBYADDR -#CFLAGS += -DUSE_LIBRESOLV -#CFLAGS += -DUSE_ARES - -# -# On some machines, gethostbyaddr_r returns int; on others, struct hostent*. -# Comment out this line if you are using one of the latter. -# -#CFLAGS += -DGETHOSTBYADD_R_RETURNS_INT - -# -# Uncomment if you are using libresolv. -# -#LDLIBS += -lresolv # or /usr/lib/libresolv.a on Linux? - -# -# Uncomment if you are using ares. -# -#LDLIBS += -lares -# ... and uncomment these if your libares is in an unusual place. -#CFLAGS += -I/software/include -#LDFLAGS += -L/software/lib - -# -# Solaris needs a library to make sockets go and lacks inet_aton. -# -#LDLIBS += -lsocket -lnsl -CFLAGS += -DFAKE_INET_ATON - -# PREFIX specifies the base directory for the installation. -PREFIX = /usr/local -#PREFIX = /software - -# BINDIR is where the binary lives relative to PREFIX (no leading /). -BINDIR = sbin - -# MANDIR is where the manual page goes. -MANDIR = man -#MANDIR = share/man # FHS-ish - -# You shouldn't need to change anything below this point. -CFLAGS += -g -Wall "-DIFTOP_VERSION=\"$(VERSION)\"" -LDFLAGS += -g #-pthread -LDLIBS += -lpcap $(CURSES) -lm -lpthread - -COMMON_SRCS = addr_hash.c hash.c ns_hash.c util.c sorted_list.c\ - options.c serv_hash.c threadprof.c screenfilter.c cfgfile.c stringmap.c addrs_ioctl.c -IFTOP_ONLY_SRCS = iftop.c ui.c stringmap.c -IFTOPDUMP_ONLY_SRCS = iftop-dump.c counter_hash.c -SRCS = $(COMMON_SRCS) $(IFTOPDUMP_ONLY_SRCS) $(IFTOP_ONLY_SRCS) -IFTOP_SRCS = $(IFTOP_ONLY_SRCS) $(COMMON_SRCS) -IFTOPDUMP_SRCS = $(IFTOPDUMP_ONLY_SRCS) $(COMMON_SRCS) -HDRS = addr_hash.h hash.h iftop.h ns_hash.h resolver.h sorted_list.h ui.h options.h sll.h\ - serv_hash.h threadprof.h ether.h ip.h tcp.h screenfilter.h token.h llc.h \ - extract.h ethertype.h -TXTS = README CHANGES INSTALL TODO iftop.8 COPYING -SPECFILE = iftop.spec iftop.spec.in - -IFTOP_OBJS = $(IFTOP_SRCS:.c=.o) -IFTOPDUMP_OBJS = $(IFTOPDUMP_SRCS:.c=.o) - -iftop: $(IFTOP_OBJS) Makefile - $(CC) $(LDFLAGS) -o $@ $(IFTOP_OBJS) $(LDLIBS) - -iftop-dump: $(IFTOPDUMP_OBJS) Makefile - $(CC) $(LDFLAGS) -o $@ $(IFTOPDUMP_OBJS) $(LDLIBS) - -#integers.h: integers -# ./integers - -install: iftop - install -D iftop $(PREFIX)/$(BINDIR)/iftop - install -D iftop.8 $(PREFIX)/$(MANDIR)/man8/iftop.8 - -uninstall: - rm -f $(PREFIX)/$(BINDIR)/iftop $(PREFIX)/$(MANDIR)/man8/iftop.8 - -%.o: %.c Makefile - $(CC) $(CFLAGS) -c -o $@ $< - -clean: - rm -f *~ *.o core iftop iftop.spec - -tarball: depend $(SRCS) $(HDRS) $(TXTS) $(SPECFILE) - mkdir iftop-$(VERSION) - set -e ; for i in Makefile depend $(SRCS) $(HDRS) $(TXTS) $(SPECFILE) ; do cp $$i iftop-$(VERSION)/$$i ; done - tar cvf - iftop-$(VERSION) | gzip --best > iftop-$(VERSION).tar.gz - rm -rf iftop-$(VERSION) - -tags : - etags *.c *.h - -depend: $(SRCS) - $(CPP) $(CFLAGS) -MM $(SRCS) > depend - -nodepend: - rm -f depend - -iftop.spec: iftop.spec.in Makefile - sed 's/__VERSION__/$(VERSION)/' < iftop.spec.in > iftop.spec - - -include depend diff --git a/Makefile.am b/Makefile.am index f28cf32..9cbddb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,7 +41,7 @@ iftop.cat: iftop.8 (echo -e ".pl 1100i" ; cat iftop.8 ; echo ".pl \n(nlu+10") | groff -Tascii -man > iftop.cat iftop.spec: iftop.spec.in configure.in - sed 's/__VERSION__/$(VERSION)/' < iftop.spec.in > iftop.spec + sed 's/__VERSION__/$(PACKAGE_VERSION)/' < iftop.spec.in > iftop.spec ## These need to be distributed along with configure: diff --git a/configure.in b/configure.ac index 076e2d8..af7f19f 100644 --- a/configure.in +++ b/configure.ac @@ -1,5 +1,5 @@ dnl -dnl configure.in: +dnl configure.ac: dnl Autoconf input for iftop. dnl dnl I hate autoconf with a passion. It's an utter pain to write these bloody @@ -17,21 +17,19 @@ dnl autoconf dnl Now you should have good sources to make into a tarball and distribute. dnl ./configure (perhaps with some arguments) dnl make -dnl Tested with Automake 1.4 and autoconf 2.59. +dnl Tested with automake 1.9.6-1.14 and autoconf 2.59-2.69. dnl dnl Boilerplate configuration dnl -AC_INIT(iftop.c) +AC_INIT([iftop], [1.0pre2], [pdw@ex-parrot.com], [http://www.ex-parrot.com/pdw/iftop/]) AC_CONFIG_AUX_DIR(config) AC_CANONICAL_SYSTEM -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(iftop, "1.0pre3") - -AC_DEFINE_UNQUOTED(IFTOP_VERSION, "$VERSION", [The iftop version number]) +AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE dnl Make sure we have a C compiler.... AC_PROG_CC @@ -107,7 +105,7 @@ dnl for type in u_int8_t u_int16_t u_int32_t ; do AC_MSG_CHECKING([size of $type]) - AC_RUN_IFELSE([ + AC_RUN_IFELSE([AC_LANG_SOURCE([ #include <sys/types.h> #include <stdio.h> int main() { @@ -117,7 +115,7 @@ int main() { fprintf(f, "%d\n", sizeof($1)); exit(0); } - ], [ + ])], [ x=`cat conftestval` eval "size_$type=$x" AC_MSG_RESULT([$x]) @@ -206,13 +204,13 @@ dnl whether it works so we can support cross-compilation. if test x$resolver = xnetdb ; then AC_MSG_CHECKING([how to call gethostbyaddr_r]) dnl Try 7 arguments returning a struct hostent*. - AC_LINK_IFELSE(AC_LANG_SOURCE([`cat config/hostentp_ghba_r.c`]), + AC_LINK_IFELSE([AC_LANG_SOURCE([`cat config/hostentp_ghba_r.c`])], [AC_MSG_RESULT([7 args]) ghba_args=8 AC_DEFINE(GETHOSTBYADDR_R_RETURNS_HOSTENT_P, 1, [7-argument gethostbyaddr_r returns struct hostent*])], [ dnl Try 8 arguments returning an int. - AC_LINK_IFELSE(AC_LANG_SOURCE([`cat config/int_ghba_r.c`]), + AC_LINK_IFELSE([AC_LANG_SOURCE([`cat config/int_ghba_r.c`])], [AC_MSG_RESULT([8 args, int return]) ghba_args=8 AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT, 1, @@ -235,7 +233,7 @@ if test x$resolver = xnetdb ; then testfile=hostentp_ghba_r fi AC_MSG_CHECKING(gethostbyaddr_r usability) - AC_RUN_IFELSE([`cat config/$testfile.c`], + AC_RUN_IFELSE([AC_LANG_SOURCE([`cat config/$testfile.c`])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) resolver=guess], @@ -387,7 +385,7 @@ for flag in "" -mt -pthread -thread ; do CFLAGS="$oldCFLAGS $flag" for lib in "" -lpthread "-lpthread -lposix4" ; do LIBS="$oldLIBS $lib" - AC_LINK_IFELSE(AC_LANG_SOURCE([`cat config/pthread.c`]), [ + AC_LINK_IFELSE([AC_LANG_SOURCE([`cat config/pthread.c`])], [ foundthrlib=$lib foundthrflag=$flag thrfail=0 @@ -407,7 +405,7 @@ fi AC_MSG_RESULT([CFLAGS=$foundthrflag and LIBS=$foundthrlib]) AC_MSG_CHECKING([POSIX threads usability]) -AC_RUN_IFELSE([`cat config/pthread.c`], +AC_RUN_IFELSE([AC_LANG_SOURCE([`cat config/pthread.c`])], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR( [it fails. We probably guessed the wrong CFLAGS.])], @@ -444,7 +442,7 @@ AC_SUBST(ac_aux_dir) AC_OUTPUT(Makefile config/Makefile) -if echo $VERSION | grep 'pre' ; then +if echo $PACKAGE_VERSION | grep 'pre' > /dev/null ; then AC_MSG_WARN([ ****************************************************************************** @@ -211,10 +211,11 @@ static void usage(FILE *fp) { " -s num print one single text output afer num seconds, then quit\n" " -L num number of lines to print\n" "\n" -"iftop, version " IFTOP_VERSION "\n" +"iftop, version " PACKAGE_VERSION "\n" "copyright (c) 2002 Paul Warren <pdw@ex-parrot.com> and contributors\n" ); } +#endif /* Obsolete code? */ void options_read_args(int argc, char **argv) { int opt; @@ -107,10 +107,10 @@ char *do_resolve(struct addr_storage *addr) { * a non thread-safe wrapper to gethostbyaddr. An interesting choice... */ char* do_resolve(struct addr_storage *addr) { - struct hostent hostbuf, *hp; + struct hostent hostbuf, *hp = NULL; size_t hstbuflen = 1024; char *tmphstbuf; - int res; + int res = 0; int herr; char * ret = NULL; @@ -3,6 +3,8 @@ * */ +#include "config.h" + #include <sys/types.h> #include <ctype.h> @@ -49,7 +51,7 @@ " > - sort by dest name\n"\ " o - freeze current order\n"\ "\n"\ -"iftop, version " IFTOP_VERSION +"iftop, version " PACKAGE_VERSION extern hash_type* history; |