From: Michihiro NAKAJIMA Date: Wed, 16 Mar 2011 14:44:22 +0000 (-0400) Subject: Use ICONV_CONST instead of ICONV_IS_POSIX; switch a detection of iconv to AM_ICONV. X-Git-Tag: v3.0.0a~655 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d975ebec52cc3157a794708f987d7e5cd563a674;p=thirdparty%2Flibarchive.git Use ICONV_CONST instead of ICONV_IS_POSIX; switch a detection of iconv to AM_ICONV. This version needs to solve about config.rpath, which AM_ICONV requires. SVN-Revision: 3017 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c1c70da1..c7cb83de2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -465,7 +465,7 @@ IF(HAVE_ICONV_H) HAVE_POSIX_ICONV_IN_LIBC) IF(HAVE_POSIX_ICONV_IN_LIBC) SET(HAVE_ICONV true) - SET(ICONV_IS_POSIX true) + SET(ICONV_CONST "const") ELSE(HAVE_POSIX_ICONV_IN_LIBC) # Try non-POSIX-conforming iconv() in libc @@ -477,6 +477,7 @@ IF(HAVE_ICONV_H) HAVE_NONPOSIX_ICONV_IN_LIBC) IF(HAVE_NONPOSIX_ICONV_IN_LIBC) SET(HAVE_ICONV true) + SET(ICONV_CONST "") ELSE(HAVE_NONPOSIX_ICONV_IN_LIBC) # iconv isn't in libc, try libiconv @@ -489,7 +490,7 @@ IF(HAVE_ICONV_H) HAVE_POSIX_ICONV_IN_LIBICONV) IF(HAVE_POSIX_ICONV_IN_LIBICONV) SET(HAVE_ICONV true) - SET(ICONV_IS_POSIX true) + SET(ICONV_CONST "const") LIST(APPEND ADDITIONAL_LIBS "iconv") ELSE(HAVE_POSIX_ICONV_IN_LIBICONV) @@ -501,8 +502,9 @@ IF(HAVE_ICONV_H) HAVE_NONPOSIX_ICONV_IN_LIBICONV) IF(HAVE_NONPOSIX_ICONV_IN_LIBICONV) SET(HAVE_ICONV true) + SET(ICONV_CONST "") LIST(APPEND ADDITIONAL_LIBS "iconv") - ENDIF(HAVE_NONPOSIX_ICONV_IN_LIBICONV) + ENDIF(HAVE_NONPOSIX_ICONV_IN_LIBICONV) ENDIF(HAVE_POSIX_ICONV_IN_LIBICONV) ENDIF(HAVE_NONPOSIX_ICONV_IN_LIBC) ENDIF(HAVE_POSIX_ICONV_IN_LIBC) diff --git a/build/clean.sh b/build/clean.sh index 9e7e7998f..e4465f8a7 100755 --- a/build/clean.sh +++ b/build/clean.sh @@ -51,7 +51,8 @@ rm -f bsdcpio_test rm -f bsdtar rm -f bsdtar_test rm -f build/autoconf/compile -rm -f build/autoconf/config.* +rm -f build/autoconf/config.guess +rm -f build/autoconf/config.sub rm -f build/autoconf/depcomp rm -f build/autoconf/install-sh rm -f build/autoconf/libtool.m4 diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index 5df98c547..0fc6692d4 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -495,9 +495,6 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `iconv' function. */ #cmakedefine HAVE_ICONV 1 -/* Define to 1 if the 'iconv' function follows POSIX. */ -#cmakedefine ICONV_IS_POSIX 1 - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ICONV_H 1 @@ -922,6 +919,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ZLIB_H 1 +/* Define as const if the declaration of iconv() needs const. */ +#cmakedefine ICONV_CONST ${ICONV_CONST} + /* Define to 1 if you have the `_ctime64_s' function. */ #cmakedefine HAVE__CTIME64_S 1 diff --git a/configure.ac b/configure.ac index f9d402e3e..1d43d173c 100644 --- a/configure.ac +++ b/configure.ac @@ -237,8 +237,7 @@ AC_ARG_WITH([iconv], if test "x$with_iconv" != "xno"; then AC_CHECK_HEADERS([iconv.h]) - AC_CHECK_LIB(iconv, iconv) - AC_CHECK_FUNCS([iconv]) + AM_ICONV fi AC_ARG_WITH([lzma], diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 98640db2b..547788b21 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -503,11 +503,7 @@ int archive_wstring_append_from_mbs(struct archive *a, struct archive_wstring *dest, const char *p, size_t len) { char buff[256]; -#if ICONV_IS_POSIX - const char *inp; -#else - char *inp; -#endif + ICONV_CONST char *inp; size_t remaining; iconv_t cd; int return_value = 0; /* success */ @@ -644,11 +640,7 @@ int archive_string_append_from_unicode_to_mbs(struct archive *a, struct archive_string *as, const wchar_t *w, size_t len) { char buff[256]; -#if ICONV_IS_POSIX - const char *inp; -#else - char *inp; -#endif + ICONV_CONST char *inp; size_t remaining; iconv_t cd; int return_value = 0; /* success */