This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libstdc++] Make configure.target smarter about defaults


While looking through our configury, I noticed that configure.target is
getting large and repetitive.  So this patch gives it some smarter defaults,
which lets us remove large chunks of case statements.  The goal is to make
simplification of the host-x-host stuff in configure.in a possibility by
cleaning up anything which looks fragile or confusing or outdated, i.e.,
I did this sort of on the side just trying to figure out how stuff works.

The only actual bugfixes were that powerpc/rs6000 wasn't always getting
the same settings, depending on whether you chose a "powerpc" name or a
"rs6000" name; DJE confirmed that this was a bug and not intended behavior.
Also, some cross-targets would still try to run the linker (which doesn't
work) while testing for symbol versioning.  The easy workaround here is,
if the user has explictly disabled symbol versioning, don't bother running
that part of the test.

This patch also brings the v3 porting document up to date.  (At some point
I'll work out how to build that into the GCC Internals manual while leaving
it in the libstdc++ area for separate snapshots.  Not soon though.)


Everywhere we were using CPU or OS directories, we were writing "config/..."
so I pulled those 7 characters out into one place.  Who-hoo.  (Also,
now that we're pointing to header files directly, instead of specifying
an -I path, I plan to go through and get rid of the needless "bits"
subdirectories under config.)

I'm fairly certain that I've maintained current behavior, but there may be
some corner cases which would change with this patch.  I've tried building
a couple of cross-compilers, but most of them seem to fail long before
getting to the configure.target part, or before libstdc++-v3 at all, so
I may have just been picking bad targets.  No problems on those targets
I was able to build, though.

I'll wait for any comments before checking in the patch.



2002-06-15  Phil Edwards  <pme@gcc.gnu.org>

	* configure.host:  Delete file.
	* configure.target:  More documentation.  Factor out common parts of
	script into "intelligent" settings about defaults.  Remove redundancy.

	* acinclude.m4:  Update comments.  Do not call configure.host.
	(GLIBCPP_ENABLE_SYMVERS):  If disabled, do not bother checking for
	libgcc_s.
	* configure.in:  Slight reformatting, more comments.  Factor out
	"config/" from all the directories.
	* docs/html/17_intro/porting.texi:  Update and expand.
	* testsuite/Makefile.am (AM_RUNTESTFLAGS):  Move empty setting
	from configure.host.

	* aclocal.m4, configure, docs/html/17_intro/porting.html,
	testsuite/Makefile.in:  Regenerate.


