This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: Supporting --enable-version-specific-runtime-libs
- To: libstdc++ at sources dot redhat dot com
- Subject: Re: Supporting --enable-version-specific-runtime-libs
- From: markh at landmark dot com
- Date: Mon, 16 Oct 2000 18:49:58 -0400 (EDT)
- cc: bkoz at redhat dot com, mharig at landmark dot com
(I forgot to send this to libstdc++ the first time. This is just a
duplicate of my earlier message.)
>
> In addition, I kept USE_LIBDIR just because I didn't want libstdc++
> divergence with what is apparently a common idiom in makefile/configure
> scripts across the development toolchain (ie gcc/java/c++).
>
> The resulting bits in src/Makefile.am look like:
>
> # Cross compiler and multilib support.
> # Install a library built with a cross compiler in tooldir, not libdir.
> if USE_LIBDIR
> toolexeclibdir = $(libdir)$(MULTISUBDIR)
> else
> if VERSION_SPECIFIC_LIBS
> gcc_version = @gcc_version@
> toolexecdir = $(libdir)/gcc-lib/$(target_alias)
> toolexeclibdir = $(toolexecdir)/$(gcc_version)
> else
> toolexecdir = $(exec_prefix)/$(target_alias)
> toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
> endif
> endif
What you have put in place is the same as my original (erroneous)
change, the one I made before submitting any patches, the one that
drove me a little crazy.
Consider the following scenario:
You configure your source using ./configure
--enable-version-specific-runtime-libs, but without using
--with-cross-host, because you don't want to build a cross compiler.
During configuration, configure will run the code that corresponds
to the following line in configure.in:
AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
Now, because you did not specify --with-cross-host, this test will
cause USE_LIBDIR to become defined, and so, even though you have a
specification of '--enable-version-specific-runtime-libs', the
library and header files will NOT be installed in the
version-specific directories. Instead the "if USE_LIBDIR" clause
will be used.
Here's my reasoning about what should be the correct order of
priority of processiong these options. Feel free to dispute this.
1) If a cross-compiler is specified, then all bets are off. This
is a special and unusual compiler that is going to be built and
it is going to reside in a special directory tree. Should we
support version-specific directories for cross compilers also?
I don't think it has been done in the past, but we could
consider adding that also.
2) If a cross-compiler has not been specified (i.e., the other 99%
:) ), then
a) by default, we allow the files to be installed in the
"multilib" directory tree.
b) if a version-specific directory structure has been
requested, then this overrides the default.
If this reasoning is correct, then we could see the following
pseudo-code:
if cross-compiler then
cross-compiler code;
else
if version-specific compiler then
version-specific code;
else
default ("multilib") code;
end-if
end-fi
Or, equivalently,
if not-cross-compiler then
if version-specific compiler then
version-specific code;
else
default ("multilib") code;
end-if
else
cross-compiler code;
end-if
(In this implementation, notice how the priority of the
configuration switches has been turned on its head.)
What you have written (and I made the same mistake) is:
if not-cross-compiler then
default ("multilib") code;
else
if version-specific compiler then
version-specific code;
else
cross-compiler code;
end-if
end-if
Why did we both make this mistake? I think it is because USE_LIBDIR
was poorly selected as a variable name (and has gone on for a long
time with people cutting and pasting code), and because the original
if-else clause in Makefile.am was poorly considered since it is
based on the absence of a configuration switch, rather than a test
for the presence of a configuration switch.
If you insist on continuing the USE_LIBDIR idiom, please change the
erroneous code above in src/Makefile.am to:
> if USE_LIBDIR
> if VERSION_SPECIFIC_LIBS
> gcc_version = @gcc_version@
> toolexecdir = $(libdir)/gcc-lib/$(target_alias)
> toolexeclibdir = $(toolexecdir)/$(gcc_version)
> else
> toolexeclibdir = $(libdir)$(MULTISUBDIR)
> endif
> else
> toolexecdir = $(exec_prefix)/$(target_alias)
> toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
> endif
But before you do this, please remember how easy it was for you to
make this mistake, as I did.
--
## Mark Harig
## Landmark Systems, Reston, Virginia, USA
## Email: mharig@landmark.com