> autoconf concludes that "gcc -E" is equivalent to cpp on my system. And
> it is, except that it needs an explicit bare "-" argument to try reading
> from a pipe, which is how cpp was being used. I can test for "gcc" being
> in the command, and add the argument, _or_ can change the scripts to
> write a temporary file instead (they already write some temp files).
Add the following to configure.in after AC_PROG_CPP and use the resultant
flag from CPPSTDIN: (either nothing or -)
--- cut here ---
AC_DEFUN(AC_TRY_CPPSTDIN,
[AC_REQUIRE_CPP()dnl
cat > conftest.$ac_ext <<EOF
[#]line __oline__ "configure"
#include "confdefs.h"
[$1]
EOF
ac_try="$ac_cpp $CPPSTDIN <conftest.$ac_ext >/dev/null 2>conftest.out"
AC_TRY_EVAL(ac_try)
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
ifelse([$2], , :, [rm -rf conftest*
$2])
else
echo "$ac_err" >&AC_FD_CC
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$3], , , [ rm -rf conftest*
$3
])dnl
fi
rm -f conftest*])
AC_MSG_CHECKING(how to use cpp with stdin)
if test -z "$CPPSTDIN"; then
AC_CACHE_VAL(ac_cv_cpp_stdin,
[ CPPSTDIN=""
AC_TRY_CPPSTDIN([#include <assert.h>
Syntax Error], , CPPSTDIN="-")
ac_cv_cpp_stdin="$CPPSTDIN"])
CPPSTDIN="$ac_cv_cpp_stdin"
else
ac_cv_cpp_stdin="$CPPSTDIN"
fi
AC_MSG_RESULT($CPP $CPPSTDIN)
AC_SUBST(CPPSTDIN)
--- cut here ---
Taral
P.S. Yes, do use the DEFUN just in case we want to add more broken variants
later :)