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