NetBSD: Stop depending upon nonstandard __WORDSIZE
authorKamil Rytarowski <n54@gmx.com>
Sun, 20 Dec 2015 00:25:41 +0000 (01:25 +0100)
committerDavid Henningsson <david.henningsson@canonical.com>
Fri, 8 Jan 2016 13:23:37 +0000 (14:23 +0100)
commit7c1a5d61597b8a7b762f8295c7d791942dba3fb5
tree0958b58114eef10d99af850300272bae65466919
parent13664cd977994dc95b0276693b836fcb69e694b5
NetBSD: Stop depending upon nonstandard __WORDSIZE

There is no way to check CPU type in a portable way across ABIs.

Assume if pointers are 64-bit that CPU is capable to perform fast
64-bit operations. Add an extra check to handle x32-ABI.

PulseAudio by default builds with -Wundef. If we add -Werror=undef this
missing define is fatal. By default build log is full of entries like:

In file included from ./pulsecore/core.h:47:0,
                 from ./pulsecore/module.h:31,
                 from ./pulsecore/sink-input.h:31,
                 from pulsecore/sound-file-stream.c:36:
./pulsecore/sample-util.h: In function 'pa_mult_s16_volume':
./pulsecore/sample-util.h:58:5: warning: "__WORDSIZE" is not defined [-Wundef]
 #if __WORDSIZE == 64 || ((ULONG_MAX) > (UINT_MAX))
     ^

(NetBSD-7.99.21 with default GCC 4.8.5)

This change fixes build issues on NetBSD.

This also address a bug reported by Shawn Walker from Oracle (possibly Solaris):
Bug 90880 - builds can fail due to non-portable glibc-specific internal macro usage
configure.ac
src/pulsecore/sample-util.h
src/tests/mult-s16-test.c