This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Skip ld/lto tests if plugins is disabled for binutils?


On Tue, Aug 12, 2014 at 9:14 PM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Aug 12, 2014 at 01:00:17PM +0800, Bin.Cheng wrote:
>> On Tue, Aug 12, 2014 at 12:45 PM, Alan Modra <amodra@gmail.com> wrote:
>> > I think we should make --enable-plugins default to yes, and make
>> > ld/configure.ac respect --enable-plugins=no.
>> Yes, this should fix the inconsistency issue.  I will try to work out a patch.
>
> This is what I have here, so far.  I'm going to leave committing this
> for a little while to let others comment.
>
>     configury changes to make ld plugin support controlled by --enable-plugins
>
>     This also makes --enable-plugins default to on for hosts that can
>     support plugins, so we have consistent lto toolchain support.  The
>     ACX_LARGEFILE moves aren't strictly necessary, but are harmless and
>     will be necessary if plugin support is extended to more hosts via
>     libtool's dlopen support.  I started down that path then decided it
>     was more work than I was interested in doing.  (ACX_LARGEFILE invokes
>     AC_PLUGINS.)
>
>         * config/plugins.m4: Test for dlfcn.h or windows.h here to set
>         default for --enable-plugins.  Report error if someone tries to
>         enable plugins on a host we don't support.
>     bfd/
>         * configure.ac: Delete redundant plugin related checks.
>         * configure: Regenerate.
>     binutils/
>         * configure.ac: Move ACX_LARGEFILE after LT_INIT.
>         * config.in: Regenerate.
>         * configure: Regenerate.
>     gas/
>         * configure.ac: Move ACX_LARGEFILE after LT_INIT.
>         * config.in: Regenerate.
>         * configure: Regenerate.
>     gprof/
>         * configure.ac: Move ACX_LARGEFILE after LT_INIT.
>         * configure: Regenerate.
>         * gconfig.in: Regenerate.
>     ld/
>         * configure.ac: Move AC_PROG_CC and other macros earlier.  Delete
>         plugin checks now done in config/plugins.m4.
>         * config.in: Regenerate.
>         * configure: Regenerate.
>
> diff --git a/config/plugins.m4 b/config/plugins.m4
> index 7ee8412..f65fdcb 100644
> --- a/config/plugins.m4
> +++ b/config/plugins.m4
> @@ -1,11 +1,18 @@
>  AC_DEFUN([AC_PLUGINS],
>  [
> -AC_ARG_ENABLE([plugins],
> -AS_HELP_STRING([--enable-plugins], [Enable support for plugins (defaults no)]),
> -[case "${enableval}" in
> -  yes | "") plugins=yes ;;
> -  no) plugins=no ;;
> -  *) plugins=yes ;;
> - esac],
> -[plugins=no])
> +  maybe_plugins=no
> +  AC_CHECK_HEADERS([dlfcn.h], [maybe_plugins=yes], [], [AC_INCLUDES_DEFAULT])
> +  AC_CHECK_HEADERS([windows.h], [maybe_plugins=yes], [], [AC_INCLUDES_DEFAULT])
> +
> +  AC_ARG_ENABLE([plugins],
> +    AS_HELP_STRING([--enable-plugins], [Enable support for plugins]),
> +    [case "${enableval}" in
> +      no) plugins=no ;;
> +      *) plugins=yes
> +         if test "$maybe_plugins" != "yes" ; then
> +          AC_MSG_ERROR([Building with plugin support requires a host that supports dlopen.])
> +        fi ;;
> +     esac],
> +    [plugins=$maybe_plugins]
> +  )
>  ])
> diff --git a/bfd/configure.ac b/bfd/configure.ac
> index 017304f..ba98e39 100644
> --- a/bfd/configure.ac
> +++ b/bfd/configure.ac
> @@ -48,10 +48,6 @@ ACX_LARGEFILE
>  AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
>
>  if test "$plugins" = "yes"; then
> -  if test "$enable_dlopen" != "yes" ; then
> -    AC_MSG_ERROR([
> -      Building BFD with plugin support requires a host that supports -ldl.])
> -  fi
>    enable_targets="$enable_targets plugin"
>  fi
>
> @@ -217,8 +213,6 @@ GCC_HEADER_STDINT(bfd_stdint.h)
>  AC_HEADER_TIME
>  AC_HEADER_DIRENT
>
> -AC_CHECK_HEADERS(windows.h dlfcn.h)
> -
>  ACX_HEADER_STRING
>  AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno)
>  AC_CHECK_FUNCS(strtoull getrlimit)
> diff --git a/binutils/configure.ac b/binutils/configure.ac
> index ff0d4dc..c5da20d 100644
> --- a/binutils/configure.ac
> +++ b/binutils/configure.ac
> @@ -31,8 +31,8 @@ AC_PROG_CC
>  AC_GNU_SOURCE
>  AC_USE_SYSTEM_EXTENSIONS
>
> -ACX_LARGEFILE
>  LT_INIT
> +ACX_LARGEFILE
>
>  AC_ARG_ENABLE(targets,
>  [  --enable-targets        alternative target configurations],
> diff --git a/gas/configure.ac b/gas/configure.ac
> index cc4fc54..e2fc1b7 100644
> --- a/gas/configure.ac
> +++ b/gas/configure.ac
> @@ -37,9 +37,9 @@ AM_INIT_AUTOMAKE
>  AC_PROG_CC
>  AC_GNU_SOURCE
>  AC_USE_SYSTEM_EXTENSIONS
> -ACX_LARGEFILE
>
>  LT_INIT
> +ACX_LARGEFILE
>
>  AC_ARG_ENABLE(targets,
>  [  --enable-targets        alternative target configurations besides the primary],
> diff --git a/gprof/configure.ac b/gprof/configure.ac
> index 583ad24..e2d3718 100644
> --- a/gprof/configure.ac
> +++ b/gprof/configure.ac
> @@ -35,10 +35,10 @@ AC_CONFIG_HEADERS([gconfig.h:gconfig.in])
>  AC_PROG_CC
>  AC_GNU_SOURCE
>  AC_USE_SYSTEM_EXTENSIONS
> -ACX_LARGEFILE
>  AC_PROG_INSTALL
>
>  LT_INIT
> +ACX_LARGEFILE
>
>  AC_CHECK_FUNCS(setmode)
>
> diff --git a/ld/configure.ac b/ld/configure.ac
> index c81ccfe..1bddfc9 100644
> --- a/ld/configure.ac
> +++ b/ld/configure.ac
> @@ -29,6 +29,15 @@ AC_ISC_POSIX
>  AM_INIT_AUTOMAKE
>  AM_MAINTAINER_MODE
>
> +AC_PROG_CC
> +AC_PROG_CXX
> +AC_GNU_SOURCE
> +AC_USE_SYSTEM_EXTENSIONS
> +AC_PROG_INSTALL
> +
> +LT_INIT
> +ACX_LARGEFILE
> +
>  AC_ARG_WITH(lib-path, [  --with-lib-path=dir1:dir2...  set default LIB_PATH],LIB_PATH=$withval)
>  AC_ARG_ENABLE(targets,
>  [  --enable-targets        alternative target configurations],
> @@ -157,15 +166,6 @@ fi
>
>  # host-specific stuff:
>
> -AC_PROG_CC
> -AC_PROG_CXX
> -AC_GNU_SOURCE
> -AC_USE_SYSTEM_EXTENSIONS
> -ACX_LARGEFILE
> -AC_PROG_INSTALL
> -
> -LT_INIT
> -
>  ALL_LINGUAS="fr sv tr es da vi zh_CN zh_TW ga fi id bg it uk"
>  ZW_GNU_GETTEXT_SISTER_DIR
>  AM_PO_SUBDIRS
> @@ -195,16 +195,8 @@ AC_CHECK_FUNCS(glob mkstemp realpath sbrk setlocale waitpid)
>  AC_CHECK_FUNCS(open lseek close)
>  AC_HEADER_DIRENT
>
> -# Check for dlopen support and enable plugins if possible.
> -enable_plugins=yes
> -AC_CHECK_HEADER([dlfcn.h],[],[enable_plugins=no],[AC_INCLUDES_DEFAULT])
> -AC_SEARCH_LIBS([dlopen],[dl],[],[enable_plugins=no],[])
> -AC_CHECK_FUNCS([dlopen dlsym dlclose],[],[enable_plugins=no])
> -# We also support plugins on Windows (MinGW).
> -if test x$enable_plugins = xno ; then
> -  AC_CHECK_HEADERS([windows.h],[enable_plugins=yes],[],[AC_INCLUDES_DEFAULT])
> -fi
> -AM_CONDITIONAL([ENABLE_PLUGINS], [test x$enable_plugins = xyes])
> +AC_SEARCH_LIBS([dlopen], [dl])
> +AM_CONDITIONAL([ENABLE_PLUGINS], [test x$plugins = xyes])
>
>  AC_ARG_ENABLE(initfini-array,
>         [  --enable-initfini-array      use .init_array/.fini_array sections],
>

Thanks very much.  This is much more complete than my experimental patch.

Thanks,
bin
>
> --
> Alan Modra
> Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]