* Aw: Re: [PATCH 4/7] autotools conversion: include the header 'config.h' in every C source file.
@ 2014-07-10 10:32 giorgio.nicole
2014-07-10 12:52 ` Patrick McHardy
2014-07-10 13:57 ` Aw: Re: Re: [PATCH 4/7] " giorgio.nicole
0 siblings, 2 replies; 6+ messages in thread
From: giorgio.nicole @ 2014-07-10 10:32 UTC (permalink / raw)
To: kaber; +Cc: netfilter-devel
----- Original Nachricht ----
Von: Patrick McHardy <kaber@trash.net>
An: Giorgio Dal Molin <giorgio.nicole@arcor.de>
Datum: 10.07.2014 12:04
Betreff: Re: [PATCH 4/7] autotools conversion: include the header 'config.h'
in every C source file.
> On Mon, Jul 07, 2014 at 04:19:28PM +0200, Giorgio Dal Molin wrote:
> > Added an #include <config.h> to all the C source files so that the
> results
> > of the tests in the configure script are available to all the compilation
> > units.
> >
> > We could have added the include also to 'yacc_parser.y' and 'scanner.l'
> > but we don't, because it is not strictly needed and to avoid to define
> > the variable 'VERSION' two times.
>
> > --- a/src/cli.c
> > +++ b/src/cli.c
> > @@ -11,6 +11,9 @@
> > *
> > * Development of this code funded by Astaro AG (http://www.astaro.com/)
> > */
> > +#ifdef HAVE_CONFIG_H
> > +#include <config.h>
> > +#endif
>
> Do we really need those ifdefs?
>
Hi,
do you mean just the #ifdefs or the whole #include <config.h> ?
The config.h should be included, unless there are real problems with it; one I've found
is the preprocessor variable VERSION defined in the yacc source 'src/yacc_parser.y':
it would conflict with the same variable defined in the 'config.h'.
Actually, if you just build the package under linux, using the ./configure... && make all install
you will always generate / include the config.h, so the #ifdef is not strictly needed.
giorgio
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Re: [PATCH 4/7] autotools conversion: include the header 'config.h' in every C source file. 2014-07-10 10:32 Aw: Re: [PATCH 4/7] autotools conversion: include the header 'config.h' in every C source file giorgio.nicole @ 2014-07-10 12:52 ` Patrick McHardy 2014-07-10 14:08 ` [PATCH] " Giorgio Dal Molin 2014-07-10 13:57 ` Aw: Re: Re: [PATCH 4/7] " giorgio.nicole 1 sibling, 1 reply; 6+ messages in thread From: Patrick McHardy @ 2014-07-10 12:52 UTC (permalink / raw) To: giorgio.nicole; +Cc: netfilter-devel On Thu, Jul 10, 2014 at 12:32:18PM +0200, giorgio.nicole@arcor.de wrote: > > > > ----- Original Nachricht ---- > Von: Patrick McHardy <kaber@trash.net> > An: Giorgio Dal Molin <giorgio.nicole@arcor.de> > Datum: 10.07.2014 12:04 > Betreff: Re: [PATCH 4/7] autotools conversion: include the header 'config.h' > in every C source file. > > > On Mon, Jul 07, 2014 at 04:19:28PM +0200, Giorgio Dal Molin wrote: > > > Added an #include <config.h> to all the C source files so that the > > results > > > of the tests in the configure script are available to all the compilation > > > units. > > > > > > We could have added the include also to 'yacc_parser.y' and 'scanner.l' > > > but we don't, because it is not strictly needed and to avoid to define > > > the variable 'VERSION' two times. > > > > > --- a/src/cli.c > > > +++ b/src/cli.c > > > @@ -11,6 +11,9 @@ > > > * > > > * Development of this code funded by Astaro AG (http://www.astaro.com/) > > > */ > > > +#ifdef HAVE_CONFIG_H > > > +#include <config.h> > > > +#endif > > > > Do we really need those ifdefs? > > > > Hi, > > do you mean just the #ifdefs or the whole #include <config.h> ? > > The config.h should be included, unless there are real problems with it; one I've found > is the preprocessor variable VERSION defined in the yacc source 'src/yacc_parser.y': > it would conflict with the same variable defined in the 'config.h'. > > Actually, if you just build the package under linux, using the ./configure... && make all install > you will always generate / include the config.h, so the #ifdef is not strictly needed. So let's remove them. Also I think a lot of programs are using CFLAGS to -include config.h, that might be easier. Please change this one way or the other and address Pablo's comment and I'll merge this. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] autotools conversion: include the header 'config.h' in every C source file. 2014-07-10 12:52 ` Patrick McHardy @ 2014-07-10 14:08 ` Giorgio Dal Molin 2014-07-10 14:54 ` Pablo Neira Ayuso 0 siblings, 1 reply; 6+ messages in thread From: Giorgio Dal Molin @ 2014-07-10 14:08 UTC (permalink / raw) To: netfilter-devel; +Cc: Giorgio Dal Molin Added an #include <config.h> to all the C source files so that the results of the tests in the configure script are available to all the compilation units. We could have added the include also to 'yacc_parser.y' and 'scanner.l' but we don't, because it is not strictly needed and to avoid to define the variable 'VERSION' two times. --- src/cli.c | 2 ++ src/ct.c | 2 ++ src/datatype.c | 2 ++ src/erec.c | 2 ++ src/evaluate.c | 2 ++ src/expression.c | 2 ++ src/exthdr.c | 2 ++ src/gmputil.c | 2 ++ src/main.c | 2 ++ src/meta.c | 2 ++ src/mnl.c | 2 ++ src/netlink.c | 2 ++ src/netlink_delinearize.c | 2 ++ src/netlink_linearize.c | 2 ++ src/payload.c | 2 ++ src/proto.c | 2 ++ src/rbtree.c | 2 ++ src/rule.c | 2 ++ src/segtree.c | 2 ++ src/statement.c | 2 ++ src/utils.c | 2 ++ 21 files changed, 42 insertions(+) diff --git a/src/cli.c b/src/cli.c index f748a0e..8943349 100644 --- a/src/cli.c +++ b/src/cli.c @@ -12,6 +12,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stdlib.h> #include <stdio.h> #include <stdarg.h> diff --git a/src/ct.c b/src/ct.c index 30639b2..3bddfcb 100644 --- a/src/ct.c +++ b/src/ct.c @@ -10,6 +10,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/datatype.c b/src/datatype.c index 55af227..2ce2997 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stdlib.h> #include <string.h> #include <inttypes.h> diff --git a/src/erec.c b/src/erec.c index 4930085..8532470 100644 --- a/src/erec.c +++ b/src/erec.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stdio.h> #include <string.h> #include <stdarg.h> diff --git a/src/evaluate.c b/src/evaluate.c index 2330bbb..0c82f36 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/expression.c b/src/expression.c index fa14d99..d3b4952 100644 --- a/src/expression.c +++ b/src/expression.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/exthdr.c b/src/exthdr.c index a619ecc..a980555 100644 --- a/src/exthdr.c +++ b/src/exthdr.c @@ -10,6 +10,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/gmputil.c b/src/gmputil.c index cb46445..3d22702 100644 --- a/src/gmputil.c +++ b/src/gmputil.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdarg.h> diff --git a/src/main.c b/src/main.c index a446bc6..874cc8d 100644 --- a/src/main.c +++ b/src/main.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stdlib.h> #include <stddef.h> #include <unistd.h> diff --git a/src/meta.c b/src/meta.c index 80f88ff..b9db99f 100644 --- a/src/meta.c +++ b/src/meta.c @@ -10,6 +10,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/mnl.c b/src/mnl.c index a816106..e2b39d6 100644 --- a/src/mnl.c +++ b/src/mnl.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <libmnl/libmnl.h> #include <libnftnl/common.h> #include <libnftnl/ruleset.h> diff --git a/src/netlink.c b/src/netlink.c index 2e7c572..2206914 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -9,6 +9,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <string.h> #include <fcntl.h> #include <errno.h> diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c index 5c6ca80..1cb514f 100644 --- a/src/netlink_delinearize.c +++ b/src/netlink_delinearize.c @@ -9,6 +9,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stdlib.h> #include <stdbool.h> #include <string.h> diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c index 5c1b46d..7dbe99e 100644 --- a/src/netlink_linearize.c +++ b/src/netlink_linearize.c @@ -9,6 +9,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <linux/netfilter/nf_tables.h> #include <string.h> diff --git a/src/payload.c b/src/payload.c index a1785a5..553597d 100644 --- a/src/payload.c +++ b/src/payload.c @@ -10,6 +10,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/proto.c b/src/proto.c index 0a37a65..9ccb8e2 100644 --- a/src/proto.c +++ b/src/proto.c @@ -9,6 +9,8 @@ * */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdint.h> diff --git a/src/rbtree.c b/src/rbtree.c index 325c012..c400c0d 100644 --- a/src/rbtree.c +++ b/src/rbtree.c @@ -19,6 +19,8 @@ * */ +#include <config.h> + #include <rbtree.h> static void __rb_rotate_left(struct rb_node *node, struct rb_root *root) diff --git a/src/rule.c b/src/rule.c index a7bc6f4..a1db70f 100644 --- a/src/rule.c +++ b/src/rule.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/segtree.c b/src/segtree.c index 1785f64..a538670 100644 --- a/src/segtree.c +++ b/src/segtree.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stdlib.h> #include <inttypes.h> #include <arpa/inet.h> diff --git a/src/statement.c b/src/statement.c index 2dd3f18..03f3ddc 100644 --- a/src/statement.c +++ b/src/statement.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/utils.c b/src/utils.c index 96ff419..bf1e8dc 100644 --- a/src/utils.c +++ b/src/utils.c @@ -8,6 +8,8 @@ * Development of this code funded by Astaro AG (http://www.astaro.com/) */ +#include <config.h> + #include <stddef.h> #include <stdlib.h> #include <stdarg.h> -- 2.0.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] autotools conversion: include the header 'config.h' in every C source file. 2014-07-10 14:08 ` [PATCH] " Giorgio Dal Molin @ 2014-07-10 14:54 ` Pablo Neira Ayuso 2014-07-12 9:09 ` Jan Engelhardt 0 siblings, 1 reply; 6+ messages in thread From: Pablo Neira Ayuso @ 2014-07-10 14:54 UTC (permalink / raw) To: Giorgio Dal Molin; +Cc: netfilter-devel On Thu, Jul 10, 2014 at 04:08:08PM +0200, Giorgio Dal Molin wrote: > Added an #include <config.h> to all the C source files so that the results > of the tests in the configure script are available to all the compilation > units. I think we can avoid this by passing the configuration options to the compiler via -D instead of via config.h file. https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Configuration-Headers.html Any reason not to do it that way? Thanks. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] autotools conversion: include the header 'config.h' in every C source file. 2014-07-10 14:54 ` Pablo Neira Ayuso @ 2014-07-12 9:09 ` Jan Engelhardt 0 siblings, 0 replies; 6+ messages in thread From: Jan Engelhardt @ 2014-07-12 9:09 UTC (permalink / raw) To: Pablo Neira Ayuso; +Cc: Giorgio Dal Molin, netfilter-devel On Thursday 2014-07-10 16:54, Pablo Neira Ayuso wrote: >On Thu, Jul 10, 2014 at 04:08:08PM +0200, Giorgio Dal Molin wrote: >> Added an #include <config.h> to all the C source files so that the results >> of the tests in the configure script are available to all the compilation >> units. > >I think we can avoid this by passing the configuration options to the >compiler via -D instead of via config.h file. > >https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Configuration-Headers.html > >Any reason not to do it that way? The compiler command line is already long enough (when choosing to look at it via `make V=1`) for human analysis, and distros easily add even more CFLAGS like -O,-f,-m into it. Not using config.h would make the situation worse for analysis by human. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Aw: Re: Re: [PATCH 4/7] autotools conversion: include the header 'config.h' in every C source file. 2014-07-10 10:32 Aw: Re: [PATCH 4/7] autotools conversion: include the header 'config.h' in every C source file giorgio.nicole 2014-07-10 12:52 ` Patrick McHardy @ 2014-07-10 13:57 ` giorgio.nicole 1 sibling, 0 replies; 6+ messages in thread From: giorgio.nicole @ 2014-07-10 13:57 UTC (permalink / raw) To: kaber; +Cc: netfilter-devel ----- Original Nachricht ---- Von: Patrick McHardy <kaber@trash.net> An: giorgio.nicole@arcor.de Datum: 10.07.2014 14:52 Betreff: Re: Re: [PATCH 4/7] autotools conversion: include the header 'config.h' in every C source file. > On Thu, Jul 10, 2014 at 12:32:18PM +0200, giorgio.nicole@arcor.de wrote: > > > > > > > > ----- Original Nachricht ---- > > Von: Patrick McHardy <kaber@trash.net> > > An: Giorgio Dal Molin <giorgio.nicole@arcor.de> > > Datum: 10.07.2014 12:04 > > Betreff: Re: [PATCH 4/7] autotools conversion: include the header > 'config.h' > > in every C source file. > > > > > On Mon, Jul 07, 2014 at 04:19:28PM +0200, Giorgio Dal Molin wrote: > > > > Added an #include <config.h> to all the C source files so that the > > > results > > > > of the tests in the configure script are available to all the > compilation > > > > units. > > > > > > > > We could have added the include also to 'yacc_parser.y' and > 'scanner.l' > > > > but we don't, because it is not strictly needed and to avoid to > define > > > > the variable 'VERSION' two times. > > > > > > > --- a/src/cli.c > > > > +++ b/src/cli.c > > > > @@ -11,6 +11,9 @@ > > > > * > > > > * Development of this code funded by Astaro AG > (http://www.astaro.com/) > > > > */ > > > > +#ifdef HAVE_CONFIG_H > > > > +#include <config.h> > > > > +#endif > > > > > > Do we really need those ifdefs? > > > > > > > Hi, > > > > do you mean just the #ifdefs or the whole #include <config.h> ? > > > > The config.h should be included, unless there are real problems with it; > one I've found > > is the preprocessor variable VERSION defined in the yacc source > 'src/yacc_parser.y': > > it would conflict with the same variable defined in the 'config.h'. > > > > Actually, if you just build the package under linux, using the > ./configure... && make all install > > you will always generate / include the config.h, so the #ifdef is not > strictly needed. > > So let's remove them. Also I think a lot of programs are using CFLAGS to > -include config.h, that might be easier. > > Please change this one way or the other and address Pablo's comment and > I'll > merge this. Hi, Pablo's comment should already be addressed here: http://marc.info/?l=netfilter-devel&m=140498900625610&w=4 The new patch for the config.h inclusion will be posted shortly. giorgio ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-12 9:09 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-10 10:32 Aw: Re: [PATCH 4/7] autotools conversion: include the header 'config.h' in every C source file giorgio.nicole 2014-07-10 12:52 ` Patrick McHardy 2014-07-10 14:08 ` [PATCH] " Giorgio Dal Molin 2014-07-10 14:54 ` Pablo Neira Ayuso 2014-07-12 9:09 ` Jan Engelhardt 2014-07-10 13:57 ` Aw: Re: Re: [PATCH 4/7] " giorgio.nicole
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).