X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fpsi%2Fpsi_decl.m4;h=ae44e73e89e85fb4440ea2efecd80302f7af666d;hb=6864dd48391d1e98959ac13d5a0914693b4f1d0f;hp=9730839a5c1903f43f626202281dfeb556896b32;hpb=c9b3436bd51a4dcf7d6cc6817d4c7a8ad99538d4;p=m6w6%2Fext-psi diff --git a/m4/psi/psi_decl.m4 b/m4/psi/psi_decl.m4 index 9730839..ae44e73 100644 --- a/m4/psi/psi_decl.m4 +++ b/m4/psi/psi_decl.m4 @@ -2,7 +2,7 @@ # Add a function redirection to $PSI_REDIRS. psi_add_redir() { cat >>$PSI_REDIRS <>$PSI_VA_DECLS <>$PSI_DECLS <@@:>@+U '$psi_cv_libc_main'/ {next} /^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'` - ]) - [psi_cv_fn_]PSI_VAR_NAME($1)=$psi_symbol_redirect + for lib in "" $4; do + decl_save_LIBS=$LIBS + LIBS=$lib + AC_TRY_LINK(PSI_INCLUDES, [ + void (*fn)(void) = (void (*)(void)) $psi_symbol; (*fn)() + ], [ + psi_symbol_redirect=`nm -g conftest$ac_exeext | $AWK -F ' *|@' '/^@<:@@<:@:space:@:>@@:>@+U '$psi_cv_libc_main'/ {next} /^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'` + ]) + LIBS=$decl_save_LIBS + + if test -n "$psi_symbol_redirect"; then + if test -n "$lib"; then + psi_decl_check="$psi_symbol_redirect in $lib" + else + psi_decl_check="$psi_symbol_redirect" + fi + break + fi + done + [psi_cv_fn_]PSI_VAR_NAME($1)=$psi_decl_check ]) - case "$[psi_cv_fn_]PSI_VAR_NAME($1)" in + + psi_symbol_redirect=`AS_ECHO("$[psi_cv_fn_]PSI_VAR_NAME($1)") | $AWK -F " in " '{print [$]1}'` + psi_symbol_libflag=`AS_ECHO("$[psi_cv_fn_]PSI_VAR_NAME($1)") | $AWK -F " in " '{print [$]2}'` + + if test -n "$psi_symbol_libflag"; then + if ! expr "X$LIBS" : "X.*\b$psi_symbol_libflag\b" >/dev/null; then + LIBS="$psi_symbol_libflag $LIBS" + fi + fi + + case "$psi_symbol_redirect" in "$psi_symbol"|"_$psi_symbol") case "$PHP_DEBUG-$3" in "1-") @@ -110,7 +137,7 @@ AC_DEFUN(PSI_DECL, [ ;; "") ifelse([$3], vararg, [ - AC_MSG_ERROR(varargs macro support is not implemented) + AC_MSG_WARN(varargs macro support is not implemented) ],[ PSI_MACRO($1, $2, [ psi_add_decl "$psi_decl_args"