fi
fi
-# Check for __get_cpuid_count() and __cpuidex() in a similar fashion.
+# Check for __get_cpuid_count()
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid_count" >&5
$as_echo_n "checking for __get_cpuid_count... " >&6; }
if ${pgac_cv__get_cpuid_count+:} false; then :
$as_echo "#define HAVE__GET_CPUID_COUNT 1" >>confdefs.h
-else
- # __cpuidex()
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuidex" >&5
+fi
+
+# Check for __cpuidex()
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuidex" >&5
$as_echo_n "checking for __cpuidex... " >&6; }
if ${pgac_cv__cpuidex+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <intrin.h>
+#ifdef _MSC_VER
+ #include <intrin.h>
+ #else
+ #include <cpuid.h>
+ #endif
int
main ()
{
unsigned int exx[4] = {0, 0, 0, 0};
- __cpuidex(exx, 7, 0);
+ __cpuidex((int *) exx, 7, 0);
;
return 0;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__cpuidex" >&5
$as_echo "$pgac_cv__cpuidex" >&6; }
- if test x"$pgac_cv__cpuidex" = x"yes"; then
+if test x"$pgac_cv__cpuidex" = x"yes"; then
$as_echo "#define HAVE__CPUIDEX 1" >>confdefs.h
- fi
fi
# Check for XSAVE intrinsics
fi
fi
-# Check for __get_cpuid_count() and __cpuidex() in a similar fashion.
+# Check for __get_cpuid_count()
AC_CACHE_CHECK([for __get_cpuid_count], [pgac_cv__get_cpuid_count],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <cpuid.h>],
[[unsigned int exx[4] = {0, 0, 0, 0};
[pgac_cv__get_cpuid_count="no"])])
if test x"$pgac_cv__get_cpuid_count" = x"yes"; then
AC_DEFINE(HAVE__GET_CPUID_COUNT, 1, [Define to 1 if you have __get_cpuid_count.])
-else
- # __cpuidex()
- AC_CACHE_CHECK([for __cpuidex], [pgac_cv__cpuidex],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <intrin.h>],
- [[unsigned int exx[4] = {0, 0, 0, 0};
- __cpuidex(exx, 7, 0);
- ]])],
- [pgac_cv__cpuidex="yes"],
- [pgac_cv__cpuidex="no"])])
- if test x"$pgac_cv__cpuidex" = x"yes"; then
- AC_DEFINE(HAVE__CPUIDEX, 1, [Define to 1 if you have __cpuidex.])
- fi
+fi
+
+# Check for __cpuidex()
+AC_CACHE_CHECK([for __cpuidex], [pgac_cv__cpuidex],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([#ifdef _MSC_VER
+ #include <intrin.h>
+ #else
+ #include <cpuid.h>
+ #endif],
+ [[unsigned int exx[4] = {0, 0, 0, 0};
+ __cpuidex((int *) exx, 7, 0);
+ ]])],
+ [pgac_cv__cpuidex="yes"],
+ [pgac_cv__cpuidex="no"])])
+if test x"$pgac_cv__cpuidex" = x"yes"; then
+ AC_DEFINE(HAVE__CPUIDEX, 1, [Define to 1 if you have __cpuidex.])
fi
# Check for XSAVE intrinsics
endif
-# Check for __get_cpuid_count() and __cpuidex() in a similar fashion.
+# Check for __get_cpuid_count()
if cc.links('''
#include <cpuid.h>
int main(int arg, char **argv)
''', name: '__get_cpuid_count',
args: test_c_args)
cdata.set('HAVE__GET_CPUID_COUNT', 1)
-elif cc.links('''
+endif
+
+# Check for __cpuidex()
+if cc.links('''
+ #ifdef _MSC_VER
#include <intrin.h>
+ #else
+ #include <cpuid.h>
+ #endif
int main(int arg, char **argv)
{
unsigned int exx[4] = {0, 0, 0, 0};
- __cpuidex(exx, 7, 0);
+ __cpuidex((int *) exx, 7, 0);
}
''', name: '__cpuidex',
args: test_c_args)
#if defined(USE_SSE2) || defined(__i386__)
-#if defined(HAVE__GET_CPUID) || defined(HAVE__GET_CPUID_COUNT)
-#include <cpuid.h>
-#endif
-
-#if defined(HAVE__CPUID) || defined(HAVE__CPUIDEX)
+#ifdef _MSC_VER
#include <intrin.h>
+#else
+#include <cpuid.h>
#endif
#ifdef HAVE_XSAVE_INTRINSICS