Index: acinclude.m4
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.208
diff -u -3 -p -r1.208 acinclude.m4
--- acinclude.m4	10 Jun 2002 20:51:49 -0000	1.208
+++ acinclude.m4	15 Jun 2002 10:13:41 -0000
@@ -3,7 +3,8 @@ dnl Initialize configure bits.
 dnl
 dnl GLIBCPP_CONFIGURE
 AC_DEFUN(GLIBCPP_CONFIGURE, [
-  dnl Default to --enable-multilib
+  dnl Default to --enable-multilib (this is also passed by default
+  dnl from the ubercommon-top-level configure)
   AC_ARG_ENABLE(multilib,
   [  --enable-multilib       build hella library versions (default)],
   [case "${enableval}" in
@@ -34,6 +35,8 @@ AC_DEFUN(GLIBCPP_CONFIGURE, [
   toplevel_srcdir=\${top_srcdir}/$toprel
   AC_SUBST(toplevel_srcdir)
 
+#possibly test for the presence of the compiler sources here?
+
   # Export build and source directories.
   # These need to be absolute paths, yet at the same time need to
   # canonicalize only relative paths, because then amd will not unmount
@@ -51,7 +54,8 @@ AC_DEFUN(GLIBCPP_CONFIGURE, [
 
   AC_PROG_AWK
   # Will set LN_S to either 'ln -s' or 'ln'.  With autoconf 2.5x, can also
-  # be 'cp -p' if linking isn't available.
+  # be 'cp -p' if linking isn't available.  Uncomment the next line to
+  # force a particular method.
   #ac_cv_prog_LN_S='cp -p'
   AC_PROG_LN_S
 
@@ -181,14 +185,12 @@ AC_DEFUN(GLIBCPP_CONFIGURE, [
     AC_EXEEXT
   fi
 
-  . [$]{glibcpp_basedir}/configure.host
-
   case [$]{glibcpp_basedir} in
     /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
     *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
   esac
 
-  # This does for the target what configure.host does for the host.  In
+  # Find platform-specific directories containing configuration info.  In
   # addition to possibly modifying the same flags, it also sets up symlinks.
   GLIBCPP_CHECK_TARGET
 
@@ -2127,12 +2129,14 @@ if test x$enable_shared = xno || 
 fi
 
 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
-AC_MSG_CHECKING([for shared libgcc])
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=' -lgcc_s'
-AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
-CFLAGS="$ac_save_CFLAGS"
-AC_MSG_RESULT($glibcpp_shared_libgcc)
+if test $enable_symvers != no; then
+  AC_MSG_CHECKING([for shared libgcc])
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS=' -lgcc_s'
+  AC_TRY_LINK(, [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
+  CFLAGS="$ac_save_CFLAGS"
+  AC_MSG_RESULT($glibcpp_shared_libgcc)
+fi
 
 # For GNU ld, we need at least this version.  It's 2.12 in the same format
 # as the tested-for version.  See GLIBCPP_CHECK_LINKER_FEATURES for more.
Index: configure.host
===================================================================
RCS file: configure.host
diff -N configure.host
--- configure.host	28 Feb 2001 18:42:47 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-# configure.host
-
-# This shell script handles all host based configuration for libstdc++.
-# It sets various shell variables based on the the host and the
-# configuration options.  You can modify this shell script without
-# needing to rerun autoconf.
-
-# This shell script should be invoked as
-#   . configure.host
-# If it encounters an error, it will exit with a message.
-
-# It uses the following shell variables:
-#   host                  The configuration host
-#   host_cpu              The configuration host CPU
-#   target_optspace       --enable-target-optspace ("yes", "no", "")
-
-# It sets the following shell variables:
-
-
-AM_RUNTESTFLAGS= 
-
-# Set any host dependent compiler flags.
-# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
-
-
-case "${host}" in
-  *)
-    ;;
-esac
-
-
Index: configure.in
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/configure.in,v
retrieving revision 1.95
diff -u -3 -p -r1.95 configure.in
--- configure.in	14 Jun 2002 18:21:24 -0000	1.95
+++ configure.in	15 Jun 2002 10:13:41 -0000
@@ -7,7 +7,7 @@ AC_INIT(src/ios.cc)
 # This works around the fact that libtool configuration may change LD
 # for this particular configuration, but some shells, instead of
 # keeping the changes in LD private, export them just because LD is
-# exported.
+# exported.  Only used at the end of this file.
 ORIGINAL_LD_FOR_MULTILIBS=$LD
 
 PACKAGE=libstdc++
@@ -20,6 +20,17 @@ libtool_VERSION=4:1:0
 AC_SUBST(libtool_VERSION)
 
 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
+#
+# You will slowly go insane if you do not grok the following fact:  when
+# building v3 as part of the compiler, the top-level /target/ becomes the
+# library's /host/.  `configure' then causes --target to default to --host,
+# exactly like any other package using autoconf.  Therefore, 'target' and
+# 'host' will always be the same.  This makes sense both for native and
+# cross compilers, just think about it for a little while.  :-)
+#
+# Also, if v3 is being configured as part of a cross compiler, the top-level
+# configure script will pass the "real" host as $with_cross_host.
+#
 # AC 2.5x sets target_alias iff the user specified --target, but we use it
 # everywhere, so we set it here just to be sure.  In AC 2.13
 # AC_CANONICAL_TARGET was known as AC_CANONICAL_SYSTEM.
@@ -30,9 +41,8 @@ AC_SUBST(target_alias)
 AM_INIT_AUTOMAKE($PACKAGE, $release_VERSION)
 AM_CONFIG_HEADER(config.h)
 
-# Runs configure.host and configure.target, as well as finds CC, CXX
-# and assorted other critical bits.  Have to run this before the
-# GLIBCPP_ENABLE_* macros below.
+# Runs configure.target, finds CC, CXX and assorted other critical bits.
+# Must run this before the GLIBCPP_ENABLE_* macros below.
 GLIBCPP_CONFIGURE(.)
 
 AC_LIBTOOL_DLOPEN
@@ -63,24 +73,25 @@ AC_CHECK_HEADERS(string.h stdlib.h)
 
 if test -n "$with_cross_host" || test x"$build" != x"$host"; then
 
-  # This lets us hard-code the functionality we know
-  # we'll have in the cross target environment. "Let" is a
-  # sugar-coated word placed on an especially dull and tedious hack, actually.
-  # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
-  # that involve linking can't be used:
-  # "cannot open sim-crt0.o"
-  # "cannot open crt0.o"
-  # etc. All this is because there currently exists no unified,
-  # consistent way for top level CC information to be passed down
-  # to target directories: newlib includes, newlib linking info,
-  # libgloss versus newlib crt0.o, etc. When all of this is done, all
-  # of this hokey, excessive AC_DEFINE junk for crosses can be removed.
-
   # We are being configured with some form of cross compiler.
   GLIBCPP_IS_CROSS_COMPILING=1
 
-  # If Canadian cross, then don't pick up tools from the build
-  # directory.
+  # This lets us hard-code the functionality we know we'll have in the cross
+  # target environment.  "Let" is a sugar-coated word placed on an especially
+  # dull and tedious hack, actually.
+  #
+  # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
+  # that involve linking, can't be used:
+  #    "cannot open sim-crt0.o"
+  #    "cannot open crt0.o"
+  # etc.  All this is because there currently exists no unified, consistent
+  # way for top level CC information to be passed down to target directories:
+  # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc.
+  # When all of that is done, all of this hokey, excessive AC_DEFINE junk for
+  # crosses can be removed.
+
+  # If Canadian cross, then don't pick up tools from the build directory.
+  # Used in GLIBCPP_EXPORT_INCLUDES (and nowhere else?).
   if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
     CANADIAN=yes
   else
@@ -94,16 +105,15 @@ if test -n "$with_cross_host" || test x"
 
   case "$target_alias" in
     *-linux*)
-      # Check for available headers.
+      os_include_dir="os/gnu-linux"
       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
-	machine/endian.h machine/param.h sys/machine.h sys/types.h \
-	fp.h locale.h float.h inttypes.h])
+        machine/endian.h machine/param.h sys/machine.h sys/types.h \
+        fp.h locale.h float.h inttypes.h])
       SECTION_FLAGS='-ffunction-sections -fdata-sections'
       AC_SUBST(SECTION_FLAGS)
       GLIBCPP_CHECK_LINKER_FEATURES
       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
       GLIBCPP_CHECK_WCHAR_T_SUPPORT
-      os_include_dir="config/os/gnu-linux"
       AC_DEFINE(HAVE_COPYSIGN)
       AC_DEFINE(HAVE_COPYSIGNF)
       AC_DEFINE(HAVE_FINITEF)
@@ -112,20 +122,20 @@ if test -n "$with_cross_host" || test x"
       AC_DEFINE(HAVE_SINCOS)
       AC_DEFINE(HAVE_SINCOSF)
       if test x"long_double_math_on_this_cpu" = x"yes"; then
-	AC_DEFINE(HAVE_HYPOTL)
+        AC_DEFINE(HAVE_HYPOTL)
       fi
       ;;
     *-hpux*)
       # Check for available headers.
       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
-	machine/endian.h machine/param.h sys/machine.h sys/types.h \
-	fp.h locale.h float.h inttypes.h])
+        machine/endian.h machine/param.h sys/machine.h sys/types.h \
+        fp.h locale.h float.h inttypes.h])
       SECTION_FLAGS='-ffunction-sections -fdata-sections'
       AC_SUBST(SECTION_FLAGS)
       GLIBCPP_CHECK_LINKER_FEATURES
       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
       GLIBCPP_CHECK_WCHAR_T_SUPPORT
-      os_include_dir="config/os/hpux"
+      os_include_dir="os/hpux"
       AC_DEFINE(HAVE_COPYSIGN)
       AC_DEFINE(HAVE_COPYSIGNF)
       AC_DEFINE(HAVE_FINITEF)
@@ -137,14 +147,14 @@ if test -n "$with_cross_host" || test x"
     *-netbsd*)
       # Check for available headers.
       AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
