#!/bin/sh
#
# the "fuck autoconf" configure script.
#

. ./config.run
HASPCAP=0

rm -f config.h
rm -f Makefile

if (test -n "$1"); then
	value=`echo $1 | sed "s/\=/ /g" | awk '{ print $2 }'`
	name=`echo $1 | sed "s/\=/ /g" | awk '{ print $1 }'`

	if (test "$name" = "--prefix"); then
		echo prefix=$value >> Makefile
		echo redefining shell build \$\{PREFIX\} variable to $value
	fi
	if (test "$name" = "--help"); then
		echo --prefix=\[dir\]
		exit 1
	fi 
else
	echo prefix=/usr/local >> Makefile
fi

cat Makefile.in >> Makefile

locate_f "gcc"
locate_f "as"
locate_f "ld"
locate_f "make"
locate_f "lex"
locate_f "yacc"

locate_l "pcap" && echo LIBS+=	-lpcap >> Makefile && HASPCAP=1
if (test "$HASPCAP" -ne "1"); then
	echo \#
	echo \# WARNING: libpcap is not  found on this system.
	echo \#          you may or may not need this.
	echo \#          If this build fails this could be
	echo \#          the reason though.
	echo \#

	exit 1
fi
locate_l "kvm" && echo LIBS+=	-lkvm >> Makefile

locate_h "sys/queue.h" && define_macro "HAVE_SYS_QUEUE_H"
locate_h "pcap.h"

locate_s /usr/include/sys/user.h kp_proc && define_macro "HAVE_KP_PROC"
locate_s /usr/include/sys/user.h ki_addr && define_macro "HAVE_KI_ADDR"

echo Makefile written
echo config.h written



syntax highlighted by Code2HTML, v. 0.9.1