From 9f3b0a74fdaac6fa5eb8b5a875b8901bc56b2f5e Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Thu, 7 Oct 2010 09:53:26 -0700 Subject: [PATCH] Fix tests build when --with-install-suffix is set. Add test/jemalloc_test.h.in, which is processed to include jemalloc/jemalloc@install_suffix@.h, so that test programs can include it without worrying about the install suffix. --- .gitignore | 9 ++++----- jemalloc/Makefile.in | 4 ++-- jemalloc/configure.ac | 3 +++ jemalloc/test/allocm.c | 2 +- jemalloc/test/jemalloc_test.h.in | 6 ++++++ jemalloc/test/posix_memalign.c | 2 +- jemalloc/test/rallocm.c | 2 +- jemalloc/test/thread_arena.c | 2 +- 8 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 jemalloc/test/jemalloc_test.h.in diff --git a/.gitignore b/.gitignore index 8e95c7a4..b4681866 100644 --- a/.gitignore +++ b/.gitignore @@ -6,11 +6,10 @@ /jemalloc/doc/jemalloc.3 /jemalloc/lib/ /jemalloc/Makefile -/jemalloc/src/internal/jemalloc_internal\.h -/jemalloc/src/internal/mtrgraph_defs\.h -/jemalloc/src/internal/mtrplay_defs\.h -/jemalloc/src/jemalloc\.h -/jemalloc/src/jemalloc_defs\.h +/jemalloc/include/jemalloc/internal/jemalloc_internal\.h +/jemalloc/include/jemalloc/jemalloc\.h +/jemalloc/include/jemalloc/jemalloc_defs\.h +/jemalloc/test/jemalloc_test\.h /jemalloc/src/*.[od] /jemalloc/test/*.[od] /jemalloc/test/*.out diff --git a/jemalloc/Makefile.in b/jemalloc/Makefile.in index f2a64539..7863c1b7 100644 --- a/jemalloc/Makefile.in +++ b/jemalloc/Makefile.in @@ -90,8 +90,8 @@ all: $(DSOS) @objroot@test/%.o: @srcroot@test/%.c @mkdir -p $(@D) - $(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $< - @$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) $< | sed \"s/\($(subst /,\/,$(notdir $(basename $@)))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.o \2/g\" > $(@:%.o=%.d)" + $(CC) $(CFLAGS) -c $(CPPFLAGS) -I@objroot@test -o $@ $< + @$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) -I@objroot@test $< | sed \"s/\($(subst /,\/,$(notdir $(basename $@)))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.o \2/g\" > $(@:%.o=%.d)" @objroot@test/%: @objroot@test/%.o \ @objroot@lib/libjemalloc@install_suffix@.$(SO) diff --git a/jemalloc/configure.ac b/jemalloc/configure.ac index 26e2b012..687cafcb 100644 --- a/jemalloc/configure.ac +++ b/jemalloc/configure.ac @@ -274,14 +274,17 @@ AC_SUBST([install_suffix]) cfgoutputs_in="${srcroot}Makefile.in ${srcroot}doc/jemalloc.3.in" cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/jemalloc.h.in" cfgoutputs_in="${cfgoutputs_in} ${srcroot}include/jemalloc/internal/jemalloc_internal.h.in" +cfgoutputs_in="${cfgoutputs_in} ${srcroot}test/jemalloc_test.h.in" cfgoutputs_out="Makefile doc/jemalloc${install_suffix}.3" cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc${install_suffix}.h" cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h" +cfgoutputs_out="${cfgoutputs_out} test/jemalloc_test.h" cfgoutputs_tup="Makefile doc/jemalloc${install_suffix}.3:doc/jemalloc.3.in" cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc${install_suffix}.h:include/jemalloc/jemalloc.h.in" cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h" +cfgoutputs_tup="${cfgoutputs_tup} test/jemalloc_test.h:test/jemalloc_test.h.in" cfghdrs_in="${srcroot}include/jemalloc/jemalloc_defs.h.in" diff --git a/jemalloc/test/allocm.c b/jemalloc/test/allocm.c index 4367cb89..59d0002e 100644 --- a/jemalloc/test/allocm.c +++ b/jemalloc/test/allocm.c @@ -3,7 +3,7 @@ #include #define JEMALLOC_MANGLE -#include "jemalloc/jemalloc.h" +#include "jemalloc_test.h" #define CHUNK 0x400000 /* #define MAXALIGN ((size_t)0x80000000000LLU) */ diff --git a/jemalloc/test/jemalloc_test.h.in b/jemalloc/test/jemalloc_test.h.in new file mode 100644 index 00000000..0c48895e --- /dev/null +++ b/jemalloc/test/jemalloc_test.h.in @@ -0,0 +1,6 @@ +/* + * This header should be included by tests, rather than directly including + * jemalloc/jemalloc.h, because --with-install-suffix may cause the header to + * have a different name. + */ +#include "jemalloc/jemalloc@install_suffix@.h" diff --git a/jemalloc/test/posix_memalign.c b/jemalloc/test/posix_memalign.c index c5651d7c..3e306c01 100644 --- a/jemalloc/test/posix_memalign.c +++ b/jemalloc/test/posix_memalign.c @@ -5,7 +5,7 @@ #include #define JEMALLOC_MANGLE -#include "jemalloc/jemalloc.h" +#include "jemalloc_test.h" #define CHUNK 0x400000 /* #define MAXALIGN ((size_t)0x80000000000LLU) */ diff --git a/jemalloc/test/rallocm.c b/jemalloc/test/rallocm.c index b52bdb20..7e8a271c 100644 --- a/jemalloc/test/rallocm.c +++ b/jemalloc/test/rallocm.c @@ -3,7 +3,7 @@ #include #define JEMALLOC_MANGLE -#include "jemalloc/jemalloc.h" +#include "jemalloc_test.h" int main(void) diff --git a/jemalloc/test/thread_arena.c b/jemalloc/test/thread_arena.c index 5b1058b5..bd884e1f 100644 --- a/jemalloc/test/thread_arena.c +++ b/jemalloc/test/thread_arena.c @@ -4,7 +4,7 @@ #include #define JEMALLOC_MANGLE -#include "jemalloc/jemalloc.h" +#include "jemalloc_test.h" void * thread_start(void *arg)