@@ -355,36 +355,40 @@ echo "- setting LDFLAGS=$LDFLAGS"
355355dnl Checks for programs.
356356AC_PROG_CPP
357357
358- dnl Check to see what flags are required to get stdin into cpp
358+ dnl Check to see what flags are required to get stdin into cpp.
359+ dnl Note that we need to look at the output, since the C compiler might
360+ dnl not raise an error when no input files are named on the cmd line.
361+ dnl (This is a somewhat modified version of AC_EGREP_CPP)
362+ dnl AC_TRY_CPPSTDIN(PATTERN, PROGRAM, [ACTION-IF-FOUND [,
363+ dnl ACTION-IF-NOT-FOUND]])
359364AC_DEFUN(AC_TRY_CPPSTDIN,
360365[AC_REQUIRE_CPP()dnl
361366cat > conftest.$ac_ext <<EOF
362367[#]line __oline__ "configure"
363368#include "confdefs.h"
364- [$1 ]
369+ [$2 ]
365370EOF
366- ac_try="$ac_cpp $CPPSTDIN <conftest.$ac_ext >/dev/null 2>conftest.out"
367- AC_TRY_EVAL(ac_try)
368- ac_err=`grep -v '^ *+' conftest.out`
369- if test -z "$ac_err"; then
370- ifelse([$2], , :, [rm -rf conftest*
371- $2])
372- else
373- echo "$ac_err" >&AC_FD_CC
374- echo "configure: failed program was:" >&AC_FD_CC
375- cat conftest.$ac_ext >&AC_FD_CC
376- ifelse([$3], , , [ rm -rf conftest*
377- $3
371+ dnl eval is necessary to expand ac_cpp.
372+ dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
373+ if (eval "$ac_cpp $CPPSTDIN <conftest.$ac_ext") 2>&AC_FD_CC |
374+ grep "$1" >/dev/null 2>&1; then
375+ ifelse([$3], , :, [rm -rf conftest*
376+ $3])
377+ ifelse([$4], , , [else
378+ rm -rf conftest*
379+ $4
378380])dnl
379381fi
380- rm -f conftest*])
382+ rm -f conftest*
383+ ])
381384
382385AC_MSG_CHECKING(how to use cpp with stdin)
383386if test -z "$CPPSTDIN"; then
384387AC_CACHE_VAL(ac_cv_cpp_stdin,
385- [ CPPSTDIN=""
386- AC_TRY_CPPSTDIN([#include <assert.h>
387- Syntax Error], , CPPSTDIN="-")
388+ [ CPPSTDIN="-"
389+ AC_TRY_CPPSTDIN([^Find Me Or Else],
390+ [#include <assert.h>
391+ Find Me Or Else], , CPPSTDIN="")
388392 ac_cv_cpp_stdin="$CPPSTDIN"])
389393 CPPSTDIN="$ac_cv_cpp_stdin"
390394else
@@ -510,24 +514,24 @@ dnl (1) We specify in YACC and YFLAGS what we want
510514dnl (2) We have bison and we use bison -y
511515dnl (3) We have yacc and use it
512516
513- AC_SUBST(YACC)
514- AC_SUBST(YFLAGS)
515- AC_PATH_PROG(yacc, yacc)
516- AC_PATH_PROG(bison, bison)
517517if test -f "$YACC"
518518then
519519echo "- Using $YACC $YFLAGS"
520- elif test -f "$bison"
521- then
520+ else
521+ AC_PATH_PROG(bison, bison)
522+ if test -f "$bison"
523+ then
522524echo "- Using $bison -y $YFLAGS"
523525YACC="$bison"
524526YFLAGS="-y $YFLAGS"
525- export YACC YFLAGS
526- else
527+ else
528+ AC_PATH_PROG(yacc, yacc)
527529echo "- Using $yacc $YFLAGS"
528530YACC="$yacc"
529- export YACC
531+ fi
530532fi
533+ AC_SUBST(YACC)
534+ AC_SUBST(YFLAGS)
531535
532536AC_CHECK_LIB(sfio, main)
533537for curses in ncurses curses ; do