Skip to content

Commit

Permalink
- (djm) Use autoconf to detect various things; in preparation of more
Browse files Browse the repository at this point in the history
   portability
  • Loading branch information
djm committed Apr 15, 2004
1 parent acf77e9 commit 4b117ff
Show file tree
Hide file tree
Showing 7 changed files with 366 additions and 37 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- (djm) Print flow start and finish times in collector.pl
- (djm) Linux needs grp.h for setgroups()
- (djm) Never endprotoent()
- (djm) Use autoconf to detect various things; in preparation of more
portability

20031111
- (djm) Remove -Werror from CFLAGS, it causes problems in released software
Expand Down
32 changes: 0 additions & 32 deletions Makefile

This file was deleted.

63 changes: 63 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# $Id$

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
libexecdir=@libexecdir@
datadir=@datadir@
mandir=@mandir@
mansubdir=@mansubdir@
sysconfdir=@sysconfdir@
piddir=@piddir@
srcdir=@srcdir@
top_srcdir=@top_srcdir@
VPATH=@srcdir@
CC=@CC@
LD=@LD@
CFLAGS=@CFLAGS@
CPPFLAGS=-I$(srcdir) @CPPFLAGS@
LIBS=@LIBS@
EXEEXT=@EXEEXT@
INSTALL=@INSTALL@

WARNFLAGS=\
-Wall -Waggregate-return -Wcast-align -Wcast-qual \
-Wmissing-declarations -Wmissing-prototypes -Wno-conversion \
-Wpointer-arith -Wshadow -Wuninitialized -Wcast-align \
-Wcast-qual -WformatC=2 -Wformat-nonliteral -Wwrite-strings \
#-Werror

#CFLAGS+=-DFLOW_RB # Use red-black tree for flows
CFLAGS+=-DFLOW_SPLAY # Use splay tree for flows
CFLAGS+=-DEXPIRY_RB # Use red-black tree for expiry events
#CFLAGS+=-DEXPIRY_SPLAY # Use splay tree for expiry events

TARGETS=softflowd${EXEEXT} softflowctl${EXEEXT}

all: $(TARGETS)

softflowd${EXEEXT}: convtime.o softflowd.o
$(CC) $(LDFLAGS) -o $@ softflowd.o convtime.o $(LIBS)

softflowctl${EXEEXT}: convtime.o softflowctl.o
$(CC) $(LDFLAGS) -o $@ softflowctl.o convtime.o $(LIBS)

clean:
rm -f $(TARGETS) *.o core *.core

realclean: clean
rm -rf autom4te.cache Makefile config.log config.status

distclean: realclean
rm -f config.h* configure

strip:
strip $(TARGETS)

install:
$(INSTALL) -m 0755 -s softflowd $(sbindir)/softflowd
$(INSTALL) -m 0755 -s softflowctl $(isbindir)/softflowctl
$(INSTALL) -m 0644 softflowd.8 $(mandir)/$(mansubdir)8/softflowd.8
$(INSTALL) -m 0644 softflowctl.8 $(mandir)/$(mansubdir)8/softflowctl.8

1 change: 1 addition & 0 deletions aclocal.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dnl Nothing here
7 changes: 2 additions & 5 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#ifndef _SFD_COMMON_H

#include "config.h"

#define _BSD_SOURCE /* Needed for BSD-style struct ip,tcp,udp on Linux */

#include <sys/types.h>
Expand Down Expand Up @@ -53,11 +55,6 @@
#include <pwd.h>
#include <grp.h>

/* XXX: this check probably isn't sufficient for all systems */
#ifndef __GNU_LIBRARY__
# define SOCK_HAS_LEN
#endif

/* The name of the program */
#define PROGNAME "softflowd"

Expand Down
47 changes: 47 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# $Id$
#
# Copyright (c) 2004 Damien Miller
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

AC_INIT
AC_CONFIG_SRCDIR([softflowd.c])

AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL

dnl AC_CHECK_HEADERS(netinet/in_systm.h netinet/tcp.h netinet/udp.h)
dnl
dnl # This ugliness is because of autoconf's stupid default include list
dnl AC_CHECK_HEADERS([netinet/ip.h],
dnl [AC_DEFINE([HAVE_HAVE_NETINET_IP_H], 1, [has netinet/ip.h])], [],
dnl [
dnl #include <sys/types.h>
dnl #include <netinet/in.h>
dnl #if HAVE_NETINET_IN_SYSTM_H
dnl #include <netinet/in_systm.h>
dnl #endif
dnl ])

AC_CHECK_MEMBER([struct sockaddr.sa_len],
[AC_DEFINE([SOCK_HAS_LEN], 1, [struct sockaddr contains length])], ,
[#include <sys/types.h>
#include <sys/socket.h>])

AC_CHECK_LIB(pcap, pcap_open_live)

AC_EXEEXT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Loading

0 comments on commit 4b117ff

Please sign in to comment.