aboutsummaryrefslogtreecommitdiff
path: root/gcc/configure.ac
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@gcc.gnu.org>2009-04-14 16:18:49 -0400
committerDiego Novillo <dnovillo@gcc.gnu.org>2009-04-14 16:18:49 -0400
commit68a607d8143693c8f4bc66bef001197ea4ff7c84 (patch)
treea65b40c88b9169d2d76f8139339fd3054612f224 /gcc/configure.ac
parent50617257085372785e4385d166b2fba4b634ee54 (diff)
downloadgcc-68a607d8143693c8f4bc66bef001197ea4ff7c84.zip
gcc-68a607d8143693c8f4bc66bef001197ea4ff7c84.tar.gz
gcc-68a607d8143693c8f4bc66bef001197ea4ff7c84.tar.bz2
[multiple changes]
2009-04-14 Diego Novillo <dnovillo@google.com> Le-Chun Wu <lcwu@google.com> * configure.ac: Add --enable-plugin support. Define ENABLE_PLUGIN and PLUGINLIBS when specified. * Makefile.in (PLUGIN_H): Define. Export ENABLE_PLUGIN and GMPINC to site.exp. Add PLUGINLIBS to link command. Add/modify dependencies for plugin.o and files including plugin.h. (plugin.o): New. * config.in: Regenerate. * opts.c (common_handle_option): Handle OPT_fplugin_ and OPT_fplugin_arg_. 2009-04-14 Le-Chun Wu <lcwu@google.com> * tree-pass.h (register_one_dump_file): Add a prototype for register_one_dump_file. * toplev.c (compile_file): Call initialize_plugins. (do_compile): Call invoke_plugin_callbacks. (toplev_main): Call invoke_plugin_callbacks. * common.opt: Add -fplugin= and -fplugin-arg-. * gcc-plugin.h: New public header file for plugins to include. * plugin.c: New source file. * plugin.h: New internal header file. * passes.c (register_one_dump_file): Make it external. * c-parser.c (c_parser_declspecs): Call invoke_plugin_callbacks. 2009-04-14 Diego Novillo <dnovillo@google.com> * doc/plugins.texi: New. * doc/gccint.texi: Add reference to Plugins chapter. * doc/invoke.texi: Document -fplugin and -fplugin-arg * diagnostic.c (diagnostic_report_diagnostic): Warn about loaded plugins, if any. * timevar.def (TV_PLUGIN_INIT): Define. (TV_PLUGIN_RUN): Define. * plugin.c: Include timevar.h (plugins_active_p): New. (dump_active_plugins): New. (debug_active_plugins): New. cp/ChangeLog 2009-04-14 Le-Chun Wu <lcwu@google.com> * Make-lang.in: Modify dependencies of files including plugin.h. * decl.c (finish_function): Call invoke_plugin_callbacks. * parser.c (cp_parser_type_specifier): Call invoke_plugin_callbacks. From-SVN: r146059
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r--gcc/configure.ac68
1 files changed, 68 insertions, 0 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 5d0221e..07e4c6d 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3949,6 +3949,74 @@ if test "x${CLOOGLIBS}" != "x" ; then
AC_DEFINE(HAVE_cloog, 1, [Define if cloog is in use.])
fi
+# Check for plugin support
+AC_ARG_ENABLE(plugin,
+[ --enable-plugin enable plugin support],
+enable_plugin=$enableval,
+enable_plugin=yes; default_plugin=yes)
+
+pluginlibs=
+if test x"$enable_plugin" = x"yes"; then
+ # Check that the host supports -rdynamic and -ldl
+ have_rdynamic=no
+ have_dl=no
+ saved_LDFLAGS="$LDFLAGS"
+ saved_LIBS="$LIBS"
+ LIBS=
+
+ # Check -rdynamic
+ LDFLAGS="$LDFLAGS -rdynamic"
+ AC_MSG_CHECKING([for -rdynamic])
+ AC_TRY_LINK([],[return 0;],
+ [AC_MSG_RESULT([yes]); have_rdynamic=yes],
+ [AC_MSG_RESULT([no])])
+ if test x"$have_rdynamic" = x"yes" ; then
+ pluginlibs="-rdynamic"
+ fi
+
+ # Check -ldl
+ LDFLAGS="$LDFLAGS -ldl"
+ AC_MSG_CHECKING([for -ldl])
+ AC_TRY_LINK(
+ [#include <dlfcn.h>],
+ [volatile int f = 0; if (f) dlopen ("dummy", 0);],
+ [AC_MSG_RESULT([yes]); have_dl=yes],
+ [AC_MSG_RESULT([no])])
+ if test x"$have_dl" = x"yes"; then
+ pluginlibs="$pluginlibs -ldl"
+ fi
+
+ # Check that we can build shared objects with -fPIC -shared
+ LDFLAGS="$LDFLAGS -fPIC -shared"
+ AC_MSG_CHECKING([for -fPIC -shared])
+ AC_TRY_LINK(
+ [extern int X;],[return X == 0;],
+ [AC_MSG_RESULT([yes]); have_pic_shared=yes],
+ [AC_MSG_RESULT([no]); have_pic_shared=no])
+ if test x"$have_pic_shared" != x"yes"; then
+ pluginlibs=
+ enable_plugin=no
+ fi
+
+ # If plugin support had been requested but not available, fail.
+ if test x"$enable_plugin" = x"no" ; then
+ if test x"$default_plugin" != x"yes"; then
+ AC_MSG_ERROR([
+Building GCC with plugin support requires a host that supports
+-fPIC, -shared, -ldl and -rdynamic.])
+ fi
+ fi
+
+ LDFLAGS="$saved_LDFLAGS"
+ LIBS="$saved_LIBS"
+fi
+
+AC_SUBST(pluginlibs)
+AC_SUBST(enable_plugin)
+if test x"$enable_plugin" = x"yes"; then
+ AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
+fi
+
# Configure the subdirectories
# AC_CONFIG_SUBDIRS($subdirs)