configure.host: Delete file.

2002-06-18  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.

From-SVN: r54757
This commit is contained in:
Phil Edwards 2002-06-18 19:07:12 +00:00
parent e3ba8d11f8
commit 2c839a4e1f
11 changed files with 1372 additions and 1286 deletions

View File

@ -1,3 +1,21 @@
2002-06-18 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.
2002-06-16 Phil Edwards <pme@gcc.gnu.org>
* docs/doxygen/TODO: Update.

View File

@ -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.

View File

@ -1,6 +1,6 @@
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@ -15,7 +15,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
@ -46,6 +47,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
@ -63,7 +66,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
@ -193,14 +197,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
@ -2139,12 +2141,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.
@ -2198,30 +2202,12 @@ AC_MSG_RESULT($enable_symvers)
])
#serial 1
# This test replaces the one in autoconf.
# Currently this macro should have the same name as the autoconf macro
# because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
undefine([AC_ISC_POSIX])
AC_DEFUN([AC_ISC_POSIX],
[
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
]
)
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN([AM_MAINTAINER_MODE],
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
@ -2238,7 +2224,7 @@ AC_DEFUN([AM_MAINTAINER_MODE],
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
@ -2258,7 +2244,7 @@ fi])
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN([AM_INIT_AUTOMAKE],
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
@ -2286,7 +2272,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])])
# Check to make sure that the build environment is sane.
#
AC_DEFUN([AM_SANITY_CHECK],
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
@ -2327,7 +2313,7 @@ AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN([AM_MISSING_PROG],
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
@ -2343,7 +2329,7 @@ AC_SUBST($1)])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN([AM_CONFIG_HEADER],
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.

1899
libstdc++-v3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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"$build" != x"$host"; then
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"$build" != x"$host"; then
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"$build" != x"$host"; then
*-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"$build" != x"$host"; then
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

View File

@ -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
#
#
# 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.
# Set any CPU dependent compiler flags.
# 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*)
os_include_dir="config/os/djgpp"
*djgpp*) # leading * picks up "msdosdjgpp"
os_include_dir="os/djgpp"
;;
linux* | gnu*)
os_include_dir="config/os/gnu-linux"
;;
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"
;;
irix6.5)
os_include_dir="config/os/irix/irix6.5"
;;
mingw32*)
os_include_dir="config/os/mingw32"
;;
netbsd*)
os_include_dir="config/os/bsd/netbsd"
;;
solaris2.5*)
os_include_dir="config/os/solaris/solaris2.5"
;;
solaris2.6*)
os_include_dir="config/os/solaris/solaris2.6"
;;
solaris2.7* | solaris2.8*)
os_include_dir="config/os/solaris/solaris2.7"
gnu* | linux*)
os_include_dir="os/gnu-linux"
;;
hpux*)
os_include_dir="config/os/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="os/irix/irix5.2"
ATOMICITYH=$os_include_dir
;;
irix6.5)
os_include_dir="os/irix/irix6.5"
ATOMICITYH=$os_include_dir
;;
mingw32*)
os_include_dir="os/mingw32"
;;
netbsd*)
os_include_dir="os/bsd/netbsd"
;;
solaris2.5*)
os_include_dir="os/solaris/solaris2.5"
;;
solaris2.6*)
os_include_dir="os/solaris/solaris2.6"
;;
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

View File

