diff --git a/src/libFLAC/CMakeLists.txt b/src/libFLAC/CMakeLists.txt index 438399f6c0..3c75faa3b0 100644 --- a/src/libFLAC/CMakeLists.txt +++ b/src/libFLAC/CMakeLists.txt @@ -21,6 +21,16 @@ if(FLAC__CPU_X86_64 OR FLAC__CPU_IA32) if(WITH_AVX AND MSVC) set_source_files_properties(fixed_intrin_avx2.c lpc_intrin_avx2.c stream_encoder_intrin_avx2.c lpc_intrin_fma.c PROPERTIES COMPILE_FLAGS /arch:AVX2) endif() + if(WITH_AVX AND WIN32 AND CMAKE_C_COMPILER_ID MATCHES "Clang") + cmake_policy(PUSH) + cmake_policy(SET CMP0075 NEW) + check_include_file("unistd.h" HAVE_UNISTD_H) + if(NOT HAVE_UNISTD_H) + # Clang on Windows using MSVC headers + set_source_files_properties(fixed_intrin_avx2.c lpc_intrin_avx2.c stream_encoder_intrin_avx2.c lpc_intrin_fma.c PROPERTIES COMPILE_FLAGS -mavx2) + endif() + cmake_policy(POP) + endif() else() check_cpu_arch_arm64(FLAC__CPU_ARM64) if(FLAC__CPU_ARM64) diff --git a/src/share/getopt/getopt.c b/src/share/getopt/getopt.c index 509c91dd8f..4691d8f7a1 100644 --- a/src/share/getopt/getopt.c +++ b/src/share/getopt/getopt.c @@ -221,7 +221,7 @@ static char *posixly_correct; /* Avoid depending on library functions or files whose names are inconsistent. */ -#ifndef getenv +#if !defined(getenv) && !(defined(__clang__) && defined(_MSC_VER)) extern char *getenv (const char * name); #endif