Index: NetworkEditor/src/main.cxx
===================================================================
--- NetworkEditor/src/main.cxx	(revision 10105)
+++ NetworkEditor/src/main.cxx	(working copy)
@@ -25,7 +25,7 @@
 
 #include "MainWindow.hxx"
 
-#ifdef WIN32
+#ifdef _MSVC_VER
 #include <CLAM/InitAudioIO.hxx>
 #include <CLAM/InitProcessing.hxx>
 #endif
@@ -44,7 +44,7 @@
 int main( int argc, char ** argv )
 {
 
-#ifdef WIN32
+#ifdef _MSVC_VER
 	CLAM::ProcessingModule::init();
 	CLAM::AudioIOModule::init();
 #endif
Index: NetworkEditor/src/prototyper/main.cxx
===================================================================
--- NetworkEditor/src/prototyper/main.cxx	(revision 10105)
+++ NetworkEditor/src/prototyper/main.cxx	(working copy)
@@ -1,4 +1,4 @@
-#ifdef WIN32
+#ifdef _MSVC_VER
 	#include <CLAM/InitAudioIO.hxx>
 	#include <CLAM/InitProcessing.hxx>
 #endif
@@ -21,7 +21,7 @@
 int main( int argc, char *argv[] )
 {
 
-#ifdef WIN32
+#ifdef _MSVC_VER
 	CLAM::ProcessingModule::init();
 	CLAM::AudioIOModule::init();
 #endif
Index: NetworkEditor/src/OfflinePlayerMain.cxx
===================================================================
--- NetworkEditor/src/OfflinePlayerMain.cxx	(revision 10105)
+++ NetworkEditor/src/OfflinePlayerMain.cxx	(working copy)
@@ -1,7 +1,7 @@
 #include <CLAM/FreewheelingNetworkPlayer.hxx>
 #include <CLAM/XMLStorage.hxx>
 
-#ifdef WIN32
+#ifdef _MSVC_VER
 #include <CLAM/InitAudioIO.hxx>
 #include <CLAM/InitProcessing.hxx>
 #endif
@@ -17,7 +17,7 @@
 int main( int argc, char *argv[] )
 {
 
-#ifdef WIN32
+#ifdef _MSVC_VER
 	CLAM::ProcessingModule::init();
 	CLAM::AudioIOModule::init();
 #endif
Index: NetworkEditor/SConstruct
===================================================================
--- NetworkEditor/SConstruct	(revision 10105)
+++ NetworkEditor/SConstruct	(working copy)
@@ -3,6 +3,11 @@
 import glob
 import sys
 
+crosscompiling = True
+isWindowsPlatform = sys.platform=='win32' or crosscompiling
+isLinuxPlatform = sys.platform=='linux' and not crosscompiling
+isDarwinPlatform = sys.platform=='darwin'
+
 options = Options('options.cache', ARGUMENTS)
 options.Add(PathOption('install_prefix', 'The prefix where the application will be installed', ''))
 options.Add(PathOption('clam_prefix', 'The prefix where CLAM was installed', ''))
@@ -32,6 +37,8 @@
 env.Tool('nsis', toolpath=[clam_sconstoolspath])
 if sys.platform=='darwin' : env.Tool('bundle', toolpath=[clam_sconstoolspath])
 env.Tool('dmg', toolpath=[clam_sconstoolspath])
+if crosscompiling :
+	env.Tool('crossmingw',toolpath=[clam_sconstoolspath])
 sys.path.append(clam_sconstoolspath)
 import versionInfo
 version, fullVersion = versionInfo.versionFromLocalInfo("NetworkEditor")
@@ -62,6 +69,7 @@
 	] , CLAMInstallDir)
 
 env.EnableQt4Modules([
+	'QtUiTools',
 	'QtCore',
 	'QtGui',
 	'QtOpenGL',
@@ -70,7 +78,6 @@
 #	'QtTest',
 	'QtXml',
 	'QtSvg',
-	'QtUiTools',
 #	'QtDesigner',
 #	'Qt3Support',
 	], debug=False)
@@ -110,12 +117,12 @@
 uifiles = scanFiles("*.ui", sourcePaths)
 if uifiles: uiheaders = env.Uic4(source=uifiles)
 
-if sys.platform=="win32" :
+if isWindowsPlatform :
 	sources += env.RES(source=["resources/NetworkEditor.rc"])
 
 if sys.platform=='win32' :
 	env.Append(CPPFLAGS=['-D_USE_MATH_DEFINES']) # to have M_PI defined
-if sys.platform=='linux2' :
+if isLinuxPlatform :
 	# TODO: This should not be hardcoded neither install_prefix (because package install)
 	env.Append(CPPFLAGS='-DDATA_EXAMPLES_PATH="\\"/usr/share/networkeditor/example-data\\""')
 
Index: Annotator/src/main.cxx
===================================================================
--- Annotator/src/main.cxx	(revision 10105)
+++ Annotator/src/main.cxx	(working copy)
@@ -25,7 +25,7 @@
 
 #include "Annotator.hxx"
 
-#ifdef WIN32
+#ifdef _MSVC_VER
 #include <CLAM/InitAudioIO.hxx>
 #include <CLAM/InitProcessing.hxx>
 #endif
@@ -41,7 +41,7 @@
 int main( int argc, char ** argv )
 {
 
-#ifdef WIN32
+#ifdef _MSVC_VER
 	CLAM::ProcessingModule::init();
 	CLAM::AudioIOModule::init();
 #endif
Index: Annotator/vmqt/SConstruct
===================================================================
--- Annotator/vmqt/SConstruct	(revision 10105)
+++ Annotator/vmqt/SConstruct	(working copy)
@@ -5,8 +5,8 @@
 options.Add(PathOption('clam_prefix', 'The prefix where CLAM was installed', ''))
 options.Add(BoolOption('release', 'Build CLAM Annotator enabling compiler optimizations', 'no') )
 options.Add(BoolOption('verbose', 'Display the full command line instead a short command description', 'no') )
+crosscompiling=True
 
-
 def scanFiles(pattern, paths) :
 	files = []
 	for path in paths :
@@ -30,6 +30,8 @@
 env.Tool('qt4', toolpath=[clam_sconstoolspath])
 env.Tool('clam', toolpath=[clam_sconstoolspath])
 env.Tool('nsis', toolpath=[clam_sconstoolspath])
+if crosscompiling :
+	env.Tool('crossmingw', toolpath=[clam_sconstoolspath])
 
 env.SConsignFile() # Single signature file
 
@@ -127,7 +129,7 @@
 
 staticLibrary = env.StaticLibrary(target='clam_vmqt4', source=sources)
 env.Append(LIBPATH='.')
-env.Append(LIBS='clam_vmqt4')
+env.Prepend(LIBS='clam_vmqt4')
 if sys.platform == "linux2" :
 	env.Append( CCFLAGS=['-g','-O3','-fomit-frame-pointer','-Wall'] )
 examples = []
Index: Annotator/SConstruct
===================================================================
--- Annotator/SConstruct	(revision 10105)
+++ Annotator/SConstruct	(working copy)
@@ -8,8 +8,9 @@
 options.Add(PathOption('clam_prefix', 'The prefix where CLAM was installed', ''))
 options.Add(BoolOption('release', 'Enabling compiler optimizations', 'no') )
 options.Add(BoolOption('verbose', 'Display the full command line instead a short command description', 'no') )
+if sys.platform=="linux2" :
+	options.Add(BoolOption('crossmingw', 'Display the full command line instead a short command description', 'no') )
 
-
 def scanFiles(pattern, paths) :
 	files = []
 	for path in paths :
@@ -19,17 +20,23 @@
 def recursiveDirs(root) :
 	return filter( (lambda a : a.rfind( ".svn")==-1 ),  [ a[0] for a in os.walk(root)]  )
 
-
 env = Environment(ENV=os.environ, tools=['default'], options=options)
 options.Save('options.cache', env)
 Help(options.GenerateHelpText(env))
 
 env.SConsignFile() # Single signature file
 
+crosscompiling = env["crossmingw"]
+isWindowsPlatform = sys.platform=='win32' or crosscompiling
+isLinuxPlatform = sys.platform=='linux' and not crosscompiling
+isDarwinPlatform = sys.platform=='darwin'
+
 CLAMInstallDir = env['clam_prefix']
 clam_sconstoolspath = os.path.join(CLAMInstallDir,'share','clam','sconstools')
 CLAMVmQtPath = 'vmqt'
 
+if crosscompiling : 
+	env.Tool('crossmingw', toolpath=[clam_sconstoolspath])
 env.Tool('qt4', toolpath=[clam_sconstoolspath])
 env.Tool('clam', toolpath=[clam_sconstoolspath])
 env.Tool('nsis', toolpath=[clam_sconstoolspath])
@@ -43,7 +50,6 @@
 versionInfo.generateVersionSources(os.path.join('src','MusicAnnotatorVersion'), "MusicAnnotator", fullVersion)
 
 
-
 env['CXXFILESUFFIX'] = '.cxx'
 env['QT4_UICDECLSUFFIX'] = '.hxx'
 env['QT4_MOCHPREFIX'] = os.path.join('generated','moc_')
@@ -119,12 +125,12 @@
 uifiles = scanFiles("*.ui", sourcePaths)
 if uifiles: uiheaders = env.Uic4(source=uifiles)
 
-if sys.platform=="win32" :
+if isWindowsPlatform :
 	sources += env.RES(source=["resources/Annotator.rc"])
 
 env.Append(CPPPATH=includePaths)
 env.Append(LIBPATH=[CLAMVmQtPath])
-env.Append(LIBS="clam_vmqt4")
+env.Prepend(LIBS="clam_vmqt4")
 if sys.platform=='darwin' :
 	env.Append(CPPFLAGS='-DRESOURCES_BASE="\\"Annotator.app/Contents/Resources\\""')
 else :
@@ -160,12 +166,16 @@
 
 programs += [ env.Program(target='ChordExtractor', source = chordSources) ]
 
-"""
 onsetSources = scanFiles("*.cpp", ["src/OnsetExtractor"])
 onsetSources = filter ( (lambda a : a.rfind( "Test")==-1 ),  onsetSources )
 onsetSources = filter ( (lambda a : a.rfind( "cppunit")==-1 ),  onsetSources )
-programs += [ env.Program(target='OnsetExtractor', source = onsetSources, LIBS=['fftw3','sndfile']) ]
-"""
+fftwlib = "fftw3-3"
+fftwlibpath = []
+if sys.platform=="win32" or crosscompiling :
+	fftwlib="fftw3-3"
+	fftwlibpath.append("../../fftw3/lib")
+	fftwlibpath.append("../../libsndfile/lib")
+programs += [ env.Program(target='OnsetExtractor', source = onsetSources, LIBS=[fftwlib,'sndfile'], LIBPATH=fftwlibpath) ]
 
 env.Uic4(source="SimacServicesClient/GUI.ui")
 bocaClientSources = [
Index: CLAM/scons/sconstools/qt4.py
===================================================================
--- CLAM/scons/sconstools/qt4.py	(revision 10111)
+++ CLAM/scons/sconstools/qt4.py	(working copy)
@@ -57,6 +57,7 @@
 
 qrcinclude_re = re.compile(r'<file>([^<]*)</file>', re.M)
 
+crosscompiling=True
 
 header_extensions = [".h", ".hxx", ".hpp", ".hh"]
 if SCons.Util.case_sensitive_suffixes('.h', '.H'):
@@ -215,17 +216,20 @@
 
 	def locateQt4Command(env, command, qtdir) :
 		fullpath1 = os.path.join(qtdir,'bin',command +'-qt4')
-		if os.access(fullpath1, os.X_OK) or \
-			os.access(fullpath1+".exe", os.X_OK):
+		if os.access(fullpath1, os.X_OK) :
 			return fullpath1
+		if os.access(fullpath1+".exe", os.X_OK) :
+			return fullpath1+".exe"
 		fullpath3 = os.path.join(qtdir,'bin',command +'4')
-		if os.access(fullpath3, os.X_OK) or \
-			os.access(fullpath3+".exe", os.X_OK):
+		if os.access(fullpath3, os.X_OK) :
 			return fullpath3
+		if os.access(fullpath3+".exe", os.X_OK) :
+			return fullpath3+".exe"
 		fullpath2 = os.path.join(qtdir,'bin',command)
-		if os.access(fullpath2, os.X_OK) or \
-			os.access(fullpath2+".exe", os.X_OK):
+		if os.access(fullpath2, os.X_OK) :
 			return fullpath2
+		if os.access(fullpath2+".exe", os.X_OK) :
+			return fullpath2+".exe"
 		fullpath = env.Detect([command+'-qt4', command+'4', command])
 		if not (fullpath is None) : return fullpath
 		raise "Qt4 command '" + command + "' not found. Tried: " + fullpath1 + " and "+ fullpath2
@@ -403,7 +407,7 @@
 		self.AppendUnique(CPPFLAGS=['-DQT_GUI_LIB'])
 
 	debugSuffix = ''
-	if sys.platform == "linux2" :
+	if sys.platform == "linux2" and not crosscompiling :
 		if debug : debugSuffix = '_debug'
 		for module in modules :
 			if module not in pclessModules : continue
@@ -414,10 +418,10 @@
 		pcmodules = [module+debugSuffix for module in modules if module not in pclessModules ]
 		self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules))
 		return
-	if sys.platform == "win32" :
+	if sys.platform == "win32" or crosscompiling :
 		if debug : debugSuffix = 'd'
 		self.AppendUnique(LIBS=[lib+'4'+debugSuffix for lib in modules if lib not in staticModules])
-		self.AppendUnique(LIBS=[lib+debugSuffix for lib in modules if lib in staticModules])
+		self.PrependUnique(LIBS=[lib+debugSuffix for lib in modules if lib in staticModules])
 		if 'QtOpenGL' in modules:
 			self.AppendUnique(LIBS=['opengl32'])
 		self.AppendUnique(CPPPATH=[ '$QTDIR/include/'+module
Index: CLAM/scons/libs/clam_dependent_libs_checks.py
===================================================================
--- CLAM/scons/libs/clam_dependent_libs_checks.py	(revision 10111)
+++ CLAM/scons/libs/clam_dependent_libs_checks.py	(working copy)
@@ -4,6 +4,8 @@
 #---------------------------------------------------------------
 # from __init__.py
 
+crosscompiling=True
+
 def setup_global_environment( clam_env, conf ) :	
 	# clam env
 	# check for pkg-config, compiler support, bash features, et.
@@ -27,7 +29,7 @@
 	if clam_env['optimize_and_lose_precision'] :
 		clam_env.Append( CPPFLAGS=['-DCLAM_OPTIMIZE'] )
 
-	if sys.platform != 'win32' :
+	if sys.platform != 'win32' or crosscompiling :
 		if clam_env['release'] :
 			clam_env.Append( CCFLAGS='-g -O2 -fomit-frame-pointer -Wall'.split(' ') )
 		else :
@@ -49,7 +51,9 @@
 	if not result :
 		print "Could not find pthread (Posix Threads) library headers!"
 		return False
-	if sys.platform == 'win32' :
+	if crosscompiling :
+		result = conf.CheckLib( 'pthreadGCE2', 'pthread_join' )
+	elif sys.platform == 'win32' :
 		result = conf.CheckLib( 'pthreadVCE', 'pthread_join' )
 	else:
 		result = conf.CheckLib( 'pthread', 'pthread_join' )
@@ -64,7 +68,7 @@
 	
 	if result :
 		clam_env.Append( CPPFLAGS=['-DUSE_PTHREADS=1'] )
-		#clam_env.Append( LIBS=['pthread'] )
+#		clam_env.Append( LIBS=['pthread'] )
 
 	if sys.platform == 'win32' :
 		clam_env.Append( CPPFLAGS=['-DWIN32'] )
@@ -86,7 +90,7 @@
 	if not result :
 		print "Could not find libsndfile headers! Please check your libsndfile installation"
 		return False
-	if sys.platform != 'win32' :
+	if sys.platform != 'win32' and not crosscompiling :
 		result = conf.CheckLib( library='sndfile', symbol='sf_open_fd' )
 	else :
 		result = conf.CheckLib( library='libsndfile', symbol='sf_open_fd' )
@@ -148,7 +152,7 @@
 	if not result :
 		print "Could not find libmad headers! Please check your libmad installation"
 		return False
-	if sys.platform != 'win32' :
+	if sys.platform != 'win32' and not crosscompiling :
 		result = conf.CheckLib( library='mad', symbol='mad_stream_init' )
 	else :
 		result = conf.CheckLib( library='libmad', symbol='mad_stream_init' )
@@ -164,13 +168,17 @@
 
 def test_id3lib( audioio_env, conf ) :
 	if sys.platform == 'win32' :
-		audioio_env.Append( CPPFLAGS=['-DID3LIB_LINKOPTION=1'] )
-		#pass
+		if crosscompiling :
+			audioio_env.Append( CPPFLAGS=['-DID3LIB_LINKOPTION=3'] )
+		else :
+			audioio_env.Append( CPPFLAGS=['-DID3LIB_LINKOPTION=1'] )
 	result = conf.CheckCXXHeader( 'id3.h' )
 	if not result :
 		print "Could not find id3lib headers! Please check your id3lib installation"
 		return False
-	if sys.platform == 'win32' :
+	if crosscompiling :
+		result = conf.CheckLibWithHeader( 'id3lib', 'id3/tag.h', 'cxx', call='ID3_Tag myTag;' )
+	elif sys.platform == 'win32' :
 		result = conf.CheckLibWithHeader( 'id3lib_vc7', 'id3/tag.h', 'cxx', call='ID3_Tag myTag;' )
 	else :
 		audioio_env.Append( LIBS=['z'] )
@@ -179,7 +187,7 @@
 	if not result :
 		print "Could not find id3lib binaries! Please check your id3lib installation"
 		return False
-	if sys.platform == 'win32' :
+	if sys.platform == 'win32' and not crosscompiling :
 		audioio_env.Append( LIBS='zlib_vc7' )
 	result = conf.check_id3lib()
 	if not result :
@@ -295,10 +303,10 @@
 	if audioio_env['with_id3'] :
 		if not test_id3lib( audioio_env, conf ) : return False
 
-	if sys.platform == 'linux2' and audioio_env['with_alsa'] :
+	if (sys.platform == 'linux2' and not crosscompiling) and audioio_env['with_alsa'] :
 		if not test_alsa_sdk( audioio_env, conf ) : return False
 
-	if audioio_env['with_jack'] :
+	if audioio_env['with_jack'] and not crosscompiling:
 		if not test_jack (audioio_env, conf): return False
 
 	if audioio_env['with_portmidi'] :
@@ -307,7 +315,7 @@
 	if audioio_env['with_portaudio'] :
 		if not test_portaudio( audioio_env, conf ) : return False
 
-	if not sys.platform == 'linux2' :
+	if not sys.platform == 'linux2' or crosscompiling :
 		if sys.platform == 'win32' :
 			if not test_directx_sdk( audioio_env, conf ) : return False
 
@@ -338,7 +346,7 @@
 		if not failed and not conf.CheckCXXHeader('xercesc/util/PlatformUtils.hpp') :
 			print "Could not find xerces c headers! Defaulting to the null xml backend"
 			failed = True
-		core_env['ENV'] = os.environ
+		core_env.Append(ENV=os.environ)
 		print('path of app: ' + core_env['ENV']['PATH'])
 		if not failed and not conf.check_xerces_c( conf ) :
 			print "xerces c code compile/link/run test failed! Check config.log for details..."
@@ -435,7 +443,10 @@
 		print "FFTW3 header not found"
 		return False
 
-	if not conf.CheckLib( 'fftw3', 'fftw_plan_dft_r2c_1d') :
+	libname = "fftw3"
+	if sys.platform=='win32' or crosscompiling :
+		libname = 'fftw3-3'
+	if not conf.CheckLib( libname, 'fftw_plan_dft_r2c_1d') :
 		print "Unable to link FFTW3"
 		return False
 
Index: CLAM/scons/libs/clam_build_helpers.py
===================================================================
--- CLAM/scons/libs/clam_build_helpers.py	(revision 10111)
+++ CLAM/scons/libs/clam_build_helpers.py	(working copy)
@@ -5,6 +5,8 @@
 
 import shelve  #TODO needed
 
+crosscompiling=True
+
 def generate_copy_files( target, source, env ) :
 	if sys.platform == 'win32' :
 		copyCmd = 'copy'
@@ -281,8 +283,8 @@
 		out = open(out_file, 'w' )
 
 		print >> out, "prefix = %s"%env['prefix']
-		print >> out, "libdir = %s\\lib"%env['prefix']
-		print >> out, "includedir = %s\\include"%env['prefix']
+		print >> out, "libdir = ${prefix}\\lib"
+		print >> out, "includedir = ${prefix}\\include"
 		print >> out
 		print >> out, "Name: %s"%self.name
 		print >> out, "Version: %s"%self.version
@@ -313,9 +315,9 @@
 	def linux_create_pkg_descriptor( self, env, out_file ) :
 		out = open(out_file, 'w')
 	
-		print >> out, "prefix = /%s"%env['prefix']
-		print >> out, "libdir = /%s/lib"%env['prefix']
-		print >> out, "includedir = /%s/include"%env['prefix']
+		print >> out, "prefix = %s"%env['prefix']
+		print >> out, "libdir = ${prefix}/lib"
+		print >> out, "includedir = ${prefix}/include"
 		print >> out
 		print >> out, "Name: %s"%self.name	
 		print >> out, "Version: %s"%self.version
@@ -347,7 +349,7 @@
 	env.Prepend(LIBPATH=['../%s'%module for module in moduleDependencies])
 	#audioio_env.Append( ARFLAGS= ['/OPT:NOREF', '/OPT:NOICF', '/DEBUG'] )
 
-	if sys.platform != 'win32' :
+	if sys.platform != 'win32' and not crosscompiling :
 		return posix_lib_rules( name, version, headers , sources, install_dirs, env )
 	else :
 		return win32_lib_rules( name, version, headers , sources, install_dirs, env )
@@ -419,10 +421,13 @@
 	return tgt, install_tgt
 
 def win32_lib_rules( name, version, headers, sources, install_dirs, env, moduleDependencies =[] ) :
-	static_lib = env.Library( 'clam_' + name, sources )
-	tgt = env.Alias(name, static_lib)
+	if crosscompiling :
+		lib = env.SharedLibrary( 'clam_' + name, sources)
+	else :
+		lib = env.Library( 'clam_' + name, sources )
+	tgt = env.Alias(name, lib)
 	lib_descriptor = env.File( 'clam_'+name+'.pc' )
-	install_static = env.Install( install_dirs.lib, static_lib )
+	install_static = env.Install( install_dirs.lib, lib )
 	install_descriptor = env.Install( install_dirs.lib+'/pkgconfig', lib_descriptor )
 	install_headers = env.Install( install_dirs.inc+'/CLAM', headers )
 	install_tgt = env.Alias('install_'+name, [install_headers,install_static,install_descriptor])
@@ -451,7 +456,7 @@
 }
 """
 
-if sys.platform == 'win32' :
+if sys.platform == 'win32' or crosscompiling :
 	package_checks['check_xerces_c'] = ThoroughPackageCheck( 'xerces-c', 'c++', 'xerces-c_2', xerces_test_code )
 else :
 	package_checks['check_xerces_c'] = ThoroughPackageCheck( 'xerces-c', 'c++', 'xerces-c', xerces_test_code )
Index: CLAM/scons/libs/core/SConscript
===================================================================
--- CLAM/scons/libs/core/SConscript	(revision 10111)
+++ CLAM/scons/libs/core/SConscript	(working copy)
@@ -4,6 +4,8 @@
 
 Import('core_env version install_dirs')
 
+crosscompiling=True
+
 def define_module_contents(env) :
 	if not os.path.exists('src') :
 		os.mkdir('src')
@@ -33,7 +35,7 @@
 		'externals/CbLib',
 		]
 
-	if sys.platform == 'win32' :
+	if sys.platform == 'win32' or crosscompiling :
 		folders.append('src/Defines/Windows')
 	else :
 		folders.append('src/Defines/Unix')	
@@ -47,7 +49,7 @@
 		'FreewheelingNetworkPlayer',
 		]
 
-	if sys.platform == 'win32' :
+	if sys.platform == 'win32' or crosscompiling :
 		blacklist.append( 'Watchdog.+' )
 
 	if core_env['xmlbackend'] == 'xercesc' :
Index: CLAM/scons/libs/audioio/SConscript
===================================================================
--- CLAM/scons/libs/audioio/SConscript	(revision 10111)
+++ CLAM/scons/libs/audioio/SConscript	(working copy)
@@ -4,6 +4,8 @@
 
 Import('audioio_env version install_dirs')
 
+crosscompiling=True
+
 def define_module_contents(env) :
 	if not os.path.exists('src') :
 		os.mkdir('src')
@@ -42,11 +44,13 @@
 	if env['with_portmidi'] :
 		folders.append( 'src/Tools/PortMIDI' )
 
-	if sys.platform == 'linux2' :
+	if crosscompiling :
+		pass
+	elif sys.platform == 'linux2' :
 		if env['with_alsa'] :
 			folders.append( 'src/Tools/MIDIIO/Linux' )
 			folders.append( 'src/Tools/AudioIO/Linux')
-	elif sys.platform == 'win32':
+	elif sys.platform == 'win32' :
 		if env['audio_backend'] == 'rtaudio' :
 			print('using rtaudio')
 			folders += ['src/Tools/AudioIO/RtAudio'] #, 'src/Defines/Windows/CLAM_windows.h']
@@ -78,6 +82,7 @@
 		'main.cxx',
 		'GUIAudioApplication.*xx',
 		]
+	env.AppendUnique(LDFLAGS=["-Wl,--exclude-libs,ogg.lib"])
 
 	file_retriever = FileRetriever( '../../..', folders, blacklist )
 
Index: CLAM/src/Standard/Array.cxx
===================================================================
--- CLAM/src/Standard/Array.cxx	(revision 10111)
+++ CLAM/src/Standard/Array.cxx	(working copy)
@@ -23,6 +23,7 @@
 
 namespace CLAM
 {
+/*
 #define CLAM_NUMERIC_ARRAY_INITIALIZATION(Type)          \
 template<>                                              \
 void Array<Type>::InitializeElement(int i)              \
@@ -43,7 +44,7 @@
 CLAM_NUMERIC_ARRAY_INITIALIZATION(float)
 
 
-/** And fast spetialization for basic types */
+/// And fast spetialization for basic types
 
 #define CLAM_FAST_ARRAY_SPECIALIZATIONS(TYPE)                           \
 template<>                                                             \
@@ -99,7 +100,7 @@
 CLAM_FAST_ARRAY_SPECIALIZATIONS(signed char)
 CLAM_FAST_ARRAY_SPECIALIZATIONS(double)
 CLAM_FAST_ARRAY_SPECIALIZATIONS(float)
+*/
 
-
 }
 
Index: CLAM/SConstruct
===================================================================
--- CLAM/SConstruct	(revision 10111)
+++ CLAM/SConstruct	(working copy)
@@ -8,8 +8,11 @@
 from clam_build_helpers import *
 from clam_dependent_libs_checks import *
 
+crosscompiling = True
+isWindowsPlatform = sys.platform=='win32' or crosscompiling
+isLinuxPlatform = sys.platform=='linux' and not crosscompiling
+isDarwinPlatform = sys.platform=='darwin'
 
-
 def load_config_file_to_env( env, dir ):
 	opts = Options(dir+'/flags.conf')
 	opts.Add( 'CPPPATH', 'CPP PATH')
@@ -42,12 +45,9 @@
 ############################################"""
 	# Sandbox setup
 	clam_env.Replace( QT_LIB = '' )
-	if sys.platform == 'win32' : #!= 'linux2' :
-		libbasenames = [ 'xercesc', 'fftw', 'dxsdk', 'id3lib', 'libmad', 'libsndfile','oggvorbis','portmidi','portaudio','pthreads']
+	if isWindowsPlatform :
+		libbasenames = [ 'xercesc', 'fftw', 'fftw3', 'dxsdk', 'id3lib', 'libmad', 'libsndfile','oggvorbis','portmidi','portaudio','pthreads']
 		for basename in libbasenames :
-			if sys.platform == 'win32' : path_sep = '\\'
-			if sys.platform == 'darwin' : path_sep = '/'
-
 			include_path = os.path.join(clam_env['sandbox_path'], basename, 'include')
 			print( 'include path: ' + include_path )
 			lib_path =  os.path.join(clam_env['sandbox_path'], basename, 'lib')
@@ -55,14 +55,16 @@
 			clam_env.Append( CPPPATH= [include_path] )
 			clam_env.Append( LIBPATH = [lib_path] )
 			# if flags is not defined it will crash while loading flags.conf
-		environmentIncludes = os.environ['INCLUDE']
+		environmentIncludes = ""
+		if os.environ.has_key('INCLUDE') : environmentIncludes = os.environ['INCLUDE']
 		environmentIncludesList = environmentIncludes.split(';')
 		for include in environmentIncludesList :
+			if not include : continue
 			print( 'adding include dir from windows config: ' + include )
 			clam_env.Append( CPPPATH = [include] )
-	if sys.platform == 'linux2':
+	if isLinuxPlatform :
 		clam_env.Append( CPPPATH= ['/usr/local/include'] )
-	if sys.platform == 'darwin' :
+	if isDarwinPlatform :
 		clam_env.Append( CPPPATH= ['/usr/local/include', '/opt/local/include'] )
 		
 
@@ -134,9 +136,9 @@
 	# global options
 	opts.Add( PathOption( 'prefix', 'Install location for CLAM', '/usr/local'))
 	opts.Add( PathOption( 'install_prefix', 'Install location when packaging (just for .deb creation)', '.'))
-	if sys.platform == 'win32' : #!= 'linux2' :
+	if isWindowsPlatform :
 		opts.Add( PathOption( 'sandbox_path', 'Path to sandbox', 'G:\\projects' ) )
-	if sys.platform == 'win32' :
+	if isWindowsPlatform :
 		release_option = 'no'
 	else :
 		release_option = 'no'
@@ -149,7 +151,7 @@
 	opts.Add( BoolOption( 'optimize_and_lose_precision', 'Use tabulated trigonometric functions and the like', 'no' )) 
 	# clam_core options
 	opts.Add( EnumOption( 'xmlbackend', 'XML passivation backend', 'xercesc', ('xercesc','xmlpp','both','none')) )
-	if sys.platform != 'win32' :
+	if not isWindowsPlatform :
 		opts.Add( BoolOption( 'with_ladspa', 'Ladspa plugin support', 'yes') )
 		opts.Add( BoolOption( 'with_osc', 'Enables/Disables OSC support', 'no') )
 		opts.Add( BoolOption( 'with_jack', 'Enables/Disable JACK support', 'yes') )
@@ -167,11 +169,11 @@
 	opts.Add( BoolOption( 'with_mad', 'Enables mpeg 1 layer 3 files reading and writing support', 'yes' ) )
 	opts.Add( BoolOption( 'with_id3', 'Enables support for accesing ID3 tags on mpeg audio streams', 'yes') )
 	opts.Add( BoolOption( 'with_portaudio', 'Enables audio device I/O using PortAudio', 'yes') )
-	if sys.platform == 'linux2' :
+	if isLinuxPlatform :
 		opts.Add( BoolOption( 'with_alsa', 'Enables PCM and MIDI device I/O through ALSA', 'yes' ) )
-	elif sys.platform == 'darwin' :
+	elif isDarwinPlatform :
 		opts.Add( EnumOption( 'audio_backend', 'Selects audio PCM i/o library used by CLAM backend', 'rtaudio', ('rtaudio','portaudio') ) )
-	elif sys.platform == 'win32' :
+	elif isWindowsPlatform :
 		opts.Add( EnumOption( 'audio_backend', 'Selects audio PCM i/o library used by CLAM backend', 'rtaudio', ('rtaudio','directx','portaudio') ) )
 	opts.Add( BoolOption( 'with_portmidi', 'Enables MIDI device I/O through portmidi', 'no' ) )
 
@@ -236,6 +238,8 @@
 setup_build_options( clam_env )
 
 clam_env.Append( CPPFLAGS = '' )
+if crosscompiling :
+	clam_env.Tool('crossmingw',toolpath=['scons/sconstools'])
 
 if clam_env['distcc_hosts'] :
 	clam_env['CXX'] = 'distcc g++'
@@ -262,7 +266,7 @@
 
 clam_env['CXXFILESUFFIX'] = '.cxx'
 
-if sys.platform=='win32' :
+if isWindowsPlatform :
 	clam_env.Append(CPPFLAGS=['-D_USE_MATH_DEFINES']) # to have M_PI defined
 
 if 'configure' in COMMAND_LINE_TARGETS or config_file_missing() or ARGUMENTS :
