From: Michael Wallner Date: Thu, 14 Apr 2016 12:01:38 +0000 (+0200) Subject: fix bashisms in configure X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=03100f9c2f83b42bee97e4adcfba5d8821c4ac22;p=m6w6%2Fext-psi fix bashisms in configure --- diff --git a/config.m4 b/config.m4 index b54c98e..e42e3bf 100644 --- a/config.m4 +++ b/config.m4 @@ -62,6 +62,7 @@ if test "$PHP_PSI" != no; then PSI_CHECK_LIBJIT PSI_CHECK_LIBFFI + AC_PATH_PROG(NM, nm) AC_FUNC_FNMATCH PSI_CONFIG_INIT diff --git a/m4/psi.m4 b/m4/psi.m4 index cf7a035..9f770c9 100644 --- a/m4/psi.m4 +++ b/m4/psi.m4 @@ -152,7 +152,7 @@ dnl PSI_CONFIG_POSIX(section, headers) 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 ]) diff --git a/m4/psi_const.m4 b/m4/psi_const.m4 index 6b86d11..8ea5c1f 100644 --- a/m4/psi_const.m4 +++ b/m4/psi_const.m4 @@ -1,13 +1,19 @@ # 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 <>$PSI_CONSTS <<<" {PSI_T_INT, \"int\", \"psi\\\\$1\", \"$2\", PSI_T_NUMBER}, " + grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS \ + || cat >>$PSI_CONSTS <>$PSI_REDIRS <<<" {\"$1\", (psi_func_ptr) $2}, " + cat >>$PSI_REDIRS <>$PSI_VA_DECLS <<<" $1, {0}, " + cat >>$PSI_VA_DECLS <>$PSI_DECLS <<<" $1, {0}, " + cat >>$PSI_DECLS <@@:>@+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 ]) @@ -73,9 +78,9 @@ AC_DEFUN(PSI_DECL, [ 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 ]) @@ -83,12 +88,17 @@ AC_DEFUN(PSI_DECL, [ "$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 ]) diff --git a/m4/psi_macro.m4 b/m4/psi_macro.m4 index e89e74b..b3ee988 100644 --- a/m4/psi_macro.m4 +++ b/m4/psi_macro.m4 @@ -1,7 +1,9 @@ # psi_add_macro(macro) # Add a pre-defined macro function to $PSI_MACROS. psi_add_macro() { - cat >>$PSI_MACROS <<<"$1" + cat >>$PSI_MACROS <>$PSI_STRUCTS <<<" $1, {0}, " + cat >>$PSI_STRUCTS <>$PSI_UNIONS <<<" $1, {0}, " + cat >>$PSI_UNIONS <>$PSI_TYPES <<<" $1, " + cat >>$PSI_TYPES <>$PSI_STDTYPES <<<" $1, " + cat >>$PSI_STDTYPES <, \"\" 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\"" ;;