Protection for non-interactive procedures
[anna.git] / SConstruct
index 1cff096..517b1a6 100644 (file)
@@ -1,4 +1,5 @@
 import os
+import sys, select
 
 # Basic paths
 prefix = ARGUMENTS.get ('prefix', "/usr/local")
@@ -17,11 +18,38 @@ target_opt_bin = os.path.join (opt_bin, "anna")
 # Versioning
 release = ARGUMENTS.get ('release', 0)
 
+# Environment
+env = None
+rc = os.system("clang++ --version >/dev/null 2>/dev/null")
+if rc == 0: 
+  print "\nDetected clang++ installed in the system"
+  print "\nSelect compiler:\n  1. g++\n  2. clang++"
+  #option = raw_input("\nInput option [1]: ") or "1"
+  # Read with timeout:
+  print "\nInput option [1]: "
+  option = 1
+  i, o, e = select.select( [sys.stdin], [], [], 60 )
+  if (i): option = sys.stdin.readline().strip()
+  else: print "expired! using default ..."
+  if option == "2":
+    env = Environment(CXX = 'clang++')
+    env.Append (CCFLAGS = '-DIS_CLANG')
+    env.Append (CXXFLAGS = '-Wno-parentheses-equality')
+  else:
+    env = Environment()
+else:
+  env = Environment()
+
+#oracle_includes = os.environ["ORACLE_HOME"] + "/include"
+oracle_includes = "/usr/lib/oracle/12.1/client64/include"
+        
 # Headers
 source_include = os.path.join (current_directory, "include")
 usr_include = [
-  "/usr/include/oracle/11.2/client",
+  #"/usr/include/oracle/12.1/client64",
+  oracle_includes,
   "/usr/include/libxml2",
+  #"/usr/include/boost",
   #"/usr/include/mysql", 
   #"/usr/include/openssl", 
 ]
@@ -30,10 +58,13 @@ usr_include = [
 libraries = []
 
 # Environment
-env = Environment ()
+#env = Environment ()
 # CPPPATH will be relative to src/<target>
 env.Append (CPPPATH = [source_include, usr_local_include, usr_include ])
-env.Append (CCFLAGS = '-std=c++0x')
+#env.Append (CCFLAGS = '-std=c++0x')
+# C++11 support:
+env.Append (CXXFLAGS = '-std=c++11')
+
 env.Append (LIBS = [''])
 # scons -Q release=1
 if int(release):
@@ -42,7 +73,7 @@ if int(release):
   env.Append (VARIANT = variant)
 else:
   variant='debug'
-  env.Append (CCFLAGS = '-g -O0 -D_DEBUG')
+  env.Append (CCFLAGS = '-g -O0')
   env.Append (LIBPATH = os.path.join (current_directory, variant))
   env.Append (VARIANT = variant)