From patchwork Wed Apr 10 08:48:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] configure: Try adding -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 for mingw as well X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 64453 Message-Id: <20190410084825.14496-1-martin@martin.st> To: libav-devel@libav.org Date: Wed, 10 Apr 2019 11:48:24 +0300 From: =?utf-8?q?Martin_Storsj=C3=B6?= List-Id: libav development Mingw headers have got header inline implementations of localtime_r and gmtime_r, but only visible if certain posix thread safe functions have been requested. This is a preparatory step for improving the detection of those functions. --- An alternative fix is also provided in a different patch series, by adjusting libavutil/time_internal.h. --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 26455054ba..3e8f2dcde1 100755 --- a/configure +++ b/configure @@ -4124,6 +4124,7 @@ probe_libc(){ add_${pfx}cppflags -D__printf__=__gnu_printf__ test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" && add_${pfx}cppflags -D_WIN32_WINNT=0x0600 + add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" || test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then eval ${pfx}libc_type=mingw32 @@ -4137,6 +4138,7 @@ probe_libc(){ add_${pfx}cppflags -D_WIN32_WINNT=0x0600 eval test \$${pfx_no_}cc_type = "gcc" && add_${pfx}cppflags -D__printf__=__gnu_printf__ + add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then eval ${pfx}libc_type=msvcrt if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then From patchwork Wed Apr 10 08:48:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] configure: Include time.h when checking for gmtime_r and localtime_r X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 64454 Message-Id: <20190410084825.14496-2-martin@martin.st> To: libav-devel@libav.org Date: Wed, 10 Apr 2019 11:48:25 +0300 From: =?utf-8?q?Martin_Storsj=C3=B6?= List-Id: libav development These functions are available in time.h (conditional on posix thread safe functions) on mingw. Previously, these functions weren't detected by configure, and libavutil/time_internal.h provided replacements, even if time.h actually contained definitions of them. Previously, these mingw inline functions were defined as "extern __inline __attribute__((__gnu_inline__))". In this case, redefining a new static inline version of the same function with the same name was accepted. But recently, the mingw inline functions have changed to be declared as "static inline", where it no longer is allowed to have libavutil/time_internal.h redefine new static inline versions. --- Contrary to what is mentioned in a similar commit 1b4dd59e5fbdebb8d9f13ad2dbdaa0179d0cce57 in ffmpeg, using check_func_headers works just fine, provided that the posix defines have been added. (Without them, check_builtin, which that commit used, doesn't work either.) --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 3e8f2dcde1..8c46a870c4 100755 --- a/configure +++ b/configure @@ -4543,9 +4543,7 @@ check_func gethrtime check_func getopt check_func getrusage check_func gettimeofday -check_func gmtime_r check_func isatty -check_func localtime_r check_func mkstemp check_func mmap check_func mprotect @@ -4561,6 +4559,8 @@ check_func usleep check_func_headers io.h setmode check_func_headers mach/mach_time.h mach_absolute_time check_func_headers stdlib.h getenv +check_func_headers time.h gmtime_r +check_func_headers time.h localtime_r check_func_headers windows.h GetProcessAffinityMask check_func_headers windows.h GetProcessTimes