5 # $Date: 2010/04/14 08:58:44 $
6 ######################################################
10 release=`uname -r | cut -b1`
12 CONFFILE="../../Makefile.conf"
22 MAKEOPTS="$MAKEOPTS -j1"
23 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
30 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
31 LDFLAGS="$LDFLAGS -L/usr/local/lib"
33 if [ "$sys" = "Linux" ]
40 if [ "$sys" = "FreeBSD" ]
52 if [ "$OS" = "unknown" ]
54 printf "#############################################################################\n"
55 printf "# Sorry, but rlm_stg currently supported by Linux, FreeBSD 4.x, 5.x, 6.x #\n"
56 printf "#############################################################################\n"
60 printf "#############################################################################\n"
61 printf " Building rlm_stg for $sys $release\n"
62 printf "#############################################################################\n"
64 STG_LIBS="crypto.lib common.lib"
66 if [ "$OS" = "linux" ]
74 DEFS="$DEFS -DFREE_BSD"
76 DEFS="$DEFS -DFREE_BSD5"
84 CXXFLAGS="$CXXFLAGS -DHAVE_CLOSEFROM"
107 printf "Checking CC... "
108 $CC --version > /dev/null 2> /dev/null
112 printf "$CC not found\n"
116 printf "Checking CXX... "
117 $CXX --version > /dev/null 2> /dev/null
121 printf "$CXX not found\n"
125 printf "Checking AR... "
126 $AR --version > /dev/null 2> /dev/null
130 printf "$AR not found\n"
134 printf "Checking RANLIB... "
135 $RANLIB --version > /dev/null 2> /dev/null
139 printf "$RANLIB not found\n"
144 printf "Checking endianess... "
145 printf "int main() { int probe = 0x00000001; return *(char *)&probe; }\n" > build_check.c
146 $CC $CFLAGS $LDFLAGS build_check.c -o fake > /dev/null 2> /dev/null
150 printf "Endianess checking failed\n"
157 CXXFLAGS="$CXXFLAGS -DARCH_LE"
158 CFLAGS="$CFLAGS -DARCH_LE"
159 printf "Little Endian\n"
162 CXXFLAGS="$CXXFLAGS -DARCH_BE"
163 CFLAGS="$CFLAGS -DARCH_BE"
164 printf "Big Endian\n"
169 printf "Checking for iconv 2nd argument... "
170 printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
171 $CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
176 DEFS="$DEFS -DCONST_ICONV"
181 printf "OS=$OS\n" > $CONFFILE
182 printf "STG_TIME=yes\n" >> $CONFFILE
183 printf "DEBUG=$DEBUG\n" >> $CONFFILE
184 printf "DIR_BUILD=$BUILD_DIR\n" >> $CONFFILE
185 printf "DIR_LIB=\$(DIR_BUILD)/../../lib\n" >> $CONFFILE
186 printf "DIR_LIBSRC=\$(DIR_BUILD)/../../stglibs\n" >> $CONFFILE
187 printf "DIR_INCLUDE=\$(DIR_BUILD)/../../include\n" >> $CONFFILE
188 printf "ARCH=$ARCH\n" >> $CONFFILE
189 printf "DEFS=$DEFS\n" >> $CONFFILE
190 printf "STG_LIBS=" >> $CONFFILE
193 printf "$lib " >> $CONFFILE
195 printf "\n" >> $CONFFILE
196 printf "CC=$CC\n" >> $CONFFILE
197 printf "CXX=$CXX\n" >> $CONFFILE
198 printf "AR=$AR\n" >> $CONFFILE
199 printf "RANLIB=$RANLIB\n" >> $CONFFILE
200 printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
201 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
202 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
203 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
204 printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
205 printf "PREFIX=$PREFIX\n" >> $CONFFILE
206 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
207 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
208 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
209 printf "OWNER=$OWNER\n" >> $CONFFILE
211 if [ "$1" != "debug" ]
215 printf "\n\n\nDebug build. Type $MAKE explicitly\n"