Remove __unix, unix and __APPLE__ defines, add new USE_LINUX and use USE_LINUX and USE_APPLE in current code

This commit is contained in:
Pali Rohár 2013-02-05 16:48:08 +01:00
parent 56d7335fd6
commit d291e598a3
6 changed files with 24 additions and 13 deletions

View file

@ -566,8 +566,12 @@ if(UNIX AND CMAKE_SYSTEM_NAME MATCHES BSD)
set(BSD true)
endif()
# Check if platform is Maemo
if(UNIX AND CMAKE_SYSTEM_NAME MATCHES Linux)
set(LINUX true)
endif()
# Check if platform is Maemo
if(LINUX)
find_package(PkgConfig QUIET REQUIRED)
pkg_check_modules(MAEMO_VERSION maemo-version)
if(MAEMO_VERSION_FOUND)
@ -755,12 +759,14 @@ endif()
if(APPLE)
add_definitions(-DUSE_MAC)
add_definitions(-D__unix)
endif()
if(BSD)
add_definitions(-DUSE_BSD)
add_definitions(-D__unix)
endif()
if(LINUX)
add_definitions(-DUSE_LINUX)
endif()
if(BEOS)
@ -879,6 +885,8 @@ elseif(BEOS)
message("Platform: BEOS")
elseif(MAEMO)
message("Platform: Maemo")
elseif(LINUX)
message("Platform: Linux")
else()
message("Platform: Other/No platform code")
endif()

View file

@ -155,9 +155,11 @@ extern unsigned inline _FetchLE32(unsigned char **pp)
#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
#include <byteswap.h>
#endif
#if defined(__APPLE__)
#if defined(USE_MAC)
#include <architecture/byte_order.h>
#endif
#endif
/*----------------------------------------------------------------------------
@ -178,7 +180,7 @@ extern unsigned inline _FetchLE32(unsigned char **pp)
#else
#if defined(__APPLE__)
#if defined(USE_MAC)
/**
** Convert a 16 bit value in little endian and return it in native format.
@ -202,7 +204,7 @@ extern unsigned inline _FetchLE32(unsigned char **pp)
*/
#define ConvertLE32(v) (v)
#endif // defined(__APPLE__)
#endif // defined(USE_MAC)
#endif // ! defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN

View file

@ -32,7 +32,7 @@
//@{
#ifndef __unix
#ifdef USE_WIN32
#undef NOUSER
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400

View file

@ -259,8 +259,7 @@ int NetSocketAddr(const Socket sock)
}
return nif;
}
#else // } { !USE_WINSOCK
#ifdef unix // {
#elif USE_LINUX // } {
// ARI: I knew how to write this for a unix environment,
// but am quite certain that porting this can cause you
// trouble..
@ -335,15 +334,14 @@ int NetSocketAddr(const Socket sock)
}
return nif;
}
#else // } !unix
#else // } {
// Beos?? Mac??
int NetSocketAddr(const Socket sock)
{
NetLocalAddrs[0] = htonl(0x7f000001);
return 1;
}
#endif
#endif // } !USE_WINSOCK
#endif // }
/**
** Open an UDP Socket port.

View file

@ -126,7 +126,7 @@ static const int CacheNotSet = -5;
#ifdef ASTAR_PROFILE
#include <map>
#ifndef __unix
#ifdef USE_WIN32
#include <windows.h>
#else

View file

@ -433,6 +433,9 @@ static void PrintHeader()
#ifdef USE_WIN32
"WIN32 "
#endif
#ifdef USE_LINUX
"LINUX "
#endif
#ifdef USE_BSD
"BSD "
#endif