diff options
author | Mateusz Piotrowski <0mp@FreeBSD.org> | 2018-12-30T01·32+0100 |
---|---|---|
committer | Mateusz Piotrowski <0mp@FreeBSD.org> | 2018-12-30T01·32+0100 |
commit | e8b0efdcc9d6329b299937790360cac8b9b256c9 (patch) | |
tree | 9b6b5a1cdc927173d4214a3bc003f7650398aced | |
parent | ff342fc0c2be662dd9791ff32b4d6d63e35aa2e9 (diff) |
Remove some bashisms from configure.ac
"configure.ac" is used to generate "configure", which is supposed to be run with /bin/sh (as suggested by the shebang line of "configure"). As a result it is a good idea to remove any /bin/sh-incompatible syntax from configure.ac. Otherwise, systems that do not use Bash as their /bin/sh are unable to run "configure" due to syntax errors.
-rw-r--r-- | configure.ac | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index 85fec77a29c9..ecacb8ab45be 100644 --- a/configure.ac +++ b/configure.ac @@ -214,9 +214,11 @@ AC_SUBST(ENABLE_S3, [$enable_s3]) AC_LANG_POP(C++) if test -n "$enable_s3"; then - declare -a aws_version_tokens=($(printf '#include <aws/core/VersionConfig.h>\nAWS_SDK_VERSION_STRING' | $CPP $CPPFLAGS - | grep -v '^#.*' | sed 's/"//g' | tr '.' ' ')) - AC_DEFINE_UNQUOTED([AWS_VERSION_MAJOR], ${aws_version_tokens@<:@0@:>@}, [Major version of aws-sdk-cpp.]) - AC_DEFINE_UNQUOTED([AWS_VERSION_MINOR], ${aws_version_tokens@<:@1@:>@}, [Minor version of aws-sdk-cpp.]) + aws_version_tokens="$(printf '#include <aws/core/VersionConfig.h>\nAWS_SDK_VERSION_STRING' | $CPP $CPPFLAGS - | grep -v '^#.*' | sed 's/"//g' | tr '.' ' ')" + aws_major_version="$(awk -v ver="${aws_version_tokens}" '{print $1}')" + aws_minor_version="$(awk -v ver="${aws_version_tokens}" '{print $2}')" + AC_DEFINE_UNQUOTED([AWS_VERSION_MAJOR], ${aws_major_version}, [Major version of aws-sdk-cpp.]) + AC_DEFINE_UNQUOTED([AWS_VERSION_MINOR], ${aws_minor_version}, [Minor version of aws-sdk-cpp.]) fi @@ -279,9 +281,12 @@ AC_SUBST(sandbox_shell) test "$prefix" = NONE && prefix=$ac_default_prefix test "$exec_prefix" = NONE && exec_prefix='${prefix}' for name in $ac_subst_vars; do - declare $name="$(eval echo "${!name}")" - declare $name="$(eval echo "${!name}")" - declare $name="$(eval echo "${!name}")" + for _ in 1 2 3; do + if printf '%s' "${name}" | egrep '^[_[:alpha:]][_[:alnum:]]*$' + then + eval "${name}"="$(eval echo "\${${name}}")" + fi + done done rm -f Makefile.config |