Merge pull request #4737 from mtasaka/autoconf271_fix

configure.ac: reset compiler flags before calling AC_CHECK_DECLS
This commit is contained in:
David Anderson 2022-04-30 01:16:21 -07:00 committed by GitHub
commit 35ddac9813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -711,11 +711,19 @@ AC_CHECK_HEADERS([sys/types.h sys/un.h arpa/inet.h dirent.h grp.h fcntl.h inttyp
save_cxxflags="${CXXFLAGS}" save_cxxflags="${CXXFLAGS}"
save_cppflags="${CPPFLAGS}" save_cppflags="${CPPFLAGS}"
CXXFLAGS="${CXXFLAGS} -msse3" sse3_flags="-msse3"
CPPFLAGS="${CPPFLAGS} -msse3" avx_flags="-mavx"
CXXFLAGS="${save_cxxflags} ${sse3_flags}"
CPPFLAGS="${save_cppflags} ${sse3_flags}"
AC_LINK_IFELSE([AC_LANG_PROGRAM([],)], [], [sse_flags=""])
CXXFLAGS="${save_cxxflags} ${avx_flags}"
CPPFLAGS="${save_cppflags} ${avx_flags}"
AC_LINK_IFELSE([AC_LANG_PROGRAM([],)], [], [avx_flags=""])
CXXFLAGS="${save_cxxflags} ${sse3_flags}"
CXXFLAGS="${save_cxxflags} ${sse3_flags}"
AC_CHECK_HEADERS([intrin.h x86intrin.h pmmintrin.h xmmintrin.h emmintrin.h]) AC_CHECK_HEADERS([intrin.h x86intrin.h pmmintrin.h xmmintrin.h emmintrin.h])
CXXFLAGS="${save_cxxflags} -mavx" CXXFLAGS="${save_cxxflags} ${avx_flags}"
CPPFLAGS="${save_cppflags} -mavx" CPPFLAGS="${save_cppflags} ${avx_flags}"
AC_CHECK_HEADERS([immintrin.h avxintrin.h]) AC_CHECK_HEADERS([immintrin.h avxintrin.h])
AC_CHECK_DECLS([_xgetbv, xgetbv, __xgetbv, cpuid, _cpuid, __cpuid], AC_CHECK_DECLS([_xgetbv, xgetbv, __xgetbv, cpuid, _cpuid, __cpuid],