-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure
executable file
·59 lines (47 loc) · 1.47 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
#!/bin/sh
prefix=/usr/local
debug="default"
extra_cxxflags="$CXXFLAGS"
extra_ldflags="$LDFLAGS"
release=false
for arg in "$@"; do
case "$arg" in
--prefix=*)
prefix=$(echo "$arg" | sed 's/--prefix=//')
;;
--debug)
debug=true;;
--no-debug)
debug=false;;
--release)
release=true;;
--help)
echo 'usage: ./configure [options]'
echo 'options:'
echo ' --prefix=<path>: installation prefix'
echo ' --debug: enable debug build'
echo ' --no-debug: disable debug build (default for release builds)'
echo ' --release: enable release build'
echo 'all invalid options are silently ignored'
exit 0
;;
esac
done
echo 'generating makefile ...'
echo "SELF_DIR = $(pwd)" > Makefile
echo "export PREFIX = $prefix" >> Makefile
echo "export RELEASE = $release" >> Makefile
if [ "$release" = "true" ]; then
extra_cxxflags="$extra_cxxflags -O2"
fi
if [ "$debug" = "true" ] || { [ "$debug" = "default" ] && [ "$release" = "false" ]; }; then
extra_cxxflags="$extra_cxxflags -g -DDEBUG=1 -Wl,-rpath,\$(SELF_DIR)/build"
fi
if ldconfig -p | grep -q libboost_iostreams; then
extra_cxxflags="$extra_cxxflags -DUSE_BOOST_IOSTREAMS=1"
extra_ldflags="$extra_ldflags -lboost_iostreams"
fi
echo "EXTRA_CXXFLAGS=$extra_cxxflags" >> Makefile
echo "EXTRA_LDFLAGS=$extra_ldflags" >> Makefile
cat Makefile.in >> Makefile
echo 'configuration complete, type make to build.'