On Wed, Dec 14, 2016 at 1:29 PM, Fabian Groffen <[email protected]> wrote:
> On 14-12-2016 13:01:16 -0500, Doug Freed wrote:
>> On Wed, Dec 14, 2016 at 12:48 PM, Nathan Zachary
>> <[email protected]> wrote:
>> > On 14/12/16 10:11, Doug Freed wrote:
>> >>> I somehow doubt that would give me the expected number only, and I lack
>> >>> a BSD install handy to test it.
>> >> $(sysctl -n hw.ncpu)
>> >>
>> > I don't know that the sysctl command works universally:
>> >
>> > # sysctl -n hw.ncpu
>> > sysctl: cannot stat /proc/sys/hw/ncpu: No such file or directory
>> >
>>
>> It's BSD-specific (Darwin may have it too, but I'm not in OS X at the
>> moment, so I can't check), which pretty much describes this branch in
>> the codepath as well. Linux users will have the nproc command from
>> coreutils.
>
> Yes, Darwin has it too, but the tool lives in /usr/sbin instead:
>
> https://gitweb.gentoo.org/repo/proj/prefix.git/tree/scripts/bootstrap-prefix.sh#n1987
>
Seems like we could borrow that code for the eclass, with some minor
modifications. It should probably use ${CBUILD:-${CHOST}} to cover
cross-compiling.
Another alternative would be to check the userland_BSD and
userland_GNU use flags.