diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2010-05-29 10:22:18 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2010-05-29 10:22:18 +0000 |
| commit | 9f88ec55fe9cd77e7ab2b552ec4085ceb5f016d3 (patch) | |
| tree | 027f9483cca3e3ece1f363bfebb566bbf0d5dc16 | |
| parent | 4f2a21ba0484b0548df5c7f9a37d2f75fffb4253 (diff) | |
| download | zcatch-9f88ec55fe9cd77e7ab2b552ec4085ceb5f016d3.tar.gz zcatch-9f88ec55fe9cd77e7ab2b552ec4085ceb5f016d3.zip | |
fixed auto configuration
| -rw-r--r-- | bam.lua | 2 | ||||
| -rw-r--r-- | configure.lua | 49 |
2 files changed, 31 insertions, 20 deletions
diff --git a/bam.lua b/bam.lua index f86e94e9..90a268fd 100644 --- a/bam.lua +++ b/bam.lua @@ -11,7 +11,7 @@ config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-p config:Add(OptLibrary("zlib", "zlib.h", false)) config:Add(SDL.OptFind("sdl", true)) config:Add(FreeType.OptFind("freetype", true)) -config:Finalize("config.bam") +config:Finalize("config.lua") -- data compiler function Script(name) diff --git a/configure.lua b/configure.lua index 9df4b82d..993ed51a 100644 --- a/configure.lua +++ b/configure.lua @@ -75,6 +75,12 @@ function NewConfig(on_configured_callback) local options_func = loadfile(filename) local options_table = {} + if not options_func then + print("auto configuration", options_func) + self:Config(filename) + options_func = loadfile(filename) + end + if options_func then -- Setup the options tables for k,v in pairs(self.options) do @@ -114,6 +120,28 @@ function NewConfig(on_configured_callback) os.exit(1) end end + + config.Config = function(self, filename) + print("") + print("configuration:") + if _bam_targets[1] == "print" then + self:Load(filename) + self:Print() + print("") + print("notes:") + self:OnConfigured() + print("") + else + self:Autodetect() + print("") + print("notes:") + if self:OnConfigured() then + self:Save(filename) + end + print("") + end + + end config.Autodetect = function(self) for k,v in pairs(self.options) do @@ -138,25 +166,8 @@ function NewConfig(on_configured_callback) self:PrintHelp() os.exit(0) end - - print("") - print("configuration:") - if _bam_targets[1] == "print" then - self:Load(filename) - self:Print() - print("") - print("notes:") - self:OnConfigured() - print("") - else - self:Autodetect() - print("") - print("notes:") - if self:OnConfigured() then - self:Save(filename) - end - print("") - end + + self:Config(filename) os.exit(0) end |