PSI_CHECK_LIBJIT
PSI_CHECK_LIBFFI
+ AC_PATH_PROG(NM, nm)
AC_FUNC_FNMATCH
PSI_CONFIG_INIT
AC_DEFUN(PSI_CONFIG_POSIX, [
PSI_CONFIG_POSIX_ENABLED($1, [
PHP_CONFIGURE_PART(Configuring PSI POSIX: $1)
- ifelse([$2],,,AC_CHECK_HEADERS($2))
+ ifelse([$2],,:,[AC_CHECK_HEADERS($2)])
], [
return 0
])
# psi_add_str_const(name, value)
# Add a pre-defined string constant to $PSI_CONSTS
psi_add_str_const() {
- grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS || cat >>$PSI_CONSTS <<<" {PSI_T_STRING, \"string\", \"psi\\\\$1\", $2, PSI_T_QUOTED_STRING}, "
+ grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS \
+ || cat >>$PSI_CONSTS <<EOF
+ {PSI_T_STRING, "string", "psi\\$1", $2, PSI_T_QUOTED_STRING},
+EOF
}
# psi_add_int_const(name, value)
# Add a pre-defined int constant to $PSI_CONSTS
psi_add_int_const() {
- grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS || cat >>$PSI_CONSTS <<<" {PSI_T_INT, \"int\", \"psi\\\\$1\", \"$2\", PSI_T_NUMBER}, "
+ grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS \
+ || cat >>$PSI_CONSTS <<EOF
+ {PSI_T_INT, "int", "psi\\$1", "$2", PSI_T_NUMBER},
+EOF
}
dnl PSI_CONST(const name, type)
# psi_add_redir(name, symbol)
# Add a function redirection to $PSI_REDIRS.
psi_add_redir() {
- cat >>$PSI_REDIRS <<<" {\"$1\", (psi_func_ptr) $2}, "
+ cat >>$PSI_REDIRS <<EOF
+ {"$1", (psi_func_ptr) $2},
+EOF
}
# psi_add_decl(decl, options)
psi_add_decl() {
case "$2" in
*vararg*)
- cat >>$PSI_VA_DECLS <<<" $1, {0}, "
+ cat >>$PSI_VA_DECLS <<EOF
+ $1, {0},
+EOF
;;
*)
- cat >>$PSI_DECLS <<<" $1, {0}, "
+ cat >>$PSI_DECLS <<EOF
+ $1, {0},
+EOF
;;
esac
}
dnl PSI_FUNC_LIBC_MAIN()
dnl Check for the platforms default stub in executables.
AC_DEFUN(PSI_FUNC_LIBC_MAIN, [
- AC_REQUIRE([AC_PROG_NM])
AC_REQUIRE([AC_PROG_AWK])
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" *|@" '/^@<:@@<:@:space:@:>@@:>@+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
])
AC_CACHE_CHECK(for PSI_VAR_NAME($1), [psi_cv_fn_]PSI_VAR_NAME($1), [
psi_symbol_redirect=
AC_TRY_LINK(PSI_INCLUDES, [
- void (*fn)(void) = (void (*)(void)) $psi_symbol;
+ 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}'`
+ 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_]PSI_VAR_NAME($1)=$psi_symbol_redirect
])
"$psi_symbol"|"_$psi_symbol")
psi_add_decl "$psi_decl_args" $3
;;
- *)
+ "")
ifelse([$3], vararg, [
AC_MSG_ERROR(varargs macro support is not implemented)
],[
- PSI_MACRO($1, $2, [psi_add_decl "$psi_decl_args"])
+ PSI_MACRO($1, $2, [
+ psi_add_decl "$psi_decl_args"
+ ])
])
;;
+ "*")
+ PSI_REDIR($psi_symbol, $psi_symbol_redirect)
+ ;;
esac
])
# psi_add_macro(macro)
# Add a pre-defined macro function to $PSI_MACROS.
psi_add_macro() {
- cat >>$PSI_MACROS <<<"$1"
+ cat >>$PSI_MACROS <<EOF
+$1
+EOF
}
dnl PSI_MACRO(macro, decl args, action-if-true)
# psi_add_struct(struct members)
# Add a pre-defined struct to $PSI_STRUCTS.
psi_add_struct() {
- cat >>$PSI_STRUCTS <<<" $1, {0}, "
+ cat >>$PSI_STRUCTS <<EOF
+ $1, {0},
+EOF
}
# psi_add_union(union/struct members)
# Add a pre-defined union to $PSI_UNIONS.
psi_add_union() {
- cat >>$PSI_UNIONS <<<" $1, {0}, "
+ cat >>$PSI_UNIONS <<EOF
+ $1, {0},
+EOF
}
dnl PSI_STRUCT_MEMBER(struct name, decl member)
# psi_add_type(type triplet)
# Add a pre-defined type to $PSI_TYPES.
psi_add_type() {
- cat >>$PSI_TYPES <<<" $1, "
+ cat >>$PSI_TYPES <<EOF
+ $1,
+EOF
}
psi_add_stdtype() {
- cat >>$PSI_STDTYPES <<<" $1, "
+ cat >>$PSI_STDTYPES <<EOF
+ $1,
+EOF
}
# psi_type_pair(type, size)
# Output a PSI_T_<TYPE>, \"<TYPENAME>\" tuple.
# Uses stdint types when possible.
psi_type_pair() {
- local psi_type_name=`tr -cd A-Za-z0-9_ <<<$1`
- local psi_type_lower=`tr A-Z a-z <<<$psi_type_name`
+ local psi_type_name=`printf "%s" "$1" | tr -cd A-Za-z0-9_`
+ local psi_type_lower=`printf "%s" "$1" | tr A-Z a-z`
case $psi_type_lower in
int*|uint*)
- local psi_type_upper=`tr a-z A-Z <<<$psi_type_name`
+ local psi_type_upper=`printf "%s" "$psi_type_name" | tr a-z A-Z`
local psi_type_bits=`expr $2 \* 8`
echo "PSI_T_${psi_type_upper}${psi_type_bits}, \"${psi_type_lower}${psi_type_bits}_t\""
;;