[2.23] Backport mingw/plugins fixes from trunk

Backport of 3 patches:

2012-10-13  H.J. Lu  <hongjiu.lu@intel.com>

       * Makefile.am (LIBDL): Replace -ldl with @lt_cv_dlopen_libs@.
       * configure.in (lt_cv_dlopen_libs): AC_SUBST.
       * Makefile.in: Regenerated.
       * configure: Likewise.

2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>

       Fix mingw gold build with plugins enabled
       * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
       * configure.ac: Export DLOPEN_LIBS and add headers check.
       * plugin.cc: Handle non-dlfcn case.
       * Makefile.in: Regenerate.
       * config.in: Regenerate.
       * configure: Regenerate.
       * testsuite/Makefile.in: Regenerate.

2013-02-11  Ian Lance Taylor  <iant@google.com>

       * descriptors.cc (Descriptors::close_all): New function.
       * descriptors.h (class Descriptors): Declare close_all.
       (close_all_descriptors): New inline function.
       * plugin.cc: Include "descriptors.h".
       (Plugin_manager::cleanup): Call close_all_descriptors.

Change-Id: I57e583b3566d214e816363501d1047833e834417
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>

Author: Pavel Chupin <pavel.v.chupin@intel.com>
Date:   Mon Apr 15 16:40:50 2013 +0400