BSD detection

3 messages dkaparis, Satoshi Nakamoto August 11, 2010 — August 12, 2010
dkaparis August 11, 2010 Source · Permalink

There is this piece of code in headers.h:

#ifdef WXMAC_OSX #define WXMAC 1 #define WXOSX 1 #define BSD 1 #endif #endif

In my testing it’s not caught on FreeBSD 8.1

I propose it be changed to:

#if (defined(unix) || defined(unix)) && !defined(USG) #include <sys/param.h> #endif

And then checks for BSD should be #ifdef BSD This is the recommended way of detecting BSD in the FreeBSD Porter’s Handbook.

This change is already done in my CMake tree.

Satoshi Nakamoto August 12, 2010 Source · Permalink

Quote from: dkaparis on August 11, 2010, 11:00:16 PMThere is this piece of code in headers.h:

#ifdef WXMAC_OSX #define WXMAC 1 #define WXOSX 1 #define BSD 1 #endif #endif

That code was a bad idea anyway, I’m deleting it.  Any Mac code should only use WXMAC_OSX, not WXMAC or WXOSX, and we should stop using BSD.

Quote #if (defined(unix) || defined(unix)) && !defined(USG) #include <sys/param.h> #endif

Will that definitely cause BSD to be defined on Mac?

Satoshi Nakamoto August 12, 2010 Source · Permalink

This is in SVN rev 130.  Check that it compiles right.

Code:#if (defined(unix) || defined(unix)) && !defined(USG) #include <sys/param.h>  // to get BSD define #endif #ifdef WXMAC_OSX #ifndef BSD #define BSD 1 #endif #endif