diff --git a/.LIBSEMIGROUPS_VERSION b/.LIBSEMIGROUPS_VERSION index 444877d48..65afb3b88 100644 --- a/.LIBSEMIGROUPS_VERSION +++ b/.LIBSEMIGROUPS_VERSION @@ -1 +1 @@ -3.5.3 +3.5.4 diff --git a/.github/workflows/config-options.yml b/.github/workflows/config-options.yml index dd1b35577..8eb7903b2 100644 --- a/.github/workflows/config-options.yml +++ b/.github/workflows/config-options.yml @@ -38,7 +38,7 @@ jobs: - name: "Build Semigroups" uses: gap-actions/build-pkg@v2 with: - CONFIGFLAGS: --disable-hpcombi --enable-debug + CONFIGFLAGS: --enable-debug - name: "Run Semigroups package's tst/teststandard.g" uses: gap-actions/run-pkg-tests@v4 @@ -56,6 +56,8 @@ jobs: ../bin/BuildPackages.sh --strict digraphs io orb datastructures profiling - name: "Build Semigroups" uses: gap-actions/build-pkg@v2 + with: + CONFIGFLAGS: --enable-hpcombi - name: "Run Semigroups package's tst/teststandard.g" uses: gap-actions/run-pkg-tests@v4 - uses: gap-actions/process-coverage@v3 @@ -101,7 +103,51 @@ jobs: ../bin/BuildPackages.sh --strict digraphs io orb datastructures profiling - name: "Build Semigroups" uses: gap-actions/build-pkg@v2 - with: # we use --with-external-fmt since this is available from conda - CONFIGFLAGS: --disable-hpcombi --with-external-libsemigroups --enable-fmt --with-external-fmt + with: + CONFIGFLAGS: --with-external-libsemigroups - name: "Run Semigroups package's tst/teststandard.g" uses: gap-actions/run-pkg-tests@v4 + + with-external-libsemigroups-and-flags: + name: "External libsemigroups + ${{ matrix.flag.value }}" + runs-on: "ubuntu-latest" + strategy: + fail-fast: false + matrix: + # Store a list of possible flags, and the expected result when ./configure is called with + # --with-external-libsemigroups and . + flag: + - { value: "--enable-hpcombi", configure-result: 1 } + - { value: "--disable-hpcombi", configure-result: 1 } + - { value: "--enable-backward", configure-result: 1 } + - { value: "--disable-backward", configure-result: 1 } + - { value: "--enable-eigen", configure-result: 1 } + - { value: "--diable-eigen", configure-result: 1 } + - { value: "--with-external-backward", configure-result: 1 } + - { value: "--with-external-fmt", configure-result: 1 } + - { value: "--with-external-eigen", configure-result: 1 } + - { value: "--enable-popcnt", configure-result: 1 } + - { value: "--disable-popcnt", configure-result: 1 } + - { value: "--enable-clzll", configure-result: 1 } + - { value: "--disable-clzll", configure-result: 1 } + - { value: "--enable-debug", configure-result: 0 } + env: + PKG_CONFIG_PATH: "/home/runner/micromamba/envs/libsemigroups/lib/pkgconfig:/home/runner/micromamba/envs/libsemigroups/share/pkgconfig/" + LD_LIBRARY_PATH: "/home/runner/micromamba/envs/libsemigroups/lib" + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v6 + - name: "Install conda environment from environment.yml . . ." + uses: mamba-org/setup-micromamba@v2 + with: + environment-file: environment.yml + cache-environment: true + - name: "Install GAP" + uses: gap-actions/setup-gap@v3 + - name: "Check Semigroups' ./configure ${{ matrix.flag.configure-result == 0 && 'passes' || 'fails' }}" + run: | + ./autogen.sh + ./configure --with-gaproot=$GAPROOT --with-external-libsemigroups ${{ matrix.flag.value }} + (( $? == ${{ matrix.flag.configure-result }})) diff --git a/GNUmakefile.in b/GNUmakefile.in index 054c3305f..f5b0a862a 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -8,8 +8,6 @@ KEXT_LDFLAGS = @LIBSEMIGROUPS_RPATH@ @LIBSEMIGROUPS_LIBS@ # configure settings GAPPATH = @GAPROOT@ -HPCOMBI_CONSTEXPR_FUN_ARGS = @HPCOMBI_CONSTEXPR_FUN_ARGS@ -LIBSEMIGROUPS_HPCOMBI_ENABLED = @LIBSEMIGROUPS_HPCOMBI_ENABLED@ WITH_INCLUDED_LIBSEMIGROUPS = @WITH_INCLUDED_LIBSEMIGROUPS@ SYS_IS_CYGWIN = @SYS_IS_CYGWIN@ abs_top_builddir = @abs_top_builddir@ @@ -42,12 +40,10 @@ KEXT_SOURCES += gapbind14/src/gapbind14.cpp KEXT_CPPFLAGS = -Igapbind14/include/ -ifdef HPCOMBI_CONSTEXPR_FUN_ARGS -KEXT_CPPFLAGS += -DHPCOMBI_CONSTEXPR_FUN_ARGS -endif +include @LIBSEMIGROUPS_INCLUDEDIR@/hpcombi.mk ifdef LIBSEMIGROUPS_HPCOMBI_ENABLED -KEXT_CXXFLAGS += @HPCOMBI_CXXFLAGS@ + KEXT_CXXFLAGS += $(HPCOMBI_CXXFLAGS) endif ifdef WITH_INCLUDED_LIBSEMIGROUPS @@ -97,7 +93,7 @@ bin/include/libsemigroups/libsemigroups.hpp: # resides in. The following achieves that assuming that the GAP # being used was self-compiled by the user. This supports # both older GAPs with libtool (first) and GAP without libtool (second) - # Additionally, we rebsae the dll with respect to the database to + # Additionally, we rebase the dll with respect to the database to # avoid fork conflicts if test -f bin/bin/cygsemigroups*.dll ; then rebase -s bin/bin/cygsemigroups*.dll ; fi if test -f bin/bin/cygsemigroups*.dll ; then if test -d $(GAPPATH)/.libs; then cp bin/bin/cygsemigroups*.dll $(GAPPATH)/.libs/ ; fi ; fi diff --git a/configure.ac b/configure.ac index 8d764d3a0..5c8c14453 100644 --- a/configure.ac +++ b/configure.ac @@ -70,6 +70,16 @@ esac dnl ## Check for libsemigroups AX_CHECK_LIBSEMIGROUPS +AS_IF([test "x$with_external_libsemigroups" = "xyes"], + [for flag in $ac_configure_args; do + flag=$(echo "$flag" | tr -d "'") + case $flag in + --enable-hpcombi|--disable-hpcombi|--enable-backward|--disable-backward|--enable-eigen|--disable-eigen|--with-external-backward|--with-external-fmt|--with-external-eigen|--enable-popcnt|--disable-popcnt|--enable-clzll|--disable-clzll) + AC_MSG_ERROR([the flag $flag is incompatible with --with-external-libsemigroups, the external libsemigroups may have been built with a different setting]) + ;; + esac + done + ]) dnl ## User setting: Debug mode (off by default) AC_ARG_ENABLE([debug], @@ -82,9 +92,6 @@ AC_MSG_RESULT([$enable_debug]) KERNEL_DEBUG=$enable_debug AC_SUBST(KERNEL_DEBUG) -# Check if HPCombi is enable, and available -AX_CHECK_HPCOMBI - dnl ## dnl ## Output everything dnl ## diff --git a/environment.yml b/environment.yml index 41a77a0ad..2f173efed 100644 --- a/environment.yml +++ b/environment.yml @@ -4,4 +4,4 @@ channels: - conda-forge dependencies: - - libsemigroups==3.5.3 + - libsemigroups==3.5.4 diff --git a/gap/libsemigroups/froidure-pin.gi b/gap/libsemigroups/froidure-pin.gi index 71e12952b..adcd91332 100644 --- a/gap/libsemigroups/froidure-pin.gi +++ b/gap/libsemigroups/froidure-pin.gi @@ -65,8 +65,7 @@ function(S, coll) Error("Expected a transf. coll. or empty list, found ", TNAM_OBJ(coll)); fi; - if N <= 16 - and IsBound(LIBSEMIGROUPS_HPCOMBI_ENABLED) then + if N <= 16 and LIBSEMIGROUPS_HPCOMBI_ENABLED then return libsemigroups.FroidurePinTransf16; elif N <= 2 ^ 16 then return libsemigroups.FroidurePinTransfUInt2; @@ -93,7 +92,7 @@ function(S, coll) Error("Expected a partial perm. coll. or empty list, found ", TNAM_OBJ(coll)); fi; - if N <= 16 and IsBound(LIBSEMIGROUPS_HPCOMBI_ENABLED) then + if N <= 16 and LIBSEMIGROUPS_HPCOMBI_ENABLED then return libsemigroups.FroidurePinPPerm16; elif N <= 2 ^ 16 then return libsemigroups.FroidurePinPPermUInt2; diff --git a/m4/ax_check_hpcombi.m4 b/m4/ax_check_hpcombi.m4 deleted file mode 100644 index 78c37e0cb..000000000 --- a/m4/ax_check_hpcombi.m4 +++ /dev/null @@ -1,44 +0,0 @@ -# Check if HPCombi is enabled, and available -AC_DEFUN([AX_CHECK_HPCOMBI], [ -AC_ARG_ENABLE([hpcombi], - [AS_HELP_STRING([--enable-hpcombi], [enable HPCombi])], - [], - [enable_hpcombi=yes] - ) -AC_MSG_CHECKING([whether to enable HPCombi]) -AC_MSG_RESULT([$enable_hpcombi]) - -# The next variable is used in Makefile.am -AM_CONDITIONAL([LIBSEMIGROUPS_HPCOMBI_ENABLED], [test "x$enable_hpcombi" = xyes]) -# The next variable becomes the preprocessor macro LIBSEMIGROUPS_HPCOMBI_ENABLED -AS_IF([test "x$enable_hpcombi" = xyes], - [AC_DEFINE([HPCOMBI_ENABLED], [1], [define if building with HPCombi])]) - -# Although HPCombi no longer requires x86, we still require the following flags -# if they are available. -m4_define([ax_hpcombi_cxxflags_variable], [HPCOMBI_CXXFLAGS]) -AS_IF([test "x$enable_hpcombi" = xyes], - [AX_CHECK_COMPILE_FLAG(-mavx, - AX_APPEND_FLAG(-mavx, [ax_hpcombi_cxxflags_variable]), - [])]) - -# The next check is because on Mac OS running on arm processors clang accepts -# the flag -mavx but doesn't actually use it, and so complains about it being -# unused. Adding -Wno-unused-command-line-argument suppresses these warnings -AS_IF([test "x$enable_hpcombi" = xyes], - [AX_CHECK_COMPILE_FLAG(-Wno-unused-command-line-argument, - AX_APPEND_FLAG(-Wno-unused-command-line-argument, - [ax_hpcombi_cxxflags_variable]), - [])]) - -AS_IF([test "x$enable_hpcombi" = xyes], - [AX_CHECK_COMPILE_FLAG(-flax-vector-conversions, - AX_APPEND_FLAG(-flax-vector-conversions, - [ax_hpcombi_cxxflags_variable]), - [])]) - -# TODO check if compiling in 32-bit, and in that case disable hpcombi - -AS_IF([test "x$enable_hpcombi" = xyes], - AC_SUBST(ax_hpcombi_cxxflags_variable)) -]) diff --git a/m4/ax_check_libsemigroup.m4 b/m4/ax_check_libsemigroup.m4 index a326e3bc8..8ec172edf 100644 --- a/m4/ax_check_libsemigroup.m4 +++ b/m4/ax_check_libsemigroup.m4 @@ -38,10 +38,10 @@ AC_DEFUN([AX_CHECK_LIBSEMIGROUPS], [ AS_IF( [test -f libsemigroups/.VERSION], [], - [AS_IF([test -f libsemigroups/etc/version-number.sh], + [AS_IF([test -f libsemigroups/etc/version-number.sh], [cd libsemigroups && etc/version-number.sh > .TMP_VERSION && mv .TMP_VERSION .VERSION && cd ..], [AC_MSG_ERROR([cannot determine the version of libsemigroups])])]) - + AC_MSG_CHECKING([libsemigroups version]) FOUND_LIBSEMIGROUPS_VERSION="$(cat libsemigroups/.VERSION)" AC_MSG_RESULT([$FOUND_LIBSEMIGROUPS_VERSION]) @@ -56,11 +56,20 @@ AC_DEFUN([AX_CHECK_LIBSEMIGROUPS], [ AC_CONFIG_SUBDIRS([libsemigroups]) AC_SUBST([LIBSEMIGROUPS_RPATH],['-Wl,-rpath,$(abs_top_builddir)/bin/lib']) - else - LIBSEMIGROUPS_VERSION="$(pkg-config --modversion libsemigroups)" + + LIBSEMIGROUPS_INCLUDEDIR="$srcdir/libsemigroups" + AC_MSG_NOTICE([the libsemigroups include dir is $LIBSEMIGROUPS_INCLUDEDIR]) + AC_SUBST([LIBSEMIGROUPS_INCLUDEDIR]) + else + LIBSEMIGROUPS_VERSION="$(pkg-config --modversion libsemigroups)" AC_MSG_NOTICE([using external libsemigroups $LIBSEMIGROUPS_VERSION]) - PKG_CHECK_VAR([LIBSEMIGROUPS_RPATH], [libsemigroups], [libdir], - [AC_SUBST([LIBSEMIGROUPS_RPATH],[-Wl,-rpath,${LIBSEMIGROUPS_RPATH}])]) + PKG_CHECK_VAR([LIBSEMIGROUPS_RPATH], + [libsemigroups], + [libdir], + [AC_SUBST([LIBSEMIGROUPS_RPATH],[-Wl,-rpath,${LIBSEMIGROUPS_RPATH}])]) + LIBSEMIGROUPS_INCLUDEDIR=$(pkg-config --variable=includedir libsemigroups)/libsemigroups + AC_MSG_NOTICE([the libsemigroups include dir is $LIBSEMIGROUPS_INCLUDEDIR]) + AC_SUBST([LIBSEMIGROUPS_INCLUDEDIR]) fi AS_IF([test "x$need_included_libsemigroups" = xyes], diff --git a/src/init-froidure-pin-pperm.cpp b/src/init-froidure-pin-pperm.cpp index 3eceb9867..d910c1627 100644 --- a/src/init-froidure-pin-pperm.cpp +++ b/src/init-froidure-pin-pperm.cpp @@ -22,6 +22,7 @@ #include "to-gap.hpp" // for to_gap // libsemigroups headers +#include "libsemigroups/config.hpp" // for LIBSEMIGROUPS_HPCOMBI_ENABLED #include "libsemigroups/froidure-pin.hpp" // for FroidurePin #include "libsemigroups/transf.hpp" // for PPerm diff --git a/src/init-froidure-pin-transf.cpp b/src/init-froidure-pin-transf.cpp index c8e1bbed2..e31683f96 100644 --- a/src/init-froidure-pin-transf.cpp +++ b/src/init-froidure-pin-transf.cpp @@ -22,6 +22,7 @@ #include "to-gap.hpp" // for to_gap // libsemigroups headers +#include "libsemigroups/config.hpp" // for LIBSEMIGROUPS_HPCOMBI_ENABLED #include "libsemigroups/froidure-pin.hpp" // for FroidurePin #include "libsemigroups/transf.hpp" // for Transf diff --git a/src/pkg.cpp b/src/pkg.cpp index 1e2c988d9..f17295c8c 100644 --- a/src/pkg.cpp +++ b/src/pkg.cpp @@ -495,7 +495,13 @@ static Int InitLibrary(StructInitInfo* module) { InitGVarFiltsFromTable(GVarFilts); InitGVarFuncsFromTable(GVarFuncs); #ifdef LIBSEMIGROUPS_HPCOMBI_ENABLED - ExportAsConstantGVar(LIBSEMIGROUPS_HPCOMBI_ENABLED); +#if LIBSEMIGROUPS_HPCOMBI_ENABLED == 1 + AssReadOnlyGVar(GVarName("LIBSEMIGROUPS_HPCOMBI_ENABLED"), True); +#else + AssReadOnlyGVar(GVarName("LIBSEMIGROUPS_HPCOMBI_ENABLED"), False); +#endif +#else + AssReadOnlyGVar(GVarName("LIBSEMIGROUPS_HPCOMBI_ENABLED"), False); #endif return PostRestore(module); } diff --git a/src/to-cpp.hpp b/src/to-cpp.hpp index 6d08f853f..1ee71bb61 100644 --- a/src/to-cpp.hpp +++ b/src/to-cpp.hpp @@ -52,6 +52,7 @@ // libsemigroups headers #include "libsemigroups/adapters.hpp" // for Degree #include "libsemigroups/bmat8.hpp" // for BMat8 +#include "libsemigroups/config.hpp" // for LIBSEMIGROUPS_HPCOMBI_ENABLED #include "libsemigroups/cong.hpp" // for Congruence #include "libsemigroups/constants.hpp" // for NegativeInfinity, PositiveIn... #include "libsemigroups/matrix.hpp" // for NTPMat, MaxPlusTruncMat, Min...