forked from antirez/hping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·166 lines (144 loc) · 3.35 KB
/
configure
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/sh
show_help()
{
echo configure help:
echo "--help show this help"
echo "--no-tcl disable TCL scripting support"
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
#
# TCL detection
#
for TCLPATH_TRY in "/usr/bin/" "/usr/local/bin/" "/bin/"
do
for TCLVER_TRY in "8.4" "8.3" "8.2" "8.1" "8.0"
do
if [ -z $TCLSH ]
then
TCLSH_TRY=${TCLPATH_TRY}tclsh${TCLVER_TRY}
if [ -f $TCLSH_TRY ]
then
TCLSH=$TCLSH_TRY
echo "===> Found Tclsh in: $TCLSH"
fi
fi
done
done
if [ -f $TCLSH ]
then
TCL_VER=`echo puts \\$tcl_version | $TCLSH -`
USE_TCL='-DUSE_TCL'
TCL_LIB="-ltcl${TCL_VER}"
if [ -e /usr/include/tcl${TCL_VER} ]
then
TCL_INC="-I/usr/include/tcl${TCL_VER}"
elif [ -e /usr/include/tcl.h ]
then
TCL_INC=""
elif [ -e /usr/local/include/tcl${TCL_VER} ]
then
TCL_INC="-I/usr/local/include/tcl${TCL_VER}"
else
USE_TCL=""
TCL_LIB=""
echo "==> WARNING: no Tcl header files found!"
fi
fi
if [ -n $USE_TCL ]
then
LIBPOSTFIX=`ls -1 /usr/local/lib/ /usr/lib | grep 'libtcl[0-9]' | grep so | sed -e 's/\.so.*//g' -e 's/libtcl//g' | sort -r | head -1`
TCL_LIB="-ltcl${LIBPOSTFIX} -lm -lpthread"
fi
#
# configurable stuff
#
PCAP="PCAP=-lpcap"
PCAP_INCLUDE=""
for ARG in $*; do
case "$ARG" in
*"--no-tcl")
USE_TCL=""
TCL_VER=""
TCL_INC=""
TCL_LIB=""
;;
esac
done
echo --------------------------------------
echo system type: $CONFIGOSTYPE
echo
echo "LIBPCAP : $PCAP"
echo "PCAP_INCLUDE : $PCAP_INCLUDE"
echo "MANPATH : $INSTALL_MANPATH"
echo "USE_TCL : $USE_TCL"
echo "TCL_VER : $TCL_VER"
echo "TCL_INC : $TCL_INC"
echo "LIBTCL : $TCL_LIB"
echo "TCLSH : $TCLSH"
echo
echo "(to modify try configure --help)"
echo --------------------------------------
echo creating Makefile...
sed -e "s^@PCAP@^$PCAP^g" \
-e "s^@PCAP_INCLUDE@^$PCAP_INCLUDE^g" \
-e "s^@MANPATH@^$INSTALL_MANPATH^g" \
-e "s^@SOLARISLIB@^$SOLARISLIB^g" \
-e "s^@USE_TCL@^$USE_TCL^g" \
-e "s^@TCL_INC@^$TCL_INC^g" \
-e "s^@TCL_VER@^$TCL_VER^g" \
-e "s^@TCL_LIB@^$TCL_LIB^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 creating dependences...
$CC -MM *.c > .depend
echo now you can try \`make\'