於 二,2015-06-30 於 09:37 +0200,Thomas Jahns 提到: > On 06/29/15 17:31, Alex Vong wrote: > > Thanks for telling me there is no portable flag for doing so. > > I am now using AC_SUBST() to set the value of STREAM and append ` > > $(STREAM)>/dev/null' to every make command. If the user configure with > > --enable-verbose-compiler, then STREAM will be set to 0, otherwise > > STREAM will be set to 2. This keeps the flexibility. Does it sound > > reasonable? > > I'm not sure if an output redirection on stdin is portable. But I think given > the way you are going about this you could easily set a Makefile variable to > the > full redirection (or none), i.e. lose the >/dev/null and instead make STREAM > be > either '2>/dev/null' or the empty string ''? > > Regards, Thomas Hi Thomas, I tried substituting `2>/dev/null' before but without success. However, I try again just now and find out that if I add a pair of single quotes, then it will work just fine. In short, the following code will work
AS_IF([test "x$enable_verbose_compiler" != "xyes"], [AC_SUBST([REDIRECTION], ['2>/dev/null'])] ) Thanks for the suggestion! Cheers, Alex