[Gridflow-cvs] [svn] commit: r6734 - /trunk/configure

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Sun Mar 6 10:54:58 EST 2011


Author: matju
Date: Sun Mar  6 10:54:57 2011
New Revision: 6734

Log:
rename CC to CXX, reorganise some things

Modified:
    trunk/configure

Modified: trunk/configure
==============================================================================
--- trunk/configure (original)
+++ trunk/configure Sun Mar  6 10:54:57 2011
@@ -62,7 +62,7 @@
 	return ret<=0
 end
 
-CC = "g++"
+CXX = "g++"
 LDSOFLAGS = []
 FEATURES = {}
 DEFINES = {}
@@ -112,7 +112,7 @@
 		LOG.puts code
 		name = "tmp/#{$$}"
 		File.open(name+".cpp","w") {|f| f.puts code }
-		command = [CC] + CFLAGS.split(/ /).reject{|x| x.length==0 }
+		command = [CXX] + CFLAGS.split(/ /).reject{|x| x.length==0 }
 		raise "gcc compilation error" if not launch *(command+flags+[name+".cpp","-o",name,*link.uniq])
 		raise "runtime error" if not launch name
 		return true
@@ -124,7 +124,7 @@
 		name = "tmp/#{$$}"
 		File.open(name+".asm","w") {|f| f.puts code }
 		launch "nasm",name+".asm","-f",(if OSX then "macho" else "elf" end),"-o",name+".o" and
-		launch CC,"-o",name,name+".o",*link and
+		launch CXX,"-o",name,name+".o",*link and
 		launch name
 	end
 end
@@ -197,7 +197,7 @@
 			T(void *)T(ptrdiff_t)T(off_t)T(size_t)puts("");
 			T(char)T(short)T(int)T(long)T(long long)puts("");
 			T(float)T(double)puts("");
-			return !( sizeof(void*)==8 );
+			return sizeof(void*)!=8;
 		}}}}
 Feature.add(:pentium,"Pentium-compatible CPU") {
 	action proc {
@@ -292,8 +292,7 @@
 		#include <stdio.h>
 		#include#
 		};
-		int main () {
-		return jpeg_write_scanlines==0;}"}}
+		int main () {return jpeg_write_scanlines==0;}"}}
 Feature.add(:png,"PNG Library") {
 	uses_so ["-lpng","-lz"]
 	uses_h Or[["png.h"],["libpng/png.h"],["libpng14/png.h"],["libpng12/png.h"]]
@@ -344,8 +343,7 @@
 	produces_o ["src/quicktimeapple.o","src/quicktimecamera.o"]
 	test proc {c_test "
 		#include#
-		int main () {return EnterMovies==0;}
-		"}}
+		int main () {return EnterMovies==0;}"}}
 Feature.add(:quicktimehw,"Plaum's LibQuickTime") {
 	uses_so Or[
 		LIBX11DIR+["-lquicktime","-lpthread","-lpng","-ldl","-lglib"    ,"-lz"],
@@ -360,14 +358,12 @@
 		#include <stdio.h>
 		#include#
 		int main () {
-		fprintf(stderr,"LQT_VERSION = %s\\n",
 		#ifdef LQT_VERSION
-			LQT_VERSION
+			printf("LQT_VERSION = %s\\n",LQT_VERSION);
 		#else
-			"(undefined)"
+			printf("LQT_VERSION = (undefined)");
 		#endif
-		); return quicktime_open==0; }
-		`}}
+		return quicktime_open==0; }`}}
 Feature.add(:opencv,"Intel OpenCV") {
 	produces_o ["src/opencv.o"]
 	uses_so ["-lcv"]
@@ -391,10 +387,7 @@
         uses_h ["GL/glew.h"]
 	test proc {c_test %`
                 #include#
-                int main () {return (GLint)0;}
-                `
-        }
-}
+                int main () {return (GLint)0;}`}}
 Feature.add(:gem,"GEM support (loadtime detect: don't disable)") {
 	produces_pdlib ["gem_loader","gem9292","gem9293","gem9393"]
 	uses_feature [:opengl]
@@ -448,7 +441,7 @@
 	when "--debug": DEFINES["HAVE_DEBUG"]=1
 	when "--lite":  DEFINES["HAVE_LITE" ]=1
 	when "--help": usage; exit 0
-	when "--use-compiler":        CC =          ARGV.shift
+	when "--use-compiler":        CXX =         ARGV.shift
 	when "--use-compiler-option": CFLAGS << " "+ARGV.shift
 	when "--use-cpu":          DEFINES["CPU"] = ARGV.shift
 	else puts "unknown option \"#{arg}\""; usage; exit 1
@@ -534,7 +527,7 @@
 #--------------------------------#
 
 LOG.puts "-"*64
-LOG.puts        "$CC: #{CC.inspect}"
+LOG.puts       "$CXX: #{CXX.inspect}"
 LOG.puts "$LDSOFLAGS: #{LDSOFLAGS.inspect}"
 LOG.puts   "$DEFINES: #{DEFINES.inspect}"
 LOG.puts      "$OBJS: #{OBJS.inspect}"
@@ -556,14 +549,11 @@
   f.puts "CFLAGS += " + CFLAGS
   f.puts "LDSOFLAGS += " + LDSOFLAGS.flatten.join(" ")
   for k,v in DEFINES do f.puts "#{k}=#{v}" end
-  f.puts "CXX = #{CC}"
-  f.puts "OBJS = #{OBJS.join(" ")}"
-  f.puts "DLEXT = #{CONFIG['DLEXT']}"
-  f.puts ""
+  f.puts "CXX = "+CXX
+  f.puts "OBJS = "+OBJS.join(" ")
+  f.puts "DLEXT = "+CONFIG['DLEXT']
   f.puts "PDLIB = gridflow$(PDSUF) "+PDLIB.map{|x|"gridflow_#{x}$(PDSUF)"}.join(" ")
-  for k in LDSO.keys.sort do
-    f.puts "LDSO_#{k} = "+LDSO[k].join(" ") if LDSO[k]
-  end
+  for k in LDSO.keys.sort do f.puts "LDSO_#{k} = "+LDSO[k].join(" ") if LDSO[k] end
 } # end open config.make
 File.open("config.h","w") {|f|
 f.puts "
@@ -571,26 +561,18 @@
 \#define __CONFIG_H
 /* this file was auto-generated by gridflow/configure */"
 f.puts "#define STARTUP_LIST(PRE) \\"
-f.puts OBJS.map {|o|
-	oo = File.basename(o,'.o').split(/-/)[0]
-	oo.gsub!(/\$\(PDSUF\)$/,"")
-	"PRE startup_#{oo}();"
-}.join("\\\n")
+f.puts OBJS.map {|o| "PRE startup_#{File.basename(o,'.o')}();"}.join("\\\n")
 for k,v in DEFINES do f.puts "\#define #{k} "+v.inspect end
-def include_here(f,a,b,c=false)
-  return unless FEATURES[b]
-  f.puts "\#ifdef #{a}_INCLUDE_HERE"
+def include_here(f,a)
+  return unless FEATURES[a.intern]
+  f.puts "\#ifdef #{a.upcase}_INCLUDE_HERE"
   f.puts "extern \"C\" {"
-  for inc in FEATURES[b].uses_h.to_a do
-    f.puts "\#include <#{inc}>"
-  end
+  for inc in FEATURES[a.intern].uses_h.to_a do f.puts "\#include <#{inc}>" end
   f.puts "};"
   f.puts "\#endif"
 end
-include_here f,"DC1394", :dc1394
-include_here f,"LIBMPEG", :mpeg3
-include_here f,"QUICKTIMEHW",:quicktimehw
-include_here f,"PNG",:png
+for tag in %w[dc1394 mpeg3 quicktimehw png] do include_here f,tag end
+# for tag in FEATURES.keys do include_here f, tag.to_s.upcase, tag if Or===FEATURES[tag].uses_h; p FEATURES[tag].uses_h end
 f.puts "\#endif /* __CONFIG_H */"
 } # end open config.h
 



More information about the Gridflow-cvs mailing list