cs configure: support installed libz and libzl4

Continue to build the bundled-with-Chez zlib and lz4 by default, but
support `--enable-libz` and `--enable-liblz4`, and turn those on when
the Chez Scheme directory doesn't have bundled versions. That should
make things build right for distributions where repackaging
dependencies is disallowed or discouraged.
This commit is contained in:
Matthew Flatt 2019-06-22 07:11:09 -06:00
parent 6647d832bb
commit f00de510de
3 changed files with 213 additions and 17 deletions

View File

@ -206,17 +206,19 @@ gracketcs@NOT_OSX@@NOT_MINGW@: raw_gracketcs petite-v.boot scheme-v.boot racket-
$(BOOTSTRAP_RACKET) $(srcdir)/embed-boot.rkt @ELF_COMP@ @BOOT_COMPRESS_COMP@ raw_gracketcs gracketcs petite-v.boot scheme-v.boot racket-v.boot
@POST_LINKER@ gracketcs
SCHEME_LIBS = $(SCHEME_TARGET_INC)/libkernel.a \
$(SCHEME_TARGET_INC)/../../lz4/lib/liblz4.a \
$(SCHEME_TARGET_INC)/../../zlib/libz.a
OWN_Z_LIB = $(SCHEME_TARGET_INC)/../../zlib/libz.a
OWN_LZ4_LIB = $(SCHEME_TARGET_INC)/../../lz4/lib/liblz4.a
SCHEME_LIB_DEPS = $(SCHEME_TARGET_INC)/libkernel.a @Z_LIB_DEP@ @LZ4_LIB_DEP@
SCHEME_LIBS = $(SCHEME_TARGET_INC)/libkernel.a @Z_LIB@ @LZ4_LIB@
BOOT_OBJ_DEPS = boot.o $(SCHEME_LIB_DEPS) rktio/librktio.a
BOOT_OBJS = boot.o $(SCHEME_LIBS) rktio/librktio.a
raw_racketcs: main.o boot.o $(BOOT_OBJS)
raw_racketcs: main.o boot.o $(BOOT_OBJ_DEPS)
$(CC) $(CFLAGS) -o raw_racketcs main.o $(BOOT_OBJS) $(LDFLAGS) $(LIBS)
@POST_LINKER@ raw_racketcs
raw_gracketcs: grmain.o boot.o $(BOOT_OBJS)
raw_gracketcs: grmain.o boot.o $(BOOT_OBJ_DEPS)
$(CC) $(CFLAGS) -o raw_gracketcs grmain.o $(BOOT_OBJS) $(LDFLAGS) $(LIBS)
@POST_LINKER@ raw_gracketcs
@ -255,7 +257,7 @@ $(GRAPPSKEL): $(srcdir)/../../mac/osx_appl.rkt $(srcdir)/../../racket/src/schve
BOOT_FILES = $(SCHEME_TARGET_INC)/petite.boot $(SCHEME_TARGET_INC)/scheme.boot racket.boot
FW_BOOT_DEST = Racket.framework/Versions/$(FWVERSION)_CS/boot
$(RKTFW): $(BOOT_OBJS) $(BOOT_FILES)
$(RKTFW): $(BOOT_OBJ_DEPS) $(BOOT_FILES)
mkdir -p Racket.framework/Versions/$(FWVERSION)_CS
@RKTLINKER@ -o $(RKTFW) -dynamiclib -all_load $(BOOT_OBJS) $(LDFLAGS) $(LIBS)
rm -f Racket.framework/Racket
@ -290,7 +292,7 @@ raw_gracketcs.exe: grmain.o MemoryModule.o grres.o
MINGW_LIBS = -lshell32 -luser32 -lole32 -lrpcrt4 -luuid -lws2_32 -ladvapi32
raw_libracketcs.dll: boot.o $(BOOT_OBJS) libres.o
raw_libracketcs.dll: boot.o $(BOOT_OBJ_DEPS) libres.o
$(CC) $(CFLAGS) --shared -o raw_libracketcs.dll $(BOOT_OBJS) libres.o $(LDFLAGS) rktio/librktio.a $(MINGW_LIBS) -static-libgcc $(LIBS)
MemoryModule.o: $(srcdir)/../../start/MemoryModule.c

View File

@ -640,6 +640,10 @@ ELF_COMP
BOOT_COMPRESS_COMP
COMPRESS_COMP
CONFIGURE_RACKET_SO_COMPILE
LZ4_LIB
LZ4_LIB_DEP
Z_LIB
Z_LIB_DEP
NOT_MINGW
MINGW
NOT_OSX
@ -788,6 +792,8 @@ enable_csdefault
enable_csonly
enable_parent
enable_crossany
enable_libz
enable_liblz4
'
ac_precious_vars='build_alias
host_alias
@ -1432,6 +1438,8 @@ Optional Features:
--enable-csonly build CS only
--enable-parent Create "../Makefile" (internal use)
--enable-crossany Record own cross target as machine-independent
--enable-libz use installed libz if available
--enable-liblz4 use installed liblz4 if available
Some influential environment variables:
CC C compiler command
@ -2475,6 +2483,16 @@ if test "${enable_crossany+set}" = set; then :
fi
# Check whether --enable-libz was given.
if test "${enable_libz+set}" = set; then :
enableval=$enable_libz;
fi
# Check whether --enable-liblz4 was given.
if test "${enable_liblz4+set}" = set; then :
enableval=$enable_liblz4;
fi
enable_quartz=no
@ -2538,6 +2556,8 @@ show_explicitly_set "${enable_mach}" "machine type"
show_explicitly_set "${enable_target}" "cross-build machine type"
show_explicitly_enabled "${enable_natipkg}" "Adding \"-natipkg\" suffix to library subpath"
show_explicitly_enabled "${enable_libz}" "Installed libz"
show_explicitly_enabled "${enable_liblz4}" "Installed liblz4"
if test "${enable_csonly}" = "yes" ; then
enable_csdefault=yes
@ -2852,6 +2872,11 @@ SETUP_BOOT_MODE=--boot
INSTALL_SETUP_FLAGS=
INSTALL_SETUP_RACKET_FLAGS=
Z_LIB_DEP='$(OWN_Z_LIB)'
Z_LIB='$(OWN_Z_LIB)'
LZ4_LIB_DEP='$(OWN_LZ4_LIB)'
LZ4_LIB='$(OWN_LZ4_LIB)'
enable_pthread_by_default=yes
###### Autoconfigure #######
@ -4070,6 +4095,8 @@ if test "${enable_pthread}" = "" ; then
fi
fi
############## machine type ################
thread_prefix=""
if test "${enable_pthread}" = "yes" ; then
thread_prefix="t"
@ -4165,6 +4192,8 @@ fi
# `TARGET_MACH` is the target that we're building for (which
# is different in cross-build mode).
############## Racket and Chez Scheme ################
SCHEME_SRC=../../ChezScheme
MAKE_BUILD_SCHEME=checkout
@ -4183,9 +4212,6 @@ if test "${enable_racket}" != "" ; then
SETUP_BOOT_MODE=--chain
fi
SCHEME_CONFIG_ARGS="--machine=${MACH} --disable-x11 ${disable_curses_arg} ${extra_scheme_config_args}"
SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${disable_curses_arg} ${extra_scheme_config_args}"
if test "${enable_compress}" != "no" ; then
COMPRESS_COMP="--compress"
fi
@ -4905,6 +4931,96 @@ $as_echo "#define RKTIO_USE_PTHREADS 1" >>confdefs.h
fi
############## zlib and LZ4 ################
if test "${enable_libz}" != "no" ; then
if test ! -d "$SCHEME_SRC/zlib" ; then
echo "No libz in Scheme directory, so trying installed"
enable_libz=yes
fi
fi
if test "${enable_liblz4}" != "no" ; then
if test ! -d "$SCHEME_SRC/lz4" ; then
echo "No lz4 in Scheme directory, so trying installed"
enable_liblz4=yes
fi
fi
if test "${enable_libz}" = "yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libz" >&5
$as_echo_n "checking for libz... " >&6; }
OLD_LIBS="${LIBS}"
LIBS="${LIBS} -lz"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <zlib.h>
int
main ()
{
zlibVersion();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_zlib=yes
else
have_zlib=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zlib" >&5
$as_echo "$have_zlib" >&6; }
if test "${have_zlib}" = "no" ; then
LIBS="${OLD_LIBS}"
echo "Building own libz"
else
Z_LIB_DEP=""
Z_LIB="-lz"
extra_scheme_config_args="${extra_scheme_config_args} ZLIB=-lz"
fi
fi
if test "${enable_liblz4}" = "yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for liblz4" >&5
$as_echo_n "checking for liblz4... " >&6; }
OLD_LIBS="${LIBS}"
LIBS="${LIBS} -llz4"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <lz4.h>
int
main ()
{
LZ4_versionString();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_lz4=yes
else
have_lz4=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_lz4" >&5
$as_echo "$have_lz4" >&6; }
if test "${have_lz4}" = "no" ; then
LIBS="${OLD_LIBS}"
echo "Building own liblz4"
else
LZ4_LIB_DEP=""
LZ4_LIB="-llz4"
extra_scheme_config_args="${extra_scheme_config_args} LZ4=-llz4"
fi
fi
############## libtool ################
if test "${enable_shared}" = "yes" ; then
@ -4995,10 +5111,15 @@ SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} ARFLAGS="'"'"${ARFLAGS}"'"'
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} RANLIB="'"'"${RANLIB}"'"'
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} WINDRES="'"'"${WINDRES}"'"'
############## final output ################
CPPFLAGS="$CPPFLAGS $PREFLAGS"
SCHEME_CONFIG_ARGS="--machine=${MACH} --disable-x11 ${disable_curses_arg} ${extra_scheme_config_args}"
SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${disable_curses_arg} ${extra_scheme_config_args}"

View File

@ -31,6 +31,8 @@ AC_ARG_ENABLE(csdefault, [ --enable-csdefault use CS as default build])
AC_ARG_ENABLE(csonly, [ --enable-csonly build CS only])
AC_ARG_ENABLE(parent, [ --enable-parent Create "../Makefile" (internal use)])
m4_include(../ac/crossany_arg.m4)
AC_ARG_ENABLE(libz, [ --enable-libz use installed libz if available])
AC_ARG_ENABLE(liblz4, [ --enable-liblz4 use installed liblz4 if available])
m4_include(../ac/sdk.m4)
@ -68,6 +70,8 @@ show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
show_explicitly_set "${enable_mach}" "machine type"
show_explicitly_set "${enable_target}" "cross-build machine type"
m4_include(../ac/natipkg_show.m4)
show_explicitly_enabled "${enable_libz}" "Installed libz"
show_explicitly_enabled "${enable_liblz4}" "Installed liblz4"
if test "${enable_csonly}" = "yes" ; then
enable_csdefault=yes
@ -137,6 +141,11 @@ SETUP_BOOT_MODE=--boot
INSTALL_SETUP_FLAGS=
INSTALL_SETUP_RACKET_FLAGS=
Z_LIB_DEP='$(OWN_Z_LIB)'
Z_LIB='$(OWN_Z_LIB)'
LZ4_LIB_DEP='$(OWN_LZ4_LIB)'
LZ4_LIB='$(OWN_LZ4_LIB)'
enable_pthread_by_default=yes
###### Autoconfigure #######
@ -296,6 +305,8 @@ if test "${enable_pthread}" = "" ; then
fi
fi
############## machine type ################
thread_prefix=""
if test "${enable_pthread}" = "yes" ; then
thread_prefix="t"
@ -391,6 +402,8 @@ fi
# `TARGET_MACH` is the target that we're building for (which
# is different in cross-build mode).
############## Racket and Chez Scheme ################
SCHEME_SRC=../../ChezScheme
MAKE_BUILD_SCHEME=checkout
@ -409,9 +422,6 @@ if test "${enable_racket}" != "" ; then
SETUP_BOOT_MODE=--chain
fi
SCHEME_CONFIG_ARGS="--machine=${MACH} --disable-x11 ${disable_curses_arg} ${extra_scheme_config_args}"
SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${disable_curses_arg} ${extra_scheme_config_args}"
if test "${enable_compress}" != "no" ; then
COMPRESS_COMP="--compress"
fi
@ -522,6 +532,64 @@ if test "${enable_pthread}" = "yes" ; then
AC_DEFINE(RKTIO_USE_PTHREADS, 1, [Pthread enabled])
fi
############## zlib and LZ4 ################
if test "${enable_libz}" != "no" ; then
if test ! -d "$SCHEME_SRC/zlib" ; then
echo "No libz in Scheme directory, so trying installed"
enable_libz=yes
fi
fi
if test "${enable_liblz4}" != "no" ; then
if test ! -d "$SCHEME_SRC/lz4" ; then
echo "No lz4 in Scheme directory, so trying installed"
enable_liblz4=yes
fi
fi
if test "${enable_libz}" = "yes" ; then
AC_MSG_CHECKING([for libz])
OLD_LIBS="${LIBS}"
LIBS="${LIBS} -lz"
AC_TRY_LINK([#include <zlib.h>],
[zlibVersion();],
have_zlib=yes,
have_zlib=no)
AC_MSG_RESULT($have_zlib)
if test "${have_zlib}" = "no" ; then
LIBS="${OLD_LIBS}"
echo "Building own libz"
else
Z_LIB_DEP=""
Z_LIB="-lz"
extra_scheme_config_args="${extra_scheme_config_args} ZLIB=-lz"
fi
fi
if test "${enable_liblz4}" = "yes" ; then
AC_MSG_CHECKING([for liblz4])
OLD_LIBS="${LIBS}"
LIBS="${LIBS} -llz4"
AC_TRY_LINK([#include <lz4.h>],
[LZ4_versionString();],
have_lz4=yes,
have_lz4=no)
AC_MSG_RESULT($have_lz4)
if test "${have_lz4}" = "no" ; then
LIBS="${OLD_LIBS}"
echo "Building own liblz4"
else
LZ4_LIB_DEP=""
LZ4_LIB="-llz4"
extra_scheme_config_args="${extra_scheme_config_args} LZ4=-llz4"
fi
fi
############## libtool ################
if test "${enable_shared}" = "yes" ; then
@ -612,10 +680,11 @@ SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} ARFLAGS="'"'"${ARFLAGS}"'"'
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} RANLIB="'"'"${RANLIB}"'"'
SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} WINDRES="'"'"${WINDRES}"'"'
############## final output ################
CPPFLAGS="$CPPFLAGS $PREFLAGS"
SCHEME_CONFIG_ARGS="--machine=${MACH} --disable-x11 ${disable_curses_arg} ${extra_scheme_config_args}"
SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${disable_curses_arg} ${extra_scheme_config_args}"
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
@ -648,6 +717,10 @@ AC_SUBST(OSX)
AC_SUBST(NOT_OSX)
AC_SUBST(MINGW)
AC_SUBST(NOT_MINGW)
AC_SUBST(Z_LIB_DEP)
AC_SUBST(Z_LIB)
AC_SUBST(LZ4_LIB_DEP)
AC_SUBST(LZ4_LIB)
AC_SUBST(CONFIGURE_RACKET_SO_COMPILE)
AC_SUBST(COMPRESS_COMP)
AC_SUBST(BOOT_COMPRESS_COMP)