From 30a8270297c3b7241d09c795fb59d171d2d7ea53 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sat, 24 Nov 2012 20:51:09 +0000 Subject: [PATCH] scons: improve logic in checking for lua library sdl doc: added tidbit about how to 'make clean' with our scons build system --- README-SDL.md | 4 ++++ SConstruct | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README-SDL.md b/README-SDL.md index 61beebb3..8542244a 100644 --- a/README-SDL.md +++ b/README-SDL.md @@ -46,6 +46,10 @@ You can choose to install the lua scripts (located in output/luaScripts) to a di cp -R output/luaScripts /usr/local/some/directory/that/i/will/find/later +If you would like to clean the temporary scons files to perform a 'make clean' like function, you can do the following: + + scons -c && rm -rf .scon* + 3 - Compile-time options ------------------------ You can enable and disable certain features of fceux at build time. diff --git a/SConstruct b/SConstruct index c341853c..c49948a5 100644 --- a/SConstruct +++ b/SConstruct @@ -25,7 +25,7 @@ opts.AddVariables( BoolVariable('LOGO', 'Enable a logoscreen when creating avis (SDL only)', 1), BoolVariable('GTK', 'Enable GTK2 GUI (SDL only)', 1), BoolVariable('GTK3', 'Enable GTK3 GUI (SDL only)', 0), - BoolVariable('CLANG', 'Compile with llvm-clang instead of gcc', 0) + BoolVariable('CLANG', 'Compile with llvm-clang instead of gcc', 1) ) AddOption('--prefix', dest='prefix', type='string', nargs=1, action='store', metavar='DIR', help='installation prefix') @@ -108,18 +108,20 @@ else: if env['PLATFORM'] == 'darwin': # Define LUA_USE_MACOSX otherwise we can't bind external libs from lua env.Append(CCFLAGS = ["-DLUA_USE_MACOSX"]) - if conf.CheckLib('lua5.1'): - env.Append(LINKFLAGS = ["-ldl", "-llua5.1"]) - elif conf.CheckLib('lua'): - env.Append(LINKFLAGS = ["-ldl", "-llua"]) if env['PLATFORM'] == 'posix': # If we're POSIX, we use LUA_USE_LINUX since that combines usual lua posix defines with dlfcn calls for dynamic library loading. # Should work on any *nix env.Append(CCFLAGS = ["-DLUA_USE_LINUX"]) - if conf.CheckLib('lua5.1'): - env.Append(LINKFLAGS = ["-ldl", "-llua5.1"]) - elif conf.CheckLib('lua'): - env.Append(LINKFLAGS = ["-ldl", "-llua"]) + lua_available = False + if conf.CheckLib('lua5.1'): + env.Append(LINKFLAGS = ["-ldl", "-llua5.1"]) + lua_available = True + elif conf.CheckLib('lua'): + env.Append(LINKFLAGS = ["-ldl", "-llua"]) + lua_available = True + if lua_available == False: + print 'Could not find liblua, exiting!' + Exit(1) # "--as-needed" no longer available on OSX (probably BSD as well? TODO: test) if env['PLATFORM'] != 'darwin': env.Append(LINKFLAGS=['-Wl,--as-needed'])