scripts/build/libc/uClibc.sh
author David Holsgrove <david.holsgrove@xilinx.com>
Thu Oct 11 14:39:44 2012 +1000 (2012-10-11)
changeset 3099 79169596cfc9
parent 2951 e9a326ae9369
child 3100 bd4af15b7c75
permissions -rw-r--r--
libc/uClibc: Add CUSTOM version and CUSTOM_LOCATION config options and GetCustom

CUSTOM_LOCATION config options only presented in menuconfig if component
CUSTOM version selected.

Signed-off-by: "David Holsgrove" <david.holsgrove@xilinx.com>
[yann.morin.1998@free.fr: fix indentation, don't patch custom dir location]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <712995e3e719fbbe24af.1349931201@localhost.localdomain>
PatchWork-Id: 190794
     1 # This file declares functions to install the uClibc C library
     2 # Copyright 2007 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 # This is a constant because it does not change very often.
     6 # We're in 2010, and are still using data from 7 years ago.
     7 uclibc_locales_version=030818
     8 uclibc_local_tarball="uClibc-locale-${uclibc_locales_version}"
     9 
    10 # Download uClibc
    11 do_libc_get() {
    12     libc_src="http://www.uclibc.org/downloads
    13               http://www.uclibc.org/downloads/snapshots
    14               http://www.uclibc.org/downloads/old-releases"
    15     # For uClibc, we have almost every thing: releases, and snapshots
    16     # for the last month or so. We'll have to deal with svn revisions
    17     # later...
    18     if [ "${CT_LIBC_UCLIBC_CUSTOM}" = "y" ]; then
    19         CT_GetCustom "uClibc" "${CT_LIBC_VERSION}" \
    20                      "${CT_LIBC_UCLIBC_CUSTOM_LOCATION}"
    21     else
    22         CT_GetFile "uClibc-${CT_LIBC_VERSION}" ${libc_src}
    23     fi
    24     # uClibc locales
    25     if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" ]; then
    26         CT_GetFile "${uclibc_local_tarball}" ${libc_src}
    27     fi
    28 
    29     return 0
    30 }
    31 
    32 # Extract uClibc
    33 do_libc_extract() {
    34     # If using custom directory location, nothing to do
    35     if [ "${CT_LIBC_UCLIBC_CUSTOM}" = "y" \
    36          -a -d "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}" ]; then
    37         return 0
    38     fi
    39     CT_Extract "uClibc-${CT_LIBC_VERSION}"
    40     # Don't patch snapshots
    41     if [    -z "${CT_LIBC_UCLIBC_V_snapshot}"      \
    42          -a -z "${CT_LIBC_UCLIBC_V_specific_date}" \
    43        ]; then
    44         CT_Patch "uClibc" "${CT_LIBC_VERSION}"
    45     fi
    46 
    47     # uClibc locales
    48     # Extracting pregen locales ourselves is kinda
    49     # broken, so just link it in place...
    50     if [    "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y"           \
    51          -a ! -f "${CT_SRC_DIR}/.${uclibc_local_tarball}.extracted" ]; then
    52         CT_Pushd "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}/extra/locale"
    53         CT_DoExecLog ALL ln -s "${CT_TARBALLS_DIR}/${uclibc_local_tarball}.tgz" .
    54         CT_Popd
    55         touch "${CT_SRC_DIR}/.${uclibc_local_tarball}.extracted"
    56     fi
    57 
    58     return 0
    59 }
    60 
    61 # Check that uClibc has been previously configured
    62 do_libc_check_config() {
    63     CT_DoStep INFO "Checking C library configuration"
    64 
    65     CT_TestOrAbort "You did not provide a uClibc config file!" -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" -a -f "${CT_LIBC_UCLIBC_CONFIG_FILE}"
    66 
    67     if grep -E '^KERNEL_SOURCE=' "${CT_LIBC_UCLIBC_CONFIG_FILE}" >/dev/null 2>&1; then
    68         CT_DoLog WARN "Your uClibc version refers to the kernel _sources_, which is bad."
    69         CT_DoLog WARN "I can't guarantee that our little hack will work. Please try to upgrade."
    70     fi
    71 
    72     CT_DoLog EXTRA "Munging uClibc configuration"
    73     mungeuClibcConfig "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_CONFIG_DIR}/uClibc.config"
    74 
    75     CT_EndStep
    76 }
    77 
    78 # Build and install headers and start files
    79 do_libc_start_files() {
    80     local install_rule
    81     local cross
    82 
    83     CT_DoStep INFO "Installing C library headers"
    84 
    85     # Simply copy files until uClibc has the ability to build out-of-tree
    86     CT_DoLog EXTRA "Copying sources to build dir"
    87     CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"   \
    88                             "${CT_BUILD_DIR}/build-libc-headers"
    89     cd "${CT_BUILD_DIR}/build-libc-headers"
    90 
    91     # Retrieve the config file
    92     CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
    93 
    94     # uClibc uses the CROSS environment variable as a prefix to the
    95     # compiler tools to use.  Setting it to the empty string forces
    96     # use of the native build host tools, which we need at this
    97     # stage, as we don't have target tools yet.
    98     # BUT! With NPTL, we need a cross-compiler (and we have it)
    99     if [ "${CT_THREADS}" = "nptl" ]; then
   100         cross="${CT_TARGET}-"
   101     fi
   102 
   103     # Force the date of the pregen locale data, as the
   104     # newer ones that are referenced are not available
   105     CT_DoLog EXTRA "Applying configuration"
   106     CT_DoYes "" |CT_DoExecLog ALL                                   \
   107                  make CROSS="${cross}"                              \
   108                  PREFIX="${CT_SYSROOT_DIR}/"                        \
   109                  LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
   110                  oldconfig
   111 
   112     CT_DoLog EXTRA "Building headers"
   113     CT_DoExecLog ALL                                        \
   114     make ${CT_LIBC_UCLIBC_VERBOSITY}                        \
   115          CROSS="${cross}"                                   \
   116          PREFIX="${CT_SYSROOT_DIR}/"                        \
   117          LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
   118          headers
   119 
   120     if [ "${CT_LIBC_UCLIBC_0_9_30_or_later}" = "y" ]; then
   121         install_rule=install_headers
   122     else
   123         install_rule=install_dev
   124     fi
   125 
   126     CT_DoLog EXTRA "Installing headers"
   127     CT_DoExecLog ALL                                        \
   128     make ${CT_LIBC_UCLIBC_VERBOSITY}                        \
   129          CROSS="${cross}"                                   \
   130          PREFIX="${CT_SYSROOT_DIR}/"                        \
   131          LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
   132          ${install_rule}
   133 
   134     if [ "${CT_THREADS}" = "nptl" ]; then
   135         CT_DoLog EXTRA "Building start files"
   136         CT_DoExecLog ALL                                        \
   137         make ${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}}           \
   138              CROSS="${cross}"                                   \
   139              PREFIX="${CT_SYSROOT_DIR}/"                        \
   140              STRIPTOOL=true                                     \
   141              ${CT_LIBC_UCLIBC_VERBOSITY}                        \
   142              LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
   143              lib/crt1.o lib/crti.o lib/crtn.o
   144 
   145         # From:  http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b
   146         # libm.so is needed for ppc, as libgcc is linked against libm.so
   147         # No problem to create it for other archs.
   148         CT_DoLog EXTRA "Building dummy shared libs"
   149         CT_DoExecLog ALL "${cross}gcc" -nostdlib        \
   150                                        -nostartfiles    \
   151                                        -shared          \
   152                                        -x c /dev/null   \
   153                                        -o libdummy.so
   154 
   155         CT_DoLog EXTRA "Installing start files"
   156         CT_DoExecLog ALL install -m 0644 lib/crt1.o lib/crti.o lib/crtn.o   \
   157                                          "${CT_SYSROOT_DIR}/usr/lib"
   158 
   159         CT_DoLog EXTRA "Installing dummy shared libs"
   160         CT_DoExecLog ALL install -m 0755 libdummy.so "${CT_SYSROOT_DIR}/usr/lib/libc.so"
   161         CT_DoExecLog ALL install -m 0755 libdummy.so "${CT_SYSROOT_DIR}/usr/lib/libm.so"
   162     fi # CT_THREADS == nptl
   163 
   164     CT_EndStep
   165 }
   166 
   167 # This function build and install the full uClibc
   168 do_libc() {
   169     CT_DoStep INFO "Installing C library"
   170 
   171     # Simply copy files until uClibc has the ability to build out-of-tree
   172     CT_DoLog EXTRA "Copying sources to build dir"
   173     CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"   \
   174                             "${CT_BUILD_DIR}/build-libc"
   175     cd "${CT_BUILD_DIR}/build-libc"
   176 
   177     # Retrieve the config file
   178     CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
   179 
   180     # uClibc uses the CROSS environment variable as a prefix to the compiler
   181     # tools to use.  The newly built tools should be in our path, so we need
   182     # only give the correct name for them.
   183     # Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
   184     # depending  on the configuration of the library. That is, they are tailored
   185     # to best fit the target. So it is useless and seems to be a bad thing to
   186     # use LIBC_EXTRA_CFLAGS here.
   187     CT_DoLog EXTRA "Applying configuration"
   188     CT_DoYes "" |CT_DoExecLog CFG                                   \
   189                  make CROSS=${CT_TARGET}-                           \
   190                  PREFIX="${CT_SYSROOT_DIR}/"                        \
   191                  LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
   192                  oldconfig
   193 
   194     # We do _not_ want to strip anything for now, in case we specifically
   195     # asked for a debug toolchain, thus the STRIPTOOL= assignment
   196     # /Old/ versions can not build in //
   197     CT_DoLog EXTRA "Building C library"
   198     CT_DoExecLog ALL                                        \
   199     make -j1                                                \
   200          CROSS=${CT_TARGET}-                                \
   201          PREFIX="${CT_SYSROOT_DIR}/"                        \
   202          STRIPTOOL=true                                     \
   203          ${CT_LIBC_UCLIBC_VERBOSITY}                        \
   204          LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
   205          pregen
   206     CT_DoExecLog ALL                                        \
   207     make ${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}}           \
   208          CROSS=${CT_TARGET}-                                \
   209          PREFIX="${CT_SYSROOT_DIR}/"                        \
   210          STRIPTOOL=true                                     \
   211          ${CT_LIBC_UCLIBC_VERBOSITY}                        \
   212          LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
   213          all
   214 
   215     # YEM-FIXME:
   216     # - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and
   217     #   such files, except the headers as they already are installed
   218     # - "make install_dev" installs the headers, the crti.o... and the
   219     #   static libs, but not the dynamic libs
   220     # - "make install_runtime" installs the dynamic libs only
   221     # - "make install" calls install_runtime and install_dev
   222     # - so we're left with re-installing the headers... Sigh...
   223     #
   224     # We do _not_ want to strip anything for now, in case we specifically
   225     # asked for a debug toolchain, hence the STRIPTOOL= assignment
   226     #
   227     # Note: JOBSFLAGS is not usefull for installation.
   228     #
   229     CT_DoLog EXTRA "Installing C library"
   230     CT_DoExecLog ALL                                        \
   231     make CROSS=${CT_TARGET}-                                \
   232          PREFIX="${CT_SYSROOT_DIR}/"                        \
   233          STRIPTOOL=true                                     \
   234          ${CT_LIBC_UCLIBC_VERBOSITY}                        \
   235          LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
   236          install
   237 
   238     CT_EndStep
   239 }
   240 
   241 # This function is used to install those components needing the final C compiler
   242 do_libc_finish() {
   243     :
   244 }
   245 
   246 # Initialises the .config file to sensible values
   247 # $1: original file
   248 # $2: munged file
   249 mungeuClibcConfig() {
   250     src_config_file="$1"
   251     dst_config_file="$2"
   252     munge_file="${CT_BUILD_DIR}/munge-uClibc-config.sed"
   253 
   254     # Start with a fresh file
   255     rm -f "${munge_file}"
   256     touch "${munge_file}"
   257 
   258     # Do it all in a sub-shell, it's easier to redirect output
   259     (
   260 
   261     # Hack our target in the config file.
   262     case "${CT_ARCH}:${CT_ARCH_BITNESS}" in
   263         x86:32)      arch=i386;;
   264         x86:64)      arch=x86_64;;
   265         sh:32)       arch="sh";;
   266         sh:64)       arch="sh64";;
   267         blackfin:32) arch="bfin";;
   268         *)           arch="${CT_ARCH}";;
   269     esac
   270     # Also remove stripping: its the responsibility of the
   271     # firmware builder to strip or not.
   272     cat <<-ENDSED
   273 		s/^(TARGET_.*)=y$/# \\1 is not set/
   274 		s/^# TARGET_${arch} is not set/TARGET_${arch}=y/
   275 		s/^TARGET_ARCH=".*"/TARGET_ARCH="${arch}"/
   276 		s/.*(DOSTRIP).*/# \\1 is not set/
   277 		ENDSED
   278 
   279     # Ah. We may one day need architecture-specific handler here...
   280     case "${CT_ARCH}" in
   281         arm)
   282             # Hack the ARM {E,O}ABI into the config file
   283             if [ "${CT_ARCH_ARM_EABI}" = "y" ]; then
   284                 cat <<-ENDSED
   285 					s/.*(CONFIG_ARM_OABI).*/# \\1 is not set/
   286 					s/.*(CONFIG_ARM_EABI).*/\\1=y/
   287 					ENDSED
   288             else
   289                 cat <<-ENDSED
   290 					s/.*(CONFIG_ARM_OABI).*/\\1=y/
   291 					s/.*(CONFIG_ARM_EABI).*/# \\1 is not set/
   292 					ENDSED
   293             fi
   294             ;;
   295         mips)
   296             case "${CT_ARCH_mips_ABI}" in
   297                 32)
   298                     cat <<-ENDSED
   299 						s/.*(CONFIG_MIPS_O32_ABI).*/\\1=y/
   300 						s/.*(CONFIG_MIPS_N32_ABI).*/# \\1 is not set/
   301 						s/.*(CONFIG_MIPS_N64_ABI).*/# \\1 is not set/
   302 						ENDSED
   303                     ;;
   304                 # For n32 and n64, also force the ISA
   305                 # Not so sure this is pertinent, so it's
   306                 # commented out for now. It would take a
   307                 # (MIPS+uClibc) expert to either remove
   308                 # or re-enable the overrides.
   309                 n32)
   310                     cat <<-ENDSED
   311 						s/.*(CONFIG_MIPS_O32_ABI).*/# \\1 is not set/
   312 						s/.*(CONFIG_MIPS_N32_ABI).*/\\1=y/
   313 						s/.*(CONFIG_MIPS_N64_ABI).*/# \\1 is not set/
   314 						s/.*(CONFIG_MIPS_ISA_.*).*/# \\1 is not set/
   315 						s/.*(CONFIG_MIPS_ISA_3).*/\\1=y/
   316 						ENDSED
   317                     ;;
   318                 64)
   319                     cat <<-ENDSED
   320 						s/.*(CONFIG_MIPS_O32_ABI).*/# \\1 is not set/
   321 						s/.*(CONFIG_MIPS_N32_ABI).*/# \\1 is not set/
   322 						s/.*(CONFIG_MIPS_N64_ABI).*/\\1=y/
   323 						s/.*(CONFIG_MIPS_ISA_.*).*/# \\1 is not set/
   324 						s/.*(CONFIG_MIPS_ISA_MIPS64).*/\\1=y/
   325 						ENDSED
   326                     ;;
   327             esac
   328             ;;
   329     esac
   330 
   331     # Accomodate for old and new uClibc versions, where the
   332     # way to select between big/little endian has changed
   333     case "${CT_ARCH_ENDIAN}" in
   334         big)
   335             cat <<-ENDSED
   336 				s/.*(ARCH_LITTLE_ENDIAN).*/# \\1 is not set/
   337 				s/.*(ARCH_BIG_ENDIAN).*/\\1=y/
   338 				s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/# \\1 is not set/
   339 				s/.*(ARCH_WANTS_BIG_ENDIAN).*/\\1=y/
   340 				ENDSED
   341         ;;
   342         little)
   343             cat <<-ENDSED
   344 				s/.*(ARCH_LITTLE_ENDIAN).*/\\1=y/
   345 				s/.*(ARCH_BIG_ENDIAN).*/# \\1 is not set/
   346 				s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/\\1=y/
   347 				s/.*(ARCH_WANTS_BIG_ENDIAN).*/# \\1 is not set/
   348 				ENDSED
   349         ;;
   350     esac
   351 
   352     # Accomodate for old and new uClibc versions, where the
   353     # MMU settings has different config knobs
   354     if [ "${CT_ARCH_USE_MMU}" = "y" ]; then
   355         cat <<-ENDSED
   356 			s/.*(ARCH_HAS_MMU).*/\\1=y\nARCH_USE_MMU=y/
   357 			ENDSED
   358     else
   359         cat <<-ENDSED
   360 			s/.*(ARCH_HAS_MMU).*/# \\1 is not set/
   361 			/.*(ARCH_USE_MMU).*/d
   362 			ENDSED
   363     fi
   364 
   365     # Accomodate for old and new uClibc version, where the
   366     # way to select between hard/soft float has changed
   367     case "${CT_ARCH_FLOAT}" in
   368         hard|softfp)
   369             cat <<-ENDSED
   370 				s/^[^_]*(HAS_FPU).*/\\1=y/
   371 				s/.*(UCLIBC_HAS_FPU).*/\\1=y/
   372 				ENDSED
   373             ;;
   374         soft)
   375             cat <<-ENDSED
   376 				s/^[^_]*(HAS_FPU).*/\\# \\1 is not set/
   377 				s/.*(UCLIBC_HAS_FPU).*/# \\1 is not set/
   378 				ENDSED
   379             ;;
   380     esac
   381 
   382     # We always want ctor/dtor
   383     cat <<-ENDSED
   384 		s/^# (UCLIBC_CTOR_DTOR) is not set/\\1=y/
   385 		ENDSED
   386 
   387     # Change paths to work with crosstool-NG
   388     # From http://www.uclibc.org/cgi-bin/viewcvs.cgi?rev=16846&view=rev
   389     #  " we just want the kernel headers, not the whole kernel source ...
   390     #  " so people may need to update their paths slightly
   391     quoted_kernel_source=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/include/?$,,; s,/,\\/,g;')
   392     quoted_headers_dir=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/,\\/,g;')
   393     # CROSS_COMPILER_PREFIX is left as is, as the CROSS parameter is forced on the command line
   394     # DEVEL_PREFIX is left as '/usr/' because it is post-pended to $PREFIX, wich is the correct value of ${PREFIX}/${TARGET}
   395     # Some (old) versions of uClibc use KERNEL_SOURCE (which is _wrong_), and
   396     # newer versions use KERNEL_HEADERS (which is right).
   397     cat <<-ENDSED
   398 		s/^DEVEL_PREFIX=".*"/DEVEL_PREFIX="\\/usr\\/"/
   399 		s/^RUNTIME_PREFIX=".*"/RUNTIME_PREFIX="\\/"/
   400 		s/^SHARED_LIB_LOADER_PREFIX=.*/SHARED_LIB_LOADER_PREFIX="\\/lib\\/"/
   401 		s/^KERNEL_SOURCE=".*"/KERNEL_SOURCE="${quoted_kernel_source}"/
   402 		s/^KERNEL_HEADERS=".*"/KERNEL_HEADERS="${quoted_headers_dir}"/
   403 		s/^UCLIBC_DOWNLOAD_PREGENERATED_LOCALE=y/\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE is not set/
   404 		ENDSED
   405 
   406     if [ "${CT_USE_PIPES}" = "y" ]; then
   407         if grep UCLIBC_EXTRA_CFLAGS extra/Configs/Config.in >/dev/null 2>&1; then
   408             # Good, there is special provision for such things as -pipe!
   409             cat <<-ENDSED
   410 				s/^(UCLIBC_EXTRA_CFLAGS=".*)"$/\\1 -pipe"/
   411 				ENDSED
   412         else
   413             # Hack our -pipe into WARNINGS, which will be internally incorporated to
   414             # CFLAGS. This a dirty hack, but yet needed
   415             cat <<-ENDSED
   416 				s/^(WARNINGS=".*)"$/\\1 -pipe"/
   417 				ENDSED
   418         fi
   419     fi
   420 
   421     # Locales support
   422     # Note that the two PREGEN_LOCALE and the XLOCALE lines may be missing
   423     # entirely if LOCALE is not set.  If LOCALE was already set, we'll
   424     # assume the user has already made all the appropriate generation
   425     # arrangements.  Note that having the uClibc Makefile download the
   426     # pregenerated locales is not compatible with crosstool; besides,
   427     # crosstool downloads them as part of getandpatch.sh.
   428     case "${CT_LIBC_UCLIBC_LOCALES}:${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" in
   429         :*)
   430             ;;
   431         y:)
   432             cat <<-ENDSED
   433 				s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\
   434 				# UCLIBC_PREGENERATED_LOCALE_DATA is not set\\
   435 				# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\
   436 				# UCLIBC_HAS_XLOCALE is not set/
   437 				ENDSED
   438             ;;
   439         y:y)
   440             cat <<-ENDSED
   441 				s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\
   442 				UCLIBC_PREGENERATED_LOCALE_DATA=y\\
   443 				# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\
   444 				# UCLIBC_HAS_XLOCALE is not set/
   445 				ENDSED
   446             ;;
   447     esac
   448 
   449     # WCHAR support
   450     if [ "${CT_LIBC_UCLIBC_WCHAR}" = "y" ] ; then
   451         cat <<-ENDSED
   452 			s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=y/
   453 			ENDSED
   454     else
   455         cat <<-ENDSED
   456 			s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=n/
   457 			ENDSED
   458     fi
   459 
   460     # Force on options needed for C++ if we'll be making a C++ compiler.
   461     # I'm not sure locales are a requirement for doing C++... Are they?
   462     if [ "${CT_CC_LANG_CXX}" = "y" ]; then
   463         cat <<-ENDSED
   464 			s/^# DO_C99_MATH is not set/DO_C99_MATH=y/
   465 			s/^# UCLIBC_HAS_GNU_GETOPT is not set/UCLIBC_HAS_GNU_GETOPT=y/
   466 			ENDSED
   467     fi
   468 
   469     # Push the threading model
   470     # Note: we take into account all of the .28, .29, .30 and .31
   471     #       versions, here. Even snapshots with NPTL.
   472     case "${CT_THREADS}:${CT_LIBC_UCLIBC_LNXTHRD}" in
   473         none:)
   474             cat <<-ENDSED
   475 				s/^UCLIBC_HAS_THREADS=y/# UCLIBC_HAS_THREADS is not set/
   476 				s/^LINUXTHREADS_OLD=y/# LINUXTHREADS_OLD is not set/
   477 				s/^LINUXTHREADS_NEW=y/# LINUXTHREADS_NEW is not set/
   478 				s/^UCLIBC_HAS_THREADS_NATIVE=y/# UCLIBC_HAS_THREADS_NATIVE is not set/
   479 				ENDSED
   480             ;;
   481         linuxthreads:old)
   482             cat <<-ENDSED
   483 				s/^# UCLIBC_HAS_THREADS is not set/UCLIBC_HAS_THREADS=y/
   484 				s/^# LINUXTHREADS_OLD is not set/LINUXTHREADS_OLD=y/
   485 				s/^LINUXTHREADS_NEW=y/# LINUXTHREADS_NEW is not set/
   486 				s/^UCLIBC_HAS_THREADS_NATIVE=y/# UCLIBC_HAS_THREADS_NATIVE is not set/
   487 				ENDSED
   488             ;;
   489         linuxthreads:new)
   490             cat <<-ENDSED
   491 				s/^# UCLIBC_HAS_THREADS is not set/UCLIBC_HAS_THREADS=y/
   492 				s/^LINUXTHREADS_OLD=y/# LINUXTHREADS_OLD is not set/
   493 				s/^# LINUXTHREADS_NEW is not set/LINUXTHREADS_NEW=y/
   494 				s/^UCLIBC_HAS_THREADS_NATIVE=y/# UCLIBC_HAS_THREADS_NATIVE is not set/
   495 				ENDSED
   496             ;;
   497         nptl:)
   498             cat <<-ENDSED
   499 				s/^HAS_NO_THREADS=y/# HAS_NO_THREADS is not set/
   500 				s/^UCLIBC_HAS_THREADS=y/# UCLIBC_HAS_THREADS is not set/
   501 				s/^LINUXTHREADS_OLD=y/# LINUXTHREADS_OLD is not set/
   502 				s/^LINUXTHREADS_NEW=y/# LINUXTHREADS_NEW is not set/
   503 				s/^# UCLIBC_HAS_THREADS_NATIVE is not set/UCLIBC_HAS_THREADS_NATIVE=y/
   504 				ENDSED
   505             ;;
   506         *)
   507             CT_Abort "Incorrect thread settings: CT_THREADS='${CT_THREAD}' CT_LIBC_UCLIBC_LNXTHRD='${CT_LIBC_UCLIBC_LNXTHRD}'"
   508             ;;
   509     esac
   510 
   511     # Always build the libpthread_db
   512     cat <<-ENDSED
   513 		s/^# PTHREADS_DEBUG_SUPPORT is not set.*/PTHREADS_DEBUG_SUPPORT=y/
   514 		ENDSED
   515 
   516     # Force on debug options if asked for
   517     case "${CT_LIBC_UCLIBC_DEBUG_LEVEL}" in
   518       0)
   519         cat <<-ENDSED
   520 			s/^DODEBUG=y/# DODEBUG is not set/
   521 			s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
   522 			s/^DOASSERTS=y/# DOASSERTS is not set/
   523 			s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
   524 			s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
   525 			s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
   526 			ENDSED
   527         ;;
   528       1)
   529         cat <<-ENDSED
   530 			s/^# DODEBUG is not set.*/DODEBUG=y/
   531 			s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
   532 			s/^DOASSERTS=y/# DOASSERTS is not set/
   533 			s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
   534 			s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
   535 			s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
   536 			ENDSED
   537         ;;
   538       2)
   539         cat <<-ENDSED
   540 			s/^# DODEBUG is not set.*/DODEBUG=y/
   541 			s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
   542 			s/^# DOASSERTS is not set.*/DOASSERTS=y/
   543 			s/^# SUPPORT_LD_DEBUG is not set.*/SUPPORT_LD_DEBUG=y/
   544 			s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
   545 			s/^# UCLIBC_MALLOC_DEBUGGING is not set/UCLIBC_MALLOC_DEBUGGING=y/
   546 			ENDSED
   547         ;;
   548       3)
   549         cat <<-ENDSED
   550 			s/^# DODEBUG is not set.*/DODEBUG=y/
   551 			s/^# DODEBUG_PT is not set.*/DODEBUG_PT=y/
   552 			s/^# DOASSERTS is not set.*/DOASSERTS=y/
   553 			s/^# SUPPORT_LD_DEBUG is not set.*/SUPPORT_LD_DEBUG=y/
   554 			s/^# SUPPORT_LD_DEBUG_EARLY is not set.*/SUPPORT_LD_DEBUG_EARLY=y/
   555 			s/^# UCLIBC_MALLOC_DEBUGGING is not set/UCLIBC_MALLOC_DEBUGGING=y/
   556 			ENDSED
   557         ;;
   558     esac
   559 
   560     # And now, this is the end
   561     ) >>"${munge_file}"
   562 
   563     sed -r -f "${munge_file}" "${src_config_file}" >"${dst_config_file}"
   564 }