summaryrefslogtreecommitdiff
path: root/ext/libelf/SConscript
diff options
context:
space:
mode:
Diffstat (limited to 'ext/libelf/SConscript')
-rw-r--r--ext/libelf/SConscript12
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/libelf/SConscript b/ext/libelf/SConscript
index 2fae8c25f..aebd0da85 100644
--- a/ext/libelf/SConscript
+++ b/ext/libelf/SConscript
@@ -28,7 +28,7 @@
#
# Authors: Nathan Binkert
-import os
+import os, subprocess
Import('env')
@@ -88,6 +88,15 @@ ElfFile('libelf_fsize.c')
ElfFile('libelf_msize.c')
m4env = Environment(ENV=os.environ)
+if env.get('CC'):
+ m4env['CC'] = env['CC']
+if env.get('CXX'):
+ m4env['CXX'] = env['CXX']
+# If we have gm4 use it
+if subprocess.Popen("gm4 --version", shell=True, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT, close_fds=True).communicate()[0].find('GNU') >= 0:
+ m4env['M4'] = 'gm4'
+
m4env.Append(M4FLAGS='-DSRCDIR=%s' % Dir('.').path)
m4env['M4COM'] = '$M4 $M4FLAGS $SOURCES > $TARGET'
m4env.M4(target=File('libelf_convert.c'),
@@ -101,3 +110,4 @@ m4env.Library('elf', elf_files)
env.Append(CPPPATH=Dir('.'))
env.Append(LIBS=['elf'])
env.Append(LIBPATH=[Dir('.')])
+