]> git.stg.codes - stg.git/blobdiff - projects/sgconf_xml/build
Added "smart" iconv 2nd arg const-ness detection.
[stg.git] / projects / sgconf_xml / build
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" ]