5 # $Date: 2010/04/14 08:58:52 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
22 MAKEOPTS="$MAKEOPTS -j1"
23 CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
24 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
31 CFLAGS="$CFLAGS -I/usr/local/include"
32 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
33 LDFLAGS="$LDFLAGS -L/usr/local/lib"
35 if [ "$sys" = "Linux" ]
42 if [ "$sys" = "FreeBSD" ]
54 if [ "$sys" = "Darwin" ]
57 ETC_DIR="./inst/freebsd/etc/stargazer"
61 if [ "$OS" = "unknown" ]
63 printf "#############################################################################\n"
64 printf "# Sorry, but rscriptd is currently supported by Linux, FreeBSD and Darwin. #\n"
65 printf "#############################################################################\n"
69 printf "#############################################################################\n"
70 printf " Building rscriptd for $sys $release\n"
71 printf "#############################################################################\n"
79 if [ "$OS" = "linux" ]
86 DEFS="$DEFS -DFREE_BSD"
90 DEFS="$DEFS -DFREE_BSD5"
93 if [ "$OS" == "darwin" ]
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 "OS=$OS\n" > $CONFFILE
160 printf "STG_TIME=yes\n" >> $CONFFILE
161 printf "DEBUG=$DEBUG\n" >> $CONFFILE
162 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
163 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
164 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
165 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
166 printf "ARCH=$ARCH\n" >> $CONFFILE
167 printf "DEFS=$DEFS\n" >> $CONFFILE
168 printf "STG_LIBS=" >> $CONFFILE
171 printf "$lib " >> $CONFFILE
173 printf "\n" >> $CONFFILE
174 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
175 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
176 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
177 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
178 printf "PREFIX=$PREFIX\n" >> $CONFFILE
179 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
180 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
181 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
182 printf "OWNER=$OWNER\n" >> $CONFFILE
184 if [ "$1" != "debug" ]
188 printf "\n\n\nDebug build. Type $MAKE explicitly\n"