This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
forked from treefrogframework/treefrog-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·227 lines (199 loc) · 5.21 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/bash
#
# Guess values for system-dependent variables and create Makefiles.
#
# usage message
usage_unix()
{
cat <<_EOF
Usage: $0 [OPTION]... [VAR=VALUE]...
Configuration:
-h, --help display this help and exit
--enable-debug compile with debugging information
--enable-gui-mod compile and link with QtGui module
Installation directories:
--prefix=PREFIX install files in PREFIX [$PREFIX]
Fine tuning of the installation directories:
--bindir=DIR user executables [$BINDIR]
--libdir=DIR object code libraries [$LIBDIR]
--includedir=DIR C++ header files [$INCLUDEDIR]
--datadir=DIR read-only architecture-independent data [$DATADIR]
_EOF
}
usage_macx()
{
cat <<_EOF
Usage: $0 [OPTION]... [VAR=VALUE]...
Configuration:
-h, --help display this help and exit
--enable-debug compile with debugging information
--enable-gui-mod compile and link with QtGui module
Fine tuning of the installation directories:
--framework=PREFIX install framework files in PREFIX [$FRAMEWORK]
--bindir=DIR user executables [$BINDIR]
--datadir=DIR read-only architecture-independent data [$DATADIR]
_EOF
}
usage()
{
if [ "$KERNEL" = "Darwin" ]; then
usage_macx
else
usage_unix
fi
}
# check the platform
if which uname >/dev/null 2>&1; then
KERNEL=`uname -s`
MACHINE=`uname -m`
RELEASE=`uname -r`
if [ "$QMAKESPEC" != "" ]; then
OPT="-spec $QMAKESPEC"
if [ "$MACHINE" = "x86_64" ]; then
OPT="$OPT CONFIG+=x86_64"
fi
elif [ "$KERNEL" = "Darwin" ]; then
QT_VERSION=$(echo $(qmake -v) | awk '{ print $7 }')
QT_MAJOR=${QT_VERSION:0:1}
if [ "$QT_MAJOR" -ge 5 ]; then
OPT="-spec macx-clang"
else
OPT="-spec macx-g++"
fi
REL=`echo $RELEASE | tr -d '.'`
if [ "$REL" -ge 1050 ]; then
OPT="$OPT CONFIG+=x86_64"
fi
if [ "$MACHINE" = "ppc" ]; then
OPT="$OPT CONFIG+=ppc"
fi
else
if [ "$KERNEL" = "Linux" ]; then
OPT="-spec linux-g++"
elif [ "$KERNEL" = "FreeBSD" ]; then
OPT="-spec freebsd-g++"
fi
if [ "$MACHINE" = "x86_64" ]; then
OPT="$OPT CONFIG+=x86_64"
fi
fi
else
echo "uname: command not found"
exit
fi
# default values
BASEDIR=`pwd`/`dirname $0`
if [ "$KERNEL" = "Darwin" ]; then
PREFIX=/usr/local
FRAMEWORK=/Library/Frameworks
LIBDIR=$FRAMEWORK
INCLUDEDIR=$FRAMEWORK/treefrog.framework/Headers
else
PREFIX=/usr
LIBDIR=$PREFIX/lib
INCLUDEDIR=$PREFIX/include/treefrog
fi
BINDIR=$PREFIX/bin
DATADIR=$PREFIX/share/treefrog
# parse options
while [ -n "`echo $1 | grep '-'`" ]; do
case $1 in
*=?*) optarg=`expr "X$1" : '[^=]*=\(.*\)'` ;;
*=) optarg= ;;
*) optarg=yes ;;
esac
case $1 in
--prefix=*)
PREFIX=$optarg
BINDIR=$PREFIX/bin
LIBDIR=$PREFIX/lib
INCLUDEDIR=$PREFIX/include/treefrog
DATADIR=$PREFIX/share/treefrog
;;
--bindir=*)
BINDIR=$optarg
;;
--libdir=*)
LIBDIR=$optarg
;;
--includedir=*)
INCLUDEDIR=$optarg
;;
--datadir=*)
DATADIR=$optarg
;;
--framework=*)
FRAMEWORK=$optarg
LIBDIR=$FRAMEWORK
INCLUDEDIR=$FRAMEWORK/treefrog.framework/Headers
;;
--enable-debug | --enable-debug=*)
ENABLE_DEBUG=yes
;;
--enable-gui-mod | --enable-gui-mod=*)
ENABLE_GUI="use_gui=1"
;;
--help | -help | -h | *)
usage
exit
;;
esac
shift
done
PID=$$
cd "$BASEDIR"
INCDIR=`echo $INCLUDEDIR | sed -e 's/\\//\\\\\\//g'`
if [ "$KERNEL" = "Darwin" ]; then
sed -e "s/macx:INCLUDEPATH +=.*$/macx:INCLUDEPATH += $INCDIR/" defaults/appbase.pri > defaults/appbase.pri.$PID
else
sed -e "s/unix:INCLUDEPATH +=.*$/unix:INCLUDEPATH += $INCDIR/" defaults/appbase.pri > defaults/appbase.pri.$PID
fi
command mv -f defaults/appbase.pri.$PID defaults/appbase.pri
if [ -n "$FRAMEWORK" ]; then
FRM=`echo $FRAMEWORK | sed -e 's/\\//\\\\\\//g'`
sed -e "s/LIBS += -F.*/LIBS += -F$FRM/" defaults/appbase.pri > defaults/appbase.pri.$PID
command mv -f defaults/appbase.pri.$PID defaults/appbase.pri
fi
if [ -n "$ENABLE_DEBUG" ]; then
OPT="$OPT CONFIG+=debug"
else
OPT="$OPT CONFIG+=release"
fi
# search qmake command
if [ -z "$QMAKE" ]; then
which qmake-qt4 >/dev/null 2>&1 && QMAKE=qmake-qt4
which qmake-qt5 >/dev/null 2>&1 && QMAKE=qmake-qt5
which qmake >/dev/null 2>&1 && QMAKE=qmake
if [ -z "$QMAKE" ]; then
echo qmake: command not found
echo
exit
fi
fi
cd "$BASEDIR/src"
[ -f Makefile ] && make -k distclean >/dev/null 2>&1
$QMAKE $OPT target.path=\"$LIBDIR\" header.path=\"$INCLUDEDIR\" $ENABLE_GUI
cd "$BASEDIR/tools"
[ -f Makefile ] && make -k distclean >/dev/null 2>&1
$QMAKE -recursive $OPT target.path=\"$BINDIR\" header.path=\"$INCLUDEDIR\" datadir=\"$DATADIR\" lib.path=\"$LIBDIR\"
make qmake
# compile MongoDB files
cd "$BASEDIR/3rdparty/mongo-c-driver"
echo
echo -n "Compiling MongoDB driver library ... "
$QMAKE $OPT mongo-c-driver.pro
make clean >/dev/null 2>&1
make >/dev/null 2>&1
RET=$?
if [ $RET != 0 ]; then
echo "failed"
echo "MongoDB driver not available."
exit $RET
fi
echo "OK"
echo
echo "First, run \"make\" and \"sudo make install\" in src directory."
echo "Next, run \"make\" and \"sudo make install\" in tools directory."