5 # $Date: 2010/04/14 08:58:44 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
22 MAKEOPTS="$MAKEOPTS -j1"
23 CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
24 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
31 CFLAGS="$CFLAGS -I/usr/local/include"
32 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
33 LDFLAGS="$LDFLAGS -L/usr/local/lib"
35 if [ "$sys" = "Linux" ]
42 if [ "$sys" = "FreeBSD" ]
54 if [ "$OS" = "unknown" ]
56 printf "#############################################################################\n"
57 printf "# Sorry, but rlm_stg currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #\n"
58 printf "#############################################################################\n"
62 printf "#############################################################################\n"
63 printf " Building rlm_stg for $sys $release\n"
64 printf "#############################################################################\n"
66 STG_LIBS="crypto.lib common.lib json.lib"
68 if [ "$OS" = "linux" ]
76 DEFS="$DEFS -DFREE_BSD"
78 DEFS="$DEFS -DFREE_BSD5"
86 CXXFLAGS="$CXXFLAGS -DHAVE_CLOSEFROM"
99 printf "Checking CC... "
100 $CC --version > /dev/null 2> /dev/null
104 printf "$CC not found\n"
108 printf "Checking CXX... "
109 $CXX --version > /dev/null 2> /dev/null
113 printf "$CXX not found\n"
118 printf "Checking endianess... "
119 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
120 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
124 printf "Endianess checking failed\n"
131 CXXFLAGS="$CXXFLAGS -DARCH_LE"
132 CFLAGS="$CFLAGS -DARCH_LE"
133 printf "Little Endian\n"
136 CXXFLAGS="$CXXFLAGS -DARCH_BE"
137 CFLAGS="$CFLAGS -DARCH_BE"
138 printf "Big Endian\n"
143 printf "Checking for iconv 2nd argument... "
144 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
145 $CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
150 DEFS="$DEFS -DCONST_ICONV"
155 printf "Checking for -lyajl... "
156 pkg-config --version > /dev/null 2> /dev/null
159 pkg-config --atleast-version=2.0.0 yajl
167 printf `pkg-config --modversion yajl`"\n"
170 printf "#include <stdio.h>\n" > build_check.c
171 printf "#include <yajl/yajl_version.h>\n" >> build_check.c
172 printf "int main() { printf(\"%%d\", yajl_version()); return 0; }\n" >> build_check.c
173 $CC $CFLAGS $LDFLAGS build_check.c -lyajl -o fake > /dev/null 2> /dev/null
180 YAJL_VERSION=`./fake`
181 if [ $YAJL_VERSION -ge 20000 ]
184 printf "${YAJL_VERSION}\n"
187 printf "no. Need at least version 2.0.0, existing version is ${YAJL_VERSION}\n"
194 printf "Checking for boost::scoped_ptr... "
195 printf "#include <boost/scoped_ptr.hpp>\nint main() { boost::scoped_ptr<int> test(new int(1)); return 0; }\n" > build_check.cpp
196 $CXX $CXXFLAGS $LDFLAGS build_check.cpp -o fake # > /dev/null 2> /dev/null
199 CHECK_BOOST_SCOPED_PTR=no
203 CHECK_BOOST_SCOPED_PTR=yes
209 rm -f build_check.cpp
211 if [ "$CHECK_YAJL" = "yes" -a "$CHECK_BOOST_SCOPED_PTR" = "yes" ]
217 printf "OS=$OS\n" > $CONFFILE
218 printf "STG_TIME=yes\n" >> $CONFFILE
219 printf "DEBUG=$DEBUG\n" >> $CONFFILE
220 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
221 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
222 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
223 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
224 printf "ARCH=$ARCH\n" >> $CONFFILE
225 printf "DEFS=$DEFS\n" >> $CONFFILE
226 printf "STG_LIBS=" >> $CONFFILE
229 printf "$lib " >> $CONFFILE
231 printf "\n" >> $CONFFILE
232 printf "CC=$CC\n" >> $CONFFILE
233 printf "CXX=$CXX\n" >> $CONFFILE
234 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
235 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
236 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
237 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
238 printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
239 printf "PREFIX=$PREFIX\n" >> $CONFFILE
240 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
241 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
242 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
243 printf "OWNER=$OWNER\n" >> $CONFFILE
245 if [ "$1" != "debug" ]
249 printf "\n\n\nDebug build. Type $MAKE explicitly\n"