File: configure

package info (click to toggle)
lcrack 20040914-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 276 kB
  • ctags: 202
  • sloc: ansic: 2,623; sh: 229; makefile: 51
file content (291 lines) | stat: -rwxr-xr-x 5,933 bytes parent folder | download
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
#!/bin/sh

Makefile=Makefile

if [ -f $Makefile ]; then
    make clean
    rm -f $Makefile
fi

# detect compiler

if [ -z "$CC" ]; then
    for COMPILER in gcc cc icc pgcc ; do
	AUX=`which $COMPILER 2>/dev/null`
	if [ $? -eq 0 -a -n "$AUX" ]; then
	    CC=$COMPILER;
	    break;
	fi
    done
fi

if [ -z "$CC" ]; then
    echo $0: compiler not found, please set the CC environment variable
    exit 1
fi

AUX=`which $CC 2>/dev/null`
echo dbg: $CC compiler found, at $AUX

XFLAGS=

case $CC in
    gcc*)
	VERSION=`$CC -v 2>&1 | tail -1 | cut -d" " -f3 2> /dev/null`

	case $VERSION in
	    3\.*)
	    echo "dbg: GNU $VERSION compiler detected"

	    if [ -z "$1" ]; then
		echo "Please select your CPU, one of {"
		echo "   pentium, pentium-mmx, pentiumpro, pentium2, "
		echo "   pentium3, pentium4, k6, k6-2, k6-3, athlon, "
		echo "   athlon-tbird, athlon-4, athlon-xp, athlon-mp"
		echo -n "} = " 
		read ARCH
	    else
		ARCH=$1
	    fi
	    
	    ARCHOPT="-march=$ARCH"

	    case $ARCH in
		pentium4)
		    CPUFLAGS="-msse2";;
		pentium2|pentium3)
		    CPUFLAGS="-msse";;
		pentiumpro)
		    CPUFLAGS="-mmmx";;
		pentium-mmx)
		    CPUFLAGS="-mmmx";;
		pentium)
		    CPUFLAGS="";;
		athlon*)
		    CPUFLAGS="-m3dnow";;
		k6*)
		    CPUFLAGS="";;

		*)
		    echo "don't know how to deal with that CPU, no problem.."
		    CPUFLAGS=
		    ARCHOPT=
		    ;;
	    esac
    
	    XFLAGS="-O9 -Wall -fomit-frame-pointer -funroll-loops -minline-all-stringops -maccumulate-outgoing-args -finline-functions -fstrict-aliasing $ARCHOPT $CPUFLAGS"
	    ;;

	    2\.*)
	    echo "dbg: GNU $VERSION compiler detected"

	    if [ -z "$1" ]; then
		echo "Please select your CPU, one of {"
		echo "   i386, i486, i586 = pentium, i686 = pentiumII, k6"
		echo -n "} = " 
		read ARCH
	    else
		ARCH=$1
	    fi
	    
	    case $ARCH in
		i[3456]86)
		    ;;
		pentium[234])
		    ARCH="i686";;
		pentium)
		    ARCH="i586";;
		k6*)
		    ARCH="k6";;

		*)
		    echo "don't know how to deal with that CPU, no problem.."
		    CPUFLAGS=
		    ARCHOPT=
		    ;;
	    esac
	    
	    XFLAGS="-O3 -Wall -fomit-frame-pointer -funroll-loops -finline-functions -fstrict-aliasing -march=$ARCH"
	    ;;
	esac
	;;

    pgcc*)
	VERSION=`$CC -V 2> /dev/null | head -2 | tail -1 | cut -d" " -f2`

	case $VERSION in
	    4*)
		echo "dbg: Portland PGCC $VERSION compiler detected"
		
		if [ -z "$1" ]; then
		    echo "Please select your CPU, one of {"
		    echo "   pentium, pentiumpro, pentium2, pentium3,"
		    echo "   pentium4, athlon, athlon-xp, athlon-mp"
		    echo -n "} = " 
		    read ARCH
		else
		    ARCH=$1
		fi
	    
		case $ARCH in
		    pentium4)
			CPUFLAGS="-tp p7 -fastsse";;
		    pentium3)
			CPUFLAGS="-tp p6 -fastsse";;
		    pentium2)
			CPUFLAGS="-tp p6 -fast";;
		    pentiumpro)
			CPUFLAGS="-tp p6 -fast";;
		    pentium)
			CPUFLAGS="-tp p5 -fast";;
		    athlon)
			CPUFLAGS="-tp athlon -fast";;
		    athlon*)
			CPUFLAGS="-tp athlonxp -fastsse";;
		    
		    *)
			echo "don't know how to deal with that CPU, no problem.."
			CPUFLAGS="-tp px -fast"
			;;
		esac
		
		XFLAGS=$CPUFLAGS
		;;
	esac
	;;

    icc*)
	VERSION=`$CC -v 2>&1 | cut -d" " -f2`

	case $VERSION in
	    8*)
		echo "dbg: Intel ICC $VERSION compiler detected"
		
		if [ -z "$1" ]; then
		    echo "Please select your CPU, one of {"
		    echo "   pentium, pentiumpro, pentium2, pentium3, pentium4"
		    echo -n "} = " 
		    read ARCH
		else
		    ARCH=$1
		fi
	    
		case $ARCH in
		    pentium4)
			CPUFLAGS="-march=pentium4";;
		    pentium3)
			CPUFLAGS="-march=pentiumiii";;
		    pentium2)
			CPUFLAGS="-march=pentiumii";;
		    pentiumpro)
			CPUFLAGS="-march=pentiumpro";;
		    pentium)
			CPUFLAGS="-march=pentium";;
		    
		    *)
			echo "don't know how to deal with that CPU, no problem.."
			CPUFLAGS=""
			;;
		esac
		
		XFLAGS="-fast $CPUFLAGS"
		;;
	esac
