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 =======================================================
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:
@ -175,6 +177,10 @@ LIBDIR="?"
MANDIR="?"
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="?"
Use this to invoke the C compiler.

View File

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

View File

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