Skip to content

Commit

Permalink
MAKE: Use subrepo-cloned GC.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamievlin committed Dec 23, 2024
1 parent f9d6c88 commit a1ed194
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 105 deletions.
45 changes: 12 additions & 33 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ POLL = poll

ASYGLVERSION = @ASYGLVERSION@
GCVERSION = @GCVERSION@
GC = gc-$(GCVERSION)
GC = gc
LIBATOMIC = libatomic_ops-@ATOMICVERSION@
GCOPTIONS = @GCOPTIONS@
GCLIB = @GCLIB@
Expand Down Expand Up @@ -176,32 +176,14 @@ $(LSP_BUILD_ROOT)/liblspcpp.a:

all: asy sty man faq asy-keywords.el

$(GCLIB): $(GC).tar.gz
gunzip -c $(GC).tar.gz > $(GC).tar
tar -xf $(GC).tar
rm -f $(GC).tar
if test -r $(LIBATOMIC).tar.gz; then \
gunzip -c $(LIBATOMIC).tar.gz > $(LIBATOMIC).tar; \
tar -xf $(LIBATOMIC).tar; \
rm -f $(LIBATOMIC).tar; \
mv $(LIBATOMIC) $(GC)/libatomic_ops; \
fi
if test "$(GC)" = "gc-7.0"; then \
cd $(GC)/include/private && \
patch < ../../../patches/gc-7.0nomem.patch; \
fi
if test "$(GC)" = "gc-7.2b"; then \
mv gc-7.2 gc-7.2b; \
fi
if test "$(GC)" = "gc-7.2c"; then \
mv gc-7.2 gc-7.2c; \
fi
if test "$(GC)" = "gc-7.2d"; then \
mv gc-7.2 gc-7.2d; \
fi
cd $(GC) && \
./configure CC="$(CC)" CXX="$(CXX)" $(GCOPTIONS); \
$(MAKE) check
$(GCLIB): $(GC)/Makefile
$(MAKE) -C $(GC) check

$(GC)/Makefile: $(GC)/libatomic_ops
cd $(GC) && ./configure CC="$(CC)" CXX="$(CXX)"

$(GC)/libatomic_ops: libatomic_ops
ln -sf libatomic_ops $(GC)/libatomic_ops

$(GCPPLIB): $(GCLIB)

Expand Down Expand Up @@ -395,14 +377,11 @@ clean: FORCE
-cd GUI && $(PYTHON) buildtool.py clean

gc-clean: FORCE clean
-if test -d $(GC); then \
$(MAKE) -C $(GC) clean; \
fi
-$(MAKE) -C $(GC) clean

cleaner: FORCE clean
-if test -d $(GC); then \
rm -rf $(GC); \
fi
-$(MAKE) -C $(GC) clean
-rm -f $(GC)/Makefile
-rm -f Makefile config.h config.log config.status errors.temp
-rm -rf acextlibs
cd doc && $(MAKE) clean
Expand Down
79 changes: 7 additions & 72 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -274,20 +274,9 @@ AC_ARG_WITH(vcpkg-host-triplet,
ATOMICVERSION=7.6.12
GCVERSION=8.2.4
GCFILE=gc-$GCVERSION
ac_cv_use_gc="system"

AC_CHECK_FILE($GCFILE.tar.gz,
ac_cv_use_gc=$GCVERSION)
AC_ARG_ENABLE(gc,
[AS_HELP_STRING(--enable-gc[[[=system]]], enable system Boehm garbage collector)]
[ [[=VERSION]] enable local VERSION of Boehm garbage collector]
[ [[=PREFIX]] use Boehm garbage collector installed in PREFIX],
[ # if true
if test "x$enableval" != "xyes" ; then # system, no or else
ac_cv_use_gc=$enableval
fi
]
)
ac_cv_use_gc="yes"
AC_ARG_ENABLE(gc, [AS_HELP_STRING(--enable-gc[[[=yes]]], enable Boehm garbage collector)])
ac_cv_use_gc=$enable_gc

AC_ARG_ENABLE(gc-debug,
[AS_HELP_STRING(--enable-gc-debug,enable (slow) garbage collector debugging)],
Expand Down Expand Up @@ -317,50 +306,10 @@ GCPPLIB=
GCNAME="Boehm Garbage Collector"
if test "x$ac_cv_use_gc" != "xno" ; then
AC_DEFINE(USEGC,1,[GC Enabled])
if test "x$with_vcpkg" != "xno"; then # managed by vcpkg
ADD_VCPKG_FEATURE(gc)
# The reason we are not using AC_CHECK_LIB is because
# we are not installing the dependencies until we collect all the features,
# hence the library files will not be available
ADD_VCPKG_LIB_FOR_PKGCONFIG(bdw-gc)
INCL=$INCL" -Ivcpkg_installed/$vcpkg_triplet/include/gc "
LIBS=$LIBS"-lgccpp "
else # else, determine by prefix or system
case _$ac_cv_use_gc in
_|_system|_*[[\\/]]*)
if test "x$ac_cv_use_gc" = "xsystem" ; then
INCL=$INCL" -I$prefix/include/gc -I/usr/include/gc "
LIBS=$LIBS"-L$prefix/lib "
else
INCL=$INCL" -I$ac_cv_use_gc/include/gc "
LIBS=$LIBS"-L$ac_cv_use_gc/lib "
fi
CPPFLAGS_SAVE=$CPPFLAGS
CPPFLAGS=$CPPFLAGS" $INCL"
AC_CHECK_HEADER(gc.h,
AC_CHECK_LIB([gc],[GC_malloc],[
LIBS=$LIBS"-lgc "
AC_MSG_NOTICE([enabling system $GCNAME])],[
GCDIR=$GCFILE
INCL=$INCL" -I\$(GC)/include "
GCLIB="\$(GC)/.libs/libgc.a"
AC_MSG_NOTICE($GCNAME library not found)]),
GCDIR=$GCFILE
GCLIB="\$(GC)/.libs/libgc.a"
INCL=$INCL" -I\$(GC)/include "
AC_MSG_NOTICE($GCNAME header file not found))
CPPFLAGS=$CPPFLAGS_SAVE
;;
*)
GCVERSION=$ac_cv_use_gc
GCFILE=gc-$GCVERSION
GCDIR=$GCFILE
AC_MSG_NOTICE([enabling local $GCNAME $GCDIR])
GCLIB="\$(GC)/.libs/libgc.a"
INCL=$INCL" -I\$(GC)/include "
;;
esac
fi
AC_MSG_NOTICE([enabling $GCNAME $GCDIR])
GCLIB="\$(GC)/.libs/libgc.a"
INCL=$INCL" -I\$(GC)/include "
;;
else
AC_MSG_NOTICE([disabling the $GCNAME])
fi
Expand Down Expand Up @@ -821,17 +770,3 @@ AC_CHECK_FUNCS(strnlen)
AC_CONFIG_FILES([Makefile doc/Makefile doc/png/Makefile])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT

if test "x$with_vcpkg" = "xno" -a "x$GCDIR" != "x" ; then
AC_CHECK_FILE($GCDIR.tar.gz,,[
echo
echo Please put the Boehm garbage collector tar.gz files in the asymptote directory.
echo FOR EXAMPLE, USE THE COMMANDS:
echo
echo wget https://github.com/ivmai/bdwgc/releases/download/v$GCVERSION/$GCFILE.tar.gz
echo wget https://github.com/ivmai/libatomic_ops/releases/download/v$ATOMICVERSION/libatomic_ops-$ATOMICVERSION.tar.gz
echo
exit 1
])
fi

0 comments on commit a1ed194

Please sign in to comment.