Add configure option --disable-libdl.

This makes it possible to build full static binary.
This commit is contained in:
Qi Wang 2018-06-07 12:27:19 -07:00 committed by Qi Wang
parent 8e9a613122
commit 1f55a15467
2 changed files with 34 additions and 8 deletions

View File

@ -269,6 +269,11 @@ any of the following arguments (not a definitive list) to 'configure':
in the same process, which will almost certainly result in confusing runtime in the same process, which will almost certainly result in confusing runtime
crashes if pointers leak from one implementation to the other. crashes if pointers leak from one implementation to the other.
* `--disable-libdl`
Disable the usage of libdl, namely dlsym(3) which is required by the lazy
lock option. This can allow building static binaries.
The following environment variables (not a definitive list) impact configure's The following environment variables (not a definitive list) impact configure's
behavior: behavior:

View File

@ -1587,6 +1587,21 @@ if test "x${LG_PAGE}" != "xundefined" -a \
fi fi
AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}]) AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}])
dnl ============================================================================
dnl Enable libdl by default.
AC_ARG_ENABLE([libdl],
[AS_HELP_STRING([--disable-libdl],
[Do not use libdl])],
[if test "x$enable_libdl" = "xno" ; then
enable_libdl="0"
else
enable_libdl="1"
fi
],
[enable_libdl="1"]
)
AC_SUBST([libdl])
dnl ============================================================================ dnl ============================================================================
dnl Configure pthreads. dnl Configure pthreads.
@ -1600,7 +1615,9 @@ if test "x$abi" != "xpecoff" ; then
AC_MSG_ERROR([libpthread is missing]))]) AC_MSG_ERROR([libpthread is missing]))])
wrap_syms="${wrap_syms} pthread_create" wrap_syms="${wrap_syms} pthread_create"
have_pthread="1" have_pthread="1"
dnl Check if we have dlsym support. dnl Check if we have dlsym support.
if test "x$enable_libdl" = "x1" ; then
have_dlsym="1" have_dlsym="1"
AC_CHECK_HEADERS([dlfcn.h], AC_CHECK_HEADERS([dlfcn.h],
AC_CHECK_FUNC([dlsym], [], AC_CHECK_FUNC([dlsym], [],
@ -1609,6 +1626,10 @@ if test "x$abi" != "xpecoff" ; then
if test "x$have_dlsym" = "x1" ; then if test "x$have_dlsym" = "x1" ; then
AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ]) AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ])
fi fi
else
have_dlsym="0"
fi
JE_COMPILABLE([pthread_atfork(3)], [ JE_COMPILABLE([pthread_atfork(3)], [
#include <pthread.h> #include <pthread.h>
], [ ], [