Commits

Andrew Thompson  committed 24ef9e3

Support for NetBSD, DragonFlyBSD and OpenBSD

There were 3 things that were fixed in this patch:

The endian detection header didn't contain all the possible machine
architecture definitions for AMD64, see
http://predef.sourceforge.net/prearch.html#sec3

DragonFlyBSD wasn't checked for as an OS along with the other BSDs

OpenBSD was exposing BSD symbols not defined by POSIX so rebar.config
now passes -D_POSIX_C_SOURCE to ensure these are hidden.

  • Participants
  • Parent commits e0ef242

Comments (0)

Files changed (2)

File c_src/brg_endian.h

 #define IS_LITTLE_ENDIAN   1234 /* byte 0 is least significant (i386) */
 
 /* Include files where endian defines and byteswap functions may reside */
-#if defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ )
+#if defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ ) || \
+    defined( __DragonFly__ )
 #  include <sys/endian.h>
 #elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
       defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ )
       defined( __i386__ )  || defined( _M_I86 )  || defined( _M_IX86 )    || \
       defined( __OS2__ )   || defined( sun386 )  || defined( __TURBOC__ ) || \
       defined( vax )       || defined( vms )     || defined( VMS )        || \
-      defined( __VMS )     || defined( _M_X64 )  || defined( AVR )
+      defined( __VMS )     || defined( _M_X64 )  || defined( AVR )        || \
+      defined( __amd64__ ) || defined( __amd64 ) || defined( __x86_64__ ) || \
+      defined( __x86_64 )
 #  define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
 
 #elif defined( AMIGA )   || defined( applec )    || defined( __AS400__ )  || \

File rebar.config

              %% Make sure to link -lstdc++ on linux or solaris
              {"(linux|solaris)", "LDFLAGS", "$LDFLAGS -lstdc++"},
 
+             {"openbsd", "CFLAGS", "-D_POSIX_C_SOURCE"},
+
              %% OS X Leopard flags for 64-bit
              {"darwin9.*-64$", "CXXFLAGS", "-m64"},
              {"darwin9.*-64$", "LDFLAGS", "-arch x86_64 -lstdc++"},