-
Notifications
You must be signed in to change notification settings - Fork 21
/
configure
executable file
·93 lines (83 loc) · 1.86 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
#!/bin/sh
#
# Search for GCC or XL C/C++, former if both exist
#
# To add another compiler, just create Makefile.XXX and add XXX to $CCS
#
# To prevent ugly Makefile extensions, underscore and chars following it
# in the name XXX are automatically removed before locating relevant
# Makefile. This is why compiler "xlc_r" has Makefile extension "xlc".
# This can be disabled if neccessary.
#
CCS="xlc_r gcc"
#
# Look for supported compilers
#
for c in $CCS; do
if CCPATH=`which $c 2>&1` && [ -z "${CCPATH%%/*}" ]; then
CC="$c"
break
fi
done
#
# Make a link to a proper Makefile.*
#
if [ -z "$CC" ]; then
echo "Unable to find GNU GCC or IBM XL C/C++. Fix your PATH!"
exit 1
else
echo "Using $CCPATH to compile Cntlm"
[ -h Makefile ] && rm -f Makefile 2>/dev/null
case "$CC" in
gcc)
# default Makefile is for GCC; just revert back to
# GCC if Makefile is linked to other compiler version
if [ ! -f Makefile ]; then
mv Makefile.gcc Makefile
fi
;;
*)
# backup default GCC Makefile and create a link to other
if [ -f Makefile ]; then
mv Makefile Makefile.gcc
fi
EXT=`echo "$CC" | sed 's/_.*//'`
ln -s Makefile.$EXT Makefile
;;
esac
fi
STAMP=configure-stamp
CONFIG=config/config.h
TESTS="endian strdup socklen_t gethostname"
#[ -f $STAMP ] && exit 0
touch $STAMP
rm -f $CONFIG
for i in $TESTS; do
printf "Checking $i... "
printf "#define config_$i " >> $CONFIG
OUT=`$CC -D_POSIX_C_SOURCE=199506L -D_ISOC99_SOURCE -D_REENTRANT -o config/$i config/$i.c 2>&1`
rc=$?
if [ $rc -ne 0 ]; then # -o -n "$OUT" ]; then
rc=0
RET=no
else
RET=`./config/$i`
rc=$?
[ -z "$RET" ] && if [ $rc -eq 0 ]; then RET="no"; else RET=yes; fi
fi
echo $rc >> $CONFIG
echo $RET
done
while [ $1 ]
do
case $1 in
--enable-kerberos)
printf "#define ENABLE_KERBEROS" >> $CONFIG
;;
*)
echo "Unknown flag $1"
rm -f $CONFIG
;;
esac
shift
done