Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc719a82

Browse files
committed
Fix cpp-from-stdin detection so that it works even if the
compiler silently accepts an empty command line.Don't bother searching for bison and yacc unless we are going to use them.
1 parentae7e19c commitc719a82

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

‎src/configure.in‎

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -355,36 +355,40 @@ echo "- setting LDFLAGS=$LDFLAGS"
355355
dnl Checks for programs.
356356
AC_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]])
359364
AC_DEFUN(AC_TRY_CPPSTDIN,
360365
[AC_REQUIRE_CPP()dnl
361366
cat > conftest.$ac_ext <<EOF
362367
[#]line __oline__ "configure"
363368
#include "confdefs.h"
364-
[$1]
369+
[$2]
365370
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
378380
])dnl
379381
fi
380-
rm -f conftest*])
382+
rm -f conftest*
383+
])
381384

382385
AC_MSG_CHECKING(how to use cpp with stdin)
383386
if test -z "$CPPSTDIN"; then
384387
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="")
388392
ac_cv_cpp_stdin="$CPPSTDIN"])
389393
CPPSTDIN="$ac_cv_cpp_stdin"
390394
else
@@ -510,24 +514,24 @@ dnl (1) We specify in YACC and YFLAGS what we want
510514
dnl (2) We have bison and we use bison -y
511515
dnl (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)
517517
if test -f "$YACC"
518518
then
519519
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
522524
echo "- Using $bison -y $YFLAGS"
523525
YACC="$bison"
524526
YFLAGS="-y $YFLAGS"
525-
export YACC YFLAGS
526-
else
527+
else
528+
AC_PATH_PROG(yacc, yacc)
527529
echo "- Using $yacc $YFLAGS"
528530
YACC="$yacc"
529-
export YACC
531+
fi
530532
fi
533+
AC_SUBST(YACC)
534+
AC_SUBST(YFLAGS)
531535

532536
AC_CHECK_LIB(sfio, main)
533537
for curses in ncurses curses ; do

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp