"Fossies" - the Fresh Open Source Software Archive

Member "ruby-2.7.4/tool/m4/ruby_decl_attribute.m4" (7 Jul 2021, 1630 Bytes) of package /linux/misc/ruby-2.7.4.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # -*- Autoconf -*-
    2 dnl RUBY_DECL_ATTRIBUTE(attrib, macroname, cachevar, condition, type, code)
    3 AC_DEFUN([RUBY_DECL_ATTRIBUTE], [dnl
    4 m4_ifval([$2], dnl
    5   [AS_VAR_PUSHDEF([attrib], m4_bpatsubst([$2], [(.*)], []))], dnl
    6   [AS_VAR_PUSHDEF([attrib], m4_toupper(m4_format(%.4s, [$5]))[_]AS_TR_CPP($1))] dnl
    7 )dnl
    8 m4_ifval([$3], dnl
    9   [AS_VAR_PUSHDEF([rbcv],[$3])], dnl
   10   [AS_VAR_PUSHDEF([rbcv],[rb_cv_]m4_format(%.4s, [$5])[_][$1])]dnl
   11 )dnl
   12 m4_pushdef([attrib_code],[m4_bpatsubst([$1],["],[\\"])])dnl
   13 m4_pushdef([attrib_params],[m4_bpatsubst([$2(x)],[^[^()]*(\([^()]*\)).*],[\1])])dnl
   14 m4_ifval([$4], [rbcv_cond=["$4"]; test "$rbcv_cond" || unset rbcv_cond])
   15 AC_CACHE_CHECK(for m4_ifval([$2],[m4_bpatsubst([$2], [(.*)], [])],[$1]) [$5] attribute, rbcv, dnl
   16 [rbcv=x
   17 RUBY_WERROR_FLAG([
   18 for mac in \
   19     "__attribute__ ((attrib_code)) x" \
   20     "x __attribute__ ((attrib_code))" \
   21     "__declspec(attrib_code) x" \
   22     x; do
   23   m4_ifval([$4],mac="$mac"${rbcv_cond+" /* only if $rbcv_cond */"})
   24   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
   25     m4_ifval([$4],${rbcv_cond+[@%:@if ]$rbcv_cond})
   26 [@%:@define ]attrib[](attrib_params)[ $mac]
   27 m4_ifval([$4],${rbcv_cond+[@%:@else]}
   28 ${rbcv_cond+[@%:@define ]attrib[](attrib_params)[ x]}
   29 ${rbcv_cond+[@%:@endif]})
   30 $6
   31 @%:@define mesg ("")
   32 @%:@define san "address"
   33     attrib[](attrib_params)[;]], [[]])],
   34     [rbcv="$mac"; break])
   35 done
   36 ])])
   37 AS_IF([test "$rbcv" != x], [
   38     RUBY_DEFINE_IF(m4_ifval([$4],[${rbcv_cond}]), attrib[](attrib_params)[], $rbcv)
   39 ])
   40 m4_ifval([$4], [unset rbcv_cond]) dnl
   41 m4_popdef([attrib_params])dnl
   42 m4_popdef([attrib_code])dnl
   43 AS_VAR_POPDEF([attrib])dnl
   44 AS_VAR_POPDEF([rbcv])dnl
   45 ])dnl