tests: question mark is extended regex for non-GNU grep.

Accepting \? for at-most-once in basic regex is a GNU grep
extension, not accepted by AIX grep for example.
* tests/libtool.at: Use \{0,1\} instead of ? with GREP.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
tests: do not test undef symbols across shlibs on AIX.

On AIX, undefined symbols across shared libraries can work only
when the main program explicitly exports those symbols. As this
is bad practice anyway and -no-undefined should be preferred, we
skip this.
* tests/template.at: Skip test with undef syms across libraries
on AIX.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
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. The behaviour is similar to
Linux/SVR4 DT_SONAME, hence the name "aix-soname=svr4".

(--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): Filename-based 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): One shared library is created with the
filename-based, another one with the in-archive versioning scheme for
backwards compatibility. The library_names value in the .la file
specifies either the one or the other, depending on whether the -brtl
linker flag is specified in LDFLAGS.
  (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.
(enable_static) Respect with_aix_soname for disabling as well.

* 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/versioning.at: When shared_archive_member_spec is defined and
LDFLAGS contain -brtl, we can run the versioning check.
AIX: use old_archive_from_new_cmds for old library

* build-aux/ltmain.in: (func_mode_install) Also install old library
using install_shared_prog when old_archive_from_new_cmds is set - it may
be necessary for relinking subsequent libs of same mode=install call.
(func_mode_link) Make backup of old library as well during mode=relink
when old_archive_from_new_cmds is set, and restore it afterwards.

* m4/libtool.m4: (_LT_SYS_DYNAMIC_LINKER) No need to handle old library
in postinstall_cmds on AIX any more when built as shared archive.
(_LT_LINKER_SHLIBS) Set old_archive_from_new_cmds on AIX when old
library is built as shared archive on AIX.