-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·80 lines (60 loc) · 1.75 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
#!/bin/sh
CONFIG_DEBUG=1
while getopts hrd opt
do
case $opt in
h) cat <<EOF
\`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [-h] [-r|-d] [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h display this help and exit
Optional Features:
-d configure a debug build (default)
-r configure a release build
Some influential environment variables:
CC C compiler command [clang gcc cc]
CFLAGS C compiler flags [-O3 -Wall -fPIC] when -r specified, [-g -Wall -fPIC] else
LDFLAGS linker flags []
BUILDDIR where the binaries and documentations will be built [./build]
Use these variables to override the choices made by \`configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
EOF
exit 2 ;;
r) unset CONFIG_DEBUG ;;
d) CONFIG_DEBUG=1 ;;
?) echo "Unknown option: $opt" ;;
esac
done
shift $((OPTIND - 1))
[ ! -z "$*" ] && export -- "$@"
# Compilation
if [ -z "$CC" ]
then
for CC in clang gcc cc
do [ ! -z `which "$CC"` ] && break
done
fi
if [ ! -z "$CC" ]
then echo "Using C compiler '$CC'"
else echo "Unable to find C compiler" ; exit 1
fi
if [ -z "$CFLAGS" ]
then
if [ ! -z "$CONFIG_DEBUG" ]
then CFLAGS='-g -Wall -fPIC'
else CFLAGS='-O3 -Wall -fPIC'
fi
fi
echo "Using C flags '$CFLAGS'"
echo "Using Linker flags: '$LDFLAGS'"
[ -z "$BUILDDIR" ] && BUILDDIR='./build'
cat - Makefile.part <<EOF > Makefile
CC=$CC
CFLAGS=$CFLAGS
LDFLAGS=$LDFLAGS
BUILDDIR=$BUILDDIR
EOF