stdio vararg decls
[m6w6/ext-psi] / m4 / psi_decl.m4
index a08197e6b2947f48530bc220ff9e9773febadeb4..69f8edb4e7b2c92905b142a132e391c9ebfb3361 100644 (file)
@@ -7,7 +7,7 @@ AC_DEFUN(PSI_FUNC_LIBC_MAIN, [
        AC_CACHE_CHECK(for libc start main symbol, psi_cv_libc_main, [
                psi_libc_main=
                AC_TRY_LINK(PSI_INCLUDES, [(void)0;], [
-                       psi_libc_main=`$NM -g conftest$ac_exeext | $AWK -F" *|@" '/^\s+U / {print$[]3; exit}'`
+                       psi_libc_main=`$NM -g conftest$ac_exeext | $AWK -F" *|@" '/^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'`
                ])
                psi_cv_libc_main=$psi_libc_main
        ])
@@ -22,7 +22,7 @@ AC_DEFUN(PSI_FUNC, [
                AC_TRY_LINK(PSI_INCLUDES, [
                        void (*fn)(void) = (void (*)(void)) $psi_symbol;
                ], [
-                       psi_symbol_redirect=`$NM -g conftest$ac_exeext | $AWK -F" *|@" '/^\s+U '$psi_cv_libc_main'/ {next} /^\s+U / {print$[]3; exit}'`
+                       psi_symbol_redirect=`$NM -g conftest$ac_exeext | $AWK -F" *|@" '/^@<:@@<:@:space:@:>@@:>@+U '$psi_cv_libc_main'/ {next} /^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'`
                ])
                psi_cv_fn_$1=$psi_symbol_redirect
        ])
@@ -51,7 +51,7 @@ AC_DEFUN(PSI_DECL_ARG, [
     psi_decl_args="[$psi_decl_args{]PSI_TYPE_PAIR(member_type)[, \"]member_name[\",] $pl, $as[}]"
 ])
 
-dnl PSI_DECL(type func, args)
+dnl PSI_DECL(type func, args, flags)
 AC_DEFUN(PSI_DECL, [
        psi_decl_args=
        PSI_DECL_ARG($1)
@@ -60,9 +60,14 @@ AC_DEFUN(PSI_DECL, [
                [()], [],
                [m4_map_args_sep([PSI_DECL_ARG(m4_normalize(], [))], [], m4_bregexp([$2], [(\(.*\))], [\1]))])
        PSI_FUNC(PSI_VAR_NAME($1), [
-               PSI_DECLS="$psi_decl_args, {0}, $PSI_DECLS"
+               ifelse([$3], vararg, [
+                       PSI_VA_DECLS="$psi_decl_args, {0}, $PSI_VA_DECLS"
+               ], [
+                       PSI_DECLS="$psi_decl_args, {0}, $PSI_DECLS"
+               ])
        ], [
                PSI_MACRO($1, $2, [
+                       ifelse([$3], vararg, AC_MSG_ERROR(varargs macro support is not implemented),[])
                        PSI_DECLS="$psi_decl_args, {0}, $PSI_DECLS"
                ])
        ])