1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Checks for CPU specific header on universal build

This commit is contained in:
Nobuyoshi Nakada 2021-10-01 20:25:30 +09:00
parent c7414f517f
commit 0ad3ed5e0e
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
Notes: git 2021-10-01 21:48:27 +09:00
2 changed files with 33 additions and 0 deletions

View file

@ -1283,6 +1283,7 @@ AC_CHECK_HEADERS(utime.h)
AS_CASE("$target_cpu", [x64|x86_64|i[3-6]86*], [
AC_CHECK_HEADERS(x86intrin.h)
])
RUBY_UNIVERSAL_CHECK_HEADER([x86_64, i386], x86intrin.h)
AC_ARG_WITH([gmp],
[AS_HELP_STRING([--without-gmp],

View file

@ -88,3 +88,35 @@ AS_IF([test "x${ARCH_FLAG}" != x], [
])
# RUBY_UNIVERSAL_ARCH end
])dnl
dnl
AC_DEFUN([RUBY_UNIVERSAL_CHECK_HEADER_COND], [ dnl
AC_CACHE_CHECK([for $2 when $1], [$3],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT([$6])[
@%:@if ]$1[
@%:@include <]$2[>
@%:@endif]], [[]])],
[AS_VAR_SET($3, yes)],
[AS_VAR_SET($3, no)]))
AS_VAR_IF([$3], [yes], [dnl
printf "@%:@if %s\n" "$1" >>confdefs.h
AC_DEFINE_UNQUOTED(HAVE_[]AS_TR_CPP($2), 1)dnl
printf "@%:@endif\n" >>confdefs.h dnl
$4], [$5])
])dnl
dnl
# RUBY_UNIVERSAL_CHECK_HEADER(CPU-LIST, HEADER,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
# [INCLUDES = DEFAULT-INCLUDES])
AC_DEFUN([RUBY_UNIVERSAL_CHECK_HEADER], [ dnl
m4_if([$# dnl
], [0], [], [ dnl
m4_foreach([rb_Header], [$1],
[AS_CASE([",$target_archs,"], [*,]rb_Header[,*],
[RUBY_UNIVERSAL_CHECK_HEADER_COND]([defined(__[]rb_Header[]__)],
[$2], [rb_cv_header_[]AS_TR_SH($2)_on_[]AS_TR_SH(rb_Header)],
[$3], [$4], [$5])
)
])
])dnl
])dnl