Commit Graph

388 Commits

Author SHA1 Message Date
lukem dac4cd245f tools/compat/compat_defs.h: improve NAME_MAX compat
Move the NAME_MAX workaround to the <limits.h> section,
and don't assume that _XOPEN_NAME_MAX is available.
2023-07-21 22:05:04 +00:00
lukem 569efedda5 tools/compat: regen 2023-07-20 16:22:30 +00:00
lukem 4815827f69 tools: binstall can use posix_spawn() instead of vfork() 2023-07-20 16:21:23 +00:00
lukem a08c7a13b0 tools/compat: regen 2023-07-20 15:18:34 +00:00
lukem 27a8da3b8e tools/compat: provide nb_check_cc_flag.m4
Implement m4 macro NB_CHECK_CC_FLAG(FLAG, [VAR=FLAG_DERIVED])
	Determine if the C compiler supports FLAG,
	and sets output variable VAR to FLAG if FLAG is supported.

	If VAR is not provided, default to FLAG_DERIVED, which is
	FLAG converted to upper-case and all special characters
	replaced with "_", and the result prepended with "CC_".
	FLAG_DERIVED is appended to the m4 macro NB_CHECK_CC_FLAG_VARS.
	E.g., if FLAG is "-Wexample=yes", FLAG_DERIVED is "CC_WEXAMPLE_YES".

This is implemented in separate buildaux/nb_check_cc_flag.m4,
based on configure's NB_CC_FLAG(), but supports VAR override.

Adapt configure from internal NB_CC_FLAG() to NB_CHECK_CC_FLAG().

(Note: AX_CHECK_COMPILE_FLAG() from autoconf-archive could be enhanced
to support the clang and gcc workarounds I've implemented here.)
2023-07-20 15:15:23 +00:00
palle aac8d61cf7 Update build instructions for Solaris 11.4 hosts: specify HOST_SH and note standards 2023-07-16 18:09:54 +00:00
palle 4fb0058c93 Add support for missing NAME_MAX when building on Solaris hosts 2023-07-08 19:10:00 +00:00
palle fcbcc39cb9 Update build instruction for Solaris 11.4 hosts 2023-07-05 16:26:29 +00:00
christos 53d5df7bf7 PR/57500: Palle Lyckegaard: include missing tools/compat/regex.h for
__{BEGIN,END}_DECLS.
2023-07-03 18:50:42 +00:00
lukem 869cdbbd1c regen 2023-06-03 09:18:14 +00:00
lukem 97766c5b60 tools/compat: support all bsd.own.mk disabled warnings
Check the host CC support for all the warnings now in <bsd.own.mk>
and override appropriately in defs.mk.

In general there's a 1:1 mapping, with the special case
CC_WNO_ADDRESS_OF_PACKED_MEMBER which is set from both
@CC_WNO_ADDRESS_OF_PACKED_MEMBER@ (gcc) and
@CC_WNO_ERROR_ADDRESS_OF_PACKED_MEMBER@ (clang).
2023-06-03 09:10:13 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
lukem 39d234c9f0 tools/compat: regen 2023-05-30 19:04:42 +00:00
lukem 8d651401a4 tools/compat: disable host CC warnings
Determine if the host CC supports flags to disable various
warnings similar to <bsd.own.mk> GCC_*, CLANG_*, and CC_*,
and override the <bsd.own.mk> equivalents in defs.mk.

Silences "warning: unknown warning option '...'" from our source.
External source (e.g., binutils and gcc) need their own fixes
to enhance their detection of supported clang compiler flags.
2023-05-30 18:54:21 +00:00
lukem 2356d03a18 tools/compat: detect supported host compiler flags
Define NB_CC_FLAG(FLAG) to use AX_CHECK_COMPILE_FLAG
to determine if the host compiler supports FLAG
and define and AC_SUBST CC_FLAG if so.

Use workarounds to force clang to hard-fail on unknown -Wwarning,
and gcc to use -WWARN to check unknown -Wno-WARN because the
latter doesn't cause an error in gcc.

In the future we could use NB_CC_FLAG([-fcommon]) for
older NetBSD release branches compiled with host gcc 10+.

Rework Darwin -no-cpp-precomp check to use NB_CC_FLAG().
Note: this flag probably hasn't been required on macOS (Darwin)
for a long time, but serves as a good example on how to use this.

Display varaibles at the end of configure to show what was detected.
2023-05-30 18:39:19 +00:00
lukem 69c1db2ad0 tools/compat: import AX_CHECK_COMPILE_FLAG
Import AX_CHECK_COMPILE_FLAG serial 6 from autoconf-archive
  https://github.com/autoconf-archive/autoconf-archive.git
as at commit 5b5ce7f on 2023-05-01.
2023-05-30 18:35:16 +00:00
lukem c578bb77d2 tools/compat: don't expose HAVE_PTHREAD_H to make
Non of the tools Makefiles needs HAVE_PTHREAD_H, so don't
AC_SUBST it or provide in defs.mk.
2023-05-30 18:31:55 +00:00
lukem f7d6f1b13f tools/compat: use autoreconf, support MAKEVERBOSE
Use autoreconf instead of autoconf + autoheader;
we'll need aclocal in the near future.

If MAKEVERBOSE >= 2, add -v to autoreconf.
2023-05-30 18:27:04 +00:00
lukem e6c216806f tools/compat: regen 2023-05-29 21:34:57 +00:00
lukem 2ec2a2d759 tools/compat/configure.ac: style tweaks
Use "NB_" prefix not "AC_" for our macros ("AC_" is for autoconf).
Fail is NB_ macro isn't defined.
Use AC_DEFUN() instead of define().
Consistently use () in zero argument macro calls.
2023-05-29 21:30:42 +00:00
lukem 0589c2d76d tools/compat: regen for dispatch_semaphore_create 2023-05-23 20:22:11 +00:00
lukem 55152776e1 tools/compat: MAKEVERBOSE support in regen 2023-05-23 20:20:54 +00:00
lukem 6eddcd88c5 ctfmerge: fix macOS semaphore implementation
Use dispatch_semaphore_create() if present instead of sem_init().

macOS doesn't actually implement sem_init() (et al)
(even though it provides the prototypes as deprecated).
This was detected by the previous commit to ctfmerge
that added error handling.

Implement ctfmerge's barrier operations in terms of
dispatch(3) APIs such as dispatch_semaphore_create() (et al).

Update tools/compat/configure.ac to find dispatch_semaphore_create().

Fixes ctfmerge on macOS hosts.

Inspired by https://stackoverflow.com/a/27847103.
2023-05-23 19:53:24 +00:00
christos a043955316 Patch the build script and toolchain to allow passing through
HOST_CPPFLAGS, HOST_CXXFLAGS, but not LIBRARY_PATH because it breaks
the build. These variables are necessary to support building NetBSD
from a GNU Guix or NixOS host, where /usr/include, /lib, and all
but /bin/sh do not exist.  In many cases, support for HOST_CPPFLAGS
was incomplete. From Ryan Sundberg
2021-09-18 01:47:07 +00:00
cjep ce74361f40 Final note on OpenBSD cross-buildling. Remaining issues were due to
default limits on the build host.
2021-07-11 06:15:42 +00:00
cjep 0534019bd5 LLVM RT library will actually cross-build from OpenBSD provided sufficient
limits are in place for the build user.
2021-07-04 12:57:48 +00:00
cjep 47c30ebc16 Note OpenBSD cross-build progress 2021-06-29 10:02:34 +00:00
cjep c1a451e849 avoid triggering conflict indicator warnings 2021-06-28 07:18:01 +00:00
cjep a09ab67fff note on Darwin/Mac 2021-06-28 07:16:46 +00:00
cjep 63399de5f3 PR port-amiga/56188
Include a prototype for __nbcompat_heapsort. The tools for amiga now
build on Darwin where one Amiga specific tool uses heapsort.

Despite being a one-liner, ./build.sh -m amiga tools was tested on
NetBSD, Darwin, FreeBSD & Linux with the change.

Discussed various options with jdc & thorpej. Perhaps in the future
we could look at using qsort instead of heapsort as qsort is
standardised and more likely to be available. We could then remove
heapsort from the compatibility library.
2021-05-30 10:39:41 +00:00
uwe fbfae67d9f Fix typo in pathname in a comment. 2021-05-24 23:07:40 +00:00
cjep ac6ba04d2d Add macOS High Sierra to the list of verified build platforms 2021-05-12 06:39:28 +00:00
cjep 72496168ad More test notes from using build.sh against non NetBSD platforms. 2021-05-07 14:52:59 +00:00
cjep b84b6c59df Update with information from recent testing of different Linux variants
on AWS. Also FreeBSD 13.
2021-05-06 07:32:15 +00:00
christos 142620627d Add reallocarray; this is used by the new regex code and we don't want to
convert it to reallocarr so the code is kept similar with the original from
FreeBSD.
2021-02-25 13:41:58 +00:00
rin 1fb63bb836 Fix copy-paste error for heapsort(3), so that it is declared appropriately. 2021-02-23 16:03:00 +00:00
uwe 3ed307aae1 Regen: Add AC_MSG_RESULT yes/no to the uio checks. 2020-06-24 14:44:44 +00:00
uwe 6072166471 Add AC_MSG_RESULT yes/no to the uio checks. 2020-06-24 14:39:01 +00:00
lukem 49c251eb17 tools: configure --silent if MAKEVERBOSE == 0 2020-06-13 10:49:17 +00:00
hannken 8d122c4997 Bring back two lines deleted by accident. From Kamil Rytarowski. 2019-06-22 14:40:33 +00:00
hannken aa8b5122a1 Update tools/compat/configure for new path of "rpc/types.h".
Remove intermediate patch from rpcgen/Makefile.

Patch from Nick Hudson, errors from me.
2019-06-22 13:42:53 +00:00
kamil 80b70339c3 regen tools/compat 2019-06-19 23:35:55 +00:00
kamil 08fadea744 Add more SunOS types to tools/compat
Add fallback defintions of: uchar_t, ushort_t, uint_t, ulong_t.

Needed by the libctf code on Ubuntu 16.x.
2019-06-19 23:33:07 +00:00
kamil 1c06c1fef3 Add sys/uio.h & enum uio_seg, enum uio_rw to tools/compat
This is needed for bootstrapping the tools on Ubuntu 16.x.
2019-06-19 03:40:15 +00:00
thorpej 8319f966d5 Fix building libprop as a host tool library on platforms that don't have
the Matt Thomas rbtree:

- Include rb.c in libnbcompat, and provide a nbcompat sys/rbtree.h
  header.
- Make sure libprop's source file include prop_object_impl.h before
  anything else, and pull in nbtool_config.h from there.

Tested by simulating such a host system by renaming the host's
<sys/rbtree.h> out of the way (which reproduced the build failure)
and verifying that the host-tool installboot contained the rb_*
functions in its own .text segment.
2019-05-08 02:25:50 +00:00
dholland 4c5da2b349 Restore comment accidentally lost in merge. 2019-01-27 05:15:32 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
palle 1e0d01e5bc Add instructions for building NetBSD on modern Solaris 11 hosts 2018-09-09 19:17:21 +00:00
christos 14cc014e8a deal with getsubopt and strncasecmp (needed by mdocml) 2018-08-30 12:05:34 +00:00
christos b9f6c86d43 add strncasecmp 2018-08-16 12:03:36 +00:00