@ -1,25 +1,29 @@
<html lang="en"><head>
<html lang="en">
<head>
<title>Porting libstdc++-v3</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name=description content="Porting libstdc++-v3">
<meta name=generator content="makeinfo 4.0">
<meta name=generator content="makeinfo 4.1">
<link href="http://texinfo.org/" rel=generator-home>
</head><body>
</head>
<body>
<h1>Porting libstdc++-v3</h1>
<p><hr>
Node:<a name="Top">Top</a>,
Next:<a rel=next href="#Operating%20system">Operating system</a>,
Up:<a rel=up href="#(dir)">(dir)</a>
Up:<a rel=up href="#dir">(dir)</a>
<br>
<h1>Porting libstdc++-v3</h1>
<h2>Porting libstdc++-v3</h2>
<p>This document explains how to port libstdc++-v3 (the GNU C++ library) to
a new target.
<p>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.
<p>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
@ -34,6 +38,7 @@ library, but you should at least try some minimal test cases.
<ul>
<li><a href="#Operating%20system">Operating system</a>: Configuring for your operating system.
<li><a href="#CPU">CPU</a>: Configuring for your processor chip.
<li><a href="#Character%20types">Character types</a>: Implementing character classification.
<li><a href="#Thread%20safety">Thread safety</a>: Implementing atomic operations.
<li><a href="#Numeric%20limits">Numeric limits</a>: Implementing numeric limits.
@ -43,14 +48,14 @@ library, but you should at least try some minimal test cases.
<p><hr>
Node:<a name="Operating%20system">Operating system</a>,
Next:<a rel=next href="#Character%20types">Character types</a>,
Next:<a rel=next href="#CPU">CPU</a>,
Previous:<a rel=previous href="#Top">Top</a>,
Up:<a rel=up href="#Top">Top</a>
<br>
<h1>Operating system</h1>
<h2>Operating system</h2>
<p>If you are porting to a new operating-system (as opposed to a new chip
<p>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 <code>config/os</code> hierarchy. For example, the IRIX
configuration files are all in <code>config/os/irix</code>. There is no set
@ -77,7 +82,7 @@ This file should provide macro definitions for <code>__off_t</code>,
<code>__off64_t</code>, and <code>__ssize_t</code>. Typically, this just looks
like:
<pre>#define __off_t off_t
<br><pre>#define __off_t off_t
#define __off64_t off64_t
#define __ssize_t ssize_t
</pre>
@ -113,7 +118,7 @@ invalidates the assumption that some ports don't use thunks).
<p>Finally, you should bracket the entire file in an include-guard, like
this:
<pre>#ifndef _GLIBCPP_OS_DEFINES
<br><pre>#ifndef _GLIBCPP_OS_DEFINES
#define _GLIBCPP_OS_DEFINES
...
#endif
@ -123,13 +128,44 @@ this:
starting point.
<p><hr>
Node:<a name="Character%20types">Character types</a>,
Next:<a rel=next href="#Thread%20safety">Thread safety</a>,
Node:<a name="CPU">CPU</a>,
Next:<a rel=next href="#Character%20types">Character types</a>,
Previous:<a rel=previous href="#Operating%20system">Operating system</a>,
Up:<a rel=up href="#Top">Top</a>
<br>
<h1>Character types</h1>
<h2>CPU</h2>
<p>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
<code>config/cpu</code> hierarchy. Much like the <a href="#Operating%20system">Operating system</a> 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.
<p>We recommend that for a target triplet <code>&lt;CPU&gt;-&lt;vendor&gt;-&lt;OS&gt;</code>, you
name your configuration directory <code>config/cpu/&lt;CPU&gt;</code>. If you do this,
the configury will find the directory itself. Otherwise you will need to
edit the <code>configure.target</code> file and, in the switch statement that sets
<code>cpu_include_dir</code>, add a pattern to handle your chip.
<p>Note that some chip families share a single configuration directory, for
example, <code>alpha</code>, <code>alphaev5</code>, and <code>alphaev6</code> all use the
<code>config/cpu/alpha</code> directory, and there is an entry in the
<code>configure.target</code> switch statement to handle this.
<p>The <code>cpu_include_dir</code> sets default locations for the files controlling
<a href="#Thread%20safety">Thread safety</a> and <a href="#Numeric%20limits">Numeric limits</a>, if the defaults are not
appropriate for your chip.
<p><hr>
Node:<a name="Character%20types">Character types</a>,
Next:<a rel=next href="#Thread%20safety">Thread safety</a>,
Previous:<a rel=previous href="#CPU">CPU</a>,
Up:<a rel=up href="#Top">Top</a>
<br>
<h2>Character types</h2>
<p>The library requires that you provide three header files to implement
character classification, analogous to that provided by the C libraries
@ -153,7 +189,7 @@ It should contain a single <code>struct</code> definition called
declarations, and one enumeration declaration, like this example, taken
from the IRIX configuration:
<pre>struct ctype_base
<br><pre>struct ctype_base
{
typedef unsigned int mask;
typedef int* __to_type;
@ -195,7 +231,7 @@ that will be included in <code>include/bits/locale_facets.h</code>. The first
function that must be written is the <code>ctype&lt;char&gt;::ctype</code>
constructor. Here is the IRIX example:
<pre>ctype&lt;char&gt;::ctype(const mask* __table = 0, bool __del = false,
<br><pre>ctype&lt;char&gt;::ctype(const mask* __table = 0, bool __del = false,
size_t __refs = 0)
: _Ctype_nois&lt;char&gt;(__refs), _M_del(__table != 0 &amp;&amp; __del),
_M_toupper(NULL),
@ -219,7 +255,7 @@ vice versa, you should initialize <code>_M_toupper</code> and
<p>Now, you have to write two functions to convert from upper-case to
lower-case, and vice versa. Here are the IRIX versions:
<pre>char
<br><pre>char
ctype&lt;char&gt;::do_toupper(char __c) const
{ return _toupper(__c); }
@ -237,7 +273,7 @@ of characters. The versions provided here will always work - but you
could use specialized routines for greater performance if you have
machinery to do that on your system:
<pre>const char*
<br><pre>const char*
ctype&lt;char&gt;::do_toupper(char* __low, const char* __high) const
{
while (__low &lt; __high)
@ -270,7 +306,7 @@ properties; they are analogous to the functions like <code>isalpha</code> and
<p>The first function is implemented like this on IRIX:
<pre>bool
<br><pre>bool
ctype&lt;char&gt;::
is(mask __m, char __c) const throw()
{ return (_M_table)[(unsigned char)(__c)] &amp; __m; }
@ -282,7 +318,7 @@ implementation here should work on all systems.
<p>The next function is:
<pre>const char*
<br><pre>const char*
ctype&lt;char&gt;::
is(const char* __low, const char* __high, mask* __vec) const throw()
{
@ -298,7 +334,7 @@ from <code>__low</code> up until <code>__high</code> into the vector given by
<p>The last two functions again are entirely generic:
<pre>const char*
<br><pre>const char*
ctype&lt;char&gt;::
scan_is(mask __m, const char* __low, const char* __high) const throw()
{
@ -324,7 +360,7 @@ Previous:<a rel=previous href="#Character%20types">Character types</a>,
Up:<a rel=up href="#Top">Top</a>
<br>
<h1>Thread safety</h1>
<h2>Thread safety</h2>
<p>The C++ library string functionality requires a couple of atomic
operations to provide thread-safety. If you don't take any special
@ -336,14 +372,26 @@ multi-threaded.
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 <code>bits/atomicity.h</code>.
make a file called <code>bits/atomicity.h</code>, and the variable
<code>ATOMICITYH</code> must point to this file.
<p>If you are using the assembly-language approach, put this code in
<code>config/cpu/&lt;chip&gt;/bits/atomicity.h</code>, where chip is the name of
your processor. In that case, edit the switch statement in
<code>configure.target</code> to set the <code>cpu_include_dir</code>. In either
case, set the switch statement that sets <code>ATOMICITYH</code> to be the
directory containing <code>bits/atomicity.h</code>.
your processor (see <a href="#CPU">CPU</a>). No additional changes are necessary to
locate the file in this case; <code>ATOMICITYH</code> will be set by default.
<p>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 <code>atomicity.h</code> file for IRIX or IA64.
<p>Alternatively, if the primitives are more closely related to the OS
than they are to the CPU, you can put the <code>atomicity.h</code> file in
the <a href="#Operating%20system">Operating system</a> directory instead. In this case, you must
edit <code>configure.target</code>, and in the switch statement that handles
operating systems, override the <code>ATOMICITYH</code> variable to point to
the appropriate <code>os_include_dir</code>. For examples of this approach,
see the <code>atomicity.h</code> file for AIX.
<p>With those bits out of the way, you have to actually write
<code>bits/atomicity.h</code> itself. This file should be wrapped in an
@ -352,7 +400,7 @@ type, and two functions.
<p>The type is <code>_Atomic_word</code>. Here is the version used on IRIX:
<pre>typedef long _Atomic_word;
<br><pre>typedef long _Atomic_word;
</pre>
<p>This type must be a signed integral type supporting atomic operations.
@ -363,7 +411,7 @@ primitives.
<p>Then, you must provide two functions. The bodies of these functions
must be equivalent to those provided here, but using atomic operations:
<pre>static inline _Atomic_word
<br><pre>static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (_Atomic_word* __mem, int __val)
{
@ -387,7 +435,7 @@ Previous:<a rel=previous href="#Thread%20safety">Thread safety</a>,
Up:<a rel=up href="#Top">Top</a>
<br>
<h1>Numeric limits</h1>
<h2>Numeric limits</h2>
<p>The C++ library requires information about the fundamental data types,
such as the minimum and maximum representable values of each type.
@ -396,16 +444,12 @@ easiest just to indicate how many bits are used in each of the data
types and let the library do the rest. For information about the
macros to define, see the top of <code>include/bits/std_limits.h</code>.
<p>If you need to define any macros, you can do so in
<code>os_defines.h</code>. 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 <code>limits.h</code> in your CPU configuration directory (e.g.,
<code>config/cpu/i386/bits</code>) and then modify <code>configure.target</code>
so that <code>LIMITSH</code> is set to the CPU directory (e.g.,
<code>config/cpu/i386</code>). Note that <code>LIMITSH</code> should not include
the <code>bits</code> part of the directory name.
<p>If you need to define any macros, you can do so in <code>os_defines.h</code>.
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 <code>cpu_limits.h</code> in
your CPU configuration directory (see <a href="#CPU">CPU</a>).
<p><hr>
Node:<a name="Libtool">Libtool</a>,
@ -414,7 +458,7 @@ Previous:<a rel=previous href="#Numeric%20limits">Numeric limits</a>,
Up:<a rel=up href="#Top">Top</a>
<br>
<h1>Libtool</h1>
<h2>Libtool</h2>
<p>The C++ library is compiled, archived and linked with libtool.
Explaining the full workings of libtool is beyond the scope of this
@ -433,10 +477,10 @@ run as the library is loaded. Often, that requires linking in special
object files when the C++ library is built as a shared library, or
taking other system-specific actions.
<p>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</code>.
<p>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</code>.
<p>If you need to change how the library is linked, look at
<code>ltcf-c.sh</code> in the top-level directory. Find the switch statement
@ -449,11 +493,10 @@ Previous:<a rel=previous href="#Libtool">Libtool</a>,
Up:<a rel=up href="#Top">Top</a>
<br>
<h1>GNU Free Documentation License</h1>
<h2>GNU Free Documentation License</h2>
<p align="center">Version 1.1, March 2000</p>
<pre>Copyright &copy; 2000 Free Software Foundation, Inc.
<div align="center">Version 1.1, March 2000</div>
<br><pre>Copyright &copy; 2000 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
@ -789,13 +832,13 @@ number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
</ol>
<h2>ADDENDUM: How to use this License for your documents</h2>
<h3>ADDENDUM: How to use this License for your documents</h3>
<p>To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
<pre> Copyright (C) <var>year</var> <var>your name</var>.
<br><pre> Copyright (C) <var>year</var> <var>your name</var>.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
@ -816,15 +859,24 @@ free software license, such as the GNU General Public License,
to permit their use in free software.
<h1>Table of Contents</h1>
<h2>Table of Contents</h2>
<ul>
<li><a href="#Top">Porting libstdc++-v3</a>
<li><a href="#Operating%20system">Operating system</a>
<li><a href="#Character%20types">Character types</a>
<li><a href="#Thread%20safety">Thread safety</a>
<li><a href="#Numeric%20limits">Numeric limits</a>
<li><a href="#Libtool">Libtool</a>
<li><a href="#GNU%20Free%20Documentation%20License">GNU Free Documentation License</a>
<li><a name="toc_Top"></a>
<a href="#Top">Porting libstdc++-v3</a>
<li><a name="toc_Operating%20system"></a>
<a href="#Operating%20system">Operating system</a>
<li><a name="toc_CPU"></a>
<a href="#CPU">CPU</a>
<li><a name="toc_Character%20types"></a>
<a href="#Character%20types">Character types</a>
<li><a name="toc_Thread%20safety"></a>
<a href="#Thread%20safety">Thread safety</a>
<li><a name="toc_Numeric%20limits"></a>
<a href="#Numeric%20limits">Numeric limits</a>
<li><a name="toc_Libtool"></a>
<a href="#Libtool">Libtool</a>
<li><a name="toc_GNU%20Free%20Documentation%20License"></a>
<a href="#GNU%20Free%20Documentation%20License">GNU Free Documentation License</a>
<ul>
<li><a href="#GNU%20Free%20Documentation%20License">ADDENDUM: How to use this License for your documents</a>
</ul>

View File

@ -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 Foundation, Inc.
@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 port the library:
@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 port the library:
@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
@ -161,6 +164,36 @@ this:
We recommend copying an existing @file{bits/os_defines.h} to use as a
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, versions of these functions, there
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 are used in each of the data
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, that requires linking in special
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

View File

@ -33,6 +33,7 @@ RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \
echo @glibcpp_srcdir@/../dejagnu/runtest ; \
else echo runtest; fi`
AM_RUNTESTFLAGS =
RUNTESTFLAGS =
CXX = @glibcpp_CXX@ @GLIBCPP_INCLUDES@

View File

@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -137,12 +137,17 @@ AUTOMAKE_OPTIONS = cygnus dejagnu
DEJATOOL = libstdc++-v3
EXPECT = `if [ -f @glibcpp_builddir@/../../expect/expect ] ; then echo @glibcpp_builddir@/../../expect/expect ; else echo expect ; fi`
EXPECT = `if [ -f @glibcpp_builddir@/../../expect/expect ] ; then \
echo @glibcpp_builddir@/../../expect/expect ; \
else echo expect ; fi`
RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then echo @glibcpp_srcdir@/../dejagnu/runtest ; else echo runtest; fi`
RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \
echo @glibcpp_srcdir@/../dejagnu/runtest ; \
else echo runtest; fi`
AM_RUNTESTFLAGS =
RUNTESTFLAGS =
CXX = @glibcpp_CXX@ @GLIBCPP_INCLUDES@
@ -174,7 +179,7 @@ DIST_COMMON = README Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
TAR = gtar
GZIP_ENV = --best
SOURCES = $(libv3test_a_SOURCES)
OBJECTS = $(libv3test_a_OBJECTS)