Description: Change buildsystem setup for Debian
 We cannot use --march, because we need to support many of them -- not even
 'native', as it will over-optimize for the build machine.
Forwarded: not-needed
Author: Michael Hanke <michael.hanke@gmail.com>
--- a/sysconf/linux.py
+++ b/sysconf/linux.py
@@ -6,7 +6,7 @@
 lib_suffix = '.so'
 
 cpp = [ 'g++', '-c', '$flags$', '$gtk$', '$path$', '$src$', '-o', '$obj$' ]
-cpp_flags = [ '-Wall', '-pedantic', '-march=native', '-fPIC', '-fno-strict-aliasing', '-DGL_GLEXT_PROTOTYPES', '-DUSE_TR1' ]
+cpp_flags = [ '-Wall', '-pedantic', '-fPIC', '-fno-strict-aliasing', '-DGL_GLEXT_PROTOTYPES', '-DUSE_TR1' ]
 
 ld = [ 'g++', '$flags$', '$path$', '$obj$', '$mrtrix$', '$gsl$', '$gtk$', '$lz$', '-o', '$bin$' ]
 ld_flags = [ '-Wl,-rpath,$ORIGIN/../lib' ]
--- a/build
+++ b/build
@@ -180,6 +180,15 @@
   ld_flags = ld_flags_profile
   ld_lib_flags = ld_lib_flags_profile
 
+# honor the environment
+try:
+  # the splitting is needed because the command is submitted as a list
+  # and we need individual options -- it may not be that simple though...
+  env_flags = os.environ['LDFLAGS'].split()
+  ld_flags.extend(env_flags)
+  ld_lib_flags.extend(env_flags)
+except:
+  pass
 
 # used to set install_name on MacOSX:
 ld_lib_flags = [ entry.replace ('LIBNAME', libname) for entry in ld_lib_flags ]
