5 # $Date: 2010/04/14 08:59:02 $
6 ######################################################
11 major=`printf "%s" "$release" | cut -d. -f1`
13 CONFFILE="../../Makefile.conf"
23 MAKEOPTS="$MAKEOPTS -j1"
24 CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
25 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
32 CFLAGS="$CFLAGS -I/usr/local/include"
33 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
34 LDFLAGS="$LDFLAGS -L/usr/local/lib"
36 if [ "$sys" = "Linux" ]
42 if [ "$sys" = "FreeBSD" ]
54 if [ "$sys" = "Darwin" ]
57 ETC_DIR="./inst/freebsd/etc/stargazer"
59 CFLAGS="$CFLAGS -I/opt/local/include"
60 CXXFLAGS="$CFLAGS -I/opt/local/include"
61 LDFLAGS="$LDFLAGS -L/opt/local/lib"
64 if [ "$OS" = "unknown" ]
66 printf "################################################################################\n"
67 printf "# Sorry, but sgauthstress is currently supported by Linux, FreeBSD and Darwin. #\n"
68 printf "################################################################################\n"
72 printf "#############################################################################\n"
73 printf " Building sgauthstress for $sys $release\n"
74 printf "#############################################################################\n"
84 if [ "$OS" = "linux" ]
92 DEFS="$DEFS -DFREE_BSD"
97 DEFS="$DEFS -DFREE_BSD5"
100 if [ "$OS" == "darwin" ]
102 DEFS="$DEFS -DDARWIN"
131 printf "Checking CC... "
132 $CC --version > /dev/null 2> /dev/null
136 printf "$CC not found\n"
140 printf "Checking CXX... "
141 $CXX --version > /dev/null 2> /dev/null
145 printf "$CXX not found\n"
149 printf "Checking AR... "
150 $AR --version > /dev/null 2> /dev/null
154 printf "$AR not found\n"
158 printf "Checking RANLIB... "
159 $RANLIB --version > /dev/null 2> /dev/null
163 printf "$RANLIB not found\n"
168 printf "Checking endianess... "
169 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
170 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
174 printf "Endianess checking failed\n"
181 CXXFLAGS="$CXXFLAGS -DARCH_LE"
182 CFLAGS="$CFLAGS -DARCH_LE"
183 printf "Little Endian\n"
186 CXXFLAGS="$CXXFLAGS -DARCH_BE"
187 CFLAGS="$CFLAGS -DARCH_BE"
188 printf "Big Endian\n"
193 printf "Checking for iconv 2nd argument... "
194 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
195 $CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
200 DEFS="$DEFS -DCONST_ICONV"
207 printf "Checking for fb_config... "
208 FB_VERSION=`fb_config --version 2> /dev/null`
212 printf "Checking for -lfbclient... "
213 printf "int main() { return 0; }\n" > build_check.c
214 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
221 FB_LDFLAGS="-lfbclient"
228 printf "Checking for fb_config --cflags... "
229 FB_CFLAGS=`fb_config --cflags`
235 printf "[$FB_CFLAGS]\n"
236 printf "Checking for fb_config --libs "
237 FB_LDFLAGS=`fb_config --libs`
244 printf "[$FB_LDFLAGS]\n"
249 printf "Checking for mysql_config... "
250 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
254 printf "Checking for -lmysqlclient... "
255 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
261 CHECK_MYSQLCLIENT=yes
267 printf "Checking for mysql_config --cflags... "
268 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
274 printf "[$MYSQL_CFLAGS]\n"
275 printf "Checking for mysql_config --libs_r... "
276 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
282 CHECK_MYSQLCLIENT=yes
283 printf "[$MYSQL_LDFLAGS]\n"
288 printf "Checking for pg_config... "
289 printf "#include <libpq-fe.h>\nint main() { return 0; }\n" > build_check.c
290 PG_VERSION=`pg_config --version 2> /dev/null`
294 printf "Checking for -lpq... "
295 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
307 printf "Checking for pg_config --includedir... "
308 PG_CFLAGS="-I"`pg_config --includedir 2> /dev/null`
314 printf "[$PG_CFLAGS]\n"
315 printf "Checking for pg_config --libdir... "
316 PG_LDFLAGS="-L"`pg_config --libdir 2> /dev/null`
323 printf "[$PG_LDFLAGS]\n"
330 if [ "$CHECK_FBCLIENT" = "yes" ]
338 if [ "$CHECK_PQ" = "yes" ]
344 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
350 printf "OS=$OS\n" > $CONFFILE
351 printf "STG_TIME=yes\n" >> $CONFFILE
352 printf "DEBUG=$DEBUG\n" >> $CONFFILE
353 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
354 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
355 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
356 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
357 printf "DIR_MOD=\$(DIR_BUILD)/../stargazer/modules\n" >> $CONFFILE
358 printf "DIR_PLUGINS=\$(DIR_BUILD)/../stargazer/plugins\n" >> $CONFFILE
359 printf "ARCH=$ARCH\n" >> $CONFFILE
360 printf "CHECK_FBCLIENT=$CHECK_FBCLIENT\n" >> $CONFFILE
361 if [ "$CHECK_FBCLIENT" = "yes" ]
363 printf "FB_CFLAGS=$FB_CFLAGS\n" >> $CONFFILE
364 printf "FB_LDFLAGS=$FB_LDFLAGS\n" >> $CONFFILE
366 printf "CHECK_MYSQLCLIENT=$CHECK_MYSQLCLIENT\n" >> $CONFFILE
367 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
369 printf "MYSQL_CFLAGS=$MYSQL_CFLAGS\n" >> $CONFFILE
370 printf "MYSQL_LDFLAGS=$MYSQL_LDFLAGS\n" >> $CONFFILE
372 printf "CHECK_PQ=$CHECK_PQ\n" >> $CONFFILE
373 if [ "$CHECK_PQ" = "yes" ]
375 printf "PG_CFLAGS=$PG_CFLAGS\n" >> $CONFFILE
376 printf "PG_LDFLAGS=$PG_LDFLAGS\n" >> $CONFFILE
378 printf "DEFS=$DEFS\n" >> $CONFFILE
379 printf "STG_LIBS=" >> $CONFFILE
382 printf "$lib " >> $CONFFILE
384 printf "\n" >> $CONFFILE
385 printf "PLUGINS=" >> $CONFFILE
386 for plugin in $PLUGINS
388 printf "$plugin " >> $CONFFILE
390 printf "\n" >> $CONFFILE
391 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
392 printf "CC=$CC\n" >> $CONFFILE
393 printf "CXX=$CXX\n" >> $CONFFILE
394 printf "AR=$AR\n" >> $CONFFILE
395 printf "RANLIB=$RANLIB\n" >> $CONFFILE
396 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
397 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
398 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
399 printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
400 printf "PREFIX=$PREFIX\n" >> $CONFFILE
401 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
402 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
403 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
404 printf "OWNER=$OWNER\n" >> $CONFFILE
406 if [ "$1" != "debug" ]
410 printf "\n\n\nDebug build. Type $MAKE explicitly\n"