[ovs-dev] [PATCH 1/2] acinclude: Add support for grep option.

Greg Rose gvrose8192 at gmail.com
Wed Oct 18 22:33:51 UTC 2017


On 10/16/2017 07:26 AM, William Tu wrote:
> Allow to pass grep's option to OVS_GREP_IFELSE.
> One use case is to pass '-w' for exact match.
> 
> Signed-off-by: William Tu <u9012063 at gmail.com>
> ---
>   acinclude.m4 | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/acinclude.m4 b/acinclude.m4
> index 89f88ca8de75..543e1e3f0630 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -326,15 +326,15 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>     AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
>   ])
>   
> -dnl OVS_GREP_IFELSE(FILE, REGEX, [IF-MATCH], [IF-NO-MATCH])
> +dnl OVS_GREP_IFELSE(FILE, REGEX, [IF-MATCH], [IF-NO-MATCH], [OPTION])
>   dnl
> -dnl Greps FILE for REGEX.  If it matches, runs IF-MATCH, otherwise IF-NO-MATCH.
> -dnl If IF-MATCH is empty then it defines to OVS_DEFINE(HAVE_<REGEX>), with
> -dnl <REGEX> translated to uppercase.
> +dnl Greps FILE for REGEX with grep's OPTION.  If it matches, runs IF-MATCH,
> +dnl otherwise IF-NO-MATCH.  If IF-MATCH is empty then it defines to
> +dnl OVS_DEFINE(HAVE_<REGEX>), with <REGEX> translated to uppercase.
>   AC_DEFUN([OVS_GREP_IFELSE], [
>     AC_MSG_CHECKING([whether $2 matches in $1])
>     if test -f $1; then
> -    grep '$2' $1 >/dev/null 2>&1
> +    grep $5 '$2' $1 >/dev/null 2>&1
>       status=$?
>       case $status in
>         0)
> 

LGTM

Tested-by: Greg Rose <gvrose8192 at gmail.com>
Reviewed-by: Greg Rose <gvrose8192 at gmail.com>


More information about the dev mailing list