Skip to content

Commit

Permalink
Extract RUBY_REQUIRE_FUNCS
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Mar 28, 2022
1 parent 282baa6 commit 2cb3eff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
9 changes: 2 additions & 7 deletions configure.ac
Expand Up @@ -34,6 +34,7 @@ m4_include([tool/m4/ruby_prepend_option.m4])dnl
m4_include([tool/m4/ruby_prog_gnu_ld.m4])dnl
m4_include([tool/m4/ruby_replace_funcs.m4])dnl
m4_include([tool/m4/ruby_replace_type.m4])dnl
m4_include([tool/m4/ruby_require_funcs.m4])dnl
m4_include([tool/m4/ruby_rm_recursive.m4])dnl
m4_include([tool/m4/ruby_setjmp_type.m4])dnl
m4_include([tool/m4/ruby_stack_grow_direction.m4])dnl
Expand Down Expand Up @@ -1943,17 +1944,11 @@ AS_CASE(["$target_os"],[freebsd*],[
AC_REPLACE_FUNCS(close)
])

AC_DEFUN([RUBY_REQUIRE_FUNC], [
AC_CHECK_FUNCS([$1])
AS_IF([test "$ac_cv_func_[]AS_TR_SH($1)" = yes], [],
[AC_MSG_ERROR($1[() must be supported])])
])

# dup and dup2 are always available except for WASI
AS_CASE(["$target_os"],
[wasi*], [],
[
m4_map_args_w([dup dup2], [RUBY_REQUIRE_FUNC(], [)])
RUBY_REQUIRE_FUNCS(dup dup2)
]
)

Expand Down
13 changes: 13 additions & 0 deletions tool/m4/ruby_require_funcs.m4
@@ -0,0 +1,13 @@
dnl -*- Autoconf -*-
dnl RUBY_REQUIRE_FUNC [func] [included]
AC_DEFUN([RUBY_REQUIRE_FUNC], [
# RUBY_REQUIRE_FUNC([$1], [$2])
AC_CHECK_FUNCS([$1])
AS_IF([test "$ac_cv_func_[]AS_TR_SH($1)" = yes], [],
[AC_MSG_ERROR($1[() must be supported])])
])dnl
dnl
dnl RUBY_REQUIRE_FUNCS [funcs] [included]
AC_DEFUN([RUBY_REQUIRE_FUNCS], [dnl
m4_map_args_w([$1], [RUBY_REQUIRE_FUNC(], [), [$2]])dnl
])dnl

0 comments on commit 2cb3eff

Please sign in to comment.