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 sgauth is currently supported by Linux, FreeBSD and Darwin. #\n"
68 printf "#############################################################################\n"
72 printf "#############################################################################\n"
73 printf " Building sgauth for $sys $release\n"
74 printf "#############################################################################\n"
81 if [ "$OS" = "linux" ]
88 DEFS="$DEFS -DFREE_BSD"
92 DEFS="$DEFS -DFREE_BSD5"
95 if [ "$OS" == "darwin" ]
116 printf "Checking CC... "
117 $CC --version > /dev/null 2> /dev/null
121 printf "$CC not found\n"
125 printf "Checking CXX... "
126 $CXX --version > /dev/null 2> /dev/null
130 printf "$CXX not found\n"
135 printf "Checking endianess... "
136 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
137 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
141 printf "Endianess checking failed\n"
148 CXXFLAGS="$CXXFLAGS -DARCH_LE"
149 CFLAGS="$CFLAGS -DARCH_LE"
150 printf "Little Endian\n"
153 CXXFLAGS="$CXXFLAGS -DARCH_BE"
154 CFLAGS="$CFLAGS -DARCH_BE"
155 printf "Big Endian\n"
161 printf "OS=$OS\n" > $CONFFILE
162 printf "STG_TIME=yes\n" >> $CONFFILE
163 printf "DEBUG=$DEBUG\n" >> $CONFFILE
164 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
165 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
166 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
167 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
168 printf "ARCH=$ARCH\n" >> $CONFFILE
169 printf "DEFS=$DEFS\n" >> $CONFFILE
170 printf "STG_LIBS=" >> $CONFFILE
173 printf "$lib " >> $CONFFILE
175 printf "\n" >> $CONFFILE
176 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
177 printf "CC=$CC\n" >> $CONFFILE
178 printf "CXX=$CXX\n" >> $CONFFILE
179 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
180 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
181 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
182 printf "PREFIX=$PREFIX\n" >> $CONFFILE
183 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
184 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
185 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
186 printf "OWNER=$OWNER\n" >> $CONFFILE
188 if [ "$1" != "debug" ]
192 printf "\n\n\nDebug build. Type $MAKE explicitly\n"