Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add heapsort to libnbcompat



details:   https://anonhg.NetBSD.org/src/rev/c5dd1180599e
branches:  trunk
changeset: 571507:c5dd1180599e
user:      jmc <jmc%NetBSD.org@localhost>
date:      Sun Nov 28 06:57:14 2004 +0000

description:
Add heapsort to libnbcompat

diffstat:

 lib/libc/stdlib/heapsort.c |    18 +-
 tools/compat/Makefile      |     4 +-
 tools/compat/compat_defs.h |     8 +-
 tools/compat/configure     |  2302 ++++++++++++++-----------------------------
 tools/compat/configure.ac  |     6 +-
 5 files changed, 769 insertions(+), 1569 deletions(-)

diffs (truncated from 4921 to 300 lines):

diff -r 0e7265003b8b -r c5dd1180599e lib/libc/stdlib/heapsort.c
--- a/lib/libc/stdlib/heapsort.c        Sun Nov 28 05:40:47 2004 +0000
+++ b/lib/libc/stdlib/heapsort.c        Sun Nov 28 06:57:14 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: heapsort.c,v 1.14 2003/09/07 19:06:50 wiz Exp $        */
+/*     $NetBSD: heapsort.c,v 1.15 2004/11/28 06:57:14 jmc Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -32,12 +32,21 @@
  * SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+/*
+ * XXX Undefine the renames of these functions so that we don't
+ * XXX rename the versions found in the host's headers by mistake!
+ */
+#undef heapsort
+#endif
+
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
 #if 0
 static char sccsid[] = "from: @(#)heapsort.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: heapsort.c,v 1.14 2003/09/07 19:06:50 wiz Exp $");
