-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·73 lines (59 loc) · 1.41 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
#!/bin/sh
try_cflag(){
flag="$1"
target="$2"
if test -z "$target"
then target='CFLAGS_CONFIGURE'
fi
printf 'checking whether compiler accepts %s... ' "$flag"
echo "typedef int abc;" >"$ctmp"
if $CC "$flag" -c -o /dev/null "$ctmp" >/dev/null 2>&1
then
echo yes
echo "$target += $flag" >> Makefile.cfg
return 0
else
echo no
return 1
fi
}
if [ $# -ne 0 ]
then
echo "Usage: $0" >&2
echo "Pass CC, CFLAGS and LDFLAGS via the environment" >&2
echo "e.g. CFLAGS=-O3 ./configure" >&2
exit 1
fi
if [ -z "$TMPDIR" ]
then
TMPDIR=tmp/
mkdir -p "$TMPDIR" || exit $?
trap "rm -r '$TMPDIR'" EXIT
fi
if [ -z "$CC" ]
then
CC=cc
fi
irtmpdir="${TMPDIR}"/ir.$$
mkdir "$irtmpdir" || { echo "couldn't make temporary directory" >&2; exit 1; }
trap "rm -rf '$irtmpdir'" EXIT
ctmp="$irtmpdir/1.c"
echo > Makefile.cfg
echo "CC = $CC" >> Makefile.cfg
echo "CFLAGS_CONFIGURE = $CFLAGS" >> Makefile.cfg
echo "LDFLAGS_CONFIGURE = $LDFLAGS" >> Makefile.cfg
try_cflag -std=c89 || try_cflag -ansi
try_cflag -Wall
try_cflag -Wextra
try_cflag -Wmissing-prototypes
try_cflag -Wmissing-declarations
try_cflag -Werror=incompatible-pointer-types
try_cflag -Werror=int-conversion
try_cflag -Werror=implicit-function-declaration
try_cflag -Wno-missing-field-initializers
try_cflag -Wno-missing-braces
try_cflag -Wno-pointer-to-int-cast
try_cflag -Wno-sign-compare
try_cflag -Wno-implicit-fallthrough
try_cflag -g
try_cflag -g LDFLAGS_CONFIGURE