]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
src: replace IPTABLES_VERSION by PACKAGE_VERSION
authorJan Engelhardt <jengelh@inai.de>
Tue, 28 May 2019 09:43:26 +0000 (11:43 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 30 May 2019 20:43:17 +0000 (22:43 +0200)
The IPTABLES_VERSION C macro replicates the PACKAGE_VERSION C macro
(both have the same definition, "@PACKAGE_VERSION@"). Since
IPTABLES_VERSION, being located in internal.h, is not exposed to
downstream users in any way, it can just be replaced by
PACKAGE_VERSION, which saves a configure-time file substitution.
This goes towards eliminating unnecessary rebuilds after rerunning
./configure.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
16 files changed:
.gitignore
Makefile.am
configure.ac
include/iptables/internal.h [moved from include/iptables/internal.h.in with 81% similarity]
iptables/ip6tables.c
iptables/iptables-restore.c
iptables/iptables-save.c
iptables/iptables-xml.c
iptables/iptables.c
iptables/xtables-arp.c
iptables/xtables-eb.c
iptables/xtables-monitor.c
iptables/xtables-restore.c
iptables/xtables-save.c
iptables/xtables-translate.c
iptables/xtables.c

index b4fe46c0f3a15ebbd0c4ed48e5b562f9c928552d..92eb178a83bdb688b38d22fd5769303bddaf7c52 100644 (file)
@@ -10,7 +10,6 @@ Makefile
 Makefile.in
 
 /include/xtables-version.h
-/include/iptables/internal.h
 
 /aclocal.m4
 /autom4te.cache/
index b1ba015ffe8e626143bc6d05fff70384494596c5..799bf8b81c74ad6d3df64199551367e560d853e2 100644 (file)
@@ -30,4 +30,4 @@ tarball:
        rm -Rf /tmp/${PACKAGE_TARNAME}-${PACKAGE_VERSION};
 
 config.status: extensions/GNUmakefile.in \
-       include/xtables-version.h.in include/iptables/internal.h.in
+       include/xtables-version.h.in
index 0a2802ff9a6a0c9654fe53ca7d62d80cbebd95d2..c922f7a05ac27ee966eac292309b2957f849eae2 100644 (file)
@@ -245,7 +245,7 @@ AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
        libiptc/Makefile libiptc/libiptc.pc
        libiptc/libip4tc.pc libiptc/libip6tc.pc
        libxtables/Makefile utils/Makefile
-       include/xtables-version.h include/iptables/internal.h
+       include/xtables-version.h
        iptables/xtables-monitor.8
        utils/nfnl_osf.8
        utils/nfbpf_compile.8])
similarity index 81%
rename from include/iptables/internal.h.in
rename to include/iptables/internal.h
index 8568e581ec8db78fdee2d34a0007a0ba6b0e95a2..86ba074a3741f91122a2cd7b09d2992fb2003f1a 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef IPTABLES_INTERNAL_H
 #define IPTABLES_INTERNAL_H 1
 
-#define IPTABLES_VERSION "@PACKAGE_VERSION@"
-
 /**
  * Program's own name and version.
  */
index 050afa9a36458c3721c4595244d9032f3159d270..57b0f9f55a921f7e01160b7d82cd80f95cf315dd 100644 (file)
@@ -24,7 +24,7 @@
  *     along with this program; if not, write to the Free Software
  *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include "config.h"
 #include <getopt.h>
 #include <string.h>
 #include <netdb.h>
@@ -121,7 +121,7 @@ static struct option original_opts[] = {
 void ip6tables_exit_error(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3)));
 struct xtables_globals ip6tables_globals = {
        .option_offset = 0,
-       .program_version = IPTABLES_VERSION,
+       .program_version = PACKAGE_VERSION,
        .orig_opts = original_opts,
        .exit_err = ip6tables_exit_error,
        .compat_rev = xtables_compatible_revision,
index 575e619cc30db2620bd4fbbfd2798feb77147fa9..6e275e1c5e8ca44347652dc7fc2d5bd652a2fea4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * This code is distributed under the terms of GNU GPL v2
  */
-
+#include "config.h"
 #include <getopt.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -125,7 +125,7 @@ ip46tables_restore_main(struct iptables_restore_cb *cb, int argc, char *argv[])
                                break;
                        case 'h':
                                print_usage(xt_params->program_name,
-                                           IPTABLES_VERSION);
+                                           PACKAGE_VERSION);
                                exit(0);
                        case 'n':
                                noflush = 1;
