File: configure

package info (click to toggle)
hping3 3.a2.ds2-10.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,068 kB
  • sloc: ansic: 11,627; sh: 129; makefile: 76
file content (167 lines) | stat: -rwxr-xr-x 3,379 bytes parent folder | download | duplicates (3)
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
167
#!/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

# for GNU/kFreeBSD, change GNU/KFREEBSD to GNUKFREEBSD, to
# not including '/'
if [ $CONFIGOSTYPE = "GNU/KFREEBSD" ]
then
	CONFIGOSTYPE=GNUKFREEBSD
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
#
TCLSH=$(which tclsh 2>/dev/null)

if [ -f "$TCLSH" ]
then
	echo "===> Found Tclsh in: $TCLSH"
	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

	if [ -n $USE_TCL ]
	then
		LIBPOSTFIX=`echo puts \\$tcl_version | $TCLSH -`
		TCL_LIB="-ltcl${LIBPOSTFIX} -lm -lpthread"
	fi
else
	if [ "$1" != "--no-tcl" ]
	then
		echo "==> WARNING: no Tcl binary found!"
	fi
fi

#
# configurable stuff
#
PCAP="PCAP=-lpcap"
PCAP_INCLUDE="-I/usr/include/pcap"

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\'