1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
#!/bin/sh
show_help()
{
echo configure help:
echo "--help show this help"
echo "--force-libpcap build a libpcap based binary under linux"
echo " even if uid != euid"
}
if [ "$1" = "--help" ]; then
show_help
exit 0
fi
CC=${CC:=cc}
echo build byteorder.c...
$CC byteorder.c -o byteorder || exit 1
INSTALL_MANPATH=`echo $MANPATH|cut -f1 -d:`
if [ "$INSTALL_MANPATH" = "" ]; then
INSTALL_MANPATH="/usr/local/man"
fi
BYTEORDER=`./byteorder -m`
echo create byteorder.h...
cat > byteorder.h <<EOF
#ifndef __BYTEORDER_H
#define __BYTEORDER_H
EOF
echo \#ifndef $BYTEORDER >> byteorder.h
echo \#define $BYTEORDER >> byteorder.h
echo \#endif /\* $BYTEORDER \*/ >> byteorder.h
cat >> byteorder.h <<EOF
#endif /* __BYTEORDER_H */
EOF
CONFIGOSTYPE=`uname -s | tr [a-z] [A-Z]`
if [ ! "$CONFIGOSTYPE" ]; then
CONFIGOSTYPE=UNKNOWN
fi
# for BSD/OS use the historical name as it doesn't include '/'
if [ $CONFIGOSTYPE = "BSD/OS" ]; then
CONFIGOSTYPE=BSDI
fi
case $CONFIGOSTYPE in
SUNOS)
SOLARISLIB="-lsocket -lresolv -lnsl"
BUG='/* #define STUPID_SOLARIS_CHECKSUM_BUG */'
case `uname -r` in
2.0*|5.0*|2.1*|5.1*|2.2*|5.2*|2.3*|5.3*|2.4*|5.4*|5.5.1)
BUG='#define STUPID_SOLARIS_CHECKSUM_BUG' ;;
esac
esac
#
# configurable stuff
#
FORCE_LIBPCAP=""
if [ "$CONFIGOSTYPE" = "LINUX" ]; then
PCAP=""
PCAP_INCLUDE=""
else
PCAP="PCAP=-lpcap"
PCAP_INCLUDE=""
fi
for ARG in $*; do
case "$ARG" in
*"--force-libpcap")
FORCE_LIBPCAP="-DFORCE_LIBPCAP"
PCAP="PCAP=-lpcap"
PCAP_INCLUDE=""
;;
esac
done
echo --------------------------------------
echo system type: $CONFIGOSTYPE
echo
echo "FORCE_LIBPCAP: $FORCE_LIBPCAP"
echo "LIBPCAP : $PCAP"
echo "PCAP_INCLUDE : $PCAP_INCLUDE"
echo "MANPATH : $INSTALL_MANPATH"
echo
echo "(to modify try configure --help)"
echo --------------------------------------
echo creating Makefile...
sed -e "s/@FORCE_LIBPCAP@/$FORCE_LIBPCAP/g" \
-e "s^@PCAP@^$PCAP^g" \
-e "s^@PCAP_INCLUDE@^$PCAP_INCLUDE^g" \
-e "s^@MANPATH@^$INSTALL_MANPATH^g" \
-e "s^@SOLARISLIB@^$SOLARISLIB^g" \
<Makefile.in > Makefile
#
#
#
cat > systype.h <<EOF
#ifndef __SYSTYPE_H
#define __SYSTYPE_H
EOF
echo \#define OSTYPE_${CONFIGOSTYPE} >> systype.h
cat >> systype.h <<EOF
#endif /* SYSTYPE_H */
EOF
echo now you can try \`make\'
|