Permalink
Browse files

m4: Fix echo -n littering in ax_app and ax_module

This fixes the problem where gcc4.7 gets angry that there are a bunch
of extra '-n' flags in its arguments. I stole the fix from Vision
Workbench (which provides a backwards compatible AS_ECHO_N). Thanks
Lundy.
  • Loading branch information...
1 parent 3ec919f commit b9aea2a56c2a70ce846e434a532861abb9fe694e Zack Moratto committed Nov 25, 2012
Showing with 20 additions and 6 deletions.
  1. +8 −3 m4/ax_app.m4
  2. +8 −3 m4/ax_module.m4
  3. +4 −0 m4/fixups.m4
View
@@ -32,13 +32,18 @@ AC_DEFUN([AX_APP],
}
var_uniq() {
- echo -n "[$]*" | sed 's/ \+/\n/g' | sed -n 'G; s/\n/&&/; /^\(@<:@^\n@:>@*\n\).*\n\1/d; s/\n//; h; P' | tr '\n' ' '
+ ASP_ECHO_N(["[$]*"]) | sed 's/ \+/\n/g' | sed -n 'G; s/\n/&&/; /^\(@<:@^\n@:>@*\n\).*\n\1/d; s/\n//; h; P' | tr '\n' ' '
}
get_rpath() {
for i in "[$]@"; do
case [$i] in
- -L*) v="`abspath ${i#-L}`"; if test -n "$v"; then echo -n " -R$v"; fi;;
+ -L*)
+ v="`abspath ${i#-L}`";
+ if test -n "$v"; then
+ ASP_ECHO_N([" -R$v"])
+ fi
+ ;;
esac
done
echo
@@ -64,7 +69,7 @@ AC_DEFUN([AX_APP],
AC_ARG_ENABLE([app-]my_tolower([$1]),
AS_HELP_STRING([--enable-app-]my_tolower([$1]), [enable the $1 app @<:@$3@:>@]),
[ ENABLE_APP_$1=$enableval; WANT_APP_$1=$enableval; ],
- [ if test "x$ENABLE_APP_$1" = x; then ENABLE_APP_$1=`/bin/echo -n $3 | tr [A-Z] [a-z]` ; fi ]
+ [ if test "x$ENABLE_APP_$1" = x; then ENABLE_APP_$1=`ASP_ECHO_N([$3]) | tr [A-Z] [a-z]` ; fi ]
)])
AC_MSG_CHECKING([whether to build app $1])
View
@@ -32,13 +32,18 @@ AC_DEFUN([AX_MODULE],
}
var_uniq() {
- echo -n "[$]*" | sed 's/ \+/\n/g' | sed -n 'G; s/\n/&&/; /^\(@<:@^\n@:>@*\n\).*\n\1/d; s/\n//; h; P' | tr '\n' ' '
+ ASP_ECHO_N(["[$]*"]) | sed 's/ \+/\n/g' | sed -n 'G; s/\n/&&/; /^\(@<:@^\n@:>@*\n\).*\n\1/d; s/\n//; h; P' | tr '\n' ' '
}
get_rpath() {
for i in "[$]@"; do
case [$i] in
- -L*) v="`abspath ${i#-L}`"; if test -n "$v"; then echo -n " -R$v"; fi;;
+ -L*)
+ v="`abspath ${i#-L}`";
+ if test -n "$v"; then
+ ASP_ECHO_N([" -R$v"])
+ fi
+ ;;
esac
done
echo
@@ -64,7 +69,7 @@ AC_DEFUN([AX_MODULE],
AC_ARG_ENABLE([module-]my_tolower([$1]),
AS_HELP_STRING([--enable-module-]my_tolower([$1]), [enable the $1 module @<:@$4@:>@]),
[ ENABLE_MODULE_$1=$enableval; WANT_MODULE_$1=$enableval; ],
- [ if test x"$ENABLE_MODULE_$1" = x; then ENABLE_MODULE_$1=`/bin/echo -n $4 | tr [A-Z] [a-z]` ; fi ]
+ [ if test x"$ENABLE_MODULE_$1" = x; then ENABLE_MODULE_$1=`ASP_ECHO_N([$4]) | tr [A-Z] [a-z]` ; fi ]
)])
AC_MSG_CHECKING([whether to build module $1])
View
@@ -42,5 +42,9 @@ m4_ifset([m4_argn], [],
[m4_define([m4_argn],
[m4_car(m4_shiftn($1, $@))])])
+m4_ifset([AS_ECHO_N], [m4_copy([AS_ECHO_N], [ASP_ECHO_N])],
+[m4_define([ASP_ECHO_N],
+ [AS_REQUIRE([_AS_ECHO_N_PREPARE])dnl
+ echo $ECHO_N $1"$ECHO_C"])])
m4_define([_AX_FIXUPS], [1])

0 comments on commit b9aea2a

Please sign in to comment.