Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame^] | 1 | From a54501d3c9541bc8600225aa2d42531f93c6def7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Joshua Watt <JPEWhacker@gmail.com> |
| 3 | Date: Sat, 9 Nov 2019 20:01:48 -0600 |
| 4 | Subject: [PATCH] Add option to control configure args |
| 5 | |
| 6 | Embedding the configure time options into the executable can lead to |
| 7 | non-reproducible builds, since configure options often have embedded |
| 8 | paths. Add a configure time option to control if the configure args are |
| 9 | embedded so this can be disabled. |
| 10 | |
| 11 | Upstream-Status: Submitted [https://midnight-commander.org/ticket/4031] |
| 12 | Signed-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 | |
| 19 | diff --git a/configure.ac b/configure.ac |
| 20 | index 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( |
| 36 | diff --git a/src/args.c b/src/args.c |
| 37 | index 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 | } |
| 80 | diff --git a/src/textconf.c b/src/textconf.c |
| 81 | index 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 | -- |
| 98 | 2.23.0 |
| 99 | |