bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix libcap configure flag handling


From: Kamil Dudka
Subject: Re: [PATCH] fix libcap configure flag handling
Date: Thu, 3 Sep 2009 23:55:59 +0200
User-agent: KMail/1.9.7

On Thursday 03 of September 2009 21:31:01 Mike Frysinger wrote:
> The current libcap flag handler treats any libcap configure option as
> --disable-libcap because it doesn't check $enableval at all.  So make
> sure we do the sane thing:
>  --disable-libcap -> disable and don't run any tests
>  --enable-libcap -> run tests and fail if not found
>  <no choice> -> run tests and warn if not found
>
> Signed-off-by: Mike Frysinger <address@hidden>
> ---
>  m4/jm-macros.m4 |   24 ++++++++++++++++--------
>  1 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
> index 416a0af..f4d43f1 100644
> --- a/m4/jm-macros.m4
> +++ b/m4/jm-macros.m4
> @@ -105,17 +105,25 @@ AC_DEFUN([coreutils_MACROS],
>    LIBS=$coreutils_saved_libs
>
>    # Check whether libcap is usable -- for ls --color support
> +  LIB_CAP=
>    AC_ARG_ENABLE([libcap],
> -    AC_HELP_STRING([--disable-libcap], [disable libcap support]),
> -    AC_MSG_WARN([libcap support disabled by user]),
> -    [AC_CHECK_LIB([cap], [cap_get_file],
> +    AC_HELP_STRING([--disable-libcap], [disable libcap support]))
> +  if test "X$enable_libcap" != "Xno"; then
> +    AC_CHECK_LIB([cap], [cap_get_file],
>        [AC_CHECK_HEADER([sys/capability.h],
>          [LIB_CAP=-lcap
> -         AC_DEFINE([HAVE_CAP], [1], [libcap usability])],
> -        [AC_MSG_WARN([header sys/capability.h was not found, support for
> libcap will not be built])] -      )],
> -      [AC_MSG_WARN([libcap library was not found or not usable, support
> for libcap will not be built])]) -    ])
> +         AC_DEFINE([HAVE_CAP], [1], [libcap usability])]
> +      )])
> +    if test "X$LIB_CAP" = "X"; then
> +      if test "X$enable_libcap" = "Xyes"; then
> +        AC_MSG_ERROR([libcap library was not found or not usable])
> +      else
> +        AC_MSG_WARN([libcap library was not found or not usable, support
> for libcap will not be built]) +      fi
> +    fi
> +  else
> +    AC_MSG_WARN([libcap support disabled by user])
> +  fi
>    AC_SUBST([LIB_CAP])
>
>    # See if linking `seq' requires -lm.

Looks good to me. I wrote that nonsense as I had misunderstood semantic
of the AC_ARG_ENABLE macro...

Kamil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]