summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct3
-rw-r--r--ext/libelf/SConscript12
-rw-r--r--ext/libelf/elf_begin.c2
-rw-r--r--ext/libelf/elf_common.h6
-rw-r--r--ext/libelf/elf_strptr.c3
-rw-r--r--ext/libelf/elf_update.c3
-rw-r--r--ext/libelf/libelf_allocate.c2
7 files changed, 24 insertions, 7 deletions
diff --git a/SConstruct b/SConstruct
index a6659fe9b..173910010 100644
--- a/SConstruct
+++ b/SConstruct
@@ -182,7 +182,6 @@ for t in abs_targets:
env = Environment(ENV = os.environ, # inherit user's environment vars
ROOT = ROOT,
SRCDIR = SRCDIR)
-Export('env')
#Parse CC/CXX early so that we use the correct compiler for
# to test for dependencies/versions/libraries/includes
@@ -192,6 +191,8 @@ if ARGUMENTS.get('CC', None):
if ARGUMENTS.get('CXX', None):
env['CXX'] = ARGUMENTS.get('CXX')
+Export('env')
+
env.SConsignFile(joinpath(build_root,"sconsign"))
# Default duplicate option is to use hard links, but this messes up
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('.')])
+
diff --git a/ext/libelf/elf_begin.c b/ext/libelf/elf_begin.c
index 1ffd26651..1b37aa061 100644
--- a/ext/libelf/elf_begin.c
+++ b/ext/libelf/elf_begin.c
@@ -26,7 +26,7 @@
#include <sys/types.h>
-#include <sys/errno.h>
+#include <errno.h>
#include <sys/mman.h>
#include <sys/stat.h>
diff --git a/ext/libelf/elf_common.h b/ext/libelf/elf_common.h
index 0a48d5cb2..c169e7e40 100644
--- a/ext/libelf/elf_common.h
+++ b/ext/libelf/elf_common.h
@@ -45,9 +45,9 @@
*/
typedef struct {
- u_int32_t n_namesz; /* Length of name. */
- u_int32_t n_descsz; /* Length of descriptor. */
- u_int32_t n_type; /* Type of this note. */
+ uint32_t n_namesz; /* Length of name. */
+ uint32_t n_descsz; /* Length of descriptor. */
+ uint32_t n_type; /* Type of this note. */
} Elf_Note;
/* Indexes into the e_ident array. Keep synced with
diff --git a/ext/libelf/elf_strptr.c b/ext/libelf/elf_strptr.c
index b89b0eac7..6a05fa1d4 100644
--- a/ext/libelf/elf_strptr.c
+++ b/ext/libelf/elf_strptr.c
@@ -26,6 +26,9 @@
#include <sys/param.h>
+#ifdef __sun
+#include <sys/sysmacros.h>
+#endif
#include <assert.h>
#include "gelf.h"
diff --git a/ext/libelf/elf_update.c b/ext/libelf/elf_update.c
index 513789563..6959d3c3e 100644
--- a/ext/libelf/elf_update.c
+++ b/ext/libelf/elf_update.c
@@ -27,6 +27,9 @@
#include <sys/mman.h>
#include <sys/param.h>
+#ifdef __sun
+#include <sys/sysmacros.h>
+#endif
#include <assert.h>
#include <errno.h>
diff --git a/ext/libelf/libelf_allocate.c b/ext/libelf/libelf_allocate.c
index c4c1b6ac5..9e1280c47 100644
--- a/ext/libelf/libelf_allocate.c
+++ b/ext/libelf/libelf_allocate.c
@@ -28,7 +28,7 @@
* Internal APIs
*/
-#include <sys/errno.h>
+#include <errno.h>
#include <assert.h>
#include "libelf.h"