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.
This commit is contained in:
Jason Evans 2010-10-07 09:53:26 -07:00
parent 1506a1b903
commit 9f3b0a74fd
8 changed files with 19 additions and 11 deletions

9
.gitignore vendored
View File

@ -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

View File

@ -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)

View File

@ -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"

View File

@ -3,7 +3,7 @@
#include <stdint.h>
#define JEMALLOC_MANGLE
#include "jemalloc/jemalloc.h"
#include "jemalloc_test.h"
#define CHUNK 0x400000
/* #define MAXALIGN ((size_t)0x80000000000LLU) */

View File

@ -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"

View File

@ -5,7 +5,7 @@
#include <string.h>
#define JEMALLOC_MANGLE
#include "jemalloc/jemalloc.h"
#include "jemalloc_test.h"
#define CHUNK 0x400000
/* #define MAXALIGN ((size_t)0x80000000000LLU) */

View File

@ -3,7 +3,7 @@
#include <string.h>
#define JEMALLOC_MANGLE
#include "jemalloc/jemalloc.h"
#include "jemalloc_test.h"
int
main(void)

View File

@ -4,7 +4,7 @@
#include <string.h>
#define JEMALLOC_MANGLE
#include "jemalloc/jemalloc.h"
#include "jemalloc_test.h"
void *
thread_start(void *arg)