aboutsummaryrefslogtreecommitdiff
path: root/config/gcc-plugin.m4
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-07-14 08:43:24 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-07-14 09:18:16 -0700
commit49d00f48e8e3c1331d367785f19c69867a47b4cd (patch)
tree5d9edd2b228cf66d312491ea7bf535647a0bcd27 /config/gcc-plugin.m4
parent99fe86f7999afd2743b08c550b10f083ae4bd9bd (diff)
downloadgdb-49d00f48e8e3c1331d367785f19c69867a47b4cd.zip
gdb-49d00f48e8e3c1331d367785f19c69867a47b4cd.tar.gz
gdb-49d00f48e8e3c1331d367785f19c69867a47b4cd.tar.bz2
Sync config files with GCC
Sync with GCC 2015-05-13 Eric Botcazou <ebotcazou@adacore.com> * sjlj.m4: New file. 2015-05-04 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * bitfields.m4: Change int to long long, and use bitfields of width 1 instead of 0. 2015-05-01 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * bitfields.m4: New file. 2015-04-14 H.J. Lu <hongjiu.lu@intel.com> * bootstrap-mpx.mk: New file. 2015-03-25 Uros Bizjak <ubizjak@gmail.com> PR bootstrap/65537 * bootstrap-lto-noplugin.mk: New build configuration. 2014-11-13 Kirill Yukhin <kirill.yukhin@intel.com> * target-posix: New file. 2014-10-27 Tom Tromey <tromey@redhat.com> * gcc-plugin.m4: New file.
Diffstat (limited to 'config/gcc-plugin.m4')
-rw-r--r--config/gcc-plugin.m4113
1 files changed, 113 insertions, 0 deletions
diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
new file mode 100644
index 0000000..dd06a58
--- /dev/null
+++ b/config/gcc-plugin.m4
@@ -0,0 +1,113 @@
+# gcc-plugin.m4 -*- Autoconf -*-
+# Check whether GCC is able to be built with plugin support.
+
+dnl Copyright (C) 2014 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# Check for plugin support.
+# Respects --enable-plugin.
+# Sets the shell variables enable_plugin and pluginlibs.
+AC_DEFUN([GCC_ENABLE_PLUGINS],
+ [# Check for plugin support
+ AC_ARG_ENABLE(plugin,
+ [AS_HELP_STRING([--enable-plugin], [enable plugin support])],
+ enable_plugin=$enableval,
+ enable_plugin=yes; default_plugin=yes)
+
+ pluginlibs=
+
+ case "${host}" in
+ *-*-darwin*)
+ if test x$build = x$host; then
+ export_sym_check="nm${exeext} -g"
+ elif test x$host = x$target; then
+ export_sym_check="$gcc_cv_nm -g"
+ else
+ export_sym_check=
+ fi
+ ;;
+ *)
+ if test x$build = x$host; then
+ export_sym_check="objdump${exeext} -T"
+ elif test x$host = x$target; then
+ export_sym_check="$gcc_cv_objdump -T"
+ else
+ export_sym_check=
+ fi
+ ;;
+ esac
+
+ if test x"$enable_plugin" = x"yes"; then
+
+ AC_MSG_CHECKING([for exported symbols])
+ if test "x$export_sym_check" != x; then
+ echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c
+ ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext > /dev/null 2>&1
+ if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then
+ : # No need to use a flag
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([for -rdynamic])
+ ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1
+ if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then
+ plugin_rdynamic=yes
+ pluginlibs="-rdynamic"
+ else
+ plugin_rdynamic=no
+ enable_plugin=no
+ fi
+ AC_MSG_RESULT([$plugin_rdynamic])
+ fi
+ else
+ AC_MSG_RESULT([unable to check])
+ fi
+
+ # Check -ldl
+ saved_LIBS="$LIBS"
+ AC_SEARCH_LIBS([dlopen], [dl])
+ if test x"$ac_cv_search_dlopen" = x"-ldl"; then
+ pluginlibs="$pluginlibs -ldl"
+ fi
+ LIBS="$saved_LIBS"
+
+ # Check that we can build shared objects with -fPIC -shared
+ saved_LDFLAGS="$LDFLAGS"
+ saved_CFLAGS="$CFLAGS"
+ case "${host}" in
+ *-*-darwin*)
+ CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
+ CFLAGS="$CFLAGS -fPIC"
+ LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
+ ;;
+ *)
+ CFLAGS="$CFLAGS -fPIC"
+ LDFLAGS="$LDFLAGS -fPIC -shared"
+ ;;
+ esac
+ 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" -o x"$ac_cv_search_dlopen" = x"no"; then
+ pluginlibs=
+ enable_plugin=no
+ fi
+ LDFLAGS="$saved_LDFLAGS"
+ CFLAGS="$saved_CFLAGS"
+
+ # 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
+ fi
+])