Changes since 20070507:
Completely rewrote the fgetln implementation, since the previous version
couldn't handle files that don't end with a '\n' character. Tested on IRIX,
NetBSD and Solaris.
anonymous empty string. the macro uses the argument multiple times
and the logic relies on identical strings having the same address,
which is compiler dependent and not guaranteed to be the case.
problem observed with pax(1) built with sunpro 11 on Solaris.
from segv@netctl.net in PR pkg/32097.
include fixing fgetln() to account for \0 characters due to implementing
it using fgets() (analysis provided by Urban Boquist). Also add a
definition for __restrict if not present since it is used in the regex
implementation code from src HEAD.
This has been tested to work correctly on:
FreeBSD-4.8/i386
NetBSD-1.6.2/i386
Solaris 9
include:
* Rework the way that poll() is detected so that it more closely
follows how the rest of the replacement functions are detected.
* Split err*() and warn*() functions into separate err.c and warn.c
files so that we can more finely isolate the objects files pulled
in by the linker. This should fix building textproc/nbsed on Solaris.
* Move more definitions from nbcompat.h into nbcompat/*.h. This makes
it more clear which NetBSD headers are expected to provide which
function declarations and macro definitions.
* Clean out nbconfig.h by moving all of the relevant definitions into
the correct nbcompat/*.h files.
* Update all of the library functions to the latest from src HEAD.
Also change the way that sources are modified when imported -- we
now include <nbcompat.h> before the first system header, include
<nbcompat/*.h> versions of headers instead of system ones where
available, and "#if 0" the sections that make no sense when being
built outside of the NetBSD source tree. This should make future
updates from src HEAD, e.g. for security updates or bug fixes,
easier.
* Move all private headers into a subdirectory and include the headers
from the private directory. This avoids any nameclashes with system
headers with the same name.
the Makefiles so that they can be built by really basic make programs.
Move the awk script in the Makefile into a separate file for clarity, and
so that really basick make programs won't choke on the continuation lines.
include:
* Adding a regex(3) implementation for those platforms that don't
have one, e.g. IRIX 5.3.
* Allow nbcompat.h to be included multiple times in case it's needed
to override values of set by config.h in bootstrap packages. This
should fix problems with building pkg_install and pax on platforms
that have /usr/include/glob.h.
* Remove namespace.h, which should be a no-op since we're building
a userland library separate from the NetBSD sources.
* Remove HAVE_CONFIG_H checks from sources since we're always going
to have and and we're always going to be including it.
* Rename all inclusion guards in nbcompat/*.h to be _NBCOMPAT_*_H_ so
that it won't get triggered by any settings in system headers.
This has been tested on:
FreeBSD-4.8/i386 Debian Linux 3.0 (woody)
IRIX 6.5 MacOS X 10.2.8
MacOS X 10.3.5 NetBSD-1.6.2/i386
NetBSD-2.0_BETA/i386 Red Hat Linux 7.3
Solaris 7/sparc Solaris 8/sparc
Solaris 9/sparc
include working around an apparent bug in an autoconf macro defined in
aclocal.m4. This should now cause getopt_long() to be built on systems
that are missing getopt.h. This version of libnbcompat has been tested
on the following platforms:
FreeBSD-4.8/i386
MacOS X 10.2.8
NetBSD-1.6.2/i386
include:
* Re-adding a default value for pkg_use_nbcompat_vis; this was
causing the configure script to fail on platforms that had funky
versions of vis(). This should fix reported problems on Solaris 8
and on IRIX 5.3.
* Added setgroupent() and setpassent() compatibility functions so
that pwcache.c will build without complaining about an incompatible
pointer type assignment.
* Remove unused tests for <arpa/nameser.h>, <netdb.h>, h_errno and
hstrerror(). These were originally used to bootstrap lukemftp, but
tnftp doesn't need libnbcompat to build nowadays, so we don't need
these anymore.
* Cleanup: in cases where we test for a function using AC_REPLACE_FUNCS,
move the function prototype into a nbcompat header that is the
same name as the NetBSD header that contains that declaration,
and include that file in place of the original one within
nbcompat.h.
This version has been tested to build on the following systems:
FreeBSD-4.8/i386 NetBSD-1.6.2/i386
FreeBSD-5.2.1/i386 NetBSD-2.0_BETA/i386
IRIX 6.5 Red Hat Linux 8.0
MacOS X 10.3.4 Solaris 8
MacOS X 10.3.5 Solaris 9
include:
(1) Add a statvfs() implementation based on statfs(), and remove the
statfs() NetBSD-compatibility implementation. statvfs() is used
in src/usr.sbin/pkg_install on the HEAD branch.
(2) Add a fnmatch() implementation, needed by IRIX. fnmatch() is used
in src/usr.sbin/pkg_install on the HEAD branch.
(3) Remove fseeko(), inet_ntop(), inet_pton(), sl_*() strptime(), and
timegm() as they're not used by any of the bootstrap packages that
require libnbcompat (pax, mtree, pkg_install). All that's left is
what's necessary to bootstrap those three packages.
and HAVE_SYS_POLL_H if we don't have a native poll() implementation.
prevents including of libnbcompat's poll.h as well as the system's
poll.h where we should be ignoring the system's poll.h.
fix tested by Jeff Rizzo on MacOSX 10.3.3.
(MacOSX 10.3) by adding a custom test for _POLL_EMUL_H_ which is
defined in poll.h on some MacOSX 10.3 systems.
not all 10.3 systems have poll.h, so only do the poll() test if at
least one of the header files is found.
multiple identical strings appear in a source file.
As a result, comparing char *o to the "" pointer gives the wrong result
in vis.c, as the "" pointer we're checking against isn't the same as the
"" which initialised char *o.
Use a global pointer initialised to "", and use it for MAKEEXTRALIST()
calls.
Thanks to Christos Zoulas for suggesting the right solution :)
- check for existence of fsid_t type, and typedef it if missing
- check for existence of struct statvfs.f_basetype field
- if <sys/mkdev.h> is included and makedev() is missing, try to use mkdev()
- add replacement library file for utimes() by wrappering utime()
* Use LLONG_{MIN,MAX} instead of QUAD_{MIN,MAX}
* Use "long long int" instead of "long long"
* Appease lint
* Use "long long" instead of "quad" in comments.
systems which have both statfs() and statvfs().
while it would be nice to have an OS-independent way of testing
whether to use our statfs() implementation, in reality it is much more
reliable to only use it where required.
using statvfs() on systems that provide it. I'm assuming that the
SVR4 statvfs() is a standardized call across systems that have it.
This should allow IRIX to build the statfs call into libnbcompat.
getopt.h implies having getopt_long. Also Fix checks for setmode, pwcache,
and vis so that if any of a list of functions is missing, then use the
nbcompat versions.
version are removing sha2* object files from libnbcompat.a. It turns
out that the functions defined there aren't provided by NetBSD, so it
makes no sense for libnbcompat to define them, and none of the
utilities in pkgsrc that link against libnbcompat actually use these
functions anyway.
include:
* Move headers out of the global namespace and into the nbcompat
directory. Since there are no headers other than nbcompat.h in
${PREFIX}/include/libnbcompat, just install it directly in
${PREFIX}/include. Using libnbcompat is now a matter of including
nbcompat.h at the top of *.c files and linking against -lnbcompat.
* Only build functions into libnbcompat.a if they aren't already in
the system libraries.
* Move several *.[ch] files that are pax- or mtree-specific out
of libnbcompat (they should belong with those packages).
On NetBSD 1.6 systems, libnbcompat.a now contains just the bare minimum:
the sha2 routines.
symbol and comment in nbconfig.h.in for us in the correct place. The
previous way of using AH_BOTTOM also worked but separated the symbol
definition from the accompanying C comment text, which was a little harder
to maintain.
* Properly declare statfs() and fstatfs() if we use the libnbcompat
versions.
* Move some headers into a private directory in the installed
location so that they don't override headers of the same name
on the system.
* Define TAILQ_HEAD_INITIALIZER if it doesn't exist.
* Add a poll() implementation using select() for poll()-less systems.
Thanks for Charles Blundell for the implementation!
* Fix the vis.h check for systems whose vis() is not as featureful
as NetBSD's.
are moving the definitions of the TAILQ accessor methods into the top level
of nbcompat.h. This should fix using nbcompat.h to replace sys/queue.h
on Linux systems.
* Don't install namespace.h, extern.h and stat_flags.h, which are
only used internally.
* Clean up util.h by using '#if !HAVE_xxx' instead of
'#ifndef !HAVE_xxx', removing some LIST_* definitions that are
defined by <nbcompat.h>, and removing static declarations.
* If fparseln is in libutil (as it is in NetBSD), then don't build
it into libnbcompat.a.
* Add mkdtemp, TAILQ_*, and statfs.
* Install a nbconfig.h file containing the discovered system information
and include it directly in nbcompat.h. Make all files use nbconfig.h
instead of config.h. Ensure that all installed headers don't include
any local header files. This makes libnbcompat more self-contained.
* Consistently use "#if HAVE_HEADER_H" instead of "#ifdef HAVE_HEADER_H"
since sometimes people put -DHAVE_HEADER_H=0 on their command lines.
don't need a GNU compatible malloc() here.
a GNU compatible malloc() is still used in libnbcompat.a if it is
required.
fixes build on (at least) Tru64.