index 826cb1e4f7b941b7c254e7546cc5a84d59e4693b..c7251e35ad763fe39a142375af275c04f9517f34 100644 (file)
@@ -5,6 +5,7 @@
  * This code is distributed under the terms of GNU GPL v2
  *
  */
+#include "config.h"
 #include <getopt.h>
 #include <errno.h>
 #include <stdio.h>
@@ -90,7 +91,7 @@ static int do_output(struct iptables_save_cb *cb, const char *tablename)
        time_t now = time(NULL);
 
        printf("# Generated by %s v%s on %s",
-              xt_params->program_name, IPTABLES_VERSION, ctime(&now));
+              xt_params->program_name, PACKAGE_VERSION, ctime(&now));
        printf("*%s\n", tablename);
 
        /* Dump out chain names first,
index 07300efc25eb41bed296f472de1f46b3c6db5e9a..9d9ce6d4a13eea04c4dd41d158f1d7240821ae1f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This code is distributed under the terms of GNU GPL v2
  */
-
+#include "config.h"
 #include <getopt.h>
 #include <errno.h>
 #include <string.h>
@@ -20,7 +20,7 @@
 
 struct xtables_globals iptables_xml_globals = {
        .option_offset = 0,
-       .program_version = IPTABLES_VERSION,
+       .program_version = PACKAGE_VERSION,
        .program_name = "iptables-xml",
 };
 #define prog_name iptables_xml_globals.program_name
@@ -557,7 +557,7 @@ iptables_xml_main(int argc, char *argv[])
                        verbose = 1;
                        break;
                case 'h':
-                       print_usage("iptables-xml", IPTABLES_VERSION);
+                       print_usage("iptables-xml", PACKAGE_VERSION);
                        break;
                }
        }
index 38c4bfe8ecf5c7d9d8e24afa67db876688b870d9..0fbe3ec96bb27ca8c9894af3afd7428edf7d0370 100644 (file)
@@ -24,7 +24,7 @@
  *     along with this program; if not, write to the Free Software
  *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include "config.h"
 #include <getopt.h>
 #include <string.h>
 #include <netdb.h>
@@ -120,7 +120,7 @@ void iptables_exit_error(enum xtables_exittype status, const char *msg, ...) __a
 
 struct xtables_globals iptables_globals = {
        .option_offset = 0,
-       .program_version = IPTABLES_VERSION,
+       .program_version = PACKAGE_VERSION,
        .orig_opts = original_opts,
        .exit_err = iptables_exit_error,
        .compat_rev = xtables_compatible_revision,
index d3cb9df823febbc2561831260d9779c0bcafba96..35844a9b7162c56e7cc12916975a7433283bcdea 100644 (file)
@@ -27,7 +27,7 @@
   This tool is not luser-proof: you can specify an Ethernet source address
   and set hardware length to something different than 6, f.e.
 */
-
+#include "config.h"
 #include <getopt.h>
 #include <string.h>
 #include <netdb.h>
@@ -155,7 +155,7 @@ int RUNTIME_NF_ARP_NUMHOOKS = 3;
 extern void xtables_exit_error(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3)));
 struct xtables_globals arptables_globals = {
        .option_offset          = 0,
-       .program_version        = IPTABLES_VERSION,
+       .program_version        = PACKAGE_VERSION,
        .orig_opts              = original_opts,
        .exit_err               = xtables_exit_error,
        .compat_rev             = nft_compatible_revision,
index bc71e12226fdc91fc2c4e143002a2559c3cb5a8d..171f41b0f616ecf73e935d743b43c88674ac2efb 100644 (file)
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include "config.h"
 #include <ctype.h>
 #include <errno.h>
 #include <getopt.h>
@@ -273,7 +273,7 @@ struct option ebt_original_options[] =
 extern void xtables_exit_error(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3)));
 struct xtables_globals ebtables_globals = {
        .option_offset          = 0,
-       .program_version        = IPTABLES_VERSION,
+       .program_version        = PACKAGE_VERSION,
        .orig_opts              = ebt_original_options,
        .exit_err               = xtables_exit_error,
        .compat_rev             = nft_compatible_revision,
index f835c5e503e0f32e9d8df840f69371a66f9fbd72..eb80bac81c64525eeaf7e66a849422c3d5585baa 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #define _GNU_SOURCE
+#include "config.h"
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>
@@ -631,10 +632,10 @@ int xtables_monitor_main(int argc, char *argv[])
                        cb_arg.nfproto = NFPROTO_IPV6;
                        break;
                case 'V':
-                       printf("xtables-monitor %s\n", IPTABLES_VERSION);
+                       printf("xtables-monitor %s\n", PACKAGE_VERSION);
                        exit(0);
                default:
-                       fprintf(stderr, "xtables-monitor %s: Bad argument.\n", IPTABLES_VERSION);
+                       fprintf(stderr, "xtables-monitor %s: Bad argument.\n", PACKAGE_VERSION);
                        fprintf(stderr, "Try `xtables-monitor -h' for more information.\n");
                        exit(PARAMETER_PROBLEM);
                }
