Bitcoin Forum
September 29, 2023, 10:02:46 AM *
News: Latest Bitcoin Core release: 25.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: BSD detection  (Read 9093 times)
dkaparis (OP)
Newbie
*
Offline Offline

Activity: 53
Merit: 0


View Profile
August 11, 2010, 11:00:16 PM
 #1

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.
1695981766
Hero Member
*
Offline Offline

Posts: 1695981766

View Profile Personal Message (Offline)

Ignore
1695981766
Reply with quote  #2

1695981766
Report to moderator
1695981766
Hero Member
*
Offline Offline

Posts: 1695981766

View Profile Personal Message (Offline)

Ignore
1695981766
Reply with quote  #2

1695981766
Report to moderator
1695981766
Hero Member
*
Offline Offline

Posts: 1695981766

View Profile Personal Message (Offline)

Ignore
1695981766
Reply with quote  #2

1695981766
Report to moderator
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1695981766
Hero Member
*
Offline Offline

Posts: 1695981766

View Profile Personal Message (Offline)

Ignore
1695981766
Reply with quote  #2

1695981766
Report to moderator
1695981766
Hero Member
*
Offline Offline

Posts: 1695981766

View Profile Personal Message (Offline)

Ignore
1695981766
Reply with quote  #2

1695981766
Report to moderator
satoshi
Founder
Sr. Member
*
qt
Offline Offline

Activity: 364
Merit: 5998


View Profile
August 12, 2010, 12:02:06 AM
 #2

There 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?
dkaparis (OP)
Newbie
*
Offline Offline

Activity: 53
Merit: 0


View Profile
August 12, 2010, 08:24:37 AM
 #3

Quote

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

Will that definitely cause BSD to be defined on Mac?


Don't know if Mac OS X is technically a BSD and I don't have access to a Mac, maybe someone else may test it.
If there are other Mac (and not BSD) specialties, then we'd need to check both for __WXMAC_OSX__ and BSD or detect these in some other way altogether.
satoshi
Founder
Sr. Member
*
qt
Offline Offline

Activity: 364
Merit: 5998


View Profile
August 12, 2010, 09:14:20 PM
 #4

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
dkaparis (OP)
Newbie
*
Offline Offline

Activity: 53
Merit: 0


View Profile
August 13, 2010, 03:38:17 PM
 #5

Incorporated into the CMake tree. No problems on Windows and FreeBSD.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!