Simplify pipe management

We don't need to write perl like C.
Work around automake bug that dropped portability warnings

There’s a bug in automake ≥ 1.10, < 1.12 where ‘-Wall foreign’
incorrectly turns off warnings about portability issues.  To get
consistent results across automake versions, use ‘foreign -Wall’
instead.

http://debbugs.gnu.org/cgi-bin/bugreport.cgi?bug=7669

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Closes #413