X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8569ecdc2c9368dc0fe650b901cce7b37337ffec..8c6fa3fbaccc22127280bf77a48fab5a3ee0716e:/projects/rlm_stg/build?ds=inline diff --git a/projects/rlm_stg/build b/projects/rlm_stg/build index 6459cdb9..8d63ae64 100755 --- a/projects/rlm_stg/build +++ b/projects/rlm_stg/build @@ -20,6 +20,7 @@ if [ "$1" = "debug" ] then DEFS="$DEFS -DDEBUG" MAKEOPTS="$MAKEOPTS -j1" + CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra" CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra" DEBUG="yes" else @@ -27,6 +28,7 @@ else DEBUG="no" fi +CFLAGS="$CFLAGS -I/usr/local/include" CXXFLAGS="$CXXFLAGS -I/usr/local/include" LDFLAGS="$LDFLAGS -L/usr/local/lib" @@ -44,15 +46,13 @@ then 5) OS=bsd5;; 6) OS=bsd5;; 7) OS=bsd7;; - 8) OS=bsd7;; - 9) OS=bsd7;; - *) OS=unknown;; + *) OS=bsd7;; esac MAKE="gmake" fi if [ "$OS" = "unknown" ] -then +then printf "#############################################################################\n" printf "# Sorry, but rlm_stg currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #\n" printf "#############################################################################\n" @@ -63,13 +63,14 @@ printf "######################################################################## printf " Building rlm_stg for $sys $release\n" printf "#############################################################################\n" -STG_LIBS="crypto.lib common.lib" +STG_LIBS="crypto.lib common.lib json.lib" if [ "$OS" = "linux" ] then DEFS="$DEFS -DLINUX" LIB_THREAD=-lpthread else + LIBICONV="-liconv" if [ "$OS" = "bsd" ] then DEFS="$DEFS -DFREE_BSD" @@ -139,6 +140,80 @@ else fi rm -f fake +printf "Checking for iconv 2nd argument... " +printf "#include \nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c +$CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null +if [ $? != 0 ] +then + printf "non-const\n" +else + DEFS="$DEFS -DCONST_ICONV" + printf "const\n" +fi +rm -f fake + +printf "Checking for -lyajl... " +pkg-config --version > /dev/null 2> /dev/null +if [ "$?" = "0" ] +then + pkg-config --atleast-version=2.0.0 yajl + if [ "$?" != "0" ] + then + CHECK_YAJL=no + printf "no\n" + exit; + else + CHECK_YAJL=yes + printf `pkg-config --modversion yajl`"\n" + fi +else + printf "#include \n" > build_check.c + printf "#include \n" >> build_check.c + printf "int main() { printf(\"%%d\", yajl_version()); return 0; }\n" >> build_check.c + $CC $CFLAGS $LDFLAGS build_check.c -lyajl -o fake > /dev/null 2> /dev/null + if [ $? != 0 ] + then + CHECK_YAJL=no + printf "no\n" + exit; + else + YAJL_VERSION=`./fake` + if [ $YAJL_VERSION -ge 20000 ] + then + CHECK_YAJL=yes + printf "${YAJL_VERSION}\n" + else + CHECK_YAJL=no + printf "no. Need at least version 2.0.0, existing version is ${YAJL_VERSION}\n" + exit; + fi + fi + rm -f fake +fi + +printf "Checking for boost::scoped_ptr... " +printf "#include \nint main() { boost::scoped_ptr test(new int(1)); return 0; }\n" > build_check.cpp +$CXX $CXXFLAGS $LDFLAGS build_check.cpp -o fake # > /dev/null 2> /dev/null +if [ $? != 0 ] +then + CHECK_BOOST_SCOPED_PTR=no + printf "no\n" + exit; +else + CHECK_BOOST_SCOPED_PTR=yes + printf "yes\n" +fi +rm -f fake + +rm -f build_check.c +rm -f build_check.cpp + +if [ "$CHECK_YAJL" = "yes" -a "$CHECK_BOOST_SCOPED_PTR" = "yes" ] +then + STG_LIBS="$STG_LIBS + json.lib" +fi + printf "OS=$OS\n" > $CONFFILE printf "STG_TIME=yes\n" >> $CONFFILE printf "DEBUG=$DEBUG\n" >> $CONFFILE @@ -154,14 +229,22 @@ do printf "$lib " >> $CONFFILE done printf "\n" >> $CONFFILE +printf "CC=$CC\n" >> $CONFFILE +printf "CXX=$CXX\n" >> $CONFFILE printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE printf "CFLAGS=$CFLAGS\n" >> $CONFFILE printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE +printf "LIBICONV=$LIBICONV\n" >> $CONFFILE printf "PREFIX=$PREFIX\n" >> $CONFFILE printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE printf "OWNER=$OWNER\n" >> $CONFFILE -$MAKE $MAKEOPTS +if [ "$1" != "debug" ] +then + $MAKE $MAKEOPTS +else + printf "\n\n\nDebug build. Type $MAKE explicitly\n" +fi