Use top-level config support for enabling plugins. Also recognizes --plugin options when plugins are disabled. 2018-03-28 Cary Coutant gold/ PR gold/21423 PR gold/22500 * configure.ac: Call AC_USE_SYSTEM_EXTENSIONS. Replace check for --enable-plugins with AC_PLUGINS. * options.cc (parse_plugin, parse_plugin_opt): Remove #ifdef. (General_options::finalize): Check if plugins enabled. * options.h (--plugin, --plugin-opt): Define even if plugins not enabled. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. diff --git a/gold/aclocal.m4 b/gold/aclocal.m4 index 47cb21fc5a..7742a0e245 100644 --- a/gold/aclocal.m4 +++ b/gold/aclocal.m4 @@ -1007,6 +1007,7 @@ m4_include([../config/lead-dot.m4]) m4_include([../config/nls.m4]) m4_include([../config/override.m4]) m4_include([../config/po.m4]) +m4_include([../config/plugins.m4]) m4_include([../config/progtest.m4]) m4_include([../config/zlib.m4]) m4_include([../bfd/warning.m4]) diff --git a/gold/configure.ac b/gold/configure.ac index 5ba43f2f95..1ed6c0d45c 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -28,6 +28,8 @@ AM_INIT_AUTOMAKE([no-dist parallel-tests]) AM_CONFIG_HEADER(config.h:config.in) +AC_USE_SYSTEM_EXTENSIONS + # PR 14072 AH_VERBATIM([00_CONFIG_H_CHECK], [/* Check that config.h is #included before system headers @@ -100,14 +102,7 @@ if test "$threads" = "yes"; then fi AM_CONDITIONAL(THREADS, test "$threads" = "yes") -AC_ARG_ENABLE([plugins], -[ --enable-plugins linker plugins], -[case "${enableval}" in - yes | "") plugins=yes ;; - no) plugins=no ;; - *) plugins=yes ;; - esac], -[plugins=no]) +AC_PLUGINS if test "$plugins" = "yes"; then AC_DEFINE(ENABLE_PLUGINS, 1, [Define to enable linker plugins]) diff --git a/gold/options.cc b/gold/options.cc index f511ba1e79..05b9bba5fa 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -448,7 +448,6 @@ General_options::parse_library(const char*, const char* arg, cmdline->inputs().add_file(file); } -#ifdef ENABLE_PLUGINS void General_options::parse_plugin(const char*, const char* arg, Command_line*) @@ -464,7 +463,6 @@ General_options::parse_plugin_opt(const char*, const char* arg, { this->add_plugin_option(arg); } -#endif // ENABLE_PLUGINS void General_options::parse_R(const char* option, const char* arg, @@ -1208,6 +1206,13 @@ General_options::finalize() program_name); #endif +#ifndef ENABLE_PLUGINS + if (this->has_plugins()) + gold_fatal(_("cannot use --plugin: " + "%s was compiled without plugin support"), + program_name); +#endif + std::string libpath; if (this->user_set_Y()) { diff --git a/gold/options.h b/gold/options.h index e75a8bd452..98d6be8009 100644 --- a/gold/options.h +++ b/gold/options.h @@ -1125,6 +1125,12 @@ class General_options N_("Load a plugin library"), N_("PLUGIN")); DEFINE_special(plugin_opt, options::TWO_DASHES, '\0', N_("Pass an option to the plugin"), N_("OPTION")); +#else + DEFINE_special(plugin, options::TWO_DASHES, '\0', + N_("Load a plugin library (not supported)"), N_("PLUGIN")); + DEFINE_special(plugin_opt, options::TWO_DASHES, '\0', + N_("Pass an option to the plugin (not supported)"), + N_("OPTION")); #endif DEFINE_bool(posix_fallocate, options::TWO_DASHES, '\0', true,