CVS: rdesktop configure.ac,1.10,1.11 rdp.c,1.78,1.79

Michael Gernoth <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1997

Modified Files:
	configure.ac rdp.c 
Log Message:
HAVE_ICONV configure test


Index: configure.ac
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/configure.ac,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** configure.ac	13 Mar 2005 13:36:03 -0000	1.10
--- configure.ac	13 Mar 2005 13:58:23 -0000	1.11
***************
*** 266,269 ****
--- 266,345 ----
  UTILS_FUNC_DIRFD
  
+ #
+ # iconv
+ #
+ 
+ dnl This macros shamelessly stolen from
+ dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html.
+ dnl Written by Bruno Haible.
+ 
+ AC_DEFUN([UTILS_FUNC_ICONV],
+ [
+   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+   dnl those with the standalone portable GNU libiconv installed).
+ 
+   AC_ARG_WITH([libiconv-prefix],
+ [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
+     for dir in `echo "$withval" | tr : ' '`; do
+       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
+       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
+     done
+    ])
+ 
+   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
+     am_cv_func_iconv="no, consider installing GNU libiconv"
+     am_cv_lib_iconv=no
+     AC_TRY_LINK([#include <stdlib.h>
+ #include <iconv.h>],
+       [iconv_t cd = iconv_open("","");
+        iconv(cd,NULL,NULL,NULL,NULL);
+        iconv_close(cd);],
+       am_cv_func_iconv=yes)
+     if test "$am_cv_func_iconv" != yes; then
+       am_save_LIBS="$LIBS"
+       LIBS="$LIBS -liconv"
+       AC_TRY_LINK([#include <stdlib.h>
+ #include <iconv.h>],
+         [iconv_t cd = iconv_open("","");
+          iconv(cd,NULL,NULL,NULL,NULL);
+          iconv_close(cd);],
+         am_cv_lib_iconv=yes
+         am_cv_func_iconv=yes)
+       LIBS="$am_save_LIBS"
+     fi
+   ])
+   if test "$am_cv_func_iconv" = yes; then
+     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+     AC_MSG_CHECKING([for iconv declaration])
+     AC_CACHE_VAL(am_cv_proto_iconv, [
+       AC_TRY_COMPILE([
+ #include <stdlib.h>
+ #include <iconv.h>
+ extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ #if defined(__STDC__) || defined(__cplusplus)
+ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+ #else
+ size_t iconv();
+ #endif
+ ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+     AC_MSG_RESULT([$]{ac_t:-
+          }[$]am_cv_proto_iconv)
+     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+       [Define as const if the declaration of iconv() needs const.])
+   fi
+   LIBICONV=
+   if test "$am_cv_lib_iconv" = yes; then
+     LIBICONV="-liconv"
+   fi
+   AC_SUBST(LIBICONV)
+ ])
+ 
+ UTILS_FUNC_ICONV
+ LIBS="$LIBS $LIBICONV"
  
  #

Index: rdp.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdp.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** rdp.c	13 Mar 2005 13:36:03 -0000	1.78
--- rdp.c	13 Mar 2005 13:58:23 -0000	1.79
***************
*** 28,31 ****
--- 28,35 ----
  #include <iconv.h>
  #endif
+ 
+ #ifndef ICONV_CONST
+ #define ICONV_CONST ""
+ #endif
  #endif
  
***************
*** 174,178 ****
  			return;
  		}
! 		if (iconv(iconv_h, (const char**)&pin, &i, &pout, &o) == (size_t)-1)
  		{
  			iconv_close(iconv_h);
--- 178,182 ----
  			return;
  		}
! 		if (iconv(iconv_h, (ICONV_CONST char**)&pin, &i, &pout, &o) == (size_t)-1)
  		{
  			iconv_close(iconv_h);
***************
*** 184,188 ****
  	}
  
! 	if (iconv(iconv_h, (const char**)&pin, &ibl, &pout, &obl) == (size_t)-1)
  	{
  		iconv_close(iconv_h);
--- 188,192 ----
  	}
  
! 	if (iconv(iconv_h, (ICONV_CONST char**)&pin, &ibl, &pout, &obl) == (size_t)-1)
  	{
  		iconv_close(iconv_h);
***************
*** 243,247 ****
  	}
  
! 	if (iconv(iconv_h, (const char**)&pin, &ibl, &pout, &obl) == (size_t)-1)
  	{
  		iconv_close(iconv_h);
--- 247,251 ----
  	}
  
! 	if (iconv(iconv_h, (ICONV_CONST char**)&pin, &ibl, &pout, &obl) == (size_t)-1)
  	{
  		iconv_close(iconv_h);



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.