index a6a331d398687959e3e65f2742da5861d826336f..86f6a3af971f0f06d28dfd6a82bc84e0299d4d8d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * This code is distributed under the terms of GNU GPL v2
  */
-
+#include "config.h"
 #include <getopt.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -362,7 +362,7 @@ xtables_restore_main(int family, const char *progname, int argc, char *argv[])
                                break;
                        case 'h':
                                print_usage("xtables-restore",
-                                           IPTABLES_VERSION);
+                                           PACKAGE_VERSION);
                                exit(0);
                        case 'n':
                                h.noflush = 1;
index 2cc5a7c7540beebb9e9d774b043b1b28f140ac45..98e004af4b1a4b11a564b9c72f6f67ff7e3fde9a 100644 (file)
@@ -6,6 +6,7 @@
  * This code is distributed under the terms of GNU GPL v2
  *
  */
+#include "config.h"
 #include <getopt.h>
 #include <errno.h>
 #include <stdio.h>
@@ -80,7 +81,7 @@ __do_output(struct nft_handle *h, const char *tablename, bool counters)
        time_t now = time(NULL);
 
        printf("# Generated by xtables-save v%s on %s",
-              IPTABLES_VERSION, ctime(&now));
+              PACKAGE_VERSION, ctime(&now));
        printf("*%s\n", tablename);
 
        /* Dump out chain names first,
@@ -266,7 +267,7 @@ static int __ebt_save(struct nft_handle *h, const char *tablename, bool counters
        if (first) {
                now = time(NULL);
                printf("# Generated by ebtables-save v%s on %s",
-                      IPTABLES_VERSION, ctime(&now));
+                      PACKAGE_VERSION, ctime(&now));
                first = false;
        }
        printf("*%s\n", tablename);
index eb35890afa782b98315a6a7d14fb30cac46937a2..4ae9ff57c0eb3cf3c5e22079743a5b62fcb2eba8 100644 (file)
@@ -6,7 +6,7 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-
+#include "config.h"
 #include <time.h>
 #include "xtables-multi.h"
 #include "nft.h"
@@ -510,20 +510,20 @@ static int xtables_restore_xlate_main(int family, const char *progname,
        while ((c = getopt_long(argc, argv, "hf:V", options, NULL)) != -1) {
                switch (c) {
                case 'h':
-                       print_usage(argv[0], IPTABLES_VERSION);
+                       print_usage(argv[0], PACKAGE_VERSION);
                        exit(0);
                case 'f':
                        file = optarg;
                        break;
                case 'V':
-                       printf("%s v%s\n", argv[0], IPTABLES_VERSION);
+                       printf("%s v%s\n", argv[0], PACKAGE_VERSION);
                        exit(0);
                }
        }
 
        if (file == NULL) {
                fprintf(stderr, "ERROR: missing file name\n");
-               print_usage(argv[0], IPTABLES_VERSION);
+               print_usage(argv[0], PACKAGE_VERSION);
                exit(0);
        }
 
@@ -534,7 +534,7 @@ static int xtables_restore_xlate_main(int family, const char *progname,
        }
 
        printf("# Translated by %s v%s on %s",
-              argv[0], IPTABLES_VERSION, ctime(&now));
+              argv[0], PACKAGE_VERSION, ctime(&now));
        xtables_restore_parse(&h, &p, &cb_xlate, argc, argv);
        printf("# Completed on %s", ctime(&now));
 
index 44986a37aaf50df9cfbcf2f9948f6c7d38326697..93d9dcba828bcf317bff10cc1b43cd37ca93ce6b 100644 (file)
@@ -24,7 +24,7 @@
  *     along with this program; if not, write to the Free Software
  *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include "config.h"
 #include <getopt.h>
 #include <string.h>
 #include <netdb.h>
@@ -104,7 +104,7 @@ void xtables_exit_error(enum xtables_exittype status, const char *msg, ...) __at
 
 struct xtables_globals xtables_globals = {
        .option_offset = 0,
-       .program_version = IPTABLES_VERSION,
+       .program_version = PACKAGE_VERSION,
        .orig_opts = original_opts,
        .exit_err = xtables_exit_error,
        .compat_rev = nft_compatible_revision,