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" ]
91 DEFS="$DEFS -DFREE_BSD"
94 DEFS="$DEFS -DFREE_BSD5"
114 printf "Checking CC... "
115 $CC --version > /dev/null 2> /dev/null
119 printf "$CC not found\n"
123 printf "Checking CXX... "
124 $CXX --version > /dev/null 2> /dev/null
128 printf "$CXX not found\n"
133 printf "Checking endianess... "
134 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
135 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
139 printf "Endianess checking failed\n"
146 CXXFLAGS="$CXXFLAGS -DARCH_LE"
147 CFLAGS="$CFLAGS -DARCH_LE"
148 printf "Little Endian\n"
151 CXXFLAGS="$CXXFLAGS -DARCH_BE"
152 CFLAGS="$CFLAGS -DARCH_BE"
153 printf "Big Endian\n"
159 printf "Checking for -lfbclient... "
160 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
171 printf "Checking for mysql_config... "
172 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
176 printf "Checking for -lmysqlclient... "
177 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
183 CHECK_MYSQLCLIENT=yes
189 printf "Checking for mysql_config --cflags... "
190 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
196 printf "[$MYSQL_CFLAGS]\n"
197 printf "Checking for mysql_config --libs_r... "
198 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
204 CHECK_MYSQLCLIENT=yes
205 printf "[$MYSQL_LDFLAGS]\n"
210 printf "Checking for pg_config... "
211 PG_VERSION=`pg_config --version 2> /dev/null`
215 printf "Checking for -lpq... "
216 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
228 printf "Checking for pg_config --includedir... "
229 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
235 printf "[$PG_CFLAGS]\n"
236 printf "Checking for pg_config --libdir... "
237 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
244 printf "[$PG_LDFLAGS]\n"
251 if [ "$CHECK_FBCLIENT" = "yes" ]
259 if [ "$CHECK_PQ" = "yes" ]
265 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
271 printf "OS=$OS\n" > $CONFFILE
272 printf "STG_TIME=yes\n" >> $CONFFILE
273 printf "DEBUG=$DEBUG\n" >> $CONFFILE
274 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
275 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
276 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
277 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
278 printf "DIR_MOD=\$(DIR_BUILD)/../stargazer/modules\n" >> $CONFFILE
279 printf "DIR_PLUGINS=\$(DIR_BUILD)/../stargazer/plugins\n" >> $CONFFILE
280 printf "ARCH=$ARCH\n" >> $CONFFILE
281 printf "DEFS=$DEFS\n" >> $CONFFILE
282 printf "STG_LIBS=" >> $CONFFILE
285 printf "$lib " >> $CONFFILE
287 printf "\n" >> $CONFFILE
288 printf "PLUGINS=" >> $CONFFILE
289 for plugin in $PLUGINS
291 printf "$plugin " >> $CONFFILE
293 printf "\n" >> $CONFFILE
294 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
295 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
296 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
297 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
298 printf "PREFIX=$PREFIX\n" >> $CONFFILE
299 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
300 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
301 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
302 printf "OWNER=$OWNER\n" >> $CONFFILE
304 if [ "$1" != "debug" ]
308 printf "\n\n\nDebug build. Type $MAKE explicitly\n"