File tree 3 files changed +28
-2
lines changed
3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ before_script:
66
66
- echo 'TCMALLOC_PATH=./thirdparty' >> depends.mk
67
67
- echo 'COMMON_PATH=./common/output' >> depends.mk
68
68
- echo 'LEVELDB_PATH=./thirdparty' >> depends.mk
69
+ - echo 'STD_FLAG=c++11' >> depends.mk
69
70
70
71
script : make -j4 && make check && make test
71
72
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ LDFLAGS = -L$(PBRPC_PATH)/lib -lsofa-pbrpc \
25
25
SO_LDFLAGS += -rdynamic $(DEPS_LDPATH ) $(SO_DEPS_LDFLAGS ) -lpthread -lrt -lz -ldl \
26
26
-shared -Wl,--version-script,so-version-script # hide symbol of thirdparty libs
27
27
28
- CXXFLAGS = -std=c++11 -Wall -fPIC $(OPT )
28
+ CXXFLAGS = -std=$( STD_FLAG ) -Wall -fPIC $(OPT )
29
29
FUSEFLAGS = -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -I$(FUSE_PATH ) /include
30
30
FUSE_LL_FLAGS = -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -I$(FUSE_LL_PATH ) /include
31
31
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ if [ ! -f "${FLAG_DIR}/snappy_1_1_1" ] \
68
68
|| [ ! -f " ${DEPS_PREFIX} /lib/libsnappy.a" ] \
69
69
|| [ ! -f " ${DEPS_PREFIX} /include/snappy.h" ]; then
70
70
cd snappy-1.1.1
71
+ autoreconf -ivf
71
72
./configure ${DEPS_CONFIG}
72
73
make -j4
73
74
make install
@@ -153,14 +154,32 @@ if [ ! -f "${FLAG_DIR}/gperftools_2_2_1" ] \
153
154
touch " ${FLAG_DIR} /gperftools_2_2_1"
154
155
fi
155
156
157
+ # test c++11
158
+ set +e
159
+ if test -z " $CXX " ; then
160
+ CXX=g++
161
+ fi
162
+
163
+ $CXX --std=c++11 -x c++ - -o teststd.out 2> /dev/null << EOF
164
+ int main() {}
165
+ EOF
166
+
167
+ if [ " $? " = 0 ]; then
168
+ STD_FLAG=c++11
169
+ fi
170
+ rm -rf teststd.out
171
+ set -e
172
+
156
173
# common
157
174
if [ ! -f " ${FLAG_DIR} /common" ] \
158
175
|| [ ! -f " ${DEPS_PREFIX} /lib/libcommon.a" ]; then
159
176
rm -rf common
160
177
git clone -b cpp11 https://github.com/baidu/common
161
178
cd common
162
179
sed -i ' s/^PREFIX=.*/PREFIX=..\/..\/thirdparty/' config.mk
163
- sed -i ' /^INCLUDE_PATH=*/s/$/ -I..\/..\/thirdparty\/boost_1_57_0/g' Makefile
180
+ if test -z " $STD_FLAG " ; then
181
+ sed -i ' s/-std=c++11/-std=c++0x/g' Makefile
182
+ fi
164
183
make -j4
165
184
make install
166
185
cd -
@@ -185,6 +204,12 @@ echo "GTEST_PATH=./thirdparty" >> depends.mk
185
204
echo " COMMON_PATH=./thirdparty" >> depends.mk
186
205
echo " TCMALLOC_PATH=./thirdparty" >> depends.mk
187
206
207
+ if test -z " $STD_FLAG " ; then
208
+ echo " STD_FLAG=c++0x" >> depends.mk
209
+ else
210
+ echo " STD_FLAG=c++11" >> depends.mk
211
+ fi
212
+
188
213
# #######################################
189
214
# build tera
190
215
# #######################################
You can’t perform that action at this time.
0 commit comments