-
Notifications
You must be signed in to change notification settings - Fork 19
/
configure
executable file
·95 lines (80 loc) · 1.54 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
87
88
89
90
91
92
93
94
95
#! /bin/bash
DEBUG=1
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
CFLAGS="$CFLAGS -W -Wall -Wstrict-prototypes -pipe"
CFLAGS="$CFLAGS -Wfloat-equal -Wundef -Wshadow -Wpointer-arith"
CFLAGS="$CFLAGS -Wmissing-declarations -Wnested-externs"
CFLAGS="$CFLAGS -Wmissing-prototypes"
CXXFLAGS="$CXXFLAGS -W -Wall -pipe -Wundef -Wshadow -Wpointer-arith -Wabi -std=c++11"
LDFLAGS="$LDFLAGS"
if [[ -z "$CC" ]]; then
CC=gcc
fi
if [[ -z "$CXX" ]]; then
CXX=g++
fi
if [[ -z "$WINCC" ]]; then
WINCC=winegcc
fi
if [[ -z "$WINCXX" ]]; then
WINCXX=wineg++
fi
if [[ -z "$PREFIX" ]]; then
PREFIX=/usr/local
fi
function usage()
{
echo -n "usage: $0
--release disable debug
--debug enables debug
--prefix=<dir> the installation prefix path
"
exit
}
until [[ $# -eq 0 ]] ;
do
case "$1" in
--release)
DEBUG=0
;;
--debug)
DEBUG=1
;;
--prefix=*)
PREFIX="${1/--prefix=/}"
;;
-h|--help|help)
usage
;;
*)
echo wrong argument "$1"
usage
;;
esac
shift
done
if [[ $DEBUG -eq 0 ]]; then
CFLAGS="$CFLAGS -DNDEBUG -O2"
CXXFLAGS="$CXXFLAGS -DNDEBUG -O2"
else
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
fi
CFLAGS="${CPPFLAGS} ${CFLAGS}"
CXXFLAGS="${CPPFLAGS} ${CXXFLAGS}"
cat >config.h <<EOF
#ifndef CONFIG_H
# define CONFIG_H
# define INSTALL_PREFIX "${PREFIX}"
#endif /* !CONFIG_H */
EOF
cat >config.mk <<EOF
CPPFLAGS = $CPPFLAGS
CFLAGS = $CFLAGS
CXXFLAGS = $CXXFLAGS
CC = $CC
CXX = $CXX
WINCC = $WINCC
WINCXX = $WINCXX
PREFIX = $PREFIX
EOF