esac

if [ -z "$XFLAGS" ]; then
    echo "dbg: unknown compiler version detected (please check Makefile)"
    CFLAGS="-O"
else
    CFLAGS=$XFLAGS
    echo "dbg: CFLAGS=$CFLAGS"
fi

# generate the Makefile

(cat <<EOF
# auto-generated Makefile, please adjust if needed

CC=$CC
CFLAGS?=$CFLAGS
LDFLAGS?=

EOF
) > $Makefile

# select name of executable program

if [ "$TERM" = "cygwin" ]; then
    PROGRAM=lcrack.exe
    REGEX=regex.exe
    MKWORD=mkword.exe
    MKTBL=mktbl.exe
else
    PROGRAM=lcrack
    REGEX=regex
    MKWORD=mkword
    MKTBL=mktbl
fi

(cat <<EOF
MAIN_BIN = $PROGRAM
MAIN_HDR = xtn_def.h xtn_method.h global.h
MAIN_SRC = engine.c set.c key.c xtn_method.c md4.c md5.c base64.c sha1.c
MAIN_OBJ = engine.o set.o key.o xtn_method.o md4.o md5.o base64.o sha1.o

MKTBL_BIN = $MKTBL
MKTBL_HDR = xtn_def.h xtn_method.h global.h
MKTBL_SRC = mktbl.c xtn_method.c md4.c md5.c base64.c sha1.c
MKTBL_OBJ = mktbl.o xtn_method.o md4.o md5.o base64.o sha1.o

REGEX_BIN = $REGEX
REGEX_HDR = global.h
REGEX_SRC = regex.c set.c
REGEX_OBJ = regex.o set.o

MKWORD_BIN = $MKWORD
MKWORD_HDR = 
MKWORD_SRC = mkword.c
MKWORD_OBJ = mkword.o

EOF
) >> $Makefile

# select modules to build

echo dbg: generating plug-in section

cp -f xtn_method.h.in xtn_method.h
cp -f xtn_method.c.in xtn_method.c

/bin/ls mod_*.h | while read MOD_HDR; do
 MOD=`echo $MOD_HDR | cut -d_ -f2 | cut -d. -f1`

 echo dbg: found \'$MOD\' plug-in at ${MOD_HDR}/${MOD_HDR%.h}.c

 echo "#include \"${MOD_HDR}\"" >> xtn_method.h
 echo "  { \"$MOD\", &xtn_${MOD}_init, &xtn_${MOD}_cmp, &xtn_${MOD}_crypt }," >> xtn_method.c
done

cat xtn_method.c.out >> xtn_method.c

(cat <<EOF
XTN_HDR=`echo mod_*.h`
XTN_SRC=`echo mod_*.c`
XTN_OBJ=`echo mod_*.c | sed -e 's/.c/.o/g'`

BIN_EXTRA=README COPYING CHANGES AUTHORS CREDITS charset.txt regex.txt
SRC_EXTRA=configure xtn_method.h.in xtn_method.c.in Makefile.in Makefile

EOF
) >> $Makefile

cat Makefile.in >> $Makefile 

echo dbg: Makefile generated
echo
echo Please check that the auto-generated Makefile looks good.
echo Then compile it typing \'make\'
echo

exit 0