Re: libnetfilter_queue: automake portability warning

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

 



Hi Jeremy,

On Fri, Aug 27, 2021 at 10:09:58PM +0100, Jeremy Sowden wrote:
> Running autogen.sh gives the following output when it gets to
> doxygen/Makefile.am:
>
>   doxygen/Makefile.am:3: warning: shell find $(top_srcdir: non-POSIX variable name
>   doxygen/Makefile.am:3: (probably a GNU make extension)
>
> Automake doesn't understand the GNU make $(shell ...) function and tries
> to interpret it as an Automake variable.  The Automake people would
> probably say we shouldn't do that 'cause it's not portable:
>
>   https://www.gnu.org/software/automake/manual/automake.html#Wildcards
>
> However, if we accept that we are targetting GNU make, but we want to
> get rid of the warning, I believe there are two ways to do so.  We can
> tell Automake not to warn about non-portable constructions:
>
>   diff --git a/configure.ac b/configure.ac
>   index 4721eebbab1f..7cd34d079e67 100644
>   --- a/configure.ac
>   +++ b/configure.ac
>   @@ -6,7 +6,7 @@ AC_CANONICAL_HOST
>    AC_CONFIG_MACRO_DIR([m4])
>    AC_CONFIG_HEADERS([config.h])
>
>   -AM_INIT_AUTOMAKE([-Wall foreign subdir-objects
>   +AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects
>           tar-pax no-dist-gzip dist-bzip2 1.6])
>    m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
>
> On the other hand, if we want to suppress the warning for just this one
> GNU-ism, we can hide it from automake:
>
>   diff --git a/configure.ac b/configure.ac
>   index 4721eebbab1f..b2b54d3168ad 100644
>   --- a/configure.ac
>   +++ b/configure.ac
>   @@ -56,6 +56,19 @@ AS_IF([test "x$DOXYGEN" = x], [
>                   with_doxygen=no
>           ])
>    ])
>   +#
>   +# Putting $(shell ... ) directly into the doyxgen Makefile.am confuses automake,
>   +# which tries to interpret it as an automake variable:
>   +#
>   +#   doxygen/Makefile.am:3: warning: shell find $(top_srcdir: non-POSIX variable name
>   +#   doxygen/Makefile.am:3: (probably a GNU make extension)
>   +#
>   +# Instead, we use autoconf to substitute it into place after automake has run.
>   +#
>   +AS_IF([test "x$with_doxygen" != no], [
>   +  AC_SUBST([DOC_SRCS], ['$(shell find $(top_srcdir)/src -name '"'"'*.c'"'"')'])
>   +])
>   +
>    AC_OUTPUT
>
>    echo "
>   diff --git a/doxygen/Makefile.am b/doxygen/Makefile.am
>   index f38009b24114..6ed30e21ff75 100644
>   --- a/doxygen/Makefile.am
>   +++ b/doxygen/Makefile.am
>   @@ -1,6 +1,6 @@
>    if HAVE_DOXYGEN
>
>   -doc_srcs = $(shell find $(top_srcdir)/src -name '*.c')
>   +doc_srcs = @DOC_SRCS@
>
>    doxyfile.stamp: $(doc_srcs) Makefile.am
>           rm -rf html man
>
> J.


Thanks for the suggestioms. I strongly prefer adding -Wno-portability to
AM_INIT_AUTOMAKE.

The alternative patch is longer, and IMHO less clear to follow. Also it's
error-prone - consider this line:
> AS_IF([test "x$with_doxygen" != no], [
The test needs to be one of the following:
> [test "x$with_doxygen" != xno]
> [test "$with_doxygen" != no]
> [test "$with_doxygen" = yes]

I'd like to get rid of the warning so will send a v3.

Cheers ... Duncan.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux