blob: e76aac816123910fe592990bd269c725e6d2a7d6 [file] [log] [blame]
Brad Bishop1d80a2e2019-11-15 16:35:03 -05001From a54501d3c9541bc8600225aa2d42531f93c6def7 Mon Sep 17 00:00:00 2001
2From: Joshua Watt <JPEWhacker@gmail.com>
3Date: Sat, 9 Nov 2019 20:01:48 -0600
4Subject: [PATCH] Add option to control configure args
5
6Embedding the configure time options into the executable can lead to
7non-reproducible builds, since configure options often have embedded
8paths. Add a configure time option to control if the configure args are
9embedded so this can be disabled.
10
11Upstream-Status: Submitted [https://midnight-commander.org/ticket/4031]
12Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
13---
14 configure.ac | 6 ++++++
15 src/args.c | 6 ++++++
16 src/textconf.c | 2 ++
17 3 files changed, 14 insertions(+)
18
19diff --git a/configure.ac b/configure.ac
20index 19d1a76be..a1948f6b9 100644
21--- a/configure.ac
22+++ b/configure.ac
23@@ -544,6 +544,12 @@ dnl Clarify do we really need GModule
24 AM_CONDITIONAL([HAVE_GMODULE], [test -n "$g_module_supported" && \
25 test x"$textmode_x11_support" = x"yes" -o x"$enable_aspell" = x"yes"])
26
27+AC_ARG_ENABLE([configure-args],
28+ AS_HELP_STRING([--enable-configure-args], [Handle all compiler warnings as errors]))
29+if test "x$enable_configure_args" != xno; then
30+ AC_DEFINE([ENABLE_CONFIGURE_ARGS], 1, [Define to enable showing configure arguments in help])
31+fi
32+
33 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments])
34
35 AC_CONFIG_FILES(
36diff --git a/src/args.c b/src/args.c
37index baef1a1c8..f8dc24020 100644
38--- a/src/args.c
39+++ b/src/args.c
40@@ -95,7 +95,9 @@ static gboolean mc_args__nouse_subshell = FALSE;
41 #endif /* ENABLE_SUBSHELL */
42 static gboolean mc_args__show_datadirs = FALSE;
43 static gboolean mc_args__show_datadirs_extended = FALSE;
44+#ifdef ENABLE_CONFIGURE_ARGS
45 static gboolean mc_args__show_configure_opts = FALSE;
46+#endif
47
48 static GOptionGroup *main_group;
49
50@@ -125,6 +127,7 @@ static const GOptionEntry argument_main_table[] = {
51 NULL
52 },
53
54+#ifdef ENABLE_CONFIGURE_ARGS
55 /* show configure options */
56 {
57 "configure-options", '\0', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
58@@ -132,6 +135,7 @@ static const GOptionEntry argument_main_table[] = {
59 N_("Print configure options"),
60 NULL
61 },
62+#endif
63
64 {
65 "printwd", 'P', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
66@@ -758,11 +762,13 @@ mc_args_show_info (void)
67 return FALSE;
68 }
69
70+#ifdef ENABLE_CONFIGURE_ARGS
71 if (mc_args__show_configure_opts)
72 {
73 show_configure_options ();
74 return FALSE;
75 }
76+#endif
77
78 return TRUE;
79 }
80diff --git a/src/textconf.c b/src/textconf.c
81index 1e0613e58..f39b9e028 100644
82--- a/src/textconf.c
83+++ b/src/textconf.c
84@@ -232,10 +232,12 @@ show_datadirs_extended (void)
85
86 /* --------------------------------------------------------------------------------------------- */
87
88+#ifdef ENABLE_CONFIGURE_ARGS
89 void
90 show_configure_options (void)
91 {
92 (void) printf ("%s\n", MC_CONFIGURE_ARGS);
93 }
94+#endif
95
96 /* --------------------------------------------------------------------------------------------- */
97--
982.23.0
99