2011-02-03 14:50:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
cat <<EOF
|
|
|
|
do_autogen.sh: make a ceph build by running autogen, etc.
|
|
|
|
|
|
|
|
-h: this help message
|
|
|
|
-d <level> debug build
|
|
|
|
level 0: no debug
|
|
|
|
level 1: -g
|
|
|
|
level 3: -Wextra
|
|
|
|
level 4: even more...
|
2012-02-23 17:44:05 +00:00
|
|
|
-T --without-tcmalloc
|
2012-02-02 00:34:00 +00:00
|
|
|
-e <path> dump encoded objects to <path>
|
2011-03-04 17:30:13 +00:00
|
|
|
-P profiling build
|
2012-08-16 18:05:44 +00:00
|
|
|
-p google profiler
|
2012-03-27 17:41:40 +00:00
|
|
|
-O <level> optimize
|
2014-10-21 06:44:43 +00:00
|
|
|
-c use cryptopp
|
2015-08-03 13:05:18 +00:00
|
|
|
-C <parameter> add parameters to configure
|
2012-09-01 17:26:41 +00:00
|
|
|
-j with java
|
2015-08-27 18:21:23 +00:00
|
|
|
-R without rocksdb
|
2014-12-15 05:52:29 +00:00
|
|
|
-J --with-jemalloc
|
2015-04-10 14:05:20 +00:00
|
|
|
-L --without-lttng
|
2011-02-03 14:50:32 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
die() {
|
|
|
|
echo $@
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
debug_level=0
|
|
|
|
verbose=0
|
2011-03-04 17:30:13 +00:00
|
|
|
profile=0
|
2015-08-27 18:21:23 +00:00
|
|
|
rocksdb=1
|
2015-02-02 10:47:46 +00:00
|
|
|
CONFIGURE_FLAGS="--disable-static --with-lttng"
|
2015-08-03 13:03:47 +00:00
|
|
|
while getopts "d:e:hHrTPJLjpcvO:C:" flag
|
2011-02-03 14:50:32 +00:00
|
|
|
do
|
|
|
|
case $flag in
|
|
|
|
d) debug_level=$OPTARG;;
|
|
|
|
|
2012-03-27 17:41:40 +00:00
|
|
|
O) CFLAGS="${CFLAGS} -O$OPTARG";;
|
|
|
|
|
2014-10-21 06:44:43 +00:00
|
|
|
c) CONFIGURE_FLAGS="$CONFIGURE_FLAGS --with-cryptopp --without-nss";;
|
2012-08-16 18:39:22 +00:00
|
|
|
|
2015-08-03 13:03:47 +00:00
|
|
|
C) CONFIGURE_FLAGS="$CONFIGURE_FLAGS $OPTARG";;
|
|
|
|
|
2011-03-04 17:30:13 +00:00
|
|
|
P) profile=1;;
|
2012-08-16 18:05:44 +00:00
|
|
|
p) with_profiler="--with-profiler" ;;
|
2011-02-28 15:42:00 +00:00
|
|
|
|
2011-02-03 14:50:32 +00:00
|
|
|
h) usage
|
|
|
|
exit 0;;
|
|
|
|
|
2012-02-23 17:44:05 +00:00
|
|
|
T) CONFIGURE_FLAGS="$CONFIGURE_FLAGS --without-tcmalloc";;
|
2011-04-21 22:47:47 +00:00
|
|
|
|
2012-09-01 17:26:41 +00:00
|
|
|
j) CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-cephfs-java";;
|
|
|
|
|
2015-08-27 18:21:23 +00:00
|
|
|
R) rocksdb=0;;
|
2014-07-28 21:04:20 +00:00
|
|
|
|
2011-02-03 14:50:32 +00:00
|
|
|
v) verbose=1;;
|
|
|
|
|
2012-02-02 00:34:00 +00:00
|
|
|
e) encode_dump=$OPTARG;;
|
|
|
|
|
2014-12-15 05:52:29 +00:00
|
|
|
J) CONFIGURE_FLAGS="$CONFIGURE_FLAGS --with-jemalloc";;
|
|
|
|
|
2015-02-02 10:47:46 +00:00
|
|
|
L) CONFIGURE_FLAGS="$CONFIGURE_FLAGS --without-lttng";;
|
|
|
|
|
2011-02-03 14:50:32 +00:00
|
|
|
*)
|
|
|
|
echo
|
|
|
|
usage
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2015-08-27 18:21:23 +00:00
|
|
|
if [ $rocksdb -eq 1 ]; then
|
|
|
|
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --with-librocksdb-static"
|
|
|
|
fi
|
|
|
|
|
2011-03-04 17:30:13 +00:00
|
|
|
if [ $profile -eq 1 ]; then
|
|
|
|
if [ $debug_level -ne 0 ]; then
|
|
|
|
echo "Can't specify both -d and -P. Profiling builds are \
|
|
|
|
different than debug builds."
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-03-07 11:04:39 +00:00
|
|
|
CFLAGS="${CFLAGS} -fno-omit-frame-pointer -O2"
|
2012-08-16 18:07:41 +00:00
|
|
|
CXXFLAGS="${CXXFLAGS} -fno-omit-frame-pointer -O2"
|
2011-03-04 17:30:13 +00:00
|
|
|
debug_level=1
|
|
|
|
fi
|
|
|
|
|
2011-02-03 14:50:32 +00:00
|
|
|
if [ "${debug_level}" -ge 1 ]; then
|
|
|
|
CFLAGS="${CFLAGS} -g"
|
|
|
|
fi
|
|
|
|
if [ "${debug_level}" -ge 3 ]; then
|
|
|
|
CFLAGS="${CFLAGS} -Wextra \
|
|
|
|
-Wno-missing-field-initializers -Wno-missing-declarations"
|
|
|
|
fi
|
|
|
|
if [ "${debug_level}" -ge 4 ]; then
|
2013-12-19 12:40:06 +00:00
|
|
|
if [ "${CXX}" != "clang++" ]; then
|
2013-08-20 09:37:51 +00:00
|
|
|
CXXFLAGS="${CXXFLAGS} -Wstrict-null-sentinel -Woverloaded-virtual"
|
|
|
|
else
|
|
|
|
CXXFLAGS="${CXXFLAGS} -Woverloaded-virtual"
|
|
|
|
fi
|
2011-02-03 14:50:32 +00:00
|
|
|
CFLAGS="${CFLAGS} \
|
|
|
|
-Wuninitialized -Winit-self \
|
|
|
|
-Wformat=2 -Wunused -Wfloat-equal \
|
|
|
|
-Wundef -Wunsafe-loop-optimizations -Wpointer-arith -Wcast-qual \
|
|
|
|
-Wcast-align -Wwrite-strings -Wlogical-op \
|
|
|
|
-Wmissing-format-attribute -Wredundant-decls -Winvalid-pch"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${debug_level}" -ge 5 ]; then
|
|
|
|
CFLAGS="${CFLAGS} -Wswitch-enum -Wpacked"
|
|
|
|
fi
|
|
|
|
if [ "${debug_level}" -ge 2000 ]; then
|
|
|
|
CFLAGS="${CFLAGS} -Wsign-promo -Wconversion -Waggregate-return -Wlong-long"
|
|
|
|
CXXFLAGS="${CXXFLAGS} -Wold-style-cast"
|
|
|
|
fi
|
|
|
|
|
2012-02-02 00:34:00 +00:00
|
|
|
if [ -n "${encode_dump}" ]; then
|
|
|
|
CXXFLAGS="${CXXFLAGS} -DENCODE_DUMP=${encode_dump}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2011-02-03 14:50:32 +00:00
|
|
|
# Warning about unused parameters just leads to a lot of pointless spew when
|
|
|
|
# using C++. It doesn't interact well with class inheritance.
|
|
|
|
CFLAGS="${CFLAGS} -Wno-unused-parameter"
|
|
|
|
|
|
|
|
CXXFLAGS="${CXXFLAGS} ${CFLAGS}"
|
|
|
|
|
|
|
|
if [ "${verbose}" -ge 1 ]; then
|
|
|
|
echo "CFLAGS=${CFLAGS}"
|
|
|
|
echo "CXXFLAGS=${CFLAGS}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
export CFLAGS
|
|
|
|
export CXXFLAGS
|
|
|
|
|
|
|
|
./autogen.sh || die "autogen failed"
|
|
|
|
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr --sbindir=/sbin --localstatedir=/var --sysconfdir=/etc \
|
2015-01-26 23:50:27 +00:00
|
|
|
--with-debug $with_profiler --with-nss --without-cryptopp --with-radosgw \
|
2012-02-23 17:44:05 +00:00
|
|
|
$CONFIGURE_FLAGS \
|
2011-02-03 14:50:32 +00:00
|
|
|
|| die "configure failed"
|