@@ -355,36 +355,40 @@ echo "- setting LDFLAGS=$LDFLAGS"
355
355
dnl Checks for programs.
356
356
AC_PROG_CPP
357
357
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]])
359
364
AC_DEFUN(AC_TRY_CPPSTDIN,
360
365
[AC_REQUIRE_CPP()dnl
361
366
cat > conftest.$ac_ext <<EOF
362
367
[#]line __oline__ "configure"
363
368
#include "confdefs.h"
364
- [$1 ]
369
+ [$2 ]
365
370
EOF
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
378
380
])dnl
379
381
fi
380
- rm -f conftest*])
382
+ rm -f conftest*
383
+ ])
381
384
382
385
AC_MSG_CHECKING(how to use cpp with stdin)
383
386
if test -z "$CPPSTDIN"; then
384
387
AC_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="")
388
392
ac_cv_cpp_stdin="$CPPSTDIN"])
389
393
CPPSTDIN="$ac_cv_cpp_stdin"
390
394
else
@@ -510,24 +514,24 @@ dnl (1) We specify in YACC and YFLAGS what we want
510
514
dnl (2) We have bison and we use bison -y
511
515
dnl (3) We have yacc and use it
512
516
513
- AC_SUBST(YACC)
514
- AC_SUBST(YFLAGS)
515
- AC_PATH_PROG(yacc, yacc)
516
- AC_PATH_PROG(bison, bison)
517
517
if test -f "$YACC"
518
518
then
519
519
echo "- 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
522
524
echo "- Using $bison -y $YFLAGS"
523
525
YACC="$bison"
524
526
YFLAGS="-y $YFLAGS"
525
- export YACC YFLAGS
526
- else
527
+ else
528
+ AC_PATH_PROG(yacc, yacc)
527
529
echo "- Using $yacc $YFLAGS"
528
530
YACC="$yacc"
529
- export YACC
531
+ fi
530
532
fi
533
+ AC_SUBST(YACC)
534
+ AC_SUBST(YFLAGS)
531
535
532
536
AC_CHECK_LIB(sfio, main)
533
537
for curses in ncurses curses ; do
0 commit comments