Fix various config/build issues.

Don't look for a shared libunwind if --with-static-libunwind is
specified.

Set SONAME when linking the shared libjemalloc.

Add DESTDIR support.

Add install_{include,lib/man} build targets.

Clean up compiler flag configuration.
This commit is contained in:
Jason Evans 2010-03-03 15:48:20 -08:00
parent 9df0215f9b
commit cfeccd34a3
3 changed files with 35 additions and 17 deletions

View File

@ -151,9 +151,11 @@ PATH="?"
=== Advanced compilation ======================================================= === Advanced compilation =======================================================
To run integrated regression tests, type: To install only parts of jemalloc, use the following targets:
make check install_include
install_lib
install_man
To clean up build results to varying degrees, use the following make targets: To clean up build results to varying degrees, use the following make targets:
@ -175,6 +177,10 @@ LIBDIR="?"
MANDIR="?" MANDIR="?"
Use this as the installation prefix for man pages. Use this as the installation prefix for man pages.
DESTDIR="?"
Prepend DESTDIR to INCLUDEDIR, LIBDIR, and MANDIR. This is useful when
installing to a different path than was specified via --prefix.
CC="?" CC="?"
Use this to invoke the C compiler. Use this to invoke the C compiler.

View File

@ -11,9 +11,10 @@ SHELL := /bin/sh
CC := @CC@ CC := @CC@
# Configuration parameters. # Configuration parameters.
INCLUDEDIR := @INCLUDEDIR@ DESTDIR =
LIBDIR := @LIBDIR@ INCLUDEDIR := $(DESTDIR)@INCLUDEDIR@
MANDIR := @MANDIR@ LIBDIR := $(DESTDIR)@LIBDIR@
MANDIR := $(DESTDIR)@MANDIR@
# Build parameters. # Build parameters.
CPPFLAGS := @CPPFLAGS@ -I@srcroot@include -I@objroot@include CPPFLAGS := @CPPFLAGS@ -I@srcroot@include -I@objroot@include
@ -32,8 +33,8 @@ endif
REV := 0 REV := 0
# Lists of files. # Lists of files.
CHDRS := @objroot@include/jemalloc@install_suffix@.h \ CHDRS := @objroot@include/jemalloc/jemalloc@install_suffix@.h \
@objroot@include/jemalloc_defs@install_suffix@.h @objroot@include/jemalloc/jemalloc_defs@install_suffix@.h
CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/base.c \ CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/base.c \
@srcroot@src/chunk.c @srcroot@src/chunk_dss.c \ @srcroot@src/chunk.c @srcroot@src/chunk_dss.c \
@srcroot@src/chunk_mmap.c @srcroot@src/chunk_swap.c @srcroot@src/ckh.c \ @srcroot@src/chunk_mmap.c @srcroot@src/chunk_swap.c @srcroot@src/ckh.c \
@ -62,26 +63,32 @@ all: $(DSOS)
$(DSOS): $(CSRCS:@srcroot@%.c=@objroot@%.o) $(DSOS): $(CSRCS:@srcroot@%.c=@objroot@%.o)
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) -shared -o $@ $+ $(LDFLAGS) $(LIBS) $(CC) -shared -Wl,-soname,libjemalloc@install_suffix@.so.$(REV) -o $@ $+ $(LDFLAGS) $(LIBS)
ln -sf libjemalloc@install_suffix@.so.$(REV) lib/libjemalloc@install_suffix@.so ln -sf libjemalloc@install_suffix@.so.$(REV) lib/libjemalloc@install_suffix@.so
ar crus @objroot@lib/libjemalloc@install_suffix@_pic.a $+ ar crus @objroot@lib/libjemalloc@install_suffix@_pic.a $+
install: install_include:
install -d $(INCLUDEDIR)/jemalloc install -d $(INCLUDEDIR)/jemalloc
@for h in $(CHDRS); do \ @for h in $(CHDRS); do \
echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \ echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
install -m 644 $$h $(INCLUDEDIR)/jemalloc; \ install -m 644 $$h $(INCLUDEDIR)/jemalloc; \
done done
install_lib: $(DSOS)
install -d $(LIBDIR) install -d $(LIBDIR)
install -m 755 @objroot@lib/libjemalloc@install_suffix@.so.$(REV) $(LIBDIR) install -m 755 @objroot@lib/libjemalloc@install_suffix@.so.$(REV) $(LIBDIR)
ln -sf libjemalloc@install_suffix@.so.$(REV) $(LIBDIR)/libjemalloc@install_suffix@.so ln -sf libjemalloc@install_suffix@.so.$(REV) $(LIBDIR)/libjemalloc@install_suffix@.so
install -m 755 @objroot@lib/libjemalloc@install_suffix@_pic.a $(LIBDIR) install -m 755 @objroot@lib/libjemalloc@install_suffix@_pic.a $(LIBDIR)
install_man:
install -d $(MANDIR)/man3 install -d $(MANDIR)/man3
@for m in $(MAN3); do \ @for m in $(MAN3); do \
echo "install -m 644 $$m $(MANDIR)/man3"; \ echo "install -m 644 $$m $(MANDIR)/man3"; \
install -m 644 $$m $(MANDIR)/man3; \ install -m 644 $$m $(MANDIR)/man3; \
done done
install: install_include install_lib install_man
check: check:
clean: clean:

