openpkg/rpm.patch.porting

changeset 13
cb59d6afeb61
child 14
0cd2ee160ef5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openpkg/rpm.patch.porting	Tue Jan 06 23:40:39 2009 +0100
     1.3 @@ -0,0 +1,1484 @@
     1.4 +##
     1.5 +##  rpm.patch.porting -- Annotated OpenPKG RPM Patch file
     1.6 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     1.8 +##
     1.9 +##  This file assembles changes to existing RPM source files between
    1.10 +##  the original RedHat RPM and the OpenPKG RPM variant. It can be
    1.11 +##  automatically applied to a vanilla RedHat RPM source tree with the
    1.12 +##  'patch' tool to upgrade those files. Each patch snippet is annotated
    1.13 +##  with a short description.
    1.14 +##
    1.15 +##  Created on: 13-Sep-2006
    1.16 +##
    1.17 +##  ATTENTION: THIS PATCH FILE WAS AUTO-GENERATED FROM AN OPENPKG
    1.18 +##             RPM CVS REPOSITORY, HENCE DO NOT EDIT THIS FILE.
    1.19 +##
    1.20 +
    1.21 ++---------------------------------------------------------------------------
    1.22 +| Evil hack to get GNU libtool working under NetBSD 1.6
    1.23 +| with the ugly way RPM currently has to use it.
    1.24 ++---------------------------------------------------------------------------
    1.25 +Index: ltconfig
    1.26 +--- ltconfig	17 Jan 2001 16:22:58 -0000	1.1.1.7
    1.27 ++++ ltconfig	29 Apr 2004 13:07:28 -0000	1.4
    1.28 +@@ -2017,6 +2017,7 @@
    1.29 +     dynamic_linker='NetBSD ld.elf_so'
    1.30 +   fi
    1.31 +   shlibpath_var=LD_LIBRARY_PATH
    1.32 ++  deplibs_check_method=pass_all
    1.33 +   ;;
    1.34 + 
    1.35 + openbsd*)
    1.36 +
    1.37 ++---------------------------------------------------------------------------
    1.38 +| Disable special RedHat NPTL handling.
    1.39 ++---------------------------------------------------------------------------
    1.40 +Index: configure.ac
    1.41 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
    1.42 ++++ configure.ac	13 Sep 2006 13:40:20 -0000
    1.43 +@@ -150,10 +151,10 @@
    1.44 + dnl XXX Test for libpthread.a that is NPTL aware (static link only).
    1.45 + dnl
    1.46 + LDFLAGS_NPTL=
    1.47 +-if test -f /usr/lib/nptl/libpthread.a ; then
    1.48 +-    LDFLAGS_NPTL="-L/usr/lib/nptl"
    1.49 +-#    INCPATH="$INCPATH -I/usr/include/nptl"
    1.50 +-fi
    1.51 ++dnl if test -f /usr/lib/nptl/libpthread.a ; then
    1.52 ++dnl     LDFLAGS_NPTL="-L/usr/lib/nptl"
    1.53 ++dnl #    INCPATH="$INCPATH -I/usr/include/nptl"
    1.54 ++dnl fi
    1.55 + AC_SUBST(LDFLAGS_NPTL)
    1.56 + 
    1.57 + dnl
    1.58 +
    1.59 ++---------------------------------------------------------------------------
    1.60 +| Disable any POSIX Pthread stuff because in OpenPKG we use
    1.61 +| non-Pthread mutexes in Berkeley-DB.
    1.62 ++---------------------------------------------------------------------------
    1.63 +Index: configure.ac
    1.64 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
    1.65 ++++ configure.ac	13 Sep 2006 13:40:21 -0000
    1.66 +@@ -446,14 +447,17 @@
    1.67 +     AC_CHECK_LIB(socket, socket)
    1.68 + ])
    1.69 + 
    1.70 +-AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
    1.71 ++dnl # required for HP-UX because of RPC stuff in DB
    1.72 ++AC_CHECK_LIB(nsl, svc_run)
    1.73 + 
    1.74 +-AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
    1.75 +-  dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
    1.76 +-  AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
    1.77 +-    AC_CHECK_LIB(thread, mutex_lock)
    1.78 +-  ])
    1.79 +-])
    1.80 ++dnl AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
    1.81 ++dnl 
    1.82 ++dnl AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
    1.83 ++dnl   dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
    1.84 ++dnl   AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
    1.85 ++dnl     AC_CHECK_LIB(thread, mutex_lock)
    1.86 ++dnl   ])
    1.87 ++dnl ])
    1.88 + 
    1.89 + AC_CHECK_HEADERS(aio.h)
    1.90 + AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
    1.91 +
    1.92 ++---------------------------------------------------------------------------
    1.93 +| Add support for BSD getmntinfo(3).
    1.94 ++---------------------------------------------------------------------------
    1.95 +Index: configure.ac
    1.96 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
    1.97 ++++ configure.ac	13 Sep 2006 13:40:23 -0000
    1.98 +@@ -963,12 +967,13 @@
    1.99 + AC_CHECK_FUNCS(getpassphrase)
   1.100 + 
   1.101 + AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
   1.102 ++ AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have the getmntinfo() function]), [
   1.103 +   AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
   1.104 +     AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
   1.105 +       AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r"; 
   1.106 + 					AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
   1.107 + 		 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
   1.108 +-                 AC_LIBOBJ(getmntent)])])])])
   1.109 ++                 AC_LIBOBJ(getmntent)])])])])])
   1.110 + 
   1.111 + AC_CHECK_FUNC(lchown,
   1.112 +    [__CHOWN_RHF="%{__chown} -Rhf"
   1.113 +
   1.114 ++---------------------------------------------------------------------------
   1.115 +| Remove RPM's "lib64" hack because we do not install
   1.116 +| into any system locations at all.
   1.117 ++---------------------------------------------------------------------------
   1.118 +Index: configure.ac
   1.119 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   1.120 ++++ configure.ac	13 Sep 2006 13:40:25 -0000
   1.121 +@@ -1141,9 +1146,6 @@
   1.122 + 
   1.123 + dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
   1.124 + MARK64=
   1.125 +-case "${target_cpu}" in
   1.126 +-x86_64*|ppc64*|powerpc64*|sparc64*|s390x*)	MARK64=64 ;;
   1.127 +-esac
   1.128 + AC_SUBST(MARK64)
   1.129 + 
   1.130 + dnl Determine the canonical arch-vendor-os for the build machine
   1.131 +
   1.132 ++---------------------------------------------------------------------------
   1.133 +| Provide fallback definitions for uintX_t stuff, which is used by
   1.134 +| build/rpmfile.h and not available on all platforms. We do this by
   1.135 +| adding the same Autoconf checks file/configure already used for its
   1.136 +| original file.h.
   1.137 +| Additionally, do not try to configure in an internal
   1.138 +| beecrypt subdirectory.
   1.139 ++---------------------------------------------------------------------------
   1.140 +Index: configure.ac
   1.141 +--- configure.ac	2 Jul 2003 19:20:52 -0000	1.1.1.4
   1.142 ++++ configure.ac	13 Sep 2006 13:40:29 -0000
   1.143 +@@ -1249,11 +1251,40 @@
   1.144 + 
   1.145 + AC_SUBST(OBJDUMP)
   1.146 + 
   1.147 ++dnl OpenPKG: rpmfile.h (used in RPM) from file(1) needs additional checks
   1.148 ++dnl for its use of uintXX_t (which are available in file/config.h, but which
   1.149 ++dnl we cannot include into RPM because of conflicts with RPM's config.h)
   1.150 ++AC_DEFUN([AC_CHECK_TYPE_STDC],
   1.151 ++[AC_REQUIRE([AC_HEADER_STDC])dnl
   1.152 ++AC_MSG_CHECKING(for $1)
   1.153 ++AC_CACHE_VAL(ac_cv_type_$1,
   1.154 ++[AC_EGREP_CPP(dnl
   1.155 ++[(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]],
   1.156 ++[#if HAVE_STDINT_H
   1.157 ++#include <stdint.h>
   1.158 ++#endif
   1.159 ++#include <sys/types.h>
   1.160 ++#if STDC_HEADERS
   1.161 ++#include <stdlib.h>
   1.162 ++#include <stddef.h>
   1.163 ++#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
   1.164 ++AC_MSG_RESULT($ac_cv_type_$1)
   1.165 ++if test $ac_cv_type_$1 = no; then
   1.166 ++  AC_DEFINE($1, $2, $1)
   1.167 ++fi])
   1.168 ++AC_CHECK_TYPE_STDC(uint8_t,  unsigned char)
   1.169 ++AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
   1.170 ++AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
   1.171 ++
   1.172 ++dnl OpenPKG: some strange platforms (like Unixware) really have MADV_XXX
   1.173 ++dnl but no madvise(2) function itself, so check for madvise explicitly.
   1.174 ++AC_CHECK_FUNC(madvise)
   1.175 ++
   1.176 + dnl XXX this causes popt to depend on zlib et al
   1.177 + dnl # XXX Propagate -lucb to popt ...
   1.178 + dnl export LIBS INCPATH CONFIG_SITE
   1.179 + 
   1.180 +-AC_CONFIG_SUBDIRS(popt beecrypt zlib elfutils file db3)
   1.181 ++AC_CONFIG_SUBDIRS(popt zlib elfutils file db3)
   1.182 + 
   1.183 + AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
   1.184 + 	rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
   1.185 +
   1.186 ++---------------------------------------------------------------------------
   1.187 +| Remove RPM's "lib64" hack because we do not install
   1.188 +| into any system locations at all.
   1.189 ++---------------------------------------------------------------------------
   1.190 +Index: popt/configure.ac
   1.191 +--- popt/configure.ac	27 Mar 2003 17:23:18 -0000	1.1.1.3
   1.192 ++++ popt/configure.ac	12 May 2004 14:34:35 -0000	1.2
   1.193 +@@ -53,9 +53,6 @@
   1.194 + 
   1.195 + dnl XXX Choose /usr/lib or /usr/lib64 for library installs.
   1.196 + MARK64=
   1.197 +-case "${target_cpu}" in
   1.198 +-x86_64*|powerpc64*|ppc64*|sparc64*|s390x*)        MARK64=64 ;;
   1.199 +-esac
   1.200 + AC_SUBST(MARK64)
   1.201 + 
   1.202 + AC_CHECK_HEADERS(alloca.h float.h libintl.h mcheck.h unistd.h)
   1.203 +
   1.204 ++---------------------------------------------------------------------------
   1.205 +| Prevent (at least NetBSD's) gcc 2.95 from optimizing (at least sha1.c)
   1.206 +| and this way run into a resource (virtual memory) exhaustion situation.
   1.207 +| Not all Bourne-Shells support embedded TAB characters in
   1.208 +| here-document style constructs. Insert the TAB character indirectly
   1.209 +| to workaround problems.
   1.210 +| Additionally, there is no need to build a shared library version of
   1.211 +| Berkeley-DB.
   1.212 +| Finally, enforce the use of the standard UNIX/fcntl mutex type for
   1.213 +| full portability and to get rid of Pthread library dependencies
   1.214 +| (which especially are nasty for the external RPM API users).
   1.215 ++---------------------------------------------------------------------------
   1.216 +Index: db3/configure
   1.217 +--- db3/configure	18 Jan 2003 14:04:22 -0000	1.1.1.4
   1.218 ++++ db3/configure	6 Jun 2005 15:53:05 -0000	1.3
   1.219 +@@ -7,19 +7,29 @@
   1.220 + # XXX edit CFLAGS= ... out of invocation args ???
   1.221 + ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's%--cache-file=.*$%%'`"
   1.222 + 
   1.223 ++# prevent gcc 2.95 from optimizing (at least sha1.c)
   1.224 ++# and this way get into a resource exhaustion situation
   1.225 ++if [ ".`($CC -v; $CC --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
   1.226 ++    case "`$CC -dumpversion 2>/dev/null`" in
   1.227 ++        3.* ) ;;
   1.228 ++        *   ) CFLAGS=`echo " $CFLAGS -O0" | sed -e 's; -O[0-9]* ; ;g' -e 's;^  *;;'` ;;
   1.229 ++    esac
   1.230 ++fi
   1.231 ++
   1.232 + CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \
   1.233 +-	--enable-shared --enable-static --enable-rpc \
   1.234 +-	--with-uniquename=_rpmdb --srcdir=$db_dist
   1.235 ++	--disable-shared --enable-static --enable-rpc \
   1.236 ++	--with-uniquename=_rpmdb --srcdir=$db_dist \
   1.237 ++	--with-mutex="UNIX/fcntl" --disable-largefile
   1.238 + 
   1.239 + mv Makefile Makefile.orig
   1.240 + cat Makefile.orig | sed -e '/^install[:-]/c\
   1.241 + .PHONY: listobjs\
   1.242 + listobjs:\
   1.243 +-	@echo $(OBJS) $(C_OBJS) \
   1.244 ++~@echo $(OBJS) $(C_OBJS) \
   1.245 + \
   1.246 + distdir install check:\
   1.247 + \
   1.248 +-db4_install: all install_setip' > Makefile
   1.249 ++db4_install: all install_setip' | tr '~' '	' > Makefile
   1.250 + 
   1.251 + mv db.h db.h.orig
   1.252 + cat db.h.orig | sed \
   1.253 +
   1.254 ++---------------------------------------------------------------------------
   1.255 +| Add support for BSD getmntinfo(3).
   1.256 ++---------------------------------------------------------------------------
   1.257 +Index: lib/fs.c
   1.258 +--- lib/fs.c	4 Jun 2003 18:09:43 -0000	1.1.1.13
   1.259 ++++ lib/fs.c	25 Nov 2004 09:32:16 -0000	1.3
   1.260 +@@ -164,6 +164,15 @@
   1.261 +     int nextMount = 0;
   1.262 + 
   1.263 + 	getmntinfo_r(&mounts, flags, &mntCount, &bufSize);
   1.264 ++#   elif HAVE_GETMNTINFO
   1.265 ++#   if defined(__NetBSD__) && (__NetBSD_Version__ > 200030000)
   1.266 ++#   define statfs statvfs
   1.267 ++#   endif
   1.268 ++    struct statfs * mounts = NULL;
   1.269 ++    int mntCount, flags = MNT_NOWAIT;
   1.270 ++    int nextMount = 0;
   1.271 ++
   1.272 ++	mntCount = getmntinfo(&mounts, flags);
   1.273 + #   endif
   1.274 + 
   1.275 +     filesystems = xcalloc((numAlloced + 1), sizeof(*filesystems));	/* XXX memory leak */
   1.276 +@@ -193,6 +202,9 @@
   1.277 + #	elif HAVE_GETMNTINFO_R
   1.278 + 	    if (nextMount == mntCount) break;
   1.279 + 	    mntdir = mounts[nextMount++].f_mntonname;
   1.280 ++#	elif HAVE_GETMNTINFO
   1.281 ++	    if (nextMount == mntCount) break;
   1.282 ++	    mntdir = mounts[nextMount++].f_mntonname;
   1.283 + #	endif
   1.284 + 
   1.285 + 	if (stat(mntdir, &sb)) {
   1.286 +
   1.287 ++---------------------------------------------------------------------------
   1.288 +| Add support for Compaq/HP OSF1/Tru64.
   1.289 ++---------------------------------------------------------------------------
   1.290 +Index: misc/fnmatch.h
   1.291 +--- misc/fnmatch.h	22 Feb 2002 17:12:15 -0000	1.1.1.3
   1.292 ++++ misc/fnmatch.h	22 Jan 2004 21:42:26 -0000	1.2
   1.293 +@@ -55,7 +55,7 @@
   1.294 + #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
   1.295 + #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
   1.296 + 
   1.297 +-#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
   1.298 ++#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE || defined __osf__
   1.299 + # define FNM_FILE_NAME	 FNM_PATHNAME	/* Preferred GNU name.  */
   1.300 + # define FNM_LEADING_DIR (1 << 3)	/* Ignore `/...' after a match.  */
   1.301 + # define FNM_CASEFOLD	 (1 << 4)	/* Compare without regard to case.  */
   1.302 +
   1.303 ++---------------------------------------------------------------------------
   1.304 +| Use more correct Autoconf based size_t check.
   1.305 +| Add support for Compaq/HP OSF1/Tru64 and SCO UnixWare.
   1.306 ++---------------------------------------------------------------------------
   1.307 +Index: misc/glob.h
   1.308 +--- misc/glob.h	11 Mar 2000 20:59:30 -0000	1.1.1.3
   1.309 ++++ misc/glob.h	22 Jan 2004 21:42:27 -0000	1.2
   1.310 +@@ -46,7 +46,7 @@
   1.311 + #endif /* C++ or ANSI C.  */
   1.312 + 
   1.313 + /* We need `size_t' for the following definitions.  */
   1.314 +-#ifndef __size_t
   1.315 ++#if !defined(__size_t) && !defined(_SIZE_T_DECLARED)
   1.316 + # if defined __GNUC__ && __GNUC__ >= 2
   1.317 + typedef __SIZE_TYPE__ __size_t;
   1.318 + #  ifdef _XOPEN_SOURCE
   1.319 +@@ -74,7 +74,7 @@
   1.320 + #define	GLOB_PERIOD	(1 << 7)/* Leading `.' can be matched by metachars.  */
   1.321 + 
   1.322 + #if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \
   1.323 +-     || defined _GNU_SOURCE)
   1.324 ++     || defined _GNU_SOURCE || defined __osf__ )
   1.325 + # define GLOB_MAGCHAR	 (1 << 8)/* Set in gl_flags if any metachars seen.  */
   1.326 + # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions.  */
   1.327 + # define GLOB_BRACE	 (1 << 10)/* Expand "{a,b}" to "a" "b".  */
   1.328 +@@ -151,7 +151,8 @@
   1.329 +    `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
   1.330 +    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
   1.331 +    Otherwise, `glob' returns zero.  */
   1.332 +-#if _FILE_OFFSET_BITS != 64
   1.333 ++/* #if _FILE_OFFSET_BITS != 64 || defined(OPENPKG_UNIXWARE) */
   1.334 ++#if !defined(__linux__)
   1.335 + extern int glob __P ((__const char *__pattern, int __flags,
   1.336 + 		      int (*__errfunc) (__const char *, int),
   1.337 + 		      glob_t *__pglob));
   1.338 +
   1.339 ++---------------------------------------------------------------------------
   1.340 +| Better portability.
   1.341 ++---------------------------------------------------------------------------
   1.342 +Index: misc/glob.c
   1.343 +--- misc/glob.c	11 Mar 2000 21:13:18 -0000	1.1.1.4
   1.344 ++++ misc/glob.c	22 Jan 2004 21:42:26 -0000	1.2
   1.345 +@@ -813,6 +813,7 @@
   1.346 + 
   1.347 + 
   1.348 + /* Free storage allocated in PGLOB by a previous `glob' call.  */
   1.349 ++#if !defined(__linux__) || (defined(__linux__) && (_FILE_OFFSET_BITS != 64) || (__GNUC__ >= 2))
   1.350 + void
   1.351 + globfree (pglob)
   1.352 +      register glob_t *pglob;
   1.353 +@@ -826,7 +827,7 @@
   1.354 +       free ((__ptr_t) pglob->gl_pathv);
   1.355 +     }
   1.356 + }
   1.357 +-
   1.358 ++#endif
   1.359 + 
   1.360 + /* Do a collated comparison of A and B.  */
   1.361 + static int
   1.362 +
   1.363 ++---------------------------------------------------------------------------
   1.364 +| Add libmisc.a for platform portability.
   1.365 ++---------------------------------------------------------------------------
   1.366 +Index: tools/Makefile.am
   1.367 +--- tools/Makefile.am	29 May 2003 17:40:17 -0000	1.1.1.14
   1.368 ++++ tools/Makefile.am	22 Jan 2004 21:42:34 -0000	1.2
   1.369 +@@ -22,7 +22,7 @@
   1.370 + 
   1.371 + LDADD = \
   1.372 + 	$(top_builddir)/lib/librpm.la \
   1.373 +-	@INTLLIBS@
   1.374 ++	@INTLLIBS@ @LIBMISC@
   1.375 + 
   1.376 + staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
   1.377 + 
   1.378 +
   1.379 ++---------------------------------------------------------------------------
   1.380 +| Add libmisc.a for platform portability.
   1.381 ++---------------------------------------------------------------------------
   1.382 +Index: tools/Makefile.in
   1.383 +--- tools/Makefile.in	16 Jul 2003 17:05:51 -0000	1.1.1.20
   1.384 ++++ tools/Makefile.in	22 Jan 2004 21:42:35 -0000	1.2
   1.385 +@@ -275,7 +275,7 @@
   1.386 + 
   1.387 + LDADD = \
   1.388 + 	$(top_builddir)/lib/librpm.la \
   1.389 +-	@INTLLIBS@
   1.390 ++	@INTLLIBS@ @LIBMISC@
   1.391 + 
   1.392 + 
   1.393 + staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
   1.394 +
   1.395 ++---------------------------------------------------------------------------
   1.396 +| Drop GCC "inline" attribute if not compiling with GCC.
   1.397 +| Workaround some other GCC'isms, too.
   1.398 +| Do not take over "const" replacements from Zlib.
   1.399 ++---------------------------------------------------------------------------
   1.400 +Index: file/system.h
   1.401 +--- file/system.h	24 Jan 2003 19:41:56 -0000	1.1.1.1
   1.402 ++++ file/system.h	6 Jun 2005 15:53:05 -0000	1.4
   1.403 +@@ -13,6 +13,9 @@
   1.404 + #endif
   1.405 + 
   1.406 + #include <sys/types.h>
   1.407 ++#ifdef HAVE_INTTYPES_H
   1.408 ++#include <inttypes.h>
   1.409 ++#endif
   1.410 + 
   1.411 + #include <sys/stat.h>
   1.412 + #include <stdio.h>
   1.413 +@@ -53,6 +56,8 @@
   1.414 + #else
   1.415 + #if HAVE_ERROR && HAVE_ERROR_H
   1.416 + #include <error.h>
   1.417 ++#else
   1.418 ++extern void error(int status, int errnum, const char *format, ...);
   1.419 + #endif
   1.420 + #endif
   1.421 + 
   1.422 +@@ -194,6 +199,7 @@
   1.423 + 
   1.424 + #ifdef HAVE_LIBZ
   1.425 + #include <zlib.h>
   1.426 ++#undef const
   1.427 + #endif
   1.428 + 
   1.429 + #ifndef HAVE_STRERROR
   1.430 +@@ -246,7 +252,11 @@
   1.431 +  */
   1.432 + /*@-shadow@*/
   1.433 + /*@unused@*/ /*@exits@*/ /*@only@*/
   1.434 ++#if defined(__GNUC__)
   1.435 + static inline void * vmefail(/*@unused@*/ size_t nb)
   1.436 ++#else
   1.437 ++static void * vmefail(/*@unused@*/ size_t nb)
   1.438 ++#endif
   1.439 + 	/*@globals fileSystem @*/
   1.440 + 	/*@modifies fileSystem @*/
   1.441 + {
   1.442 +@@ -286,9 +296,33 @@
   1.443 + 
   1.444 + #if !defined(__LCLINT__)
   1.445 + /* Memory allocation via macro defs to get meaningful locations from mtrace() */
   1.446 ++#if defined(__GNUC__)
   1.447 + #define	xmalloc(_size) 		(malloc(_size) ? : vmefail(0))
   1.448 + #define	xcalloc(_nmemb, _size)	(calloc((_nmemb), (_size)) ? : vmefail(0))
   1.449 + #define	xrealloc(_ptr, _size)	(realloc((_ptr), (_size)) ? : vmefail(0))
   1.450 ++#else
   1.451 ++static void *xmalloc(size_t size)
   1.452 ++{
   1.453 ++    void *vp = malloc(size);
   1.454 ++    if (vp == NULL)
   1.455 ++        vmefail(0);
   1.456 ++    return vp;
   1.457 ++}
   1.458 ++static void *xcalloc(size_t number, size_t size)
   1.459 ++{
   1.460 ++    void *vp = calloc(number, size);
   1.461 ++    if (vp == NULL)
   1.462 ++        vmefail(0);
   1.463 ++    return vp;
   1.464 ++}
   1.465 ++static void *xrealloc(void *ptr, size_t size)
   1.466 ++{
   1.467 ++    void *vp = realloc(ptr, size);
   1.468 ++    if (vp == NULL)
   1.469 ++        vmefail(0);
   1.470 ++    return vp;
   1.471 ++}
   1.472 ++#endif
   1.473 + #define	xstrdup(_str)	(strcpy(xmalloc(strlen(_str)+1), (_str)))
   1.474 + #endif
   1.475 + 
   1.476 +@@ -314,9 +348,14 @@
   1.477 + 
   1.478 + #if defined(__LCLINT__)
   1.479 + #define FILE_RCSID(id)
   1.480 +-#else
   1.481 ++#elif defined(__GNUC__)
   1.482 + #define FILE_RCSID(id) \
   1.483 + static inline const char *rcsid(const char *p) { \
   1.484 ++        return rcsid(p = id); \
   1.485 ++}
   1.486 ++#else
   1.487 ++#define FILE_RCSID(id) \
   1.488 ++static const char *rcsid(const char *p) { \
   1.489 + 	return rcsid(p = id); \
   1.490 + }
   1.491 + #endif
   1.492 +
   1.493 ++---------------------------------------------------------------------------
   1.494 +| Use GCC extensional features only if compiled with GCC.
   1.495 ++---------------------------------------------------------------------------
   1.496 +Index: file/file.h
   1.497 +--- file/file.h	24 Jan 2003 19:41:56 -0000	1.1.1.1
   1.498 ++++ file/file.h	22 Jan 2004 21:42:22 -0000	1.2
   1.499 +@@ -95,7 +95,11 @@
   1.500 + 	} value;		/* either number or string */
   1.501 + 	uint32_t mask;	/* mask before comparison with value */
   1.502 + 	char desc[MAXDESC];	/* description */
   1.503 ++#if defined(__GNUC__)
   1.504 + } __attribute__((__packed__));
   1.505 ++#else
   1.506 ++};
   1.507 ++#endif
   1.508 + 
   1.509 + #define BIT(A)   (1 << (A))
   1.510 + #define STRING_IGNORE_LOWERCASE		BIT(0)
   1.511 +
   1.512 ++---------------------------------------------------------------------------
   1.513 +| Add int32_t detection and automatic fallback support.
   1.514 ++---------------------------------------------------------------------------
   1.515 +Index: file/config.h.in
   1.516 +--- file/config.h.in	7 Mar 2003 19:39:18 -0000	1.1.1.1
   1.517 ++++ file/config.h.in	13 Sep 2006 13:40:49 -0000
   1.518 +@@ -106,6 +106,9 @@
   1.519 + /* Define to 1 if you have the <unistd.h> header file. */
   1.520 + #undef HAVE_UNISTD_H
   1.521 + 
   1.522 ++/* Define to 1 if you have the `vsnprintf' function. */
   1.523 ++#undef HAVE_VSNPRINTF
   1.524 ++
   1.525 + /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
   1.526 +    */
   1.527 + #undef MAJOR_IN_MKDEV
   1.528 +@@ -162,12 +165,16 @@
   1.529 + /* Define to empty if `const' does not conform to ANSI C. */
   1.530 + #undef const
   1.531 + 
   1.532 ++/* int32_t */
   1.533 ++#undef int32_t
   1.534 ++
   1.535 + /* Define to `long' if <sys/types.h> does not define. */
   1.536 + #undef off_t
   1.537 + 
   1.538 + /* Define to `unsigned' if <sys/types.h> does not define. */
   1.539 + #undef size_t
   1.540 + 
   1.541 ++#ifndef HAVE_STDINT_H
   1.542 + /* uint16_t */
   1.543 + #undef uint16_t
   1.544 + 
   1.545 +@@ -179,3 +186,4 @@
   1.546 + 
   1.547 + /* uint8_t */
   1.548 + #undef uint8_t
   1.549 ++#endif
   1.550 +
   1.551 ++---------------------------------------------------------------------------
   1.552 +| Add int32_t detection and automatic fallback support.
   1.553 ++---------------------------------------------------------------------------
   1.554 +Index: file/configure.ac
   1.555 +--- file/configure.ac	1 Dec 2002 21:34:06 -0000	1.1.1.1
   1.556 ++++ file/configure.ac	6 Jun 2005 15:53:05 -0000	1.2
   1.557 +@@ -92,6 +92,7 @@
   1.558 + AC_CHECK_TYPE_STDC(uint8_t, unsigned char)
   1.559 + AC_CHECK_TYPE_STDC(uint16_t, unsigned short)
   1.560 + AC_CHECK_TYPE_STDC(uint32_t, unsigned int)
   1.561 ++AC_CHECK_TYPE_STDC(int32_t, int)
   1.562 + AC_C_LONG_LONG
   1.563 + if test $ac_cv_c_long_long = yes; then
   1.564 +   long64='unsigned long long';
   1.565 +@@ -107,7 +108,7 @@
   1.566 + AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0)
   1.567 + 
   1.568 + dnl Checks for functions
   1.569 +-AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul)
   1.570 ++AC_CHECK_FUNCS(error mtrace mkstemp mmap strdup strerror strtoul vsnprintf)
   1.571 + 
   1.572 + dnl Checks for libraries
   1.573 + AC_CHECK_LIB(z, gzopen)
   1.574 +
   1.575 ++---------------------------------------------------------------------------
   1.576 +| Add int32_t detection and automatic fallback support.
   1.577 ++---------------------------------------------------------------------------
   1.578 +Index: file/configure
   1.579 +--- file/configure	16 Jul 2003 17:05:25 -0000	1.1.1.2
   1.580 ++++ file/configure	6 Jun 2005 15:53:05 -0000	1.2
   1.581 +@@ -10847,6 +10847,46 @@
   1.582 + 
   1.583 + fi
   1.584 + 
   1.585 ++echo "$as_me:$LINENO: checking for int32_t" >&5
   1.586 ++echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
   1.587 ++if test "${ac_cv_type_int32_t+set}" = set; then
   1.588 ++  echo $ECHO_N "(cached) $ECHO_C" >&6
   1.589 ++else
   1.590 ++  cat >conftest.$ac_ext <<_ACEOF
   1.591 ++#line $LINENO "configure"
   1.592 ++/* confdefs.h.  */
   1.593 ++_ACEOF
   1.594 ++cat confdefs.h >>conftest.$ac_ext
   1.595 ++cat >>conftest.$ac_ext <<_ACEOF
   1.596 ++/* end confdefs.h.  */
   1.597 ++#if HAVE_STDINT_H
   1.598 ++#include <stdint.h>
   1.599 ++#endif
   1.600 ++#include <sys/types.h>
   1.601 ++#if STDC_HEADERS
   1.602 ++#include <stdlib.h>
   1.603 ++#include <stddef.h>
   1.604 ++#endif
   1.605 ++_ACEOF
   1.606 ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   1.607 ++  $EGREP "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   1.608 ++  ac_cv_type_int32_t=yes
   1.609 ++else
   1.610 ++  ac_cv_type_int32_t=no
   1.611 ++fi
   1.612 ++rm -f conftest*
   1.613 ++
   1.614 ++fi
   1.615 ++echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
   1.616 ++echo "${ECHO_T}$ac_cv_type_int32_t" >&6
   1.617 ++if test $ac_cv_type_int32_t = no; then
   1.618 ++
   1.619 ++cat >>confdefs.h <<\_ACEOF
   1.620 ++#define int32_t int
   1.621 ++_ACEOF
   1.622 ++
   1.623 ++fi
   1.624 ++
   1.625 + echo "$as_me:$LINENO: checking for long long" >&5
   1.626 + echo $ECHO_N "checking for long long... $ECHO_C" >&6
   1.627 + if test "${ac_cv_c_long_long+set}" = set; then
   1.628 +@@ -11220,7 +11260,8 @@
   1.629 + 
   1.630 + 
   1.631 + 
   1.632 +-for ac_func in error mtrace mkstemp mmap strdup strerror strtoul
   1.633 ++
   1.634 ++for ac_func in error mtrace mkstemp mmap strdup strerror strtoul vsnprintf
   1.635 + do
   1.636 + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
   1.637 + echo "$as_me:$LINENO: checking for $ac_func" >&5
   1.638 +
   1.639 ++---------------------------------------------------------------------------
   1.640 +| Fallback to vsprintf(3) if vsnprintf(3) does not exist.
   1.641 ++---------------------------------------------------------------------------
   1.642 +Index: file/print.c
   1.643 +--- file/print.c	24 Jan 2003 19:41:56 -0000	1.1.1.1
   1.644 ++++ file/print.c	6 Jun 2005 15:53:05 -0000	1.2
   1.645 +@@ -187,7 +187,11 @@
   1.646 + 
   1.647 + 	va_start(va, f);
   1.648 + /*@-boundswrite@*/
   1.649 ++#ifdef HAVE_VSNPRINTF
   1.650 + 	rc = vsnprintf(fm->obp, fm->nob, f, va);
   1.651 ++#else
   1.652 ++	rc = vsprintf(fm->obp, f, va);
   1.653 ++#endif
   1.654 + /*@=boundswrite@*/
   1.655 + 	va_end(va);
   1.656 + 
   1.657 +
   1.658 ++---------------------------------------------------------------------------
   1.659 +| Use GNU libtool's weaker -static (link with own static libraries)
   1.660 +| instead of the strong -all-static (link even with static libc, etc),
   1.661 +| because OpenPKG does not need to be fully static.
   1.662 ++---------------------------------------------------------------------------
   1.663 +Index: rpmdb/Makefile.am
   1.664 +--- rpmdb/Makefile.am	2 Jul 2003 20:14:07 -0000	1.1.1.7
   1.665 ++++ rpmdb/Makefile.am	22 Jan 2004 21:42:29 -0000	1.2
   1.666 +@@ -18,7 +18,7 @@
   1.667 + EXTRA_PROGRAMS = tjfn
   1.668 + 
   1.669 + tjfn_SOURCES = tjfn.c
   1.670 +-tjfn_LDFLAGS = -all-static
   1.671 ++tjfn_LDFLAGS = -static
   1.672 + tjfn_LDADD = librpmdb.la
   1.673 + 
   1.674 + pkgincdir = $(pkgincludedir)
   1.675 +@@ -180,4 +180,4 @@
   1.676 + 	$(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
   1.677 + 
   1.678 + tdbi: librpmdb.la tdbi.o
   1.679 +-	$(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
   1.680 ++	$(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
   1.681 +
   1.682 ++---------------------------------------------------------------------------
   1.683 +| Use GNU libtool's weaker -static (link with own static libraries)
   1.684 +| instead of the strong -all-static (link even with static libc, etc),
   1.685 +| because OpenPKG does not need to be fully static.
   1.686 ++---------------------------------------------------------------------------
   1.687 +Index: rpmdb/Makefile.in
   1.688 +--- rpmdb/Makefile.in	16 Jul 2003 17:05:48 -0000	1.1.1.7
   1.689 ++++ rpmdb/Makefile.in	22 Jan 2004 21:42:29 -0000	1.2
   1.690 +@@ -273,7 +273,7 @@
   1.691 + EXTRA_PROGRAMS = tjfn
   1.692 + 
   1.693 + tjfn_SOURCES = tjfn.c
   1.694 +-tjfn_LDFLAGS = -all-static
   1.695 ++tjfn_LDFLAGS = -static
   1.696 + tjfn_LDADD = librpmdb.la
   1.697 + 
   1.698 + pkgincdir = $(pkgincludedir)
   1.699 +@@ -952,7 +952,7 @@
   1.700 + 	$(LINT) $(DEFS) $(INCLUDES) $(librpmdb_la_SOURCES)
   1.701 + 
   1.702 + tdbi: librpmdb.la tdbi.o
   1.703 +-	$(LINK) -all-static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
   1.704 ++	$(LINK) -static $@.o $< $(mylibpaths) $(mylibs) $(LIBS)
   1.705 + # Tell versions [3.59,3.63) of GNU make to not export all variables.
   1.706 + # Otherwise a system limit (for SysV at least) may be exceeded.
   1.707 + .NOEXPORT:
   1.708 +
   1.709 ++---------------------------------------------------------------------------
   1.710 +| Use GNU libtool's weaker -static (link with own static libraries)
   1.711 +| instead of the strong -all-static (link even with static libc, etc),
   1.712 +| because OpenPKG does not need to be fully static.
   1.713 ++---------------------------------------------------------------------------
   1.714 +Index: rpmio/Makefile.am
   1.715 +--- rpmio/Makefile.am	5 Jun 2003 12:05:23 -0000	1.1.1.9
   1.716 ++++ rpmio/Makefile.am	22 Jan 2004 21:42:31 -0000	1.2
   1.717 +@@ -68,27 +68,27 @@
   1.718 + tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.719 + 
   1.720 + tdir_SOURCES = tdir.c
   1.721 +-tdir_LDFLAGS = -all-static
   1.722 ++tdir_LDFLAGS = -static
   1.723 + tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.724 + 
   1.725 + tfts_SOURCES = tfts.c
   1.726 +-tfts_LDFLAGS = -all-static
   1.727 ++tfts_LDFLAGS = -static
   1.728 + tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.729 + 
   1.730 + tglob_SOURCES = tglob.c
   1.731 +-tglob_LDFLAGS = -all-static
   1.732 ++tglob_LDFLAGS = -static
   1.733 + tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.734 + 
   1.735 + tinv_SOURCES = tinv.c
   1.736 +-tinv_LDFLAGS = -all-static
   1.737 ++tinv_LDFLAGS = -static
   1.738 + tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.739 + 
   1.740 + tkey_SOURCES = tkey.c
   1.741 +-tkey_LDFLAGS = -all-static
   1.742 ++tkey_LDFLAGS = -static
   1.743 + tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.744 + 
   1.745 + tring_SOURCES = tring.c
   1.746 +-tring_LDFLAGS = -all-static
   1.747 ++tring_LDFLAGS = -static
   1.748 + tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.749 + 
   1.750 + trpmio_SOURCES = trpmio.c
   1.751 +
   1.752 ++---------------------------------------------------------------------------
   1.753 +| Use GNU libtool's weaker -static (link with own static libraries)
   1.754 +| instead of the strong -all-static (link even with static libc, etc),
   1.755 +| because OpenPKG does not need to be fully static.
   1.756 +| Additionally, remove hard-coded Linux'ism of linking against POSIX
   1.757 +| rt/pthread libraries (is not needed even under Linux itself) and
   1.758 +| make sure the build does not break by an empty argument list when
   1.759 +| iterating over (the not existing) BeeCrypt objects.
   1.760 ++---------------------------------------------------------------------------
   1.761 +Index: rpmio/Makefile.in
   1.762 +--- rpmio/Makefile.in	16 Jul 2003 17:05:49 -0000	1.1.1.9
   1.763 ++++ rpmio/Makefile.in	22 Jan 2004 21:42:31 -0000	1.2
   1.764 +@@ -288,8 +288,7 @@
   1.765 + librpmio_la_LDFLAGS = -release 4.2 \
   1.766 + 	@WITH_BEECRYPT_LIB@ \
   1.767 + 	$(top_builddir)/file/libfmagic.la \
   1.768 +-	@WITH_ZLIB_LIB@ \
   1.769 +-	-lrt -lpthread
   1.770 ++	@WITH_ZLIB_LIB@
   1.771 + 
   1.772 + librpmio_la_LIBADD = $(BEECRYPTLOBJS)
   1.773 + librpmio_la_DEPENDENCIES = .created
   1.774 +@@ -298,27 +297,27 @@
   1.775 + tdigest_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.776 + 
   1.777 + tdir_SOURCES = tdir.c
   1.778 +-tdir_LDFLAGS = -all-static
   1.779 ++tdir_LDFLAGS = -static
   1.780 + tdir_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.781 + 
   1.782 + tfts_SOURCES = tfts.c
   1.783 +-tfts_LDFLAGS = -all-static
   1.784 ++tfts_LDFLAGS = -static
   1.785 + tfts_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.786 + 
   1.787 + tglob_SOURCES = tglob.c
   1.788 +-tglob_LDFLAGS = -all-static
   1.789 ++tglob_LDFLAGS = -static
   1.790 + tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.791 + 
   1.792 + tinv_SOURCES = tinv.c
   1.793 +-tinv_LDFLAGS = -all-static
   1.794 ++tinv_LDFLAGS = -static
   1.795 + tinv_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.796 + 
   1.797 + tkey_SOURCES = tkey.c
   1.798 +-tkey_LDFLAGS = -all-static
   1.799 ++tkey_LDFLAGS = -static
   1.800 + tkey_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.801 + 
   1.802 + tring_SOURCES = tring.c
   1.803 +-tring_LDFLAGS = -all-static
   1.804 ++tring_LDFLAGS = -static
   1.805 + tring_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   1.806 + 
   1.807 + trpmio_SOURCES = trpmio.c
   1.808 +@@ -743,8 +742,8 @@
   1.809 + .created:
   1.810 + 	if test X"@WITH_BEECRYPT_SUBDIR@" != X; then \
   1.811 + 	${MAKE} -C $(top_builddir)/@WITH_BEECRYPT_SUBDIR@ listobjs ; \
   1.812 +-	for lo in $(BEECRYPTLOBJS); do \
   1.813 +-	  [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
   1.814 ++	for lo in $(BEECRYPTLOBJS) ''; do \
   1.815 ++	  [ ".$$lo" = . ] || [ -f $$lo ] || $(LN_S) $(top_builddir)/@WITH_BEECRYPT_SUBDIR@/$$lo $$lo ; \
   1.816 + 	done \
   1.817 + 	fi
   1.818 + 	touch $@
   1.819 +
   1.820 ++---------------------------------------------------------------------------
   1.821 +| Add Unixware support.
   1.822 ++---------------------------------------------------------------------------
   1.823 +Index: rpmio/fts.h
   1.824 +--- rpmio/fts.h	18 Jan 2003 16:13:17 -0000	1.1.1.3
   1.825 ++++ rpmio/fts.h	22 Jan 2004 21:42:32 -0000	1.2
   1.826 +@@ -51,7 +51,7 @@
   1.827 + # define	_LARGEFILE64_SOURCE
   1.828 + #endif
   1.829 + 
   1.830 +-#if defined(sun)
   1.831 ++#if defined(sun) || defined(OPENPKG_UNIXWARE)
   1.832 + # define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
   1.833 + #endif
   1.834 + 
   1.835 +
   1.836 ++---------------------------------------------------------------------------
   1.837 +| Add FreeBSD/NetBSD/OpenBSD support.
   1.838 +| Workaround some GCC'isms.
   1.839 ++---------------------------------------------------------------------------
   1.840 +Index: rpmio/fts.c
   1.841 +--- rpmio/fts.c	18 Jan 2003 16:13:17 -0000	1.1.1.3
   1.842 ++++ rpmio/fts.c	8 Jun 2005 13:16:25 -0000	1.5
   1.843 +@@ -34,6 +34,8 @@
   1.844 + static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
   1.845 + #endif /* LIBC_SCCS and not lint */
   1.846 + 
   1.847 ++#include <limits.h>
   1.848 ++
   1.849 + #if defined(_LIBC)
   1.850 + #include <sys/param.h>
   1.851 + #include <include/sys/stat.h>
   1.852 +@@ -45,20 +47,49 @@
   1.853 + #include <string.h>
   1.854 + #include <unistd.h>
   1.855 + #else
   1.856 +-#if defined(hpux)
   1.857 ++#if defined(OPENPKG_HPUX)
   1.858 + # define        _INCLUDE_POSIX_SOURCE
   1.859 + #   define __errno_location() 	(&errno)
   1.860 + #   define dirfd(dirp)		-1
   1.861 + #   define stat64		stat
   1.862 + #   define _STAT_VER		0
   1.863 + #   define __fxstat64(_stat_ver, _fd, _sbp)	fstat((_fd), (_sbp))
   1.864 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
   1.865 + #endif
   1.866 +-#if defined(sun)
   1.867 ++#if defined(sun) || defined(OPENPKG_UNIXWARE)
   1.868 + #   define __errno_location()	(&errno)
   1.869 + #   define dirfd(dirp)		-1
   1.870 + #   define _STAT_VER		0
   1.871 + #   define __fxstat64(_stat_ver, _fd, _sbp)	fstat((_fd), (_sbp))
   1.872 + #endif
   1.873 ++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
   1.874 ++#   define __errno_location()	(&errno)
   1.875 ++#   define stat64 stat
   1.876 ++#   define _STAT_VER		0
   1.877 ++#   define __fxstat64(_stat_ver, _fd, _sbp)	fstat((_fd), (_sbp))
   1.878 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
   1.879 ++#endif
   1.880 ++#if defined(__osf__)
   1.881 ++#   define __errno_location()   (&errno)
   1.882 ++#   define dirfd(dirp)          -1
   1.883 ++#   define stat64               stat
   1.884 ++#   define _STAT_VER            0
   1.885 ++#   define __fxstat64(_stat_ver, _fd, _sbp)     fstat((_fd), (_sbp))
   1.886 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
   1.887 ++#endif
   1.888 ++#if defined(OPENPKG_IRIX64)
   1.889 ++#   define __errno_location()   (&errno)
   1.890 ++#   define dirfd(dirp)          -1
   1.891 ++#   define __fxstat64(_stat_ver, _fd, _sbp)     fstat((_fd), (_sbp))
   1.892 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_reclen)
   1.893 ++#endif
   1.894 ++#if defined(OPENPKG_AIX)
   1.895 ++#   define __errno_location()   (&errno)
   1.896 ++#   define _STAT_VER            0
   1.897 ++#   define dirfd(dirp)          ((dirp)->dd_fd)
   1.898 ++#   define __fxstat64(_stat_ver, _fd, _sbp)     fstat((_fd), (_sbp))
   1.899 ++#   define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
   1.900 ++#endif
   1.901 + #include "system.h"
   1.902 + #include "fts.h"
   1.903 + #include "rpmio.h"
   1.904 +@@ -73,7 +104,12 @@
   1.905 + /* Largest alignment size needed, minus one.
   1.906 +    Usually long double is the worst case.  */
   1.907 + #ifndef ALIGNBYTES
   1.908 ++#if defined(__GNUC__)
   1.909 + #define ALIGNBYTES	(__alignof__ (long double) - 1)
   1.910 ++#else
   1.911 ++/* not accurate enough (usually too large), but sufficient (and this way equal safe) */
   1.912 ++#define ALIGNBYTES	(sizeof (long double) - 1)
   1.913 ++#endif
   1.914 + #endif
   1.915 + /* Align P to that size.  */
   1.916 + #ifndef ALIGN
   1.917 +@@ -107,9 +143,13 @@
   1.918 + 	/*@modifies fileSystem, internalState @*/;
   1.919 + 
   1.920 + #ifndef MAX
   1.921 ++#if defined(__GNUC__)
   1.922 + #define MAX(a, b)	({ __typeof__ (a) _a = (a); \
   1.923 + 			   __typeof__ (b) _b = (b); \
   1.924 + 			   _a > _b ? _a : _b; })
   1.925 ++#else
   1.926 ++#define MAX(a, b)   ((a) > (b) ? (a) : (b))
   1.927 ++#endif
   1.928 + #endif
   1.929 + 
   1.930 + #define	ISDOT(a)	(a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
   1.931 +
   1.932 ++---------------------------------------------------------------------------
   1.933 +| Remove inclusion of system <glob.h> because RPM uses its own glob(3)
   1.934 +| implementation and this can conflict with the system one.
   1.935 ++---------------------------------------------------------------------------
   1.936 +Index: rpmio/rpmio.h
   1.937 +--- rpmio/rpmio.h	12 Jun 2003 18:22:18 -0000	1.1.1.7
   1.938 ++++ rpmio/rpmio.h	22 Jan 2004 21:42:33 -0000	1.2
   1.939 +@@ -9,9 +9,6 @@
   1.940 + #include <sys/types.h>
   1.941 + #include <sys/stat.h>
   1.942 + #include <dirent.h>
   1.943 +-/*@-noparams@*/
   1.944 +-#include <glob.h>
   1.945 +-/*@=noparams@*/
   1.946 + #include <stdio.h>
   1.947 + #include <stdlib.h>
   1.948 + #include <unistd.h>
   1.949 +
   1.950 ++---------------------------------------------------------------------------
   1.951 +| Make this whole "dirent" fiddling at least working on
   1.952 +| FreeBSD/NetBSD/OpenBSD, Solaris, HPUX and Unixware. This certainly
   1.953 +| is a bad corner of RPM which inherently leads to portability
   1.954 +| problems.
   1.955 ++---------------------------------------------------------------------------
   1.956 +Index: rpmio/rpmrpc.c
   1.957 +--- rpmio/rpmrpc.c	29 May 2003 22:14:04 -0000	1.1.1.8
   1.958 ++++ rpmio/rpmrpc.c	8 Jun 2005 13:16:26 -0000	1.5
   1.959 +@@ -1079,6 +1079,8 @@
   1.960 +     return rc;
   1.961 + }
   1.962 + 
   1.963 ++#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_DARWIN)
   1.964 ++
   1.965 + struct __dirstream {
   1.966 +     int fd;			/* File descriptor.  */
   1.967 +     char * data;		/* Directory block.  */
   1.968 +@@ -1091,6 +1093,8 @@
   1.969 + #endif
   1.970 + };
   1.971 + 
   1.972 ++#endif
   1.973 ++
   1.974 + #if !defined(DT_DIR)
   1.975 + # define DT_UNKNOWN	0
   1.976 + # define DT_FIFO	1
   1.977 +@@ -1101,14 +1105,30 @@
   1.978 + # define DT_LNK		10
   1.979 + # define DT_SOCK	12
   1.980 + # define DT_WHT		14
   1.981 +-typedef struct __dirstream *	FTPDIR;
   1.982 +-#else
   1.983 +-typedef DIR *			FTPDIR;
   1.984 + #endif
   1.985 + 
   1.986 ++struct mydirstreament {
   1.987 ++    unsigned char type;
   1.988 ++    char *name;
   1.989 ++};
   1.990 ++struct mydirstream {
   1.991 ++    DIR dir;
   1.992 ++    struct dirent ent;
   1.993 ++    unsigned int offset;
   1.994 ++    unsigned int size;
   1.995 ++    struct mydirstreament av[1];
   1.996 ++};
   1.997 ++typedef struct mydirstream *FTPDIR;
   1.998 ++
   1.999 + /*@unchecked@*/
  1.1000 + static int ftpmagicdir = 0x8440291;
  1.1001 +-#define	ISFTPMAGIC(_dir) (!memcmp((_dir), &ftpmagicdir, sizeof(ftpmagicdir)))
  1.1002 ++#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sun) && !defined(OPENPKG_UNIXWARE) && !defined(OPENPKG_DARWIN) && !defined(__osf__) && !defined(OPENPKG_IRIX64) && !defined(OPENPKG_HPUX) && !defined(OPENPKG_AIX)
  1.1003 ++#define SETFTPMAGIC(_dir) ((_dir)->fd) = ftpmagicdir
  1.1004 ++#define ISFTPMAGIC(_dir) ((_dir)->fd == ftpmagicdir)
  1.1005 ++#else
  1.1006 ++#define SETFTPMAGIC(_dir) ((_dir)->dd_fd) = ftpmagicdir
  1.1007 ++#define ISFTPMAGIC(_dir) ((_dir)->dd_fd == ftpmagicdir)
  1.1008 ++#endif
  1.1009 + 
  1.1010 + /*@-boundswrite@*/
  1.1011 + /*@-type@*/ /* FIX: abstract DIR */
  1.1012 +@@ -1121,8 +1141,7 @@
  1.1013 +     struct dirent * dp;
  1.1014 +     size_t nb;
  1.1015 +     const char * s, * sb, * se;
  1.1016 +-    const char ** av;
  1.1017 +-    unsigned char * dt;
  1.1018 ++    struct mydirstreament * av;
  1.1019 +     char * t;
  1.1020 +     int ac;
  1.1021 +     int c;
  1.1022 +@@ -1165,28 +1184,22 @@
  1.1023 + 	}
  1.1024 +     }
  1.1025 + 
  1.1026 +-    nb += sizeof(*mydir) + sizeof(*dp) + ((ac + 1) * sizeof(*av)) + (ac + 1);
  1.1027 ++    nb = sizeof(*mydir) + (ac * sizeof(*av)) + nb;
  1.1028 +     mydir = xcalloc(1, nb);
  1.1029 +     /*@-abstract@*/
  1.1030 +-    dp = (struct dirent *) (mydir + 1);
  1.1031 +-    av = (const char **) (dp + 1);
  1.1032 +-    dt = (char *) (av + (ac + 1));
  1.1033 +-    t = (char *) (dt + ac + 1);
  1.1034 ++    dp = &mydir->ent;
  1.1035 ++    av = &mydir->av[0];
  1.1036 ++    t  = (char *)&mydir->av[ac+1];
  1.1037 +     /*@=abstract@*/
  1.1038 + 
  1.1039 +-    mydir->fd = ftpmagicdir;
  1.1040 +-/*@-usereleased@*/
  1.1041 +-    mydir->data = (char *) dp;
  1.1042 +-/*@=usereleased@*/
  1.1043 +-    mydir->allocation = nb;
  1.1044 +-    mydir->size = ac;
  1.1045 +-    mydir->offset = -1;
  1.1046 +-    mydir->filepos = 0;
  1.1047 ++    SETFTPMAGIC((DIR *)mydir);
  1.1048 ++    mydir->size   = ac;
  1.1049 ++    mydir->offset = 0;
  1.1050 + 
  1.1051 +     ac = 0;
  1.1052 +     /*@-dependenttrans -unrecog@*/
  1.1053 +-    dt[ac] = DT_DIR;	av[ac++] = t;	t = stpcpy(t, ".");	t++;
  1.1054 +-    dt[ac] = DT_DIR;	av[ac++] = t;	t = stpcpy(t, "..");	t++;
  1.1055 ++    av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".");  ++ac;
  1.1056 ++    av[ac].type = DT_DIR; av[ac].name = t; t = stpcpy(t, ".."); ++ac;
  1.1057 +     /*@=dependenttrans =unrecog@*/
  1.1058 +     sb = NULL;
  1.1059 +     s = se = ftpBuf;
  1.1060 +@@ -1198,34 +1211,34 @@
  1.1061 + 	    /*@switchbreak@*/ break;
  1.1062 + 	case '\r':
  1.1063 + 	    /*@-dependenttrans@*/
  1.1064 +-	    av[ac] = t;
  1.1065 ++	    av[ac].name = t;
  1.1066 + 	    /*@=dependenttrans@*/
  1.1067 + 	    if (sb == NULL) {
  1.1068 + 		/*@-unrecog@*/
  1.1069 + 		switch(*s) {
  1.1070 + 		case 'p':
  1.1071 +-		    dt[ac] = DT_FIFO;
  1.1072 ++		    av[ac].type = DT_FIFO;
  1.1073 + 		    /*@innerbreak@*/ break;
  1.1074 + 		case 'c':
  1.1075 +-		    dt[ac] = DT_CHR;
  1.1076 ++		    av[ac].type = DT_CHR;
  1.1077 + 		    /*@innerbreak@*/ break;
  1.1078 + 		case 'd':
  1.1079 +-		    dt[ac] = DT_DIR;
  1.1080 ++		    av[ac].type = DT_DIR;
  1.1081 + 		    /*@innerbreak@*/ break;
  1.1082 + 		case 'b':
  1.1083 +-		    dt[ac] = DT_BLK;
  1.1084 ++		    av[ac].type = DT_BLK;
  1.1085 + 		    /*@innerbreak@*/ break;
  1.1086 + 		case '-':
  1.1087 +-		    dt[ac] = DT_REG;
  1.1088 ++		    av[ac].type = DT_REG;
  1.1089 + 		    /*@innerbreak@*/ break;
  1.1090 + 		case 'l':
  1.1091 +-		    dt[ac] = DT_LNK;
  1.1092 ++		    av[ac].type = DT_LNK;
  1.1093 + 		    /*@innerbreak@*/ break;
  1.1094 + 		case 's':
  1.1095 +-		    dt[ac] = DT_SOCK;
  1.1096 ++		    av[ac].type = DT_SOCK;
  1.1097 + 		    /*@innerbreak@*/ break;
  1.1098 + 		default:
  1.1099 +-		    dt[ac] = DT_UNKNOWN;
  1.1100 ++		    av[ac].type = DT_UNKNOWN;
  1.1101 + 		    /*@innerbreak@*/ break;
  1.1102 + 		}
  1.1103 + 		/*@=unrecog@*/
  1.1104 +@@ -1243,7 +1256,7 @@
  1.1105 + 	    /*@switchbreak@*/ break;
  1.1106 + 	}
  1.1107 +     }
  1.1108 +-    av[ac] = NULL;
  1.1109 ++    av[ac].name = NULL;
  1.1110 + 
  1.1111 + /*@-kepttrans@*/
  1.1112 +     return (DIR *) mydir;
  1.1113 +@@ -1258,43 +1271,50 @@
  1.1114 + {
  1.1115 +     FTPDIR mydir = (FTPDIR)dir;
  1.1116 +     struct dirent * dp;
  1.1117 +-    const char ** av;
  1.1118 +-    unsigned char * dt;
  1.1119 ++    struct mydirstreament * av;
  1.1120 +     int ac;
  1.1121 +     int i;
  1.1122 + 
  1.1123 +     /*@+voidabstract@*/
  1.1124 +-    if (mydir == NULL || !ISFTPMAGIC(mydir) || mydir->data == NULL) {
  1.1125 ++    if (dir == NULL || !ISFTPMAGIC(dir)) {
  1.1126 + 	/* XXX TODO: EBADF errno. */
  1.1127 + 	return NULL;
  1.1128 +     }
  1.1129 +     /*@=voidabstract@*/
  1.1130 + 
  1.1131 +-    dp = (struct dirent *) mydir->data;
  1.1132 +-    av = (const char **) (dp + 1);
  1.1133 ++    dp = &mydir->ent;
  1.1134 ++    av = &mydir->av[0];
  1.1135 +     ac = mydir->size;
  1.1136 +-    dt = (char *) (av + (ac + 1));
  1.1137 +-    i = mydir->offset + 1;
  1.1138 ++    i  = mydir->offset + 1;
  1.1139 + 
  1.1140 + /*@-boundsread@*/
  1.1141 +-    if (i < 0 || i >= ac || av[i] == NULL)
  1.1142 ++    if (i < 0 || i >= ac || av[i].name == NULL)
  1.1143 + 	return NULL;
  1.1144 + /*@=boundsread@*/
  1.1145 + 
  1.1146 +     mydir->offset = i;
  1.1147 + 
  1.1148 ++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENPKG_DARWIN)
  1.1149 ++    dp->d_ino = i + 1;
  1.1150 ++    dp->d_reclen = 0;
  1.1151 ++    dp->d_type = av[i].type;
  1.1152 ++    strncpy(dp->d_name, av[i].name, sizeof(dp->d_name) - 1);
  1.1153 ++    dp->d_name[sizeof(dp->d_name)-1] = '\0';
  1.1154 ++    dp->d_namlen = strlen(dp->d_name);
  1.1155 ++#elif defined(OPENPKG_HPUX) || defined(sun) || defined(OPENPKG_UNIXWARE) || defined(__osf__) || defined(OPENPKG_IRIX64) || defined(OPENPKG_AIX)
  1.1156 ++    /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
  1.1157 ++    dp->d_ino = i + 1;		/* W2DO? */
  1.1158 ++    dp->d_reclen = 0;		/* W2DO? */
  1.1159 ++    strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
  1.1160 ++#else
  1.1161 +     /* XXX glob(3) uses REAL_DIR_ENTRY(dp) test on d_ino */
  1.1162 +     dp->d_ino = i + 1;		/* W2DO? */
  1.1163 +     dp->d_reclen = 0;		/* W2DO? */
  1.1164 +-
  1.1165 +-#if !defined(hpux) && !defined(sun)
  1.1166 +     dp->d_off = 0;		/* W2DO? */
  1.1167 +-/*@-boundsread@*/
  1.1168 +-    dp->d_type = dt[i];
  1.1169 +-/*@=boundsread@*/
  1.1170 ++    dp->d_type = av[i].type;
  1.1171 ++    strncpy(dp->d_name, av[i].name, sizeof(dp->d_name));
  1.1172 + #endif
  1.1173 + 
  1.1174 +-    strncpy(dp->d_name, av[i], sizeof(dp->d_name));
  1.1175 + /*@+voidabstract@*/
  1.1176 + if (_ftp_debug)
  1.1177 + fprintf(stderr, "*** ftpReaddir(%p) %p \"%s\"\n", (void *)mydir, dp, dp->d_name);
  1.1178 +@@ -1313,7 +1333,7 @@
  1.1179 +     /*@+voidabstract@*/
  1.1180 + if (_ftp_debug)
  1.1181 + fprintf(stderr, "*** ftpClosedir(%p)\n", (void *)mydir);
  1.1182 +-    if (mydir == NULL || !ISFTPMAGIC(mydir)) {
  1.1183 ++    if (dir == NULL || !ISFTPMAGIC(dir)) {
  1.1184 + 	/* XXX TODO: EBADF errno. */
  1.1185 + 	return -1;
  1.1186 +     }
  1.1187 +
  1.1188 ++---------------------------------------------------------------------------
  1.1189 +| Remove inclusion of ancient (and since years deprecated) <malloc.h>
  1.1190 +| header. This especially makes sure RPM build does not break on
  1.1191 +| strict platforms like FreeBSD 5.
  1.1192 ++---------------------------------------------------------------------------
  1.1193 +Index: system.h
  1.1194 +--- system.h	1 Mar 2003 19:53:08 -0000	1.1.1.10
  1.1195 ++++ system.h	8 Jun 2005 13:15:16 -0000	1.4
  1.1196 +@@ -256,10 +256,6 @@
  1.1197 + #include <err.h>
  1.1198 + #endif
  1.1199 + 
  1.1200 +-#if HAVE_MALLOC_H && !defined(__LCLINT__)
  1.1201 +-#include <malloc.h>
  1.1202 +-#endif
  1.1203 +-
  1.1204 + /*@-declundef -incondefs @*/ /* FIX: these are macros */
  1.1205 + /**
  1.1206 +  */
  1.1207 +
  1.1208 ++---------------------------------------------------------------------------
  1.1209 +| Add support for BSD getmntinfo(3).
  1.1210 ++---------------------------------------------------------------------------
  1.1211 +Index: system.h
  1.1212 +--- system.h	1 Mar 2003 19:53:08 -0000	1.1.1.10
  1.1213 ++++ system.h	8 Jun 2005 13:15:16 -0000	1.4
  1.1214 +@@ -550,7 +546,7 @@
  1.1215 + #define lchown chown
  1.1216 + #endif
  1.1217 + 
  1.1218 +-#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
  1.1219 ++#if HAVE_GETMNTINFO_R || HAVE_GETMNTINFO || HAVE_MNTCTL
  1.1220 + # define GETMNTENT_ONE 0
  1.1221 + # define GETMNTENT_TWO 0
  1.1222 + # if HAVE_SYS_MNTCTL_H
  1.1223 +
  1.1224 ++---------------------------------------------------------------------------
  1.1225 +| Drop GCC "inline" attribute if not compiling with GCC.
  1.1226 ++---------------------------------------------------------------------------
  1.1227 +Index: system.h
  1.1228 +--- system.h	1 Mar 2003 19:53:08 -0000	1.1.1.10
  1.1229 ++++ system.h	8 Jun 2005 13:15:16 -0000	1.4
  1.1230 +@@ -603,11 +599,24 @@
  1.1231 + 
  1.1232 + #if defined(__LCLINT__)
  1.1233 + #define FILE_RCSID(id)
  1.1234 +-#else
  1.1235 ++#elif defined(__GNUC__)
  1.1236 + #define FILE_RCSID(id) \
  1.1237 + static inline const char *rcsid(const char *p) { \
  1.1238 +         return rcsid(p = id); \
  1.1239 + }
  1.1240 ++#else
  1.1241 ++#define FILE_RCSID(id) \
  1.1242 ++static const char *rcsid(const char *p) { \
  1.1243 ++        return rcsid(p = id); \
  1.1244 ++}
  1.1245 ++#endif
  1.1246 ++
  1.1247 ++/* for basename(3) and dirname(3) */
  1.1248 ++#if !defined(OPENPKG_AIX)
  1.1249 ++#include <libgen.h>
  1.1250 ++#endif
  1.1251 ++#if defined(OPENPKG_AIX)
  1.1252 ++#define unsetenv(x) /* unsetenv() is used in RPM just for malloc debugging purposes */
  1.1253 + #endif
  1.1254 + 
  1.1255 + #endif	/* H_SYSTEM */
  1.1256 +
  1.1257 ++---------------------------------------------------------------------------
  1.1258 +| Remove GCC'ism.
  1.1259 ++---------------------------------------------------------------------------
  1.1260 +Index: build/rpmfile.h
  1.1261 +--- build/rpmfile.h	24 Jan 2003 19:41:56 -0000	1.1.1.1
  1.1262 ++++ build/rpmfile.h	22 Jan 2004 21:42:14 -0000	1.2
  1.1263 +@@ -95,7 +95,11 @@
  1.1264 + 	} value;		/* either number or string */
  1.1265 + 	uint32_t mask;	/* mask before comparison with value */
  1.1266 + 	char desc[MAXDESC];	/* description */
  1.1267 ++#if defined(__GNUC__)
  1.1268 + } __attribute__((__packed__));
  1.1269 ++#else
  1.1270 ++};
  1.1271 ++#endif
  1.1272 + 
  1.1273 + #define BIT(A)   (1 << (A))
  1.1274 + #define STRING_IGNORE_LOWERCASE		BIT(0)
  1.1275 +
  1.1276 ++---------------------------------------------------------------------------
  1.1277 +| Better portability for madvise(2) usage.
  1.1278 ++---------------------------------------------------------------------------
  1.1279 +Index: rpmdb/legacy.c
  1.1280 +--- rpmdb/legacy.c	18 Dec 2002 22:40:19 -0000	1.1.1.4
  1.1281 ++++ rpmdb/legacy.c	22 Jan 2004 21:42:30 -0000	1.2
  1.1282 +@@ -182,7 +182,7 @@
  1.1283 + 	    break;
  1.1284 + 	}
  1.1285 + 
  1.1286 +-#ifdef	MADV_SEQUENTIAL
  1.1287 ++#if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL)
  1.1288 +         xx = madvise(mapped, fsize, MADV_SEQUENTIAL);
  1.1289 + #endif
  1.1290 + 
  1.1291 +
  1.1292 ++---------------------------------------------------------------------------
  1.1293 +| Better portability for madvise(2) usage.
  1.1294 ++---------------------------------------------------------------------------
  1.1295 +Index: lib/fsm.c
  1.1296 +--- lib/fsm.c	3 Mar 2003 21:28:12 -0000	1.1.1.5
  1.1297 ++++ lib/fsm.c	22 Jan 2004 21:42:23 -0000	1.2
  1.1298 +@@ -879,7 +879,7 @@
  1.1299 + 	    rdbuf = fsm->rdbuf;
  1.1300 + 	    fsm->rdbuf = (char *) mapped;
  1.1301 + 	    fsm->rdlen = nmapped = st->st_size;
  1.1302 +-#if defined(MADV_DONTNEED)
  1.1303 ++#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
  1.1304 + 	    xx = madvise(mapped, nmapped, MADV_DONTNEED);
  1.1305 + #endif
  1.1306 + 	}
  1.1307 +@@ -909,7 +909,7 @@
  1.1308 + #if HAVE_MMAP
  1.1309 + 	if (mapped != (void *)-1) {
  1.1310 + 	    xx = msync(mapped, nmapped, MS_ASYNC);
  1.1311 +-#if defined(MADV_DONTNEED)
  1.1312 ++#if defined(HAVE_MADVISE) && defined(MADV_DONTNEED)
  1.1313 + 	    xx = madvise(mapped, nmapped, MADV_DONTNEED);
  1.1314 + #endif
  1.1315 + 	    /*@-noeffect@*/ xx = munmap(mapped, nmapped) /*@=noeffect@*/;
  1.1316 +
  1.1317 ++---------------------------------------------------------------------------
  1.1318 +| Support UnixWare 7.1.3 and OpenDarwin 6.6.2, too.
  1.1319 ++---------------------------------------------------------------------------
  1.1320 +Index: aclocal.m4
  1.1321 +--- aclocal.m4	16 Jul 2003 17:05:28 -0000	1.1.1.10
  1.1322 ++++ aclocal.m4	6 Jun 2005 15:53:03 -0000	1.4
  1.1323 +@@ -2838,7 +2838,7 @@
  1.1324 +     runpath_var=LD_RUN_PATH
  1.1325 +     ;;
  1.1326 + 
  1.1327 +-  sysv5uw7* | unixware7*)
  1.1328 ++  sysv5uw7* | unixware7* | sysv5UnixWare7* )
  1.1329 +     no_undefined_flag='${wl}-z ${wl}text'
  1.1330 +     if test "$GCC" = yes; then
  1.1331 +       archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
  1.1332 +@@ -4311,6 +4311,7 @@
  1.1333 +     ;;
  1.1334 +   *) # Darwin 1.3 on
  1.1335 +     lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
  1.1336 ++    lt_cv_deplibs_check_method=pass_all
  1.1337 +     ;;
  1.1338 +   esac
  1.1339 +   ;;
  1.1340 +@@ -4336,7 +4337,7 @@
  1.1341 +   ;;
  1.1342 + 
  1.1343 + hpux10.20*|hpux11*)
  1.1344 +-  lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
  1.1345 ++  lt_cv_deplibs_check_method='pass_all'
  1.1346 +   lt_cv_file_magic_cmd=/usr/bin/file
  1.1347 +   lt_cv_file_magic_test_file=/usr/lib/libc.sl
  1.1348 +   ;;
  1.1349 +@@ -4375,11 +4376,7 @@
  1.1350 +   ;;
  1.1351 + 
  1.1352 + netbsd*)
  1.1353 +-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
  1.1354 +-    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
  1.1355 +-  else
  1.1356 +-    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
  1.1357 +-  fi
  1.1358 ++  lt_cv_deplibs_check_method='pass_all'
  1.1359 +   ;;
  1.1360 + 
  1.1361 + newos6*)
  1.1362 +@@ -4414,7 +4411,7 @@
  1.1363 +   lt_cv_file_magic_test_file=/lib/libc.so
  1.1364 +   ;;
  1.1365 + 
  1.1366 +-sysv5uw[[78]]* | sysv4*uw2*)
  1.1367 ++sysv5uw[[78]]* | sysv4*uw2* | sysv5UnixWare7* )
  1.1368 +   lt_cv_deplibs_check_method=pass_all
  1.1369 +   ;;
  1.1370 + 
  1.1371 +
  1.1372 ++---------------------------------------------------------------------------
  1.1373 +| Use Linux i386 assembly specific stuff on Linux only.
  1.1374 ++---------------------------------------------------------------------------
  1.1375 +Index: rpmio/rpmsw.c
  1.1376 +--- rpmio/rpmsw.c	5 Jun 2003 12:04:05 -0000	1.1.1.1
  1.1377 ++++ rpmio/rpmsw.c	22 Jan 2004 21:42:33 -0000	1.2
  1.1378 +@@ -27,7 +27,7 @@
  1.1379 + /*@unchecked@*/
  1.1380 + static int rpmsw_initialized = 0;
  1.1381 + 
  1.1382 +-#if defined(__i386__)
  1.1383 ++#if defined(__linux__) && defined(__i386__)
  1.1384 + /* Swiped from glibc-2.3.2 sysdeps/i386/i686/hp-timing.h */
  1.1385 + 
  1.1386 + #define	HP_TIMING_ZERO(Var)	(Var) = (0)
  1.1387 +
  1.1388 ++---------------------------------------------------------------------------
  1.1389 +| Fix "environ" declaration.
  1.1390 ++---------------------------------------------------------------------------
  1.1391 +Index: lib/signature.c
  1.1392 +--- lib/signature.c	29 May 2003 18:42:23 -0000	1.1.1.23
  1.1393 ++++ lib/signature.c	22 Jan 2004 21:42:25 -0000	1.2
  1.1394 +@@ -27,7 +27,7 @@
  1.1395 + /*@access pgpDigParams@*/
  1.1396 + 
  1.1397 + #if !defined(__GLIBC__)
  1.1398 +-char ** environ = NULL;
  1.1399 ++extern char ** environ;
  1.1400 + #endif
  1.1401 + 
  1.1402 + int rpmLookupSignatureType(int action)
  1.1403 +
  1.1404 ++---------------------------------------------------------------------------
  1.1405 +| Rename own mergesort(3) implementation to avoid conflicts
  1.1406 +| with a possibly existing vendor version.
  1.1407 ++---------------------------------------------------------------------------
  1.1408 +Index: rpmdb/merge.c
  1.1409 +--- rpmdb/merge.c	22 Jun 2002 18:51:58 -0000	1.1.1.2
  1.1410 ++++ rpmdb/merge.c	22 Jan 2004 21:42:30 -0000	1.2
  1.1411 +@@ -204,7 +204,7 @@
  1.1412 +  * Arguments are as for qsort.
  1.1413 +  */
  1.1414 + int
  1.1415 +-mergesort(void *base, size_t nmemb, size_t size,
  1.1416 ++rpmdb_mergesort(void *base, size_t nmemb, size_t size,
  1.1417 + 		int (*cmp) (const void *, const void *))
  1.1418 + {
  1.1419 + 	register int i, sense;
  1.1420 +
  1.1421 ++---------------------------------------------------------------------------
  1.1422 +| Rename own mergesort(3) implementation to avoid conflicts
  1.1423 +| with a possibly existing vendor version.
  1.1424 ++---------------------------------------------------------------------------
  1.1425 +Index: rpmdb/rpmdb.h
  1.1426 +--- rpmdb/rpmdb.h	18 Jan 2003 14:04:35 -0000	1.1.1.5
  1.1427 ++++ rpmdb/rpmdb.h	22 Jan 2004 21:42:31 -0000	1.2
  1.1428 +@@ -1080,7 +1080,7 @@
  1.1429 +  * Mergesort, same arguments as qsort(2).
  1.1430 +  */
  1.1431 + /*@unused@*/
  1.1432 +-int mergesort(void *base, size_t nmemb, size_t size,
  1.1433 ++int rpmdb_mergesort(void *base, size_t nmemb, size_t size,
  1.1434 +                 int (*cmp) (const void *, const void *))
  1.1435 + 	/*@globals errno @*/
  1.1436 + 	/*@modifies base, errno @*/;
  1.1437 +
  1.1438 ++---------------------------------------------------------------------------
  1.1439 +| Rename own mergesort(3) implementation to avoid conflicts
  1.1440 +| with a possibly existing vendor version.
  1.1441 ++---------------------------------------------------------------------------
  1.1442 +Index: rpmdb/rpmdb.c
  1.1443 +--- rpmdb/rpmdb.c	2 Jul 2003 19:21:54 -0000	1.1.1.6
  1.1444 ++++ rpmdb/rpmdb.c	22 Jan 2004 21:42:30 -0000	1.2
  1.1445 +@@ -2361,7 +2361,7 @@
  1.1446 + 		sizeof(*mi->mi_set->recs), hdrNumCmp);
  1.1447 + /*@=boundsread@*/
  1.1448 + #else
  1.1449 +-	mergesort(mi->mi_set->recs, mi->mi_set->count,
  1.1450 ++	rpmdb_mergesort(mi->mi_set->recs, mi->mi_set->count,
  1.1451 + 		sizeof(*mi->mi_set->recs), hdrNumCmp);
  1.1452 + #endif
  1.1453 + 	mi->mi_sorted = 1;
  1.1454 +
  1.1455 ++---------------------------------------------------------------------------
  1.1456 +| Workaround a double-inclusion problem under AIX.
  1.1457 ++---------------------------------------------------------------------------
  1.1458 +Index: lib/getdate.y
  1.1459 +--- lib/getdate.y	24 Sep 2001 21:53:15 -0000	1.1.1.2
  1.1460 ++++ lib/getdate.y	8 Jun 2005 13:16:22 -0000	1.2
  1.1461 +@@ -30,7 +30,9 @@
  1.1462 + #undef static
  1.1463 + #endif
  1.1464 + 
  1.1465 ++#ifndef OPENPKG_AIX
  1.1466 + #include <stdio.h>
  1.1467 ++#endif
  1.1468 + #include <ctype.h>
  1.1469 + 
  1.1470 + /* The code at the top of get_date which figures out the offset of the
  1.1471 +
  1.1472 ++---------------------------------------------------------------------------
  1.1473 +| Workaround a double-inclusion problem under AIX.
  1.1474 ++---------------------------------------------------------------------------
  1.1475 +Index: lib/getdate.c
  1.1476 +--- lib/getdate.c	2 Jul 2003 19:21:45 -0000	1.1.1.4
  1.1477 ++++ lib/getdate.c	8 Jun 2005 13:16:21 -0000	1.2
  1.1478 +@@ -50,7 +50,9 @@
  1.1479 + #undef static
  1.1480 + #endif
  1.1481 + 
  1.1482 ++#ifndef OPENPKG_AIX
  1.1483 + #include <stdio.h>
  1.1484 ++#endif
  1.1485 + #include <ctype.h>
  1.1486 + 
  1.1487 + /* The code at the top of get_date which figures out the offset of the

mercurial