-	machine/endian.h machine/param.h sys/machine.h sys/types.h \
-	fp.h locale.h float.h inttypes.h])
+        machine/endian.h machine/param.h sys/machine.h sys/types.h \
+        fp.h locale.h float.h inttypes.h])
       SECTION_FLAGS='-ffunction-sections -fdata-sections'
       AC_SUBST(SECTION_FLAGS) 
       GLIBCPP_CHECK_LINKER_FEATURES
       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
       GLIBCPP_CHECK_WCHAR_T_SUPPORT
-      os_include_dir="config/os/bsd/netbsd"
+      os_include_dir="os/bsd/netbsd"
       AC_DEFINE(HAVE_COPYSIGN)
       AC_DEFINE(HAVE_COPYSIGNF)
       AC_DEFINE(HAVE_FINITEF)
@@ -156,10 +166,10 @@ if test -n "$with_cross_host" || test x"
       GLIBCPP_CHECK_LINKER_FEATURES
       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
       GLIBCPP_CHECK_WCHAR_T_SUPPORT
-      os_include_dir="config/os/mingw32"
+      os_include_dir="os/mingw32"
       ;;
     *-windiss*)
-      os_include_dir="config/os/windiss"
+      os_include_dir="os/windiss"
       ;;
 changequote(,)dnl
     *-qnx6.[12]*)
