]> jfr.im git - irc/quakenet/newserv.git/blobdiff - configure
Merge pull request #2 from meeb/meeb
[irc/quakenet/newserv.git] / configure
index 358fd4c334ec279406ca69e6dd95c24fad8fb5c1..43c04a35e447da2db7995dc10ba35647a2cac9a7 100755 (executable)
--- a/configure
+++ b/configure
@@ -24,7 +24,7 @@ def iprint(x):
   sys.stdout.write(x)
   sys.stdout.flush()
   LOG.write(x)
-  
+
 class IniParser:
   def __init__(self, file):
     self.__d = {}
@@ -68,7 +68,7 @@ class ConfigureIniParser(IniParser):
     self.buildorder = []
     self.updatemodules(self.keys("modules"))
 
-    self.selectlibs = {}    
+    self.selectlibs = {}
     for k, v in self.setdefault("selectlibs", {}).items():
       self.selectlibs[k] = v.split()
 
@@ -138,6 +138,10 @@ class MultiConfigureIniParser(ConfigureIniParser):
       if c2.has_key("options"):
         self.options.update(c2["options"])
 
+      if c2.has_key("osvars"):
+        for k, v in c2.keys("osvars"):
+          self.osflags.setdefault(k, []).append(v)
+
 def librarycheck(libraries, includes, libs):
   def findlibrarypaths(library, x, includes, libs):
     if x["alwayspresent"]:
@@ -325,6 +329,8 @@ def configure(config, selectoverrides, workspaces):
   if len(cantbuild) > 0:
     lprint("configure: can't select: %s" % " ".join(cantbuild))
 
+validopts = {}
+
 def usage():
   print
   print "  Usage: %s [-h] [-v] [options]" % sys.argv[0]
@@ -332,35 +338,33 @@ def usage():
   print "  Additional options are:"
   for k, v in validopts.items():
     print "    --with-%s=[%s]" % (v[0], "|".join(v[1]))
-
-  print "    -L [additional lib dir]" 
+  print "    -L [additional lib dir]"
   print "    -I [additional include dir]"
   print "    -m [additional module]"
   print "    -v: verbose"
 
-def main(workspacesfile):
+def main():
   global LOG, VERBOSE
 
-  workspacesconfig = IniParser(open(workspacesfile, "r"))
+  files, workspaces = [], []
+  for root, _, file_list in os.walk("."):
+    if "configure.ini" not in file_list:
+      continue
 
-  files = []
-  workspaces = []
+    print "found workspace: %s" % root
+    workspaces.append(root)
 
-  for workspace in ["."] + workspacesconfig["workspaces"].keys():
-    path = workspace + "/configure.ini"
-    if os.path.exists(path):
-      print "found workspace: %s" % workspace
-      workspaces.append(workspace)
-      files.append( (workspace, open(path, "r")) )
+    path = os.path.join(root, "configure.ini")
+    files.append( (root, open(path, "r")) )
 
-      local_path = workspace + "/configure.ini.local"
-      if os.path.exists(local_path):
-        files.append( (workspace, open(local_path, "r")) )
+    local_path = os.path.join(root, "configure.ini.local")
+    if os.path.exists(local_path):
+      files.append( (root, open(local_path, "r")) )
 
   config = MultiConfigureIniParser(files)
 
   mopts = []
-  validopts = {}
+
   for k, v in config.selectlibs.items():
     mopts.append("with-%s=" % k)
     validopts["--with-%s" % k] = (k, v)
@@ -408,4 +412,4 @@ def main(workspacesfile):
   configure(config, overrides, workspaces)
 
 if __name__ == "__main__":
-  main("workspaces.ini")
+  main()