+__RCSID("$NetBSD: heapsort.c,v 1.15 2004/11/28 06:57:14 jmc Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -48,6 +57,11 @@
 #include <errno.h>
 #include <stdlib.h>
 
+#if HAVE_NBTOOL_CONFIG_H
+/* XXX Now, re-apply the renaming that we undid above. */
+#define heapsort       __nbcompat_heapsort
+#endif
+
 #ifdef __weak_alias
 __weak_alias(heapsort,_heapsort)
 #endif
diff -r 0e7265003b8b -r c5dd1180599e tools/compat/Makefile
--- a/tools/compat/Makefile     Sun Nov 28 05:40:47 2004 +0000
+++ b/tools/compat/Makefile     Sun Nov 28 06:57:14 2004 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: Makefile,v 1.31 2004/06/20 22:20:15 jmc Exp $
+#      $NetBSD: Makefile,v 1.32 2004/11/28 06:57:14 jmc Exp $
 
 HOSTLIB=       nbcompat
 
 SRCS=          atoll.c basename.c dirname.c fgetln.c flock.c fparseln.c \
-               getmode.c getopt_long.c gettemp.c issetugid.c \
+               getmode.c getopt_long.c gettemp.c heapsort.c issetugid.c \
                lchflags.c lchmod.c lchown.c libyywrap.c \
                md2c.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c mkdtemp.c \
                mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
diff -r 0e7265003b8b -r c5dd1180599e tools/compat/compat_defs.h
--- a/tools/compat/compat_defs.h        Sun Nov 28 05:40:47 2004 +0000
+++ b/tools/compat/compat_defs.h        Sun Nov 28 06:57:14 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_defs.h,v 1.43 2004/06/23 11:08:01 tron Exp $    */
+/*     $NetBSD: compat_defs.h,v 1.44 2004/11/28 06:57:14 jmc Exp $     */
 
 #ifndef        __NETBSD_COMPAT_DEFS_H__
 #define        __NETBSD_COMPAT_DEFS_H__
@@ -298,6 +298,12 @@
 ssize_t pread(int, void *, size_t, off_t);
 #endif
 
+#if !HAVE_HEAPSORT
+int heapsort (void *, size_t, size_t, int (*)(const void *, const void *));
+#endif
+/* Make them use our version */
+#  define heapsort __nbcompat_heapsort
+
 #if !HAVE_PWCACHE_USERDB
 int uid_from_user(const char *, uid_t *);
 int pwcache_userdb(int (*)(int), void (*)(void),
diff -r 0e7265003b8b -r c5dd1180599e tools/compat/configure
--- a/tools/compat/configure    Sun Nov 28 05:40:47 2004 +0000
+++ b/tools/compat/configure    Sun Nov 28 06:57:14 2004 +0000
@@ -1,10 +1,11 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for libnbcompat noversion.
+# Generated by GNU Autoconf 2.57 for libnbcompat noversion.
 #
 # Report bugs to <lib-bug-people%NetBSD.org@localhost>.
 #
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
@@ -21,10 +22,9 @@
 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
   set -o posix
 fi
-DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
@@ -43,7 +43,7 @@
   LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
   LC_TELEPHONE LC_TIME
 do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
     $as_unset $as_var
@@ -220,17 +220,16 @@
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
 else
-  test -d ./-p && rmdir ./-p
   as_mkdir_p=false
 fi
 
 as_executable_p="test -f"
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
 
 
 # IFS
@@ -669,7 +668,7 @@
 
 # Be sure to have absolute paths.
 for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-             localstatedir libdir includedir oldincludedir infodir mandir
+              localstatedir libdir includedir oldincludedir infodir mandir
 do
   eval ac_val=$`echo $ac_var`
   case $ac_val in
@@ -709,10 +708,10 @@
   # Try the directory containing this script, then its parent.
   ac_confdir=`(dirname "$0") 2>/dev/null ||
 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$0" : 'X\(//\)[^/]' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| \
-        .     : '\(.\)' 2>/dev/null ||
+         X"$0" : 'X\(//\)[^/]' \| \
+         X"$0" : 'X\(//\)$' \| \
+         X"$0" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
 echo X"$0" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
          /^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -804,9 +803,9 @@
   cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
-                         [$ac_default_prefix]
+                          [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                         [PREFIX]
+                          [PREFIX]
 
 By default, \`make install' will install all the files in
 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
@@ -886,45 +885,12 @@
     ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
     ac_top_srcdir=$ac_top_builddir$srcdir ;;
 esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
-  case "$ac_dir" in
-  .) ac_abs_builddir=`pwd`;;
-  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
-  *) ac_abs_builddir=`pwd`/"$ac_dir";;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
-  case ${ac_top_builddir}. in
-  .) ac_abs_top_builddir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
-  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
-  case $ac_srcdir in
-  .) ac_abs_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
-  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
-  case $ac_top_srcdir in
-  .) ac_abs_top_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
-  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
-  esac;;
-esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
 
     cd $ac_dir
     # Check for guested configure; otherwise get Cygnus style configure.
@@ -935,7 +901,7 @@
       echo
       $SHELL $ac_srcdir/configure  --help=recursive
     elif test -f $ac_srcdir/configure.ac ||
-          test -f $ac_srcdir/configure.in; then
+           test -f $ac_srcdir/configure.in; then
       echo
       $ac_configure --help
     else
@@ -949,9 +915,10 @@
 if $ac_init_version; then
   cat <<\_ACEOF
 libnbcompat configure noversion
-generated by GNU Autoconf 2.59
-
-Copyright (C) 2003 Free Software Foundation, Inc.
+generated by GNU Autoconf 2.57
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -963,7 +930,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by libnbcompat $as_me noversion, which was
-generated by GNU Autoconf 2.59.  Invocation command line was
+generated by GNU Autoconf 2.57.  Invocation command line was
 
   $ $0 $@
 
@@ -1040,19 +1007,19 @@
     2)
       ac_configure_args1="$ac_configure_args1 '$ac_arg'"
       if test $ac_must_keep_next = true; then
-       ac_must_keep_next=false # Got value, back to normal.
+        ac_must_keep_next=false # Got value, back to normal.
       else
-       case $ac_arg in
-         *=* | --config-cache | -C | -disable-* | --disable-* \
-         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-         | -with-* | --with-* | -without-* | --without-* | --x)
-           case "$ac_configure_args0 " in
-             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-           esac
-           ;;
-         -* ) ac_must_keep_next=true ;;
-       esac
+        case $ac_arg in
+          *=* | --config-cache | -C | -disable-* | --disable-* \
+          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+          | -with-* | --with-* | -without-* | --without-* | --x)
+            case "$ac_configure_args0 " in
+              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+            esac
+            ;;
+          -* ) ac_must_keep_next=true ;;
+        esac
       fi
       ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
       # Get rid of the leading space.
@@ -1086,12 +1053,12 @@
     case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
     *ac_space=\ *)
       sed -n \
-       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
       ;;



Home | Main Index | Thread Index | Old Index