@@ -169,7 +179,7 @@ changequote([,])dnl
       GLIBCPP_CHECK_LINKER_FEATURES
       GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
       GLIBCPP_CHECK_WCHAR_T_SUPPORT
-      os_include_dir="config/os/qnx/qnx6.1"
+      os_include_dir="os/qnx/qnx6.1"
       AC_DEFINE(HAVE_COSF)
       AC_DEFINE(HAVE_COSL)
       AC_DEFINE(HAVE_COSHF)
@@ -184,7 +194,7 @@ changequote([,])dnl
       AC_DEFINE(HAVE_SINHL)
       ;;
     *)
-      os_include_dir="config/os/newlib"
+      os_include_dir="os/newlib"
       AC_DEFINE(HAVE_HYPOT)
       ;;
   esac
@@ -290,6 +300,7 @@ changequote([,])dnl
     AC_DEFINE(HAVE_TANL)
     AC_DEFINE(HAVE_TANHL)
   fi
+
 else
 
   # We are being configured natively. We can do more elaborate tests
@@ -327,15 +338,17 @@ fi
 GLIBCPP_ENABLE_SYMVERS([yes])
 
 # Propagate the target-specific source directories through the build chain.
-OS_INC_SRCDIR=$os_include_dir/bits
-ATOMICITY_INC_SRCDIR=$ATOMICITYH/bits
-CPU_LIMITS_INC_SRCDIR=$CPULIMITSH/bits
+# (Nothing currently uses cpu_include_dir directly; only ATOMICITYH and
+# CPULIMITSH [might] use it, and they only get used here.)
+OS_INC_SRCDIR=config/${os_include_dir}/bits
+ATOMICITY_INC_SRCDIR=config/${ATOMICITYH}/bits
+CPU_LIMITS_INC_SRCDIR=config/${CPULIMITSH}/bits
 AC_SUBST(OS_INC_SRCDIR)
 AC_SUBST(ATOMICITY_INC_SRCDIR)
 AC_SUBST(CPU_LIMITS_INC_SRCDIR)
 
 # Set up cross-compile flags
-AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)
+AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)  dnl Unused so far.
 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
  
 AC_CACHE_SAVE
Index: configure.target
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/configure.target,v
retrieving revision 1.41
diff -u -3 -p -r1.41 configure.target
--- configure.target	11 Jun 2002 17:54:25 -0000	1.41
+++ configure.target	15 Jun 2002 10:13:41 -0000
@@ -1,121 +1,181 @@
 # configure.target
-
+#
 # This shell script handles all target based configuration for libstdc++.
 # It sets various shell variables based on the the target and the
-# configuration options.  You can modify this shell script without
-# needing to rerun autoconf.
-
-# This shell script should be invoked as
-#   . configure.target
-# If it encounters an error, it will exit with a message.
-
-# It uses the following shell variables:
-#   target                The configuration target
+# configuration options.  You can modify this shell script without needing
+# to rerun autoconf/aclocal/etc.  This file is "sourced" not executed.
+#
+# You should read docs/html/17_intro/porting.* to make sense of this file.
+#
+#
+# It uses the following shell variables as set by config.guess:
+#   target                The configuration target (full CPU-vendor-OS triplet)
 #   target_cpu            The configuration target CPU
 #   target_os             The configuration target OS
