]> git.stg.codes - stg.git/blobdiff - projects/rlm_stg/build
stg-2.409 pre-merge.
[stg.git] / projects / rlm_stg / build
index b93f30bd4d6b929d104dddcefcd003b34807b9bf..179d526188d9aef6e1370ca024d04d01063a27e9 100755 (executable)
@@ -68,6 +68,7 @@ then
     DEFS="$DEFS -DLINUX"
     LIB_THREAD=-lpthread
 else
+    LIBICONV="-liconv"
     if [ "$OS" = "bsd" ]
     then
         DEFS="$DEFS -DFREE_BSD"
@@ -137,6 +138,18 @@ else
 fi
 rm -f fake
 
+printf "Checking for iconv 2nd argument... "
+printf "#include <iconv.h>\nint main(){ const char** src = 0; iconv(0, src, 0, 0, 0); }\n" > build_check.c
+$CC $CFLAGS $LDFLAGS -Werror build_check.c $LIBICONV -o fake > /dev/null 2> /dev/null
+if [ $? != 0 ]
+then
+    printf "non-const\n"
+else
+    DEFS="$DEFS -DCONST_ICONV"
+    printf "const\n"
+fi
+rm -f fake
+
 printf "OS=$OS\n" > $CONFFILE
 printf "STG_TIME=yes\n" >> $CONFFILE
 printf "DEBUG=$DEBUG\n" >> $CONFFILE
@@ -156,10 +169,16 @@ printf "CXXFLAGS=$CXXFLAGS\n" >> $CONFFILE
 printf "CFLAGS=$CFLAGS\n" >> $CONFFILE
 printf "LDFLAGS=$LDFLAGS\n" >> $CONFFILE
 printf "LIB_THREAD=$LIB_THREAD\n" >> $CONFFILE
+printf "LIBICONV=$LIBICONV\n" >> $CONFFILE
 printf "PREFIX=$PREFIX\n" >> $CONFFILE
 printf "BIN_MODE=$BIN_MODE\n" >> $CONFFILE
 printf "DATA_MODE=$DATA_MODE\n" >> $CONFFILE
 printf "DIR_MODE=$DIR_MODE\n" >> $CONFFILE
 printf "OWNER=$OWNER\n" >> $CONFFILE
-$MAKE $MAKEOPTS
 
+if [ "$1" != "debug" ]
+then
+    $MAKE $MAKEOPTS
+else
+    printf "\n\n\nDebug build. Type $MAKE explicitly\n"
+fi