From: Michihiro NAKAJIMA Date: Wed, 6 Apr 2011 13:04:12 +0000 (-0400) Subject: Unbreak build on msys. X-Git-Tag: v3.0.0a~517 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fb156f97d5ea5f990cb020e35b3bd359e6c6858;p=thirdparty%2Flibarchive.git Unbreak build on msys. SVN-Revision: 3169 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 16248e345..1977fad23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -612,7 +612,9 @@ CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S) +CHECK_FUNCTION_EXISTS_GLIBC(_free_locale HAVE__FREE_LOCALE) CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) +CHECK_FUNCTION_EXISTS_GLIBC(_get_current_locale HAVE__GET_CURRENT_LOCALE) CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S) CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64) diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index c348aa6ad..fb656d13e 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -931,9 +931,15 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `_ctime64_s' function. */ #cmakedefine HAVE__CTIME64_S 1 +/* Define to 1 if you have the `_free_locale' function. */ +#cmakedefine HAVE__FREE_LOCALE 1 + /* Define to 1 if you have the `_fseeki64' function. */ #cmakedefine HAVE__FSEEKI64 1 +/* Define to 1 if you have the `_get_current_locale' function. */ +#cmakedefine HAVE__GET_CURRENT_LOCALE 1 + /* Define to 1 if you have the `_get_timezone' function. */ #cmakedefine HAVE__GET_TIMEZONE 1 diff --git a/configure.ac b/configure.ac index a4535a391..9c31f1716 100644 --- a/configure.ac +++ b/configure.ac @@ -445,7 +445,8 @@ AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm]) AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork]) AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy]) -AC_CHECK_FUNCS([_ctime64_s _fseeki64 _get_timezone _localtime64_s _mkgmtime64]) +AC_CHECK_FUNCS([_ctime64_s _free_locale _fseeki64 _get_current_locale]) +AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64]) # detects cygwin-1.7, as opposed to older versions AC_CHECK_FUNCS([cygwin_conv_path]) diff --git a/libarchive/archive.h b/libarchive/archive.h index 8879f8664..bb6a55d40 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -98,7 +98,7 @@ # define __LA_DECL #endif -#if defined(__GNUC__) && __GNUC__ >= 3 +#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__MINGW32__) #define __LA_PRINTF(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) #else diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 3987e0e43..79c6e5d94 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -751,9 +751,13 @@ get_current_codepage() { unsigned codepage; +#if defined(HAVE__GET_CURRENT_LOCALE) && defined(HAVE__FREE_LOCALE) _locale_t locale = _get_current_locale(); codepage = locale->locinfo->lc_codepage; _free_locale(locale); +#else + codepage = GetOEMCP(); +#endif return (codepage); } #endif /* defined(_WIN32) && !defined(__CYGWIN__) */ diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c index b6c204504..be8c93a68 100644 --- a/libarchive/archive_windows.c +++ b/libarchive/archive_windows.c @@ -122,9 +122,13 @@ get_current_codepage() { unsigned codepage; +#if defined(HAVE__GET_CURRENT_LOCALE) && defined(HAVE__FREE_LOCALE) _locale_t locale = _get_current_locale(); codepage = locale->locinfo->lc_codepage; _free_locale(locale); +#else + codepage = GetOEMCP(); +#endif return (codepage); }