-
-# It possibly modifies the following shell variables:
-#   cpu_include_dir        CPU-specific include directory, relative to srcdir
-#   os_include_dir         OS-specific include directory, relative to srcdir
-
-
-# Set any CPU dependent compiler flags.
+#
+#
+# It sets the following shell variables:
+#
+#   cpu_include_dir        CPU-specific directory, defaults to cpu/generic
+#                              if cpu/target_cpu doesn't exist.  This is
+#                              used to set the next two:
+#   ATOMICITYH             location of bits/atomicity.h,
+#                              defaults to cpu_include_dir
+#   CPULIMITSH             location of bits/cpu_limits.h,
+#                              defaults to cpu_include_dir
+#
+#   os_include_dir         OS-specific directory, defaults to os/generic.
+#
+#
+# It possibly modifies the following variables:
+#
+#   OPT_LDFLAGS            extra flags to pass when linking the library, of
+#                              the form '-Wl,blah'
+#                              (defaults to empty in acinclude.m4)
+#
+#
+# If the defaults will not work for your platform, you need only change the
+# variables that won't work, i.e., you do not need to explicitly set a
+# working variable to its default.  Most targets only need to change the two
+# *_include_dir variables.
+
+
+# Try to guess a default cpu_include_dir based on the name of the CPU.  We
+# cannot do this for os_include_dir; there are too many portable operating
+# systems out there.  :-)
+if test -d ${glibcpp_srcdir}/config/cpu/${target_cpu}; then
+    cpu_include_dir="cpu/${target_cpu}"
+else
+    cpu_include_dir="cpu/generic"
+fi
+
+
+# Here we override defaults and catch more general cases due to naming
+# conventions (e.g., chip_name* to catch all variants).  Also set any
+# CPU-dependent compiler flags.
 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
 case "${target_cpu}" in
   alpha*)
-    cpu_include_dir="config/cpu/alpha"
+    cpu_include_dir="cpu/alpha"
     ;;
   arm*)
-    cpu_include_dir="config/cpu/arm"
-    ;;
-  cris)
-    cpu_include_dir="config/cpu/cris"
-    ;;
-  ia64)
-    cpu_include_dir="config/cpu/ia64"
-    ;;
-  i386)
-    cpu_include_dir="config/cpu/i386"
+    cpu_include_dir="cpu/arm"
     ;;
   i486 | i586 | i686 | i786)
-    cpu_include_dir="config/cpu/i486"
+    cpu_include_dir="cpu/i486"
+    CPULIMITSH="cpu/i386"
     ;;
   m68k | m680[246]0)
-    cpu_include_dir="config/cpu/m68k"
+    cpu_include_dir="cpu/m68k"
+    ;;
+  mmix)
+    ATOMICITYH="cpu/generic"
     ;;
   powerpc | rs6000)
-    cpu_include_dir="config/cpu/powerpc"
+    cpu_include_dir="cpu/powerpc"
     ;;
   s390 | s390x)
-    cpu_include_dir="config/cpu/s390"
+    cpu_include_dir="cpu/s390"
     ;;
   sparc64 | ultrasparc)
-    cpu_include_dir="config/cpu/sparc/sparc64"
+    cpu_include_dir="cpu/sparc/sparc64"
     ;;
   sparc*)
-    cpu_include_dir="config/cpu/sparc/sparc32"
+    cpu_include_dir="cpu/sparc/sparc32"
     ;;
   x86_64*)
-    cpu_include_dir="config/cpu/x86-64"
-    ;;
-  *)
-    cpu_include_dir="config/cpu/generic"
+    cpu_include_dir="cpu/x86-64"
     ;;
 esac
 
 
-# Set any OS dependent compiler flags.
+# Now look for the two files usually tied to a CPU model, and make default
+# choices for those if they haven't been explicitly set already.
+_cpu_incdir_fullpath=${glibcpp_srcdir}/config/${cpu_include_dir}
+if test x${ATOMICITYH+set} != xset; then
+  if test -f ${_cpu_incdir_fullpath}/bits/atomicity.h; then
+    ATOMICITYH=$cpu_include_dir
+  else
+    ATOMICITYH="cpu/generic"
+  fi
+fi
+if test x${CPULIMITSH+set} != xset; then
+  if test -f ${_cpu_incdir_fullpath}/bits/cpu_limits.h; then
+    CPULIMITSH=$cpu_include_dir
+  else
+    CPULIMITSH="cpu/generic"
+  fi
+fi
+unset _cpu_incdir_fullpath
+
+
+# Set the os_include_dir.  If atomic ops and/or numeric limits are OS-specific
+# rather than CPU-specifc, set those here too.  Also set any OS-dependent
+# compiler flags.
 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
 case "${target_os}" in
   aix4.[3456789]* | aix[56789]*)
-    os_include_dir="config/os/aix"
+    # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
+    # os/aix/bits/atomicity.h works on earlier versions of AIX 4.*, so we
+    # explicitly duplicate the directory for 4.[<3].
+    os_include_dir="os/aix"
+    ATOMICITYH="os/aix"
     OPT_LDFLAGS="-Wl,-G"
     ;;
+  aix4.*)
+    ATOMICITYH="os/aix"
+    ;;
+  aix*)
+    ATOMICITYH="cpu/generic"
+    ;;
   bsd* | freebsd* )
-    os_include_dir="config/os/bsd/freebsd"
+    os_include_dir="os/bsd/freebsd"
     ;;
   cygwin*)
-    os_include_dir="config/os/newlib"
+    os_include_dir="os/newlib"
+    ;;
+  *djgpp*)      # leading * picks up "msdosdjgpp"
+    os_include_dir="os/djgpp"
     ;;
-  *djgpp*)
-    os_include_dir="config/os/djgpp"
+  gnu* | linux*)
+    os_include_dir="os/gnu-linux"
     ;;
-  linux* | gnu*)
-    os_include_dir="config/os/gnu-linux"
+  hpux*)
+    os_include_dir="os/hpux"
+    CPULIMITSH="os/hpux"
     ;;
   irix[1-6] | irix[1-5].* | irix6.[0-4])
-   # This is known to work on at least IRIX 5.2 and 6.3.
-   os_include_dir="config/os/irix/irix5.2"
-   ;;
+    # This is known to work on at least IRIX 5.2 and 6.3.
+    os_include_dir="os/irix/irix5.2"
+    ATOMICITYH=$os_include_dir
+    ;;
   irix6.5)
-    os_include_dir="config/os/irix/irix6.5"
+    os_include_dir="os/irix/irix6.5"
+    ATOMICITYH=$os_include_dir
     ;;
   mingw32*)
-    os_include_dir="config/os/mingw32"
+    os_include_dir="os/mingw32"
     ;;
   netbsd*)
-    os_include_dir="config/os/bsd/netbsd"
+    os_include_dir="os/bsd/netbsd"
     ;;
   solaris2.5*)
-    os_include_dir="config/os/solaris/solaris2.5"
+    os_include_dir="os/solaris/solaris2.5"
     ;;
   solaris2.6*)
-    os_include_dir="config/os/solaris/solaris2.6"
+    os_include_dir="os/solaris/solaris2.6"
     ;;
-  solaris2.7* | solaris2.8*)
-    os_include_dir="config/os/solaris/solaris2.7"
-    ;;
-  hpux*)
-    os_include_dir="config/os/hpux"
+  solaris2.[78]*)
+    os_include_dir="os/solaris/solaris2.7"
     ;;
   windiss*)
-    os_include_dir="config/os/windiss"
+    os_include_dir="os/windiss"
     ;;
   qnx6.[12]*)
-    os_include_dir="config/os/qnx/qnx6.1"
+    os_include_dir="os/qnx/qnx6.1"
     ;;
   *)
-    os_include_dir="config/os/generic"
+    os_include_dir="os/generic"
     ;;
 esac
 
@@ -123,62 +183,8 @@ esac
 # Set any flags dependent on the full target triplet.
 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
 case "${target}" in
-   *-*-aix[456789]*)
-     # We set os_include_dir to config/os/aix only on AIX 4.3 and
-     # newer, but config/os/aix/bits/atomicity.h works on earlier
-     # versions of AIX 4.*, so we explicitly duplicate the directory
-     # here, because os_include_dir.
-     ATOMICITYH=config/os/aix
-     ;;
-   *-*-aix*)
-     ATOMICITYH=config/cpu/generic
-     ;;
-   *-*-irix*)
-     ATOMICITYH=$os_include_dir
-     ;;
-   *)
-     ATOMICITYH=$cpu_include_dir
-     ;;
+  alpha*-*-*osf5*)
+    CPULIMITSH="os/osf/osf5.0"
+    ;;
 esac
 
-# Set CPULIMITSH to the directory where the configuration-dependent
-# cpu_limits.h can be found.
-# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
-case "${target}" in
-   *-*-hpux*)
-     CPULIMITSH=config/os/hpux
-     ;;
-   alpha*-*-*osf5*)
-     CPULIMITSH=config/os/osf/osf5.0
-     ;;
-   alpha*-*-*)
-     CPULIMITSH=config/cpu/alpha
-     ;;
-   cris-*-*)
-     CPULIMITSH=config/cpu/cris
-     ;;
-   ia64-*-*)
-     CPULIMITSH=config/cpu/ia64
-     ;;
-   i?86-*-*)
-     CPULIMITSH=config/cpu/i386
-     ;;
-   m68k-*-* | m680[246]0-*-*)
-     CPULIMITSH=config/cpu/m68k
-     ;;
-   mmix-*-*)
-     CPULIMITSH=config/cpu/mmix
-     ;;
-   powerpc-*-*)
-     CPULIMITSH=config/cpu/powerpc
-     ;;
-   s390-*-* | s390x-*-*)
-     CPULIMITSH=config/cpu/s390
-     ;;
-   x86_64-*-*)
-     CPULIMITSH=config/cpu/x86-64
-     ;;
-   *)
-     CPULIMITSH=config/cpu/generic
-     ;;
-esac
Index: docs/html/17_intro/porting.texi
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/docs/html/17_intro/porting.texi,v
retrieving revision 1.4
diff -u -3 -p -r1.4 porting.texi
--- docs/html/17_intro/porting.texi	22 Apr 2002 22:46:34 -0000	1.4
+++ docs/html/17_intro/porting.texi	15 Jun 2002 10:13:41 -0000
@@ -12,7 +12,7 @@
 This file explains how to port libstdc++-v3 (the GNU C++ library) to 
 a new target.
 
-Copyright (c) 2000, 2001 Free Software Foundation, Inc.
+Copyright (c) 2000, 2001, 2002 Free Software Foundation, Inc.
 @end ifinfo
 
 @c ---------------------------------------------------------------------
@@ -24,7 +24,7 @@ Copyright (c) 2000, 2001 Free Software F
 @author Mark Mitchell
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 2000, 2001 Free Software Foundation, Inc.
+Copyright @copyright{} 2000, 2001, 2002 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1 or
@@ -57,7 +57,9 @@ a new target.
 
 In order to make the GNU C++ library (libstdc++-v3) work with a new
 target, you must edit some configuration files and provide some new
-header files.  
+header files.  Unless this is done, libstdc++-v3 will use generic
+settings which may not be correct for your target; even if they are
+correct, they will likely be inefficient.
 
 Before you get started, make sure that you have a working C library on
 your target.  The C library need not precisely comply with any
@@ -72,6 +74,7 @@ Here are the primary steps required to p
 
 @menu
 * Operating system::    Configuring for your operating system.
+* CPU::                 Configuring for your processor chip.
 * Character types::     Implementing character classification.
 * Thread safety::       Implementing atomic operations.
 * Numeric limits::	Implementing numeric limits.
@@ -86,7 +89,7 @@ Here are the primary steps required to p
 @node Operating system
 @chapter Operating system
 
-If you are porting to a new operating-system (as opposed to a new chip
+If you are porting to a new operating system (as opposed to a new chip
 using an existing operating system), you will need to create a new
 directory in the @file{config/os} hierarchy.  For example, the IRIX
 configuration files are all in @file{config/os/irix}.  There is no set
@@ -162,6 +165,36 @@ We recommend copying an existing @file{b
 starting point.
 
 @c ---------------------------------------------------------------------
+@c CPU
+@c ---------------------------------------------------------------------
+
+@node CPU
+@chapter CPU
+
+If you are porting to a new chip (as opposed to a new operating system
+running on an existing chip), you will need to create a new directory in the
+@file{config/cpu} hierarchy.  Much like the @ref{Operating system} setup,
+there are no strict rules on how to organize the CPU configuration
+directory, but careful naming choices will allow the configury to find your
+setup files without explicit help.
+
+We recommend that for a target triplet @code{<CPU>-<vendor>-<OS>}, you
+name your configuration directory @file{config/cpu/<CPU>}.  If you do this,
+the configury will find the directory itself.  Otherwise you will need to
+edit the @file{configure.target} file and, in the switch statement that sets
+@code{cpu_include_dir}, add a pattern to handle your chip.
+
+Note that some chip families share a single configuration directory, for
+example, @code{alpha}, @code{alphaev5}, and @code{alphaev6} all use the
+@file{config/cpu/alpha} directory, and there is an entry in the
+@file{configure.target} switch statement to handle this.
+
+The @code{cpu_include_dir} sets default locations for the files controlling
+@ref{Thread safety} and @ref{Numeric limits}, if the defaults are not
+appropriate for your chip.
+
+
+@c ---------------------------------------------------------------------
 @c Character types
 @c ---------------------------------------------------------------------
 
@@ -383,14 +416,26 @@ If you want to provide custom, safe, ver
 are two distinct approaches.  One is to provide a version for your CPU,
 using assembly language constructs.  The other is to use the
 thread-safety primitives in your operating system.  In either case, you
-make a file called @file{bits/atomicity.h}.  
+make a file called @file{bits/atomicity.h}, and the variable
+@code{ATOMICITYH} must point to this file.
 
 If you are using the assembly-language approach, put this code in
 @file{config/cpu/<chip>/bits/atomicity.h}, where chip is the name of
-your processor.  In that case, edit the switch statement in
-@file{configure.target} to set the @code{cpu_include_dir}.  In either
-case, set the switch statement that sets @code{ATOMICITYH} to be the
-directory containing @file{bits/atomicity.h}.
+your processor (@pxref{CPU}).  No additional changes are necessary to
+locate the file in this case; @code{ATOMICITYH} will be set by default.
+
+If you are using the operating system thread-safety primitives approach,
+you can also put this code in the same CPU directory, in which case no more
+work is needed to locate the file.  For examples of this approach,
+see the @file{atomicity.h} file for IRIX or IA64.
+
+Alternatively, if the primitives are more closely related to the OS
+than they are to the CPU, you can put the @file{atomicity.h} file in
+the @ref{Operating system} directory instead.  In this case, you must
+edit @file{configure.target}, and in the switch statement that handles
+operating systems, override the @code{ATOMICITYH} variable to point to
+the appropriate @code{os_include_dir}.  For examples of this approach,
+see the @file{atomicity.h} file for AIX.
 
 With those bits out of the way, you have to actually write
 @file{bits/atomicity.h} itself.  This file should be wrapped in an
@@ -444,16 +489,12 @@ easiest just to indicate how many bits a
 types and let the library do the rest.  For information about the
 macros to define, see the top of @file{include/bits/std_limits.h}.
 
-If you need to define any macros, you can do so in
-@file{os_defines.h}.  However, if all operating systems for your CPU
-are likely to use the same values, you can provide a CPU-specific file
-instead so that you do not have to provide the same definitions for
-each operating system.  To take that approach, create a new file
-called @file{limits.h} in your CPU configuration directory (e.g.,
-@file{config/cpu/i386/bits}) and then modify @file{configure.target}
-so that @code{LIMITSH} is set to the CPU directory (e.g.,
-@file{config/cpu/i386}).  Note that @code{LIMITSH} should not include
-the @samp{bits} part of the directory name.
+If you need to define any macros, you can do so in @file{os_defines.h}.
+However, if all operating systems for your CPU are likely to use the
+same values, you can provide a CPU-specific file instead so that you
+do not have to provide the same definitions for each operating system.
+To take that approach, create a new file called @file{cpu_limits.h} in
+your CPU configuration directory (@pxref{CPU}).
 
 @c ---------------------------------------------------------------------
 @c Libtool
@@ -479,10 +520,10 @@ run as the library is loaded.  Often, th
 object files when the C++ library is built as a shared library, or
 taking other system-specific actions.
 
-The libstdc++-v3 library is linked with the C version of libtool, even though it
-is a C++ library.  Therefore, the C version of libtool needs to ensure
-that the run-time library initializers are run.  The usual way to do
-this is to build the library using @code{gcc -shared}.
+The libstdc++-v3 library is linked with the C version of libtool, even
+though it is a C++ library.  Therefore, the C version of libtool needs to
+ensure that the run-time library initializers are run.  The usual way to
+do this is to build the library using @code{gcc -shared}.
 
 If you need to change how the library is linked, look at
 @file{ltcf-c.sh} in the top-level directory.  Find the switch statement
Index: testsuite/Makefile.am
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/testsuite/Makefile.am,v
retrieving revision 1.6
diff -u -3 -p -r1.6 Makefile.am
--- testsuite/Makefile.am	6 Jun 2002 07:32:57 -0000	1.6
+++ testsuite/Makefile.am	15 Jun 2002 10:13:41 -0000
@@ -33,6 +33,7 @@ RUNTEST = `if [ -f @glibcpp_srcdir@/../d
 	       echo @glibcpp_srcdir@/../dejagnu/runtest ; \
 	    else echo runtest; fi`
 
+AM_RUNTESTFLAGS =
 RUNTESTFLAGS =
 
 CXX = @glibcpp_CXX@ @GLIBCPP_INCLUDES@


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]