	Configuring libstdc++-2.8.1.1

Like most GNU software, libstdc++ must be configured before it can be built.
This document attempts to describe the recommended configuration procedure
for both native and cross targets.

We use srcdir to refer to the toplevel source directory for
libstdc++; we use objdir to refer to the toplevel build/object
directory for libstdc++.

First, we highly recommend that libstdc++ be built into a separate
directory than the sources.  This is how we generally build libstdc++; building
where srcdir == objdir should still work, but doesn't get
extensive testing.

Second, when configuring a native system, either "cc" must be in your
path or you must set CC in your environment before running configure.
Otherwise the configuration scripts may fail.

Third, beginning with this version of libstdc++ we highly recommend that
gcc will not be built separately. One advantage of this is that gcc
and the runtime libraries agree about where the runtime libs' include
files will be installed. Rather untar gcc-m.x.y into the toplevel
directory of libstdc++ (where this INSTALL file lives), rename the
gcc-m.x.y directory to gcc, and optionally apply the patch
at the end of this file (you can actually feed this file as input to
patch). This patch allows you to check the built compiler (if you
actually intend to do this, you'd need to get a testsuite for gcc
- e.g. egcs' one from <ftp://egcs.cygnus.com/pub/egcs/releases/>
and move that directory into the gcc directory):

  % cd srcdir
  % gunzip < /where/you/store/GNU/packages/gcc-m.x.y.tar.gz | tar xf -
  % mv gcc-m.x.y gcc
  % patch < INSTALL
  % gunzip < /where/you/store/GNU/packages/egcs-n.x.y.tar.gz | \
    tar xf - egcs-n.x.y/gcc/teststuite
  % mv egcs-n.x.y/gcc/teststuite gcc
  % rmdir -p egcs-n.x.y/gcc

To configure libstdc++:

  % mkdir objdir
  % cd objdir
  % srcdir/configure [target] [options]


target specification

  libstdc++ has code to correctly determine the correct value for
  target for nearly all native systems.  Therefore, we highly
  recommend you not provide a configure target when configuring a
  native package.

  target must be specified when configuring a cross package;
  examples of valid targets would be i960-rtems, m68k-coff, sh-elf, etc.


options specification

Use options to override several configure time options for
libstdc++.  A partial list of supported options:


  --prefix=dirname -- Specify the toplevel installation
  directory.  This is the recommended way to install the tools into a directory
  other than the default.  The toplevel installation directory defaults to
  /usr/local.

  These additional options control where certain parts of the distribution
  are installed.  Normally you should not need to use these options.
  
     --with-local-prefix=dirname -- Specify the installation
     directory for local include files.  The default is /usr/local.

     --with-gxx-include-dir=dirname -- Specify the installation
     directory for g++ header files.  The default is /usr/local/include/g++.
  

  --enable-shared -- Build shared versions of the C++ runtime
  libraries if supported --disable-shared is the default.

  --with-gnu-as -- Specify that the compiler should assume the GNU
  assembler (aka gas) is available. 

  --with-gnu-ld -- Specify that the compiler should assume the GNU
  linker (aka gld) is available. 

  --enable-multilib -- Specify that multiple target libraries
  should be built to support different target variants, calling conventions,
  etc.  This is the default. 

 
Note that each --enable option has a corresponding --disable option and
that each --with option has a corresponding --without option.



	Building libstdc++-2.8.1.1

Now that libstdc++ is configured, you are ready to build the compiler
(if you unpacked the compiler sources as recommended above) and
runtime libraries.  If you've arranged your compiler and library sources
in the `one tree' proposal, you should call `make bootstrap'; this will
bootstrap the compiler and the runtime libraries in one shot. If you don't
want to build the compiler, simply call `make all'.

We highly recommend that libstdc++ be built using gnu-make; other
versions may work, then again they might not.  To be safe build with gnu-make.



	Testing libstdc++-2.8.1.1

To see if the built compiler (optionally) and runtime libraries actually
work, you can check them with `cd objdir; make check'.



	Final install libstdc++-2.8.1.1

Now that libstdc++ has been built and tested, you can install it with
`cd objdir; make install'.

That step completes the installation of libstdc++; user level binaries can
be found in prefix/bin where prefix is the value you specified
with the --prefix to configure (or /usr/local by default).



	Found a bug?

If you think you've found a bug, you should send a bug report to
<bug-lib-g++@gnu.org>.

The fundamental principle of reporting bugs usefully is this:

  *report all the facts*.  If you are not sure whether to state a fact or
  leave it out, state it!

Often people omit facts because they think they know what causes the
problem and they conclude that some details don't matter.  Thus, you
might assume that the name of the variable you use in an example does
not matter.  Well, probably it doesn't, but one cannot be sure.
Perhaps the bug is a stray memory reference which happens to fetch from
the location where that name is stored in memory; perhaps, if the name
were different, the contents of that location would fool the compiler
into doing the right thing despite the bug.  Play it safe and give a
specific, complete example.  That is the easiest thing for you to do,
and the most helpful.

Keep in mind that the purpose of a bug report is to enable someone to
fix the bug if it is not known.  It isn't very important what happens if
the bug is already known.  Therefore, always write your bug reports on
the assumption that the bug is not known.

Sometimes people give a few sketchy facts and ask, "Does this ring a
bell?"  This cannot help us fix a bug, so it is basically useless.  We
respond by asking for enough details to enable us to investigate.  You
might as well expedite matters by sending them to begin with.

Try to make your bug report self-contained.  If we have to ask you
for more information, it is best if you include all the previous
information in your response, as well as the information that was
missing.

Please report each bug in a separate message.  This makes it easier
for us to track which bugs have been fixed and to forward your bugs
reports to the appropriate maintainer.

Do not compress and encode any part of your bug report using programs
such as `uuencode'.  If you do so it will slow down the processing of
your bug.  If you must submit multiple large files, use `shar', which
allows us to read your message without having to run any decompression
programs.

To enable someone to investigate the bug, you should include all
these things:

  * The version of GNU CC.  You can get this by running it with the
    `-v' option.

     Without this, we won't know whether there is any point in looking
     for the bug in the current version of GNU CC.

   * A complete input file that will reproduce the bug. A single statement
     is not enough of an example.  In order to compile it, it must be
     embedded in a complete file of compiler input; and the bug might
     depend on the details of how this is done.

   * The command arguments you gave GNU CC or GNU C++ to compile that
     example and observe the bug.  For example, did you use `-O'?  To
     guarantee you won't omit something important, list all the options.

     If we were to try to guess the arguments, we would probably guess
     wrong and then we would not encounter the bug.

   * The type of machine you are using, and the operating system name
     and version number.

   * The operands you gave to the `configure' command when you installed
     the compiler and libstdc++.

   * A complete list of any modifications you have made to the library
     source.  (We don't promise to investigate the bug unless it
     happens with unmodified sources.  But if you've made
     modifications and don't tell us, then you are sending us on a wild
     goose chase.)

     Be precise about these changes.  A description in English is not
     enough--send a context diff for them.

     Adding files of your own (such as a machine description for a
     machine we don't support) is a modification of the library source.

   * Details of any other deviations from the standard procedure for
     installing GNU libstdc++.

   * A description of what behavior you observe that you believe is
     incorrect.  For example, "The compiler gets a fatal signal," or,
     "The assembler instruction at line 208 in the output is incorrect."

Never send core dump files!  We have no way of examining a core dump
for your type of machine unless we have an identical system--and if
we do have one, we should be able to reproduce the crash ourselves.



Fri Feb 20 13:55:39 1998  Manfred Hollstein  <manfred@s-direktnet.de>

	* Makefile.in (EXPECT): New macro for `make check'.
	(RUNTEST): Likewise.
	(RUNTESTFLAGS): Likewise.
	(target_subdir): Likewise.
	(CHECK_TARGETS): Likewise.
	(FLAGS_TO_PASS): Add local_prefix and gxx_include_dir.
	(distclean): Remove testsuite specific files.
	(site.exp): New rule to generate gcc specific check information.
	(testsuite/site.exp): Likewise.
	(check-g++): Rule to invoke checking g++.
	(check-gcc): Rule to invoke checking gcc.
	(check-g77): Rule to invoke checking g77.

--- gcc/Makefile.in.orig	Fri Feb 20 13:53:00 1998
+++ gcc/Makefile.in	Fri Feb 20 13:58:33 1998
@@ -411,6 +411,16 @@
 # Source for float.h.  Overridden by cross-make.
 FLOAT_H=float.h-nat
 
+# Setup the testing framework, if you have one
+EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
+            echo $${rootme}/../expect/expect ; \
+          else echo expect ; fi`
+
+RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
+	       echo $${srcdir}/../dejagnu/runtest ; \
+	    else echo runtest; fi`
+RUNTESTFLAGS =
+
 # Extra symbols for fixproto to define when parsing headers.
 FIXPROTO_DEFINES = 
 
@@ -546,7 +556,9 @@
 	"prefix=$(prefix)" \
 	"tooldir=$(tooldir)" \
 	"bindir=$(bindir)" \
-	"libsubdir=$(libsubdir)"
+	"libsubdir=$(libsubdir)" \
+	"local_prefix=$(local_prefix)" \
+	"gxx_include_dir=$(gxx_include_dir)"
 #
 # Lists of files for various purposes.
 
@@ -2100,6 +2112,8 @@
 	-rm -f c-parse.output
 	-rm -f *.asm
 	-rm -f float.h
+	-rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
+	-rm -f testsuite/{gcc,g++}.{log,sum}
 
 # Delete anything likely to be found in the source directory
 # that shouldn't be in the distribution.
@@ -2383,6 +2397,104 @@
 	-rm -rf $(mandir)/protoize$(manext)
 	-rm -rf $(mandir)/unprotoize$(manext)
 #
+# These targets are for the dejagnu testsuites. The file site.exp 
+# contains global variables that all the testsuites will use.
+
+# Set to $(target_alias)/ for cross.
+target_subdir = libraries/
+
+site.exp: ./config.status Makefile
+	@echo "Making a new config file..."
+	-@rm -f ./tmp?
+	@touch site.exp
+	-@mv site.exp site.bak
+	@echo "## these variables are automatically generated by make ##" > ./tmp0
+	@echo "# Do not edit here. If you wish to override these values" >> ./tmp0
+	@echo "# add them to the last section" >> ./tmp0
+	@echo "set rootme \"`pwd`\"" >> ./tmp0
+	@echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
+	@echo "set host_triplet $(host_canonical)" >> ./tmp0
+	@echo "set build_triplet $(build_canonical)" >> ./tmp0
+	@echo "set target_triplet $(target)" >> ./tmp0
+	@echo "set target_alias $(target_alias)" >> ./tmp0
+# CFLAGS is set even though it's empty to show we reserve the right to set it.
+	@echo "set CFLAGS \"\"" >> ./tmp0
+	@echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0
+# If newlib has been configured, we need to pass -B to gcc so it can find
+# newlib's crt0.o if it exists.  This will cause a "path prefix not used"
+# message if it doesn't, but the testsuite is supposed to ignore the message -
+# it's too difficult to tell when to and when not to pass -B (not all targets
+# have crt0's).  We could only add the -B if ../newlib/crt0.o exists, but that
+# seems like too selective a test.
+# ??? Another way to solve this might be to rely on linker scripts.  Then
+# theoretically the -B won't be needed.
+# We also need to pass -L ../ld so that the linker can find ldscripts.
+	@if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
+	  echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
+	  echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
+	  echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
+	  echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
+	  echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
+	else true; \
+	fi
+	@if [ -d $(objdir)/../ld ] ; then \
+	  echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
+	else true; \
+	fi
+	@if  [ $(build_canonical) != $(host_canonical) ] ; then \
+	  echo "set tmpdir /tmp" >> ./tmp0 ; \
+	else echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 ; \
+	fi
+	@echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
+	@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
+	@cat ./tmp0 > site.exp
+	@cat site.bak | sed \
+		-e '1,/^## All variables above are.*##/ d' >> site.exp
+	-@rm -f ./tmp?
+
+CHECK_TARGETS = check-gcc check-g++
+
+check: $(CHECK_TARGETS)
+
+testsuite/site.exp: site.exp
+	if [ -d testsuite ]; then \
+	  true; \
+	else \
+	  mkdir testsuite; \
+	fi
+	rm -rf testsuite/site.exp
+	cp site.exp testsuite/site.exp
+
+check-g++: testsuite/site.exp
+	-rootme=`pwd`; export rootme; \
+	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
+	cd testsuite; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	if [ -f $${rootme}/../expect/expect ] ; then  \
+	   TCL_LIBRARY=$${srcdir}/../tcl/library ; \
+	    export TCL_LIBRARY ; fi ; \
+	$(RUNTEST) --tool g++ $(RUNTESTFLAGS)
+
+check-gcc: testsuite/site.exp
+	-rootme=`pwd`; export rootme; \
+	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
+	cd testsuite; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	if [ -f $${rootme}/../expect/expect ] ; then  \
+	   TCL_LIBRARY=$${srcdir}/../tcl/library ; \
+	   export TCL_LIBRARY ; fi ; \
+	$(RUNTEST) --tool gcc $(RUNTESTFLAGS)
+
+check-g77: testsuite/site.exp
+	-rootme=`pwd`; export rootme; \
+	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
+	cd testsuite; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	if [ -f $${rootme}/../expect/expect ] ; then  \
+	   TCL_LIBRARY=$${srcdir}/../tcl/library ; \
+	   export TCL_LIBRARY ; fi ; \
+	$(RUNTEST) --tool g77 $(RUNTESTFLAGS)
+
 # These exist for maintenance purposes.
 
 # Update the tags table.
