diff options
author | Jesse Gross <jesse@nicira.com> | 2010-11-02 16:00:16 -0700 |
---|---|---|
committer | Jesse Gross <jesse@nicira.com> | 2010-11-02 17:23:22 -0700 |
commit | 7507ec485f72c2ec56731ee5c9790a20d6d694fd (patch) | |
tree | e9c54f7a5cc3d568f8d7dcc96b8599d209f413fe /acinclude.m4 | |
parent | 0f9fc40325e390f23ef46cb2b3588da6b97ad5b1 (diff) |
autoconf: Tolerate missing file when grepping.
Currently we die when grepping for compatibility strings if the
file does not exist. Since this can be a valid situation when
files are added in later versions, we shouldn't kill the build.
Instead, note that the file doesn't exist but otherwise treat it
as if the string was not found.
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index f1322fa0..0af7fd0f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -108,21 +108,26 @@ dnl dnl Greps FILE for REGEX. If it matches, runs IF-MATCH, otherwise IF-NO-MATCH. AC_DEFUN([OVS_GREP_IFELSE], [ AC_MSG_CHECKING([whether $2 matches in $1]) - grep '$2' $1 >/dev/null 2>&1 - status=$? - case $status in - 0) - AC_MSG_RESULT([yes]) - $3 - ;; - 1) - AC_MSG_RESULT([no]) - $4 - ;; - *) - AC_MSG_ERROR([grep exited with status $status]) - ;; - esac + if test -f $1; then + grep '$2' $1 >/dev/null 2>&1 + status=$? + case $status in + 0) + AC_MSG_RESULT([yes]) + $3 + ;; + 1) + AC_MSG_RESULT([no]) + $4 + ;; + *) + AC_MSG_ERROR([grep exited with status $status]) + ;; + esac + else + AC_MSG_RESULT([file not found]) + $4 + fi ]) dnl OVS_DEFINE(NAME) |