diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass index 9143aa454d0d..0546c5c3c576 100644 --- a/eclass/autotools.eclass +++ b/eclass/autotools.eclass @@ -518,6 +518,31 @@ autotools_run_tool() { set -- "${1}" $(autotools_m4dir_include) "${@:2}" $(autotools_m4sysdir_include) fi + # re-order arguments, bug #680210 + local _old_args=( ${@} ) + local _at_command= + local _at_file= + local -a _at_args=() + local _argument= + + for _argument in ${_old_args[*]}; do + if [[ -z "${_at_command}" ]]; then + _at_command=${_argument} + continue + fi + + if [[ -z "${_at_file}" && "${_argument}" =~ \.(in|ac)$ ]]; then + _at_file=${_argument} + continue + fi + + _at_args+=( ${_argument} ) + done + + debug-print "\$@ before reordering of arguments: ${@}" + set -- "${_at_command}" "${_at_args[@]}" "${_at_file}" + debug-print "\$@ after reordering of arguments: ${@}" + # If the caller wants to probe something, then let them do it directly. if ${return_output} ; then "$@"