View File

@ -86,11 +86,12 @@ CFLAGS=$CFLAGS
AC_PROG_CC AC_PROG_CC
if test "x$CFLAGS" = "x" ; then if test "x$CFLAGS" = "x" ; then
no_CFLAGS="yes" no_CFLAGS="yes"
if test "x$GCC" = "xyes" ; then
JE_CFLAGS_APPEND([-std=gnu99]) JE_CFLAGS_APPEND([-std=gnu99])
JE_CFLAGS_APPEND([-Wall]) JE_CFLAGS_APPEND([-Wall])
JE_CFLAGS_APPEND([-pipe]) JE_CFLAGS_APPEND([-pipe])
JE_CFLAGS_APPEND([-g3]) JE_CFLAGS_APPEND([-g3])
JE_CFLAGS_APPEND([-march=native]) fi
fi fi
dnl Append EXTRA_CFLAGS to CFLAGS, if defined. dnl Append EXTRA_CFLAGS to CFLAGS, if defined.
if test "x$EXTRA_CFLAGS" != "x" ; then if test "x$EXTRA_CFLAGS" != "x" ; then
@ -305,7 +306,7 @@ if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
if test "x$GCC" = "xyes" ; then if test "x$GCC" = "xyes" ; then
JE_CFLAGS_APPEND([-O3]) JE_CFLAGS_APPEND([-O3])
JE_CFLAGS_APPEND([-funroll-loops]) JE_CFLAGS_APPEND([-funroll-loops])
JE_CFLAGS_APPEND([-fomit-frame-pointer]) JE_CFLAGS_APPEND([-march=native])
else else
JE_CFLAGS_APPEND([-O]) JE_CFLAGS_APPEND([-O])
fi fi
@ -678,8 +679,12 @@ if test "x$enable_prof" = "x1" ; then
AC_DEFINE([JEMALLOC_PROF], [ ]) AC_DEFINE([JEMALLOC_PROF], [ ])
if test "x$enable_prof_libunwind" = "x1" ; then if test "x$enable_prof_libunwind" = "x1" ; then
AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"]) AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
if test "x$LUNWIND" = "x-lunwind" ; then
AC_CHECK_LIB([unwind], [backtrace], [LIBS="$LIBS $LUNWIND"], AC_CHECK_LIB([unwind], [backtrace], [LIBS="$LIBS $LUNWIND"],
[enable_prof_libunwind="0"]) [enable_prof_libunwind="0"])
else
LIBS="$LIBS $LUNWIND"
fi
if test "x${enable_prof_libunwind}" = "x1" ; then if test "x${enable_prof_libunwind}" = "x1" ; then
AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ]) AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
fi fi