]> git.stg.codes - stg.git/blobdiff - projects/sgconv/build
Add a script to run cppcheck over all projects.
[stg.git] / projects / sgconv / build
index d158d3202aaf6a633c1a734214c4f16726ef0c98..3eb6e033dc30a70cd5de6aa43c52b56ed44582ba 100755 (executable)
@@ -56,7 +56,7 @@ if [ "$sys" = "Darwin" ]
 then
     OS=darwin
     ETC_DIR="./inst/freebsd/etc/stargazer"
-    MAKE="gmake"
+    MAKE="make"
 fi
 
 if [ "$OS" = "unknown" ]
@@ -72,7 +72,6 @@ printf "       Building sgconv for $sys $release\n"
 printf "#############################################################################\n"
 
 STG_LIBS="logger.lib
-          locker.lib
           crypto.lib
           common.lib
           conffiles.lib
@@ -85,6 +84,7 @@ then
     DEFS="$DEFS -DLINUX"
     LIB_THREAD=-lpthread
 else
+    LIBICONV="-liconv"
     if [ "$OS" = "bsd" ]
     then
         DEFS="$DEFS -DFREE_BSD"
@@ -160,6 +160,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 "Checking for fb_config... "
 FB_VERSION=`fb_config --version 2> /dev/null`
 if [ "$?" != "0" ]
@@ -167,7 +179,7 @@ then
     printf "no\n"
     printf "Checking for -lfbclient... "
     printf "int main() { return 0; }\n" > build_check.c
-    $CXX $CXXFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
+    $CC $CFLAGS $LDFLAGS build_check.c -lfbclient $LIB_THREAD -o fake > /dev/null 2> /dev/null
     if [ $? != 0 ]
     then
         CHECK_FBCLIENT=no
@@ -249,7 +261,7 @@ if [ $? != 0 ]
 then
     printf "no\n";
     printf "Checking for -lpq... "
-    $CXX $CXXFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
+    $CC $CFLAGS $LDFLAGS build_check.c -lpq $LIB_THREAD -o fake > /dev/null 2> /dev/null
     if [ $? != 0 ]
     then
         CHECK_PQ=no
@@ -345,10 +357,13 @@ do
     printf "$plugin " >> $CONFFILE
 done
 printf "\n" >> $CONFFILE
+printf "CC=$CC\n" >> $CONFFILE
+printf "CXX=$CXX\n" >> $CONFFILE
 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