Use AM_ICONV to determine what needs to be done for iconv support. (closes #19)

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1012 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Pierre Ossman 2006-06-12 14:18:19 +00:00
parent c32176b0ad
commit 519aa9b2ef
3 changed files with 12 additions and 7 deletions

View file

@ -165,7 +165,7 @@ AM_CONDITIONAL(OS_IS_WIN32, test "x$os_is_win32" = "x1")
AC_HEADER_STDC AC_HEADER_STDC
# POSIX # POSIX
AC_CHECK_HEADERS([arpa/inet.h glob.h grp.h iconv.h netdb.h netinet/in.h \ AC_CHECK_HEADERS([arpa/inet.h glob.h grp.h netdb.h netinet/in.h \
netinet/in_systm.h netinet/ip.h netinet/tcp.h pwd.h sched.h \ netinet/in_systm.h netinet/ip.h netinet/tcp.h pwd.h sched.h \
sys/resource.h sys/select.h sys/socket.h sys/wait.h \ sys/resource.h sys/select.h sys/socket.h sys/wait.h \
syslog.h]) syslog.h])
@ -270,6 +270,10 @@ ACX_PTHREAD
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
#### [lib]iconv ####
AM_ICONV
################################### ###################################
# External libraries # # External libraries #
################################### ###################################

View file

@ -420,7 +420,7 @@ endif
libpolyp_la_CFLAGS = $(AM_CFLAGS) libpolyp_la_CFLAGS = $(AM_CFLAGS)
libpolyp_la_LDFLAGS = -version-info $(LIBPOLYP_VERSION_INFO) libpolyp_la_LDFLAGS = -version-info $(LIBPOLYP_VERSION_INFO)
libpolyp_la_LIBADD = $(AM_LIBADD) $(WINSOCK_LIBS) libpolyp_la_LIBADD = $(AM_LIBADD) $(WINSOCK_LIBS) $(LIBICONV)
if HAVE_X11 if HAVE_X11
libpolyp_la_CFLAGS += $(X_CFLAGS) libpolyp_la_CFLAGS += $(X_CFLAGS)
@ -587,7 +587,7 @@ endif
libpolypcore_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBOIL_CFLAGS) libpolypcore_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBOIL_CFLAGS)
libpolypcore_la_LDFLAGS = -version-info $(LIBPOLYPCORE_VERSION_INFO) libpolypcore_la_LDFLAGS = -version-info $(LIBPOLYPCORE_VERSION_INFO)
libpolypcore_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSNDFILE_LIBS) $(WINSOCK_LIBS) $(LIBOIL_LIBS) libpolypcore_la_LIBADD = $(AM_LIBADD) $(LIBLTDL) $(LIBSAMPLERATE_LIBS) $(LIBSNDFILE_LIBS) $(WINSOCK_LIBS) $(LIBOIL_LIBS) $(LIBICONV)
################################### ###################################
# Plug-in support libraries # # Plug-in support libraries #

View file

@ -34,7 +34,7 @@
#include <inttypes.h> #include <inttypes.h>
#include <string.h> #include <string.h>
#ifdef HAVE_ICONV_H #ifdef HAVE_ICONV
#include <iconv.h> #include <iconv.h>
#endif #endif
@ -168,14 +168,15 @@ char* pa_utf8_filter (const char *str) {
return utf8_validate(str, new_str); return utf8_validate(str, new_str);
} }
#ifdef HAVE_ICONV_H #ifdef HAVE_ICONV
static char* iconv_simple(const char *str, const char *to, const char *from) { static char* iconv_simple(const char *str, const char *to, const char *from) {
char *new_str; char *new_str;
size_t len, inlen; size_t len, inlen;
iconv_t cd; iconv_t cd;
char *inbuf, *outbuf; ICONV_CONST char *inbuf;
char *outbuf;
size_t res, inbytes, outbytes; size_t res, inbytes, outbytes;
cd = iconv_open(to, from); cd = iconv_open(to, from);
@ -187,7 +188,7 @@ static char* iconv_simple(const char *str, const char *to, const char *from) {
assert(new_str); assert(new_str);
while (1) { while (1) {
inbuf = (char*)str; /* Brain dead prototype for iconv() */ inbuf = (ICONV_CONST char*)str; /* Brain dead prototype for iconv() */
inbytes = inlen; inbytes = inlen;
outbuf = new_str; outbuf = new_str;
outbytes = len; outbytes = len;