AIX: Optional filename-based shlib versioning

Support filename-based shared library versioning on AIX with the lib.so
library filename extension, which is used with runtime linking only.
Runtime linking is enabled by the -brtl linker flag for executables and
the -G linker flag for Shared Objects.
(with-aix-soname=aix): Default, the current situation.
  (lib.a): When the -brtl linker flag is found in LDFLAGS, create from
    static objects only. Otherways, create as traditional shared library
    archive from the Shared Object built without runtime linking, with
    in-archive versioning.
  (lib.so): When the -brtl linker flag is found in LDFLAGS, create as
    the standalone Shared Object built with the -G linker flag, without
    any versioning support. Otherways, do not create it at all.
  (executables): When the -brtl linker flag is found in LDFLAGS, prefer
    to link against libraries with the .so filename extension.
    Otherways, link against libraries with the .a filename extension.
  (module): When the -brtl linker flag is found in LDFLAGS, same as for
    lib.so.  Otherways, same as for lib.a.
(with-aix-soname=svr4): Linux/SVR4 compatible shared library versioning.
  (lib.a): Create from static objects.
  (lib.so): Create as shared library archive from the Shared Object
    named shr.o or shr_64.o, built with the -G linker flag, and the
    F_LOADONLY flag set, plus an Import File named shr.imp or
    shr_64.imp, respectively, necessary to allow for filename-based
    versioning.
  (executables): Add the -brtl linker flag to LDFLAGS, to prefer linking
    against shared libraries with the .so filename extension.
  (module): Same as for lib.so.
(with-aix-soname=both): Linux/SVR4 compatible shared library versioning,
but backwards compatible.
  (lib.a): Create as traditional shared library archive from the Shared
  Object built without runtime linking, with in-archive versioning.
  (lib.so): Create as shared library archive from the Shared Object
    named shr.o or shr_64.o, built with the -G linker flag, and the
    F_LOADONLY flag set, plus an Import File named shr.imp or
    shr_64.imp, respectively, necessary to allow for filename-based
    versioning.
  (executables): When the -brtl linker flag is found in LDFLAGS, prefer
    to link against libraries with the .so filename extension.
    Otherways, link against libraries with the .a filename extension.
  (module): Same as for both lib.a and lib.so.

* Makefile.am: (TESTS_ENVIRONMENT) Pass with_aix_soname value via
lt_cv_with_aix_soname into testsuite.

* configure.ac: AC_SUBST with_aix_soname.

* libltdl/loaders/dlopen.c: (vm_open) Use RTLD_MEMBER flag for dlopen
when the filename does specify an archive member between "()".
Otherways, retry with appending LT_SHARED_LIB_MEMBER when loading fails
without but archive file seems to exist.

* m4/libtool.m4: (dynamic_linker) Describe configured shared library
versioning variant according to with_aix_soname and runtime linking.
(soname_spec, library_names_spec, shlibpath_overrides_runpath,
postinstall_cmds, postuninstall_cmds, hardcode_direct,
hardcode_direct_absolute, no_undefined_flag, allow_undefined_flag) Set
according to with_aix_soname and runtime linking configuration.
(export_symbols_cmds) Decorate symbols with the weak keyword.
(archive_expsym_cmds) Create both shared libraries according to
with_aix_soname and runtime linking configuration. Filter -brtl linker
flag from compiler_flags for shared libraries due to its side effects.
(old_archive_from_new_cmds) Set when old shared archive is created.
(enable_static) No need to disable with old_archive_from_new_cmds.

* m4/ltdl.m4: (LT_SHARED_LIB_MEMBER) Define, set based on the value of
the shared_archive_member_spec libtool variable.

* m4/ltoptions.m4: (_LT_WITH_AIX_SONAME) New. Provides commandline
option --with-aix-soname=aix|svr4|both. Declares
(shared_archive_member_spec) as libtool variable.
(_LT_SET_OPTIONS) Define LT_INIT options "aix-soname=aix",
"aix-soname=svr4", "aix-soname=both". Default is "aix-soname=aix".

* tests/deplibs-ident.at: To define whether this test should XFAIL, use
hardcode_action, hardcode_direct, hardcode_direct_absolute configuration
settings instead of platforms aix, bitrig, hppa-hpux, interix or openbsd.

* tests/template.at: Skip test with undef syms across libraries on AIX.

* tests/versioning.at: When shared_archive_member_spec is defined and
LDFLAGS contain -brtl, we can run the versioning check.
respect old_archive_from_new_cmds in mode=relink

When old_archive_from_new_cmds is set, old library might be both
relinked and necessary for subsequent relinking, so installing late with
the other static archives might be too late.

* build-aix/ltmain.in: (func_mode_install) Install (maybe relinked) old
library using install_shared_prog when old_archive_from_new_cmds is set.
(func_mode_link) When relinking, back up and restore old library as well
when old_archive_from_new_cmds is set.