From: Henrik Gramner Date: Wed, 13 Apr 2016 15:53:49 +0000 (+0200) Subject: Eliminate some compiler warnings on BSD X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=2102de2584e03fce4abac49eb37d5d7a0803380f;p=x264 Eliminate some compiler warnings on BSD Include in addition to . According to the POSIX specification the prototypes for strcasecmp() and strncasecmp() are declared in . On some systems they are also declared in for compatibility reasons but we shouldn't rely on that. Define _POSIX_C_SOURCE only when it's required to do so. Some BSD variants doesn't declare certain function prototypes otherwise. --- diff --git a/common/osdep.h b/common/osdep.h index 520710a9..64e34317 100644 --- a/common/osdep.h +++ b/common/osdep.h @@ -60,6 +60,8 @@ int x264_vsnprintf( char *s, size_t n, const char *fmt, va_list arg ); #define snprintf x264_snprintf #define vsnprintf x264_vsnprintf #endif +#else +#include #endif #if !defined(va_copy) && defined(__INTEL_COMPILER) diff --git a/configure b/configure index f9856bd7..7c01ebcb 100755 --- a/configure +++ b/configure @@ -547,6 +547,9 @@ if [[ $host_os = mingw* || $host_os = cygwin* ]]; then `$CC 2>&1 | grep -q 'x86'` && host_cpu=i486 `$CC 2>&1 | grep -q 'x64'` && host_cpu=x86_64 cpp_check '' '' '_MSC_VER > 1800 || (_MSC_VER == 1800 && _MSC_FULL_VER >= 180030324)' || die "Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer" + else + # MinGW uses broken pre-VS2015 Microsoft printf functions unless it's told to use the POSIX ones. + CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L" fi else if [[ "$cc_base" = icc || "$cc_base" = icc[\ .]* ]]; then @@ -570,7 +573,6 @@ case $host_os in darwin*) SYS="MACOSX" libm="-lm" - CFLAGS="$CFLAGS -D_DARWIN_C_SOURCE" if [ "$pic" = "no" ]; then cc_check "" -mdynamic-no-pic && CFLAGS="$CFLAGS -mdynamic-no-pic" fi @@ -807,7 +809,7 @@ cc_check || die "No working C compiler found." if [ $compiler_style = GNU ]; then if cc_check '' -std=gnu99 'for( int i = 0; i < 9; i++ );' ; then - CFLAGS="$CFLAGS -std=gnu99 -D_POSIX_C_SOURCE=200112L -D_GNU_SOURCE" + CFLAGS="$CFLAGS -std=gnu99 -D_GNU_SOURCE" elif cc_check '' -std=c99 'for( int i = 0; i < 9; i++ );' ; then CFLAGS="$CFLAGS -std=c99 -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE" elif ! cc_check '' '' 'for( int i = 0; i < 9; i++ );' ; then