summaryrefslogtreecommitdiff
path: root/config.lib
diff options
context:
space:
mode:
authoregladil <egladil@openttd.org>2007-11-07 21:35:33 +0000
committeregladil <egladil@openttd.org>2007-11-07 21:35:33 +0000
commitcd5597dddf6ec33d9c2bd1db1a892267e9acbc9e (patch)
treebe0a6d5de09021779c127a919cfe99eac6421412 /config.lib
parent015454198226049694037f1b85af0b6d44318351 (diff)
downloadopenttd-cd5597dddf6ec33d9c2bd1db1a892267e9acbc9e.tar.xz
(svn r11389) -Fix [FS#1386]: Replace calls to deprecated API with newer ones and handle broken iconv declaration in OSX 10.5.
Diffstat (limited to 'config.lib')
-rw-r--r--config.lib30
1 files changed, 30 insertions, 0 deletions
diff --git a/config.lib b/config.lib
index db9d009e6..bfe933839 100644
--- a/config.lib
+++ b/config.lib
@@ -1008,6 +1008,10 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -I$with_iconv/include"
LIBS="$LIBS -L$with_iconv/lib"
fi
+
+ if [ "$have_broken_iconv" != "no" ]; then
+ CFLAGS="$CFLAGS -DHAVE_BROKEN_ICONV"
+ fi
fi
if [ -n "$with_midi" ]; then
@@ -1854,6 +1858,32 @@ detect_iconv() {
log 2 "found iconv in $iconv"
log 1 "checking iconv... found"
+
+ # Check if we need to work around buggy iconv implementation where inbuf
+ # is wrongly typed as non-const. Correct implementation is at
+ # http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html
+
+ cat > tmp.iconv.cpp << EOF
+#include "src/stdafx.h"
+#include <iconv.h>
+int main() {
+ static char buf[1024];
+ iconv_t convd = 0;
+ const char *inbuf = "";
+ char *outbuf = buf;
+ size_t outlen = 1023;
+ size_t inlen = 0;
+ return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
+}
+EOF
+ execute="$cxx_host $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
+ eval $execute >&/dev/null
+ ret=$?
+ log 2 "executing $execute"
+ log 2 " exit code $ret"
+ if [ "$ret" = "0" ]; then have_broken_iconv="no"; else have_broken_iconv="yes"; fi
+ log 1 "checking if iconv has non-const inbuf... $have_broken_iconv"
+ rm -f tmp.iconv tmp.iconv.cpp
}
_detect_sort() {