diff --git a/neo/SConstruct b/neo/SConstruct index 3110af71..2386650a 100644 --- a/neo/SConstruct +++ b/neo/SConstruct @@ -158,7 +158,7 @@ if len(g_cpu) < 1: if len(g_cpu) < 1: g_cpu = 'cpu' -g_os = 'Linux' +g_os = commands.getoutput('uname -s') # end system detection --------------------------- @@ -294,9 +294,12 @@ BASECPPFLAGS.append( '-Wno-unknown-pragmas' ) # this define is necessary to make sure threading support is enabled in X CORECPPFLAGS.append( '-DXTHREADS' ) -if ( g_os == 'Linux' ): - # gcc 4.x option only - only export what we mean to from the game SO - BASECPPFLAGS.append( '-fvisibility=hidden' ) +# gcc 4.x option only - only export what we mean to from the game SO +BASECPPFLAGS.append( '-fvisibility=hidden' ) + +if ( "BSD" in g_os ): + BASECPPFLAGS.append( '-I/usr/local/include' ) + BASELINKFLAGS.append('-L/usr/local/lib') if ( g_sdk or SDK != '0' ): BASECPPFLAGS.append( '-D_D3SDK' ) diff --git a/neo/sys/scons/SConscript.core b/neo/sys/scons/SConscript.core index baae7fbd..9073c1b8 100644 --- a/neo/sys/scons/SConscript.core +++ b/neo/sys/scons/SConscript.core @@ -247,13 +247,16 @@ sound_env.Append( CPPPATH = '/usr/local/lib/oss/include' ) # store a local copy of the include headers as well for holy build sound_env.Append( CPPPATH = '../linux/oss/include' ) sound_list = [ '../linux/sound.cpp' ] -if ( ALSA != '0' ): +if ( g_os == "Linux" and ALSA != '0' ): sound_list.append( '../../sys/linux/sound_alsa.cpp' ) else: sound_env.Append( CPPDEFINES = 'NO_ALSA' ) sound_lib = sound_env.StaticLibrary( 'sound', sound_list ) -local_env.Append( LIBS = [ 'pthread', 'dl', 'jpeg', 'vorbisfile' ] ) +local_env.Append( LIBS = [ 'pthread', 'jpeg', 'vorbisfile' ] ) + +if (g_os == "Linux"): + local_env.Append( LIBS = [ 'dl' ] ) if ( local_curl == 1 ): local_env.Append( LIBS = [ 'curl', 'z' ] ) diff --git a/neo/sys/sys_public.h b/neo/sys/sys_public.h index 93a543d9..2aab8c2c 100644 --- a/neo/sys/sys_public.h +++ b/neo/sys/sys_public.h @@ -104,25 +104,40 @@ If you have questions concerning this license or the applicable additional terms #endif -// Linux -#ifdef __linux__ +// Unix +#ifdef __unix__ #define BUILD_OS_ID 2 +#ifdef __linux__ + #define BUILD_OS "linux" +#elif defined(__FreeBSD__) + #define BUILD_OS "FreeBSD" +#elif defined(__DragonFly__) + #define BUILD_OS "DragonFly" +#elif defined(__OpenBSD__) + #define BUILD_OS "OpenBSD" +#elif defined(__NetBSD__) + #define BUILD_OS "NetBSD" +#else + #error unknown operating system! +#endif + #ifdef __i386__ - #define BUILD_STRING "linux-x86" #define CPUSTRING "x86" #define CPU_EASYARGS 1 #elif defined(__x86_64__) - #define BUILD_STRING "linux-x86_64" #define CPUSTRING "x86_64" #define CPU_EASYARGS 0 #elif defined(__ppc__) - #define BUILD_STRING "linux-ppc" #define CPUSTRING "ppc" #define CPU_EASYARGS 0 +#else + #error unknown cpu architecture! #endif +#define BUILD_STRING (BUILD_OS "-" CPUSTRING) + #define _alloca alloca #define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))