5 # $Date: 2010/04/14 08:58:44 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
22 MAKEOPTS="$MAKEOPTS -j1"
23 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
30 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
31 LDFLAGS="$LDFLAGS -L/usr/local/lib"
33 if [ "$sys" = "Linux" ]
40 if [ "$sys" = "FreeBSD" ]
52 if [ "$OS" = "unknown" ]
54 printf "#############################################################################\n"
55 printf "# Sorry, but rlm_stg currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #\n"
56 printf "#############################################################################\n"
60 printf "#############################################################################\n"
61 printf " Building rlm_stg for $sys $release\n"
62 printf "#############################################################################\n"
64 STG_LIBS="crypto.lib common.lib json.lib"
66 if [ "$OS" = "linux" ]
74 DEFS="$DEFS -DFREE_BSD"
76 DEFS="$DEFS -DFREE_BSD5"
84 CXXFLAGS="$CXXFLAGS -DHAVE_CLOSEFROM"
97 printf "Checking CC... "
98 $CC --version > /dev/null 2> /dev/null
102 printf "$CC not found\n"
106 printf "Checking CXX... "
107 $CXX --version > /dev/null 2> /dev/null
111 printf "$CXX not found\n"
116 printf "Checking endianess... "
117 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
118 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
122 printf "Endianess checking failed\n"
129 CXXFLAGS="$CXXFLAGS -DARCH_LE"
130 CFLAGS="$CFLAGS -DARCH_LE"
131 printf "Little Endian\n"
134 CXXFLAGS="$CXXFLAGS -DARCH_BE"
135 CFLAGS="$CFLAGS -DARCH_BE"
136 printf "Big Endian\n"
141 printf "Checking for iconv 2nd argument... "
142 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
143 $CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
148 DEFS="$DEFS -DCONST_ICONV"
153 printf "Checking for -lyajl... "
154 pkg-config --version > /dev/null 2> /dev/null
157 pkg-config --atleast-version=2.0.0 yajl
165 printf `pkg-config --modversion yajl`"\n"
168 printf "#include <stdio.h>\n" > build_check.c
169 printf "#include <yajl/yajl_version.h>\n" >> build_check.c
170 printf "int main() { printf(\"%%d\", yajl_version()); return 0; }\n" >> build_check.c
171 $CC $CFLAGS $LDFLAGS build_check.c -lyajl -o fake > /dev/null 2> /dev/null
178 YAJL_VERSION=`./fake`
179 if [ $YAJL_VERSION -ge 20000 ]
182 printf "${YAJL_VERSION}\n"
185 printf "no. Need at least version 2.0.0, existing version is ${YAJL_VERSION}\n"
192 printf "Checking for boost::scoped_ptr... "
193 printf "#include <boost/scoped_ptr.hpp>\nint main() { boost::scoped_ptr<int> test(new int(1)); return 0; }\n" > build_check.cpp
194 $CXX $CXXFLAGS $LDFLAGS build_check.cpp -o fake # > /dev/null 2> /dev/null
197 CHECK_BOOST_SCOPED_PTR=no
201 CHECK_BOOST_SCOPED_PTR=yes
207 rm -f build_check.cpp
209 if [ "$CHECK_YAJL" = "yes" -a "$CHECK_BOOST_SCOPED_PTR" = "yes" ]
215 printf "OS=$OS\n" > $CONFFILE
216 printf "STG_TIME=yes\n" >> $CONFFILE
217 printf "DEBUG=$DEBUG\n" >> $CONFFILE
218 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
219 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
220 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
221 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
222 printf "ARCH=$ARCH\n" >> $CONFFILE
223 printf "DEFS=$DEFS\n" >> $CONFFILE
224 printf "STG_LIBS=" >> $CONFFILE
227 printf "$lib " >> $CONFFILE
229 printf "\n" >> $CONFFILE
230 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
231 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
232 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
233 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
234 printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
235 printf "PREFIX=$PREFIX\n" >> $CONFFILE
236 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
237 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
238 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
239 printf "OWNER=$OWNER\n" >> $CONFFILE
241 if [ "$1" != "debug" ]
245 printf "\n\n\nDebug build. Type $MAKE explicitly\n"