From: hackbard Date: Wed, 1 Jun 2005 15:42:42 +0000 (+0000) Subject: configure file checkin X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b20137f3f0a0b27e441c8ed148482b28c590873f;p=my-code%2Fhdw-sniff.git configure file checkin --- diff --git a/configure b/configure new file mode 100755 index 0000000..f99f757 --- /dev/null +++ b/configure @@ -0,0 +1,93 @@ +#!/bin/sh + +name="hdw-sniff" + +#defaults +prefix=/usr +apidir="" + +usage() { + echo "usage $0 " + echo "options:" + echo "--prefix=PREFIX specify install prefix" + echo "--with-api=DIR specify api dir" + echo + } + +while [ "$1" ]; do + case "`echo $1 | awk -F= '{ print $1 }'`" in + --prefix) prefix=`echo $1 | awk -F= '{ print $2 }'`; shift;; + --help) usage; shift 1;; + --with-api) apidir=`echo $1 | awk -F= '{ print $2 }'`; shift;; + esac +done + +echo "checking for api stuff ..." +api_dir="0" +if [ -z "$apidir" ]; then + for i in ../api ../../api; do + if [ -f $i/CHANGELOG ]; then + api_dir=$i + fi + done +else + if [ -f $apidir/CHANGELOG ]; then + api_dir=$apidir + fi +fi +if [ "$api_dir" = "0" ]; then + echo "api files not found ..." + echo "WARNING: your build will fail." + echo "please get the api files first (see README file)." + api_dir="./" +fi + +GENLIBS="-lm -lncurses -lpcap" +GENAPI="network.o event.o list.o display.o input.o" +SRC="main.c parse.c" + +echo "creating Makefile" + +cat > Makefile << EOF +# $name Makefile, created `date` + +INCLUDEDIR = /usr/include +CFLAGS = -DDEBUG -O3 -Wall +LIBS = $GENLIBS + +OBJS = $GENAPI +OBJS2 = $name + +links: +EOF + +for i in $GENAPI; do + foo="`echo $i | sed 's/\.o//g'`" + cat >> Makefile << EOF + ln -sf $api_dir/$foo/${foo}.{c,h} . +EOF +done + +for i in $name; do +cat >> Makefile << EOF + +$i: links \$(OBJS) + \$(CC) \$(CFLAGS) -o \$@ \$(OBJS) $SRC \$(LIBS) + +EOF +done + +cat >> Makefile << EOF +all: $name + +clean: + rm -f \$(OBJS) \$(OBJS2) + +remake: clean all + +install: + mkdir -p $prefix/bin + cp $name $prefix/bin +EOF + +echo "done"