Fix static compilation (libc should be dynamically linked)

This commit is contained in:
Nicolas Viennot 2016-01-10 12:39:09 -08:00
parent 3a73f17354
commit a2520da195
2 changed files with 7 additions and 4 deletions

View File

@ -11,7 +11,7 @@ TMATE_CONFIGURE=PKG_CONFIG_PATH=./ext/lib/pkgconfig
all: tmate
dependencies:
apt-get install build-essentials cmake libssl-dev autoconf automake pkg-config libtool libevent-dev libncurses-dev zlib1g-dev
apt-get install build-essential cmake libssl-dev autoconf automake pkg-config libtool libevent-dev libncurses-dev zlib1g-dev
downloads/$(notdir $(LIBSSH_URL)):
mkdir -p downloads

View File

@ -47,13 +47,12 @@ AC_ARG_ENABLE(
found_static=$enable_static
)
if test "x$found_static" = xyes; then
LDFLAGS="$LDFLAGS -static"
PKG_CONFIG="pkg-config --static"
CFLAGS="$CFLAGS -flto"
LDFLAGS="$LDFLAGS -flto"
PKG_CHECK_MODULES([ZLIB], [zlib], [
PKG_CHECK_MODULES([ZLIB], [zlib], [
CPPFLAGS="$ZLIB_CFLAGS $CPPFLAGS"
LIBS="$ZLIB_LIBS $LIBS"
])
@ -62,7 +61,6 @@ if test "x$found_static" = xyes; then
CPPFLAGS="$LIBCRYPTO_CFLAGS $CPPFLAGS"
LIBS="$LIBCRYPTO_LIBS $LIBS"
])
AC_CHECK_LIB(dl, dlopen)
fi
# Is this gcc?
@ -451,6 +449,11 @@ if test "x$found_getopt" != xno; then
fi
AM_CONDITIONAL(NO_GETOPT, [test "x$found_getopt" = xno])
if test "x$found_static" = xyes; then
# libc and libdl should be dynamically linked.
LIBS="-Wl,-Bstatic ${LIBS/-ldl/} -Wl,-Bdynamic -ldl"
fi
# Check for BSD-style integer types.
AC_MSG_CHECKING(for BSD-style unsigned types)
AC_COMPILE_IFELSE([AC_LANG_SOURCE(