-
Notifications
You must be signed in to change notification settings - Fork 16
/
configure.sh
executable file
·47 lines (41 loc) · 1.54 KB
/
configure.sh
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
#!/bin/bash
# need --enable-maintainer-mode to be able to run in place
# must be disabled to build an installable package
# *FLAGS are what Arch Linux makepkg uses with the exception
# that -Wall -Werror is added
case "`uname -m`" in
i686)
CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
DEBUG_CFLAGS="-g -ggdb -fvar-tracking-assignments"
DEBUG_CXXFLAGS="-g -ggdb -fvar-tracking-assignments"
;;
x86_64)
CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
DEBUG_CFLAGS="-g -ggdb -fvar-tracking-assignments"
DEBUG_CXXFLAGS="-g -ggdb -fvar-tracking-assignments"
;;
esac
# Clang has no variable tracking options
if [[ $CC =~ ^clang || $CC =~ /clang ]]
then
DEBUG_CFLAGS=${DEBUG_CFLAGS%%-fvar-tracking-assignments*}
fi
if [[ $CXX =~ ^clang || $CXX =~ /clang ]]
then
DEBUG_CXXFLAGS=${DEBUG_CXXFLAGS%%-fvar-tracking-assignments*}
fi
./configure \
--enable-maintainer-mode \
--enable-dependency-tracking \
CPPFLAGS="$CPPFLAGS" \
CFLAGS="$DEBUG_CFLAGS -Wall -Werror $CFLAGS" \
CXXFLAGS="$DEBUG_CXXFLAGS -Wall -Werror $CXXFLAGS" \
LDFLAGS="$LDFLAGS" \
DEBUG_CFLAGS="$DEBUG_CFLAGS" \
DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS"