Alex Cherepanov
2008-08-05 14:15:40 UTC
gdevopvp.c uses some basic functionality from iconv library
but none of GNU extensions.
configure script searches first for the native implementation
of iconv functions. If not, it searches for the GNU version.
GNU header uses different names in the library and defines
some macros to map iconv* names to GNU names.
gcc uses GNU version of iconv.h first, which requires a compatibility
flag to link with the native libraries.
When the flag is set, the code won't link with GNU library.
So the compatibility flag is set when iconv* functions come
come from non-gnu library. This flag affects GNU header but should
have no effect on the native header.
-------------- next part --------------
Index: gs/src/configure.ac
===================================================================
--- gs/src/configure.ac (revision 8935)
+++ gs/src/configure.ac (working copy)
@@ -293,6 +293,7 @@
case $with_libiconv in
gnu)
AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv])
+ CFLAGS="$CFLAGS -DUSE_LIBICONV_GNU"
;;
native)
AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library])
Index: gs/contrib/opvp/gdevopvp.c
===================================================================
--- gs/contrib/opvp/gdevopvp.c (revision 8935)
+++ gs/contrib/opvp/gdevopvp.c (working copy)
@@ -25,13 +25,18 @@
#include <unistd.h>
#include <string.h>
#include <locale.h>
-#include <iconv.h>
#include <langinfo.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+/* Set compatibility flag just in case we have GNU iconv.h */
+#ifndef USE_LIBICONV_GNU
+# define LIBCONV_PLUG
+#endif
+#include <iconv.h>
+
#include "string_.h"
#include "math_.h"
#include "gx.h"
but none of GNU extensions.
configure script searches first for the native implementation
of iconv functions. If not, it searches for the GNU version.
GNU header uses different names in the library and defines
some macros to map iconv* names to GNU names.
gcc uses GNU version of iconv.h first, which requires a compatibility
flag to link with the native libraries.
When the flag is set, the code won't link with GNU library.
So the compatibility flag is set when iconv* functions come
come from non-gnu library. This flag affects GNU header but should
have no effect on the native header.
-------------- next part --------------
Index: gs/src/configure.ac
===================================================================
--- gs/src/configure.ac (revision 8935)
+++ gs/src/configure.ac (working copy)
@@ -293,6 +293,7 @@
case $with_libiconv in
gnu)
AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv])
+ CFLAGS="$CFLAGS -DUSE_LIBICONV_GNU"
;;
native)
AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library])
Index: gs/contrib/opvp/gdevopvp.c
===================================================================
--- gs/contrib/opvp/gdevopvp.c (revision 8935)
+++ gs/contrib/opvp/gdevopvp.c (working copy)
@@ -25,13 +25,18 @@
#include <unistd.h>
#include <string.h>
#include <locale.h>
-#include <iconv.h>
#include <langinfo.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+/* Set compatibility flag just in case we have GNU iconv.h */
+#ifndef USE_LIBICONV_GNU
+# define LIBCONV_PLUG
+#endif
+#include <iconv.h>
+
#include "string_.h"
#include "math_.h"
#include "gx.h"