fix bashisms in configure
authorMichael Wallner <mike@php.net>
Thu, 14 Apr 2016 12:01:38 +0000 (14:01 +0200)
committerMichael Wallner <mike@php.net>
Thu, 14 Apr 2016 12:01:38 +0000 (14:01 +0200)
config.m4
m4/psi.m4
m4/psi_const.m4
m4/psi_decl.m4
m4/psi_macro.m4
m4/psi_struct.m4
m4/psi_type.m4

index b54c98ee9373af09a620a01aaa8fd6c2d763783c..e42e3bf4dd4a84ad45120cb8ebdc26c7a888e559 100644 (file)
--- a/config.m4
+++ b/config.m4
@@ -62,6 +62,7 @@ if test "$PHP_PSI" != no; then
        PSI_CHECK_LIBJIT
        PSI_CHECK_LIBFFI
 
        PSI_CHECK_LIBJIT
        PSI_CHECK_LIBFFI
 
+       AC_PATH_PROG(NM, nm)
        AC_FUNC_FNMATCH
        
        PSI_CONFIG_INIT
        AC_FUNC_FNMATCH
        
        PSI_CONFIG_INIT
index cf7a0354e1ff0863fbc9eb43343b3b79f15bf036..9f770c903b9854a61dc0af61016332d8a7832355 100644 (file)
--- 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)
 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
        ])
        ], [
                return 0
        ])
index 6b86d11e0b529106cad7810b0a8e0820cee1a38e..8ea5c1f4491510e6e430fa3beea4795900a0acfc 100644 (file)
@@ -1,13 +1,19 @@
 # psi_add_str_const(name, value)
 # Add a pre-defined string constant to $PSI_CONSTS
 psi_add_str_const() {
 # 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() {
 }
 
 # 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)
 }
 
 dnl PSI_CONST(const name, type)
index d1acd32f1eb248da35392cfc5004fdc87f6601f9..6a0ef809916b256dd99e8f7e8cfeedd93c7d2014 100644 (file)
@@ -1,7 +1,9 @@
 # psi_add_redir(name, symbol)
 # Add a function redirection to $PSI_REDIRS.
 psi_add_redir() {
 # 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(decl, options)
@@ -9,10 +11,14 @@ psi_add_redir() {
 psi_add_decl() {
        case "$2" in
        *vararg*)
 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
 }
                ;;
        esac
 }
@@ -26,12 +32,11 @@ AC_DEFUN(PSI_REDIR, [
 dnl PSI_FUNC_LIBC_MAIN()
 dnl Check for the platforms default stub in executables.
 AC_DEFUN(PSI_FUNC_LIBC_MAIN, [
 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;], [
        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
        ])
                ])
                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, [
        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_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
                ;;
        "$psi_symbol"|"_$psi_symbol")
                psi_add_decl "$psi_decl_args" $3
                ;;
-       *)
+       "")
                ifelse([$3], vararg, [
                        AC_MSG_ERROR(varargs macro support is not implemented)
                ],[
                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
 ])
        esac
 ])
index e89e74b05967504ac733a4ade49d4bed7000cbfe..b3ee9882ebb7d8fda758b79a2b1cee9e69d98ccc 100644 (file)
@@ -1,7 +1,9 @@
 # psi_add_macro(macro)
 # Add a pre-defined macro function to $PSI_MACROS.
 psi_add_macro() {
 # 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)
 }
 
 dnl PSI_MACRO(macro, decl args, action-if-true)
index e25b354e2824dc7b6be985b2229fcf6169e291cd..800e03644354724cd07ef88f2eb4bbfb2c018de8 100644 (file)
@@ -1,13 +1,17 @@
 # psi_add_struct(struct members)
 # Add a pre-defined struct to $PSI_STRUCTS.
 psi_add_struct() {
 # 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() {
 }
 
 # 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)
 }
 
 dnl PSI_STRUCT_MEMBER(struct name, decl member)
index b635e173c230e422819ca90f42137fac21c72fd4..ef073ca3191f844bb5325a41310ef76ee99556ef 100644 (file)
@@ -1,22 +1,26 @@
 # psi_add_type(type triplet)
 # Add a pre-defined type to $PSI_TYPES.
 psi_add_type() {
 # 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() {
 }
 
 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() {
 }
 
 # 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*)
        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\""
                ;;
                local psi_type_bits=`expr $2 \* 8`
                echo "PSI_T_${psi_type_upper}${psi_type_bits}, \"${psi_type_lower}${psi_type_bits}_t\""
                ;;