5 # $Date: 2010/04/14 08:58:43 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
18 VAR_DIR="./inst/var/stargazer"
23 MAKEOPTS="$MAKEOPTS -j1"
24 CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
25 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
32 CFLAGS="$CFLAGS -ggdb3 -W -Wall -I/usr/local/include"
33 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -I/usr/local/include"
34 LDFLAGS="$LDFLAGS -L/usr/local/lib"
36 if [ "$sys" = "Linux" ]
43 if [ "$sys" = "FreeBSD" ]
55 if [ "$sys" = "Darwin" ]
58 ETC_DIR="./inst/freebsd/etc/stargazer"
62 if [ "$OS" = "unknown" ]
64 printf "#############################################################################\n"
65 printf "# Sorry, but sgconv currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #\n"
66 printf "#############################################################################\n"
70 printf "#############################################################################\n"
71 printf " Building sgconv for $sys $release\n"
72 printf "#############################################################################\n"
83 if [ "$OS" = "linux" ]
90 DEFS="$DEFS -DFREE_BSD"
95 DEFS="$DEFS -DFREE_BSD5"
98 if [ "$OS" == "darwin" ]
100 DEFS="$DEFS -DDARWIN"
119 printf "Checking CC... "
120 $CC --version > /dev/null 2> /dev/null
124 printf "$CC not found\n"
128 printf "Checking CXX... "
129 $CXX --version > /dev/null 2> /dev/null
133 printf "$CXX not found\n"
138 printf "Checking endianess... "
139 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
140 $CC $CFLAGS $LDFLAGS -L/usr/lib/mysql -L/usr/local/lib/mysql build_check.c -o fake > /dev/null 2> /dev/null
144 printf "Endianess checking failed\n"
151 CXXFLAGS="$CXXFLAGS -DARCH_LE"
152 CFLAGS="$CFLAGS -DARCH_LE"
153 printf "Little Endian\n"
156 CXXFLAGS="$CXXFLAGS -DARCH_BE"
157 CFLAGS="$CFLAGS -DARCH_BE"
158 printf "Big Endian\n"
163 printf "Checking for -lfbclient... "
164 $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
175 printf "Checking for mysql_config... "
176 printf "#include <mysql.h>\nint main() { return 0; }\n" > build_check.c
177 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
181 printf "Checking for -lmysqlclient... "
182 $CC $CFLAGS $LDFLAGS build_check.c -lmysqlclient_r $LIB_THREAD -o fake > /dev/null 2> /dev/null
188 CHECK_MYSQLCLIENT=yes
194 printf "Checking for mysql_config --cflags... "
195 MYSQL_CFLAGS=`mysql_config --cflags 2> /dev/null`
201 printf "[$MYSQL_CFLAGS]\n"
202 printf "Checking for mysql_config --libs_r... "
203 MYSQL_LDFLAGS=`mysql_config --libs_r 2> /dev/null`
209 CHECK_MYSQLCLIENT=yes
210 printf "[$MYSQL_LDFLAGS]\n"
215 printf "Checking for pg_config... "
216 printf "#include <libpq-fe.h>\nint main() { return 0; }\n" > build_check.c
217 PG_VERSION=`pg_config --version 2> /dev/null`
221 printf "Checking for -lpq... "
222 $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
234 printf "Checking for pg_config --includedir... "
235 PG_CFLAGS=`pg_config --includedir 2> /dev/null`
241 printf "[$PG_CFLAGS]\n"
242 printf "Checking for pg_config --libdir... "
243 PG_LDFLAGS=`pg_config --libdir 2> /dev/null`
250 printf "[$PG_LDFLAGS]\n"
257 if [ "$CHECK_FBCLIENT" = "yes" ]
265 if [ "$CHECK_PQ" = "yes" ]
271 if [ "$CHECK_MYSQLCLIENT" = "yes" ]
277 printf "OS=$OS\n" > $CONFFILE
278 printf "STG_TIME=yes\n" >> $CONFFILE
279 printf "DEBUG=$DEBUG\n" >> $CONFFILE
280 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
281 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
282 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
283 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
284 printf "DIR_MOD=\$(DIR_BUILD)/../stargazer/modules\n" >> $CONFFILE
285 printf "DIR_PLUGINS=\$(DIR_BUILD)/../stargazer/plugins\n" >> $CONFFILE
286 printf "ARCH=$ARCH\n" >> $CONFFILE
287 printf "CHECK_FBCLIENT=$CHECK_FBCLIENT\n" >> $CONFFILE
288 printf "DEFS=$DEFS\n" >> $CONFFILE
289 printf "STG_LIBS=" >> $CONFFILE
292 printf "$lib " >> $CONFFILE
294 printf "\n" >> $CONFFILE
295 printf "PLUGINS=" >> $CONFFILE
296 for plugin in $PLUGINS
298 printf "$plugin " >> $CONFFILE
300 printf "\n" >> $CONFFILE
301 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
302 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
303 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
304 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
305 printf "PREFIX=$PREFIX\n" >> $CONFFILE
306 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
307 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
308 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
309 printf "OWNER=$OWNER\n" >> $CONFFILE
310 printf "VAR_DIR=$VAR_DIR\n" >> $CONFFILE
312 mkdir -p ../stargazer/modules
314 if [ "$1" != "debug" ]
318 printf "\n\n\nDebug build. Type $MAKE explicitly\n"