diff mbox

autotools conversion: include the header 'config.h' in every C source file.

Message ID 1405001313-12902-1-git-send-email-giorgio.nicole@arcor.de
State Not Applicable
Delegated to: Pablo Neira
Headers show

Commit Message

Giorgio Dal Molin July 10, 2014, 2:08 p.m. UTC
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(+)

Comments

Pablo Neira Ayuso July 10, 2014, 2:54 p.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Engelhardt July 12, 2014, 9:09 a.m. UTC | #2
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.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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>