]> git.stg.codes - stg.git/commitdiff
Added "smart" iconv 2nd arg const-ness detection.
authorMaxim Mamontov <faust.madf@gmail.com>
Mon, 11 May 2015 17:04:06 +0000 (20:04 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Mon, 11 May 2015 17:04:06 +0000 (20:04 +0300)
projects/libs/build
projects/rlm_stg/build
projects/rscriptd/build
projects/sgauth/build
projects/sgauthstress/build
projects/sgconf/build
projects/sgconf_xml/build
projects/sgconv/build
projects/stargazer/build
stglibs/common.lib/common.cpp

index 1d40d725628d9ec955c660a7a6d409190c7a3558..9b23d546dab94a19ac80cd186d9c6b288e0f21e0 100755 (executable)
@@ -1,10 +1,5 @@
 #!/bin/sh
 
-#   $Revision: 1.57 $
-#   $Author: faust $
-#   $Date: 2010/05/09 12:39:01 $
-######################################################
-
 # Installation path prefix
 
 #PREFIX=""
@@ -183,6 +178,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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -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" ]
index 433cd04fc0ff97e4182beab41996782c0cead587..f78a9e1fbeefeb8dae6b344ccdf5400cdacbe291 100755 (executable)
@@ -137,6 +137,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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -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
index da5c3b5b3df79f4bc23cf0d492fb5cbd9711c0b2..f01f50cb33b151accff29e1ac53a13f233962419 100755 (executable)
@@ -154,6 +154,19 @@ else
     fi
 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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -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
+
 rm -f build_check.c
 
 printf "OS=$OS\n" > $CONFFILE
index 0e7e5f01080c81f83de269230c572bd11b9cb2a2..4f8048cccdfd976047514f7c5fb929fde5a94352 100755 (executable)
@@ -156,6 +156,19 @@ else
     fi
 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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -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
+
 rm -f build_check.c
 
 printf "OS=$OS\n" > $CONFFILE
index 1593af28b623170057d67524474e8432e09a7d3f..92be70d91283ba1404ee03a0fd294f192798e871 100755 (executable)
@@ -154,6 +154,19 @@ else
     fi
 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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -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
+
 rm -f build_check.c
 
 printf "Checking for fb_config... "
index 0b25a1ca54396ef8fdf8ab10c8a94c62079b1256..2d6fc859f5ca4f9c9cde0adda4be1f2bb1346862 100755 (executable)
@@ -166,6 +166,19 @@ else
     printf "yes\n"
 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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -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
+
 rm -f build_check.c
 
 if [ "$CHECK_EXPAT" != "yes" ]
index 7b83359b7447d9f4b71b1f249d14397efc2febbe..10de5f003478d554ab1078bd1ead6af06d61e212 100755 (executable)
@@ -159,6 +159,19 @@ else
     printf "yes\n"
 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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -o fake > /dev/null 2> /dev/null
+if [ $? != 0 ]
+then
+    DEFS="$DEFS -DCONST_ICONV"
+    printf "non-const\n"
+else
+    printf "const\n"
+fi
+rm -f fake
+
 rm -f build_check.c
 
 if [ "$CHECK_EXPAT" != "yes" ]
index edde35f9b05700a2436a6c1c65a900e6c583da93..2d6ce471ef5a88ff779ea5aa1f171e604a1bba31 100755 (executable)
@@ -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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -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" ]
index 238ae19414120e4894745b72fc0d286a1ff356f0..4bf38506e58f8f2e943ea7454672a28b08275818 100755 (executable)
@@ -208,6 +208,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
+$CXX $CXXFLAGS $LDFLAGS -Werror build_check.c -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" ]
index d91c17956755bfb008d800dcac5fccac2ffe0f55..22ec354b002442eab12f55b8868ddee7254669e8 100644 (file)
@@ -899,7 +899,7 @@ strncpy(inBuf, source.c_str(), source.length());
 
 inBuf[source.length()] = 0;
 
-#if defined(FREE_BSD) || defined(FREE_BSD5) || defined(WIN32)
+#if defined(CONST_ICONV)
 const char * srcPos = inBuf;
 #else
 char * srcPos = inBuf;