Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

[PATCH] Fails to build on FreeBSD 8.1 #11

Open
GoogleCodeExporter opened this issue Mar 16, 2015 · 1 comment
Open

[PATCH] Fails to build on FreeBSD 8.1 #11

GoogleCodeExporter opened this issue Mar 16, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Here's an "svn diff" patch to fix the multiple minor problems (mostly 
linuxisms) that stopped it from building on FreeBSD.  With this patch, "gmake 
check" passes.  I've tried to rely on only standard features wherever possible, 
but on some of the scripts I wussed out and said "run bash" instead.

Summary of changes:
- Prefer standard POSIX shell constructs where possible:
  - Bash isn't necessarily in /bin (FreeBSD puts it in /usr/local/bin);
  - expr-matching instead of grep <<< string;
  - case-statement instead of == inside [[ ]];
  - "foo()" instead of "function foo";
  - "for (( s1; expr; s2 ))" is not supported;
  - "$SZL" in command position isn't always expanded correctly [actually, I'm not sure about this since I found some instances of $"$SZL" that might explain the odd error messages]; and
  - in test statements, "-eq" instead of "==".
- Detect at configure time whether va_copy is supported, and if so use it 
instead of trying to use __va_copy.
- Use a union type to effect reinterpret-casting between double and unsigned 
long long; the pointer-reinterpretation approach failed disastrously with the 
requested -O2 -fstrict-aliasing flags, causing incorrect values to come out of 
the cast.
- On systems without ieee754.h (e.g. FreeBSD), generate random floats and 
doubles by multiplying the minimum representable value >1 by a random integer 
to get an exactly-representable value.  I microbenchmarked this and found it to 
be a tiny bit faster than the existing 
fill-a-struct-of-bitfields-and-reinterpret-cast approach.  Oddly, it returned 
the same values given the same random seed; you might consider using it even if 
ieee754.h is available.
- An abs() call had an ambiguous type since it had definitions available for 
int and long, but not for long long which was the actual arg type.  Replaced 
with llabs().
- The declaration of uintptr_t clashed with the slightly different declaration 
in the standard library, so it was made conditional on an autoconf check.
- ACX_USE_SYSTEM_EXTENSIONS doesn't exist, and that first X is probably a typo. 
 Read the ./configure output next time! :-)

Happy patching!

 --Adrian.
who/aecolley

Original issue reported on code.google.com by aecolley on 8 Nov 2010 at 3:46

Attachments:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant