-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·80 lines (67 loc) · 1.08 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
#!/bin/sh
usage(){
echo >&2 "Usage: $0 [--use-ps]"
exit 1
}
trace_tool(){
ed -s config.h > /dev/null <<!
/TRACE_TOOL .*/s/.*/#define TRACE_TOOL "$1"/
wq
!
}
config(){
echo "$@" >> config.mk
}
cdeps(){
"${CC}" -MM $@
}
CC=${CC:-cc}
use_ps=0
for arg in $@
do
case "$arg" in
--use-ps)
use_ps=1
;;
*)
usage
;;
esac
done
set -e
rm -f config.mk
arch=`uname -s`
case $arch in
FreeBSD)
config "LDFLAGS += -lkvm"
trace_tool ktrace
;;
Linux)
config "CFLAGS += -D_POSIX_SOURCE -D_BSD_SOURCE"
trace_tool strace
;;
*)
if test $use_ps -eq 0
then
echo "unregonised platform ($arch)" >&2
echo "Using \`ps\` parser"
use_ps=1
fi
;;
esac
if test $use_ps -ne 0
then config "CFLAGS += -DMACHINE_PS"
fi
try_cflag(){
if echo 'int main(){}' | "${CC}" "$@" -xc - >/dev/null 2>&1
then config "CFLAGS += $@"
fi
}
try_cflag -Wmissing-prototypes
try_cflag -Wmissing-noreturn
try_cflag -Wmissing-variable-declarations
try_cflag -Wshadow
try_cflag -Wshorten-64-to-32
try_cflag -Wunused-macros
try_cflag -Wno-dollar-in-identifier-extension
echo Configured for $arch