-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·86 lines (70 loc) · 1.99 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
#!/usr/bin/env sh
DIR="$( cd "$( dirname "${0}" )" && pwd )"
prefix=/usr/local
debugsym=true
sanitizer=true
# Figure out project name:
project_name=$(basename $DIR)
if [ -f "PROJECT.name" ]; then
project_name=$(cat "PROJECT.name")
else
echo "Warning: no file 'PROJECT.name' found, guessing project name: '${project_name}'"
fi
for arg in "$@"; do
case "$arg" in
--prefix=*)
prefix=`echo $arg | sed 's/--prefix=//'`
;;
--enable-debug )
debugsym=true
;;
--disable-debug )
debugsym=false
;;
--enable-sanitizer )
sanitizer=true
;;
--disable-sanitizer )
sanitizer=false
;;
--help)
echo 'usage: ./configure [options]'
echo 'options:'
echo ' --prefix=<path>: installation prefix'
echo ' --enable-debug include debug symbols'
echo ' --disable-debug do not include debug symbols'
echo ' --enable-sanitizer To enable -fsanitize compiler option'
echo ' --disable-sanitizer To disable -fsanitize compiler option'
echo ''
echo 'all invalid options are silently ignored'
exit 0
;;
*)
echo "Unexpected option '$arg'"
exit 0
;;
esac
done
echo "Generating Makefile for ${project_name}..."
echo "# Generated Makefile for ${project_name}: $(date)" > Makefile
echo "PREFIX ?= ${prefix}" >> Makefile
echo "PROJECT ?= ${project_name}" >> Makefile
if $debugsym; then
echo 'dbg = -g' >> Makefile
fi
if $sanitizer; then
echo 'sanitize = address,undefined,leak' >> Makefile
fi
if [ ! -z "${CXX}" ] || [ ! -z "${CC}" ] ; then
echo "Using custom copiler: CXX=$CXX CC=$CC"
printf "\n# Compiler config\n" >> Makefile
if [ ! -z "${CXX}" ] ; then
echo "CXX ?= ${CXX}" >> Makefile
fi
if [ ! -z "${CC}" ]; then
echo "CC ?= ${CC}" >> Makefile
fi
fi
echo '' >> Makefile
cat Makefile.in >> Makefile
echo "Configuration complete, type 'make' to build ${project_name}."