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-02 00:34:00 +00:00
|
|
|
-H --with-hadoop
|
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
|
2012-08-16 18:39:22 +00:00
|
|
|
-n use libnss
|
2012-09-01 17:26:41 +00:00
|
|
|
-j with java
|
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
|
2012-03-27 17:41:40 +00:00
|
|
|
CONFIGURE_FLAGS=""
|
2012-09-01 17:26:41 +00:00
|
|
|
while getopts "d:e:hHTPjpnvO:" 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";;
|
|
|
|
|
2012-08-16 18:39:22 +00:00
|
|
|
n) CONFIGURE_FLAGS="$CONFIGURE_FLAGS --with-nss --without-cryptopp";;
|
|
|
|
|
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
|
|
|
H) CONFIGURE_FLAGS="$CONFIGURE_FLAGS --with-hadoop";;
|
|
|
|
|
|
|
|
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";;
|
|
|
|
|
2011-02-03 14:50:32 +00:00
|
|
|
v) verbose=1;;
|
|
|
|
|
2012-02-02 00:34:00 +00:00
|
|
|
e) encode_dump=$OPTARG;;
|
|
|
|
|
2011-02-03 14:50:32 +00:00
|
|
|
*)
|
|
|
|
echo
|
|
|
|
usage
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
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-08-20 09:37:51 +00:00
|
|
|
if [ "${CXX}" -ne "clang++" ]; then
|
|
|
|
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 \
|
2012-05-18 03:11:41 +00:00
|
|
|
--with-debug $with_profiler --with-cryptopp --with-radosgw \
|
2012-02-23 17:44:05 +00:00
|
|
|
$CONFIGURE_FLAGS \
|
2011-02-03 14:50:32 +00:00
|
|
|
|| die "configure failed"
|