Index: CLAM/scons/sconstools/crossmingw.py
===================================================================
--- CLAM/scons/sconstools/crossmingw.py	(revision 10069)
+++ CLAM/scons/sconstools/crossmingw.py	(working copy)
@@ -68,9 +68,10 @@
 
   return (target, source)
 
+#Vok
+#shlib_action = SCons.Action.CommandGenerator(shlib_generator)
+shlib_action = shlib_generator
 
-shlib_action = SCons.Action.CommandGenerator(shlib_generator)
-
 res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
 
 res_builder = SCons.Builder.Builder(action=res_action, suffix='.o',
Index: CLAM/scons/libs/clam_dependent_libs_checks.py
===================================================================
--- CLAM/scons/libs/clam_dependent_libs_checks.py	(revision 10069)
+++ 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,7 @@
 	if not result :
 		print "Could not find pthread (Posix Threads) library headers!"
 		return False
-	if sys.platform == 'win32' :
+	if sys.platform == 'win32' or crosscompiling :
 		result = conf.CheckLib( 'pthreadVCE', 'pthread_join' )
 	else:
 		result = conf.CheckLib( 'pthread', 'pthread_join' )
@@ -86,7 +88,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 +150,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 +166,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 +185,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' or crosscompiling :
 		audioio_env.Append( LIBS='zlib_vc7' )
 	result = conf.check_id3lib()
 	if not result :
@@ -295,10 +301,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 +313,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 +344,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..."
Index: CLAM/scons/libs/clam_build_helpers.py
===================================================================
--- CLAM/scons/libs/clam_build_helpers.py	(revision 10069)
+++ 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'
@@ -451,7 +453,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/audioio/SConscript
===================================================================
--- CLAM/scons/libs/audioio/SConscript	(revision 10069)
+++ 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,11 @@
 	if env['with_portmidi'] :
 		folders.append( 'src/Tools/PortMIDI' )
 
-	if sys.platform == 'linux2' :
+	if sys.platform == 'linux2' and not crosscompiling :
 		if env['with_alsa'] :
 			folders.append( 'src/Tools/MIDIIO/Linux' )
 			folders.append( 'src/Tools/AudioIO/Linux')
-	elif sys.platform == 'win32':
+	elif sys.platform == 'win32' or crosscompiling:
 		if env['audio_backend'] == 'rtaudio' :
 			print('using rtaudio')
 			folders += ['src/Tools/AudioIO/RtAudio'] #, 'src/Defines/Windows/CLAM_windows.h']
Index: CLAM/SConstruct
===================================================================
--- CLAM/SConstruct	(revision 10069)
+++ 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' :
+	if isWindowsPlatform :
 		libbasenames = [ 'xercesc', 'fftw', '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,15 @@
 			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 :
 			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 +135,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 = 'yes'
@@ -149,7 +150,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 +168,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' ) )
 
@@ -237,6 +238,8 @@
 
 clam_env.Append( CPPFLAGS = '' )
 
+clam_env.Tool('crossmingw',toolpath=['scons/sconstools'])
+
 if clam_env['distcc_hosts'] :
 	clam_env['CXX'] = 'distcc g++'
 	clam_env['ENV']['DISTCC_HOSTS'] = clam_env['distcc_hosts']
@@ -262,7 +265,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() :
