5 # $Date: 2010/04/14 08:59:02 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
28 CFLAGS="$CFLAGS -ggdb3 -W -Wall"
29 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
37 CFLAGS="$CFLAGS -I/usr/local/include"
38 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
39 LDFLAGS="$LDFLAGS -L/usr/local/lib"
41 if [ "$sys" = "Linux" ]
48 if [ "$sys" = "FreeBSD" ]
62 if [ "$OS" = "unknown" ]
64 printf "################################################################################\n"
65 printf "# Sorry, but sgauthstress currently supported by Linux, FreeBSD 4.x-8.x #\n"
66 printf "################################################################################\n"
70 printf "#############################################################################\n"
71 printf " Building sgauthstress for $sys $release\n"
72 printf "#############################################################################\n"
82 if [ "$OS" = "linux" ]
89 DEFS="$DEFS -DFREE_BSD"
92 DEFS="$DEFS -DFREE_BSD5"
112 printf "Checking CC... "
113 $CC --version > /dev/null 2> /dev/null
117 printf "$CC not found\n"
121 printf "Checking CXX... "
122 $CXX --version > /dev/null 2> /dev/null
126 printf "$CXX not found\n"
131 printf "Checking endianess... "
132 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
133 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
137 printf "Endianess checking failed\n"
144 CXXFLAGS="$CXXFLAGS -DARCH_LE"
145 CFLAGS="$CFLAGS -DARCH_LE"
146 printf "Little Endian\n"
149 CXXFLAGS="$CXXFLAGS -DARCH_BE"
150 CFLAGS="$CFLAGS -DARCH_BE"
151 printf "Big Endian\n"
157 printf "Checking for -lfbclient... "
158 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
169 printf "Checking for mysql_config... "
170 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
174 printf "Checking for -lmysqlclient... "
175 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
181 CHECK_MYSQLCLIENT=yes
187 printf "Checking for mysql_config --cflags... "
188 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
194 printf "[$MYSQL_CFLAGS]\n"
195 printf "Checking for mysql_config --libs_r... "
196 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
202 CHECK_MYSQLCLIENT=yes
203 printf "[$MYSQL_LDFLAGS]\n"
208 printf "Checking for pg_config... "
209 PG_VERSION=`pg_config --version 2> /dev/null`
213 printf "Checking for -lpq... "
214 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
226 printf "Checking for pg_config --includedir... "
227 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
233 printf "[$PG_CFLAGS]\n"
234 printf "Checking for pg_config --libdir... "
235 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
242 printf "[$PG_LDFLAGS]\n"
249 if [ "$CHECK_FBCLIENT" = "yes" ]
257 if [ "$CHECK_PQ" = "yes" ]
263 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
269 printf "OS=$OS\n" > $CONFFILE
270 printf "STG_TIME=yes\n" >> $CONFFILE
271 printf "DEBUG=$DEBUG\n" >> $CONFFILE
272 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
273 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
274 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
275 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
276 printf "DIR_MOD=\$(DIR_BUILD)/../stargazer/modules\n" >> $CONFFILE
277 printf "DIR_PLUGINS=\$(DIR_BUILD)/../stargazer/plugins\n" >> $CONFFILE
278 printf "ARCH=$ARCH\n" >> $CONFFILE
279 printf "DEFS=$DEFS\n" >> $CONFFILE
280 printf "STG_LIBS=" >> $CONFFILE
283 printf "$lib " >> $CONFFILE
285 printf "\n" >> $CONFFILE
286 printf "PLUGINS=" >> $CONFFILE
287 for plugin in $PLUGINS
289 printf "$plugin " >> $CONFFILE
291 printf "\n" >> $CONFFILE
292 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
293 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
294 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
295 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
296 printf "PREFIX=$PREFIX\n" >> $CONFFILE
297 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
298 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
299 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
300 printf "OWNER=$OWNER\n" >> $CONFFILE
302 if [ "$1" != "debug" ]
306 printf "\n\n\nDebug build. Type $MAKE explicitly\n"