Description: debianization: 4ti2 tool suite prefix
 Prepend 4ti2- to the names of the 4ti2 tools for preventing
 from possible collisions.
 This is a Debian centric patch.
Origin: debian
Forwarded: not-needed
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2025-06-09

--- a/src/groebner/Makefile.am
+++ b/src/groebner/Makefile.am
@@ -256,7 +256,7 @@
 	walk_main.h				\
 	zbasis_main.h
 
-WRAPPERSCRIPTS =				\
+listof_function_WRAPPERSCRIPTS = \
 	circuits				\
 	groebner				\
 	markov					\
@@ -267,6 +267,8 @@
 	walk					\
 	zbasis
 
+WRAPPERSCRIPTS = $(addprefix 4ti2-, $(listof_function_WRAPPERSCRIPTS))
+
 nodist_bin_SCRIPTS = $(WRAPPERSCRIPTS)
 DISTCLEANFILES = $(WRAPPERSCRIPTS)
 
--- a/src/groebner/script.template.in
+++ b/src/groebner/script.template.in
@@ -24,9 +24,12 @@
 PKGLIBEXECDIR=@libexecdir@/@PACKAGE@
 
 # We locate where this script is so we can call the executables.
-SCRIPT=$(realpath $(which "$0"))
-SCRIPTDIR=`dirname "$SCRIPT"`
-FUNCTION=`basename "$SCRIPT"`
+SCRIPT=${0}
+SCRIPTDIR=${SCRIPT%/*}
+
+# We deduce the function from the script name.
+FUNCTION=${SCRIPT##*/}
+FUNCTION=${FUNCTION#4ti2-}
 
 # The default executable.
 EXECUTABLE=@GROEBNER_DEFAULT_EXECUTABLE@
@@ -34,7 +37,7 @@
 # We look for options on the command line which indicate the level of precision
 # required and we call the appropriate 4ti2 executable according to the required
 # precision level. The short option is `-p' and the long option is
-# `--precision', and the argument to either is one of 32, 64, or `arbitrary'.  
+# `--precision', and the argument to either is one of 32, 64, or `arbitrary'.
 # The following regular expressions are not exactly correct since for example
 # they allow misspellings of precision. However, they will match correctly
 # formatted input and if the option is incorrectly formatted, the actual
--- a/test/circuits/Makefile.am
+++ b/test/circuits/Makefile.am
@@ -7,7 +7,7 @@
 	ppi3.mat ppi3.cir.chk
 
 check-local:
-	@../check.template $(srcdir) "" src/groebner/circuits -q -m
-	@../check.template $(srcdir) "" src/groebner/circuits -q -s
+	@../check.template $(srcdir) "" src/groebner/4ti2-circuits -q -m
+	@../check.template $(srcdir) "" src/groebner/4ti2-circuits -q -s
 
 CLEANFILES = .num_failures
--- a/test/minimize/Makefile.am
+++ b/test/minimize/Makefile.am
@@ -8,6 +8,6 @@
 	4coins.mat 4coins.zsol 4coins.sign 4coins.cost 4coins.min.chk
 
 check-local:
-	@../check.template $(srcdir) "" src/groebner/minimize -q
+	@../check.template $(srcdir) "" src/groebner/4ti2-minimize -q
 
 CLEANFILES = .num_failures
--- a/test/groebner/Makefile.am
+++ b/test/groebner/Makefile.am
@@ -26,11 +26,11 @@
 	grin10900.5.mat grin10900.5.cost grin10900.5.mar grin10900.5.zsol									\
 	4coins.mat 4coins.sign 4coins.cost 4coins.gro.chk
 
-check-fifo: 
-	@../check.template $(srcdir) "-fifo" src/groebner/groebner -q -afifo
+check-fifo:
+	@../check.template $(srcdir) "-fifo" src/groebner/4ti2-groebner -q -afifo
 
 check-weighted:
-	@../check.template $(srcdir) "-weighted" src/groebner/groebner -q -aweighted
+	@../check.template $(srcdir) "-weighted" src/groebner/4ti2-groebner -q -aweighted
 
 check-local: check-fifo check-weighted
 	@../flavorsum "-fifo" "-weighted"
--- a/test/markov/Makefile.am
+++ b/test/markov/Makefile.am
@@ -32,10 +32,10 @@
 	4x4.mat 4x4.mar.chk
 
 check-hybrid:
-	@../check.template $(srcdir) "-hybrid" src/groebner/markov -q -ghybrid
+	@../check.template $(srcdir) "-hybrid" src/groebner/4ti2-markov -q -ghybrid
 
 check-project-and-lift:
-	@../check.template $(srcdir) "-project-and-lift" src/groebner/markov -q -gproject-and-lift
+	@../check.template $(srcdir) "-project-and-lift" src/groebner/4ti2-markov -q -gproject-and-lift
 
 check-local: check-hybrid check-project-and-lift
 	@../flavorsum "-hybrid" "-project-and-lift"
--- a/test/normalform/Makefile.am
+++ b/test/normalform/Makefile.am
@@ -3,6 +3,6 @@
 	4coins.mat 4coins.cost 4coins.feas 4coins.gro 4coins.nf.chk
 
 check-local:
-	@../check.template $(srcdir) "" src/groebner/normalform -q 
+	@../check.template $(srcdir) "" src/groebner/4ti2-normalform -q
 
 CLEANFILES = .num_failures
--- a/test/qsolve/Makefile.am
+++ b/test/qsolve/Makefile.am
@@ -24,10 +24,10 @@
 	subspace2.mat subspace2.qfree.chk subspace2.qhom.chk subspace2.sign
 
 check-maxcutoff:
-	@../check.template $(srcdir) "-maxcutoff" src/groebner/qsolve -q -m -o maxcutoff
+	@../check.template $(srcdir) "-maxcutoff" src/groebner/4ti2-qsolve -q -m -o maxcutoff
 
 check-maxinter:
-	@../check.template $(srcdir) "-maxinter" src/groebner/qsolve -q -s -o maxinter 
+	@../check.template $(srcdir) "-maxinter" src/groebner/4ti2-qsolve -q -s -o maxinter
 
 check-local: check-maxcutoff check-maxinter
 	@../flavorsum "-maxcutoff" "-maxinter"
--- a/test/rays/Makefile.am
+++ b/test/rays/Makefile.am
@@ -12,10 +12,10 @@
 	subspace2.mat subspace2.qfree.chk subspace2.ray.chk subspace2.sign
 
 check-m:
-	@../check.template $(srcdir) "-m" src/groebner/rays -q -m 
+	@../check.template $(srcdir) "-m" src/groebner/4ti2-rays -q -m
 
 check-s:
-	@../check.template $(srcdir) "-s" src/groebner/rays -q -s 
+	@../check.template $(srcdir) "-s" src/groebner/4ti2-rays -q -s
 
 check-local: check-m check-s
 	@../flavorsum "-m" "-s"
--- a/test/walk/Makefile.am
+++ b/test/walk/Makefile.am
@@ -5,10 +5,10 @@
 	prob20.mat prob20.cost prob20.cost.start prob20.gro.chk prob20.gro.start prob20.lat prob20.sign
 
 check-32:
-	@../check.template $(srcdir) "-32" src/groebner/walk -q 
+	@../check.template $(srcdir) "-32" src/groebner/4ti2-walk -q
 
 check-arb:
-	@../check.template $(srcdir) "-arb" src/groebner/walk -p arb -q 
+	@../check.template $(srcdir) "-arb" src/groebner/4ti2-walk -p arb -q
 
 check-local: check-32 check-arb
 	@../flavorsum "-32" "-arb"
--- a/test/zbasis/Makefile.am
+++ b/test/zbasis/Makefile.am
@@ -11,6 +11,6 @@
 	grin.mat grin.lat.chk
 
 check-local:
-	@../check.template $(srcdir) "" src/groebner/zbasis -q 
+	@../check.template $(srcdir) "" src/groebner/4ti2-zbasis -q
 
 CLEANFILES = .num_failures
--- a/test/groebner/gmp/Makefile.am
+++ b/test/groebner/gmp/Makefile.am
@@ -6,10 +6,10 @@
 	grin10900.1.mat grin10900.1.cost grin10900.1.gro.chk grin10900.1.mar grin10900.1.zsol
 
 check-fifo: 
-	@../../check.template $(srcdir) "-fifo" src/groebner/groebner -q -p arb -afifo
+	@../../check.template $(srcdir) "-fifo" src/groebner/4ti2-groebner -q -p arb -afifo
 
 check-weighted:
-	@../../check.template $(srcdir) "-weighted" src/groebner/groebner -q -p arb -aweighted
+	@../../check.template $(srcdir) "-weighted" src/groebner/4ti2-groebner -q -p arb -aweighted
 
 check-local: check-fifo check-weighted
 	@../../flavorsum "-fifo" "-weighted"
--- a/test/markov/saturation/Makefile.am
+++ b/test/markov/saturation/Makefile.am
@@ -18,6 +18,6 @@
 	prob20.mat prob20.mar.chk
 
 check-local:
-	@../../check.template $(srcdir) "" src/groebner/markov -q -gsaturation
+	@../../check.template $(srcdir) "" src/groebner/4ti2-markov -q -gsaturation
 
 CLEANFILES = .num_failures
--- a/test/markov/maxmin/Makefile.am
+++ b/test/markov/maxmin/Makefile.am
@@ -5,6 +5,6 @@
 	cuww5.mat cuww5.mar.chk
 
 check-local:
-	@../../check.template $(srcdir) "" src/groebner/markov -q -gmax-min
+	@../../check.template $(srcdir) "" src/groebner/4ti2-markov -q -gmax-min
 
 CLEANFILES = .num_failures
--- a/test/markov/gmp/Makefile.am
+++ b/test/markov/gmp/Makefile.am
@@ -6,10 +6,10 @@
 	prob06.mat prob06.lat prob06.mar.chk
 
 check-hybrid:
-	@../../check.template $(srcdir) "-hybrid" src/groebner/markov -q -p arb -ghybrid
+	@../../check.template $(srcdir) "-hybrid" src/groebner/4ti2-markov -q -p arb -ghybrid
 
 check-project-and-lift:
-	@../../check.template $(srcdir) "-project-and-lift" src/groebner/markov -q -p arb -gproject-and-lift
+	@../../check.template $(srcdir) "-project-and-lift" src/groebner/4ti2-markov -q -p arb -gproject-and-lift
 
 check-local: check-hybrid check-project-and-lift
 	@../../flavorsum "-hybrid" "-project-and-lift"
--- a/test/qsolve/gmp/Makefile.am
+++ b/test/qsolve/gmp/Makefile.am
@@ -4,7 +4,7 @@
 	ppp.c.mat ppp.c.qhom.chk ppp.c.sign
 
 check-local:
-	@../../check.template $(srcdir) "" src/groebner/qsolve -q -p arb
+	@../../check.template $(srcdir) "" src/groebner/4ti2-qsolve -q -p arb
 
 CLEANFILES = .num_failures
 
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -23,10 +23,10 @@
 pkgliblibdir = $(libdir)
 
 bin_PROGRAMS =					\
-	genmodel				\
-	gensymm					\
-	output
-#	normaliz_wrapper
+	4ti2-genmodel				\
+	4ti2-gensymm					\
+	4ti2-output
+#	4ti2-normaliz_wrapper
 
 pkgliblib_LTLIBRARIES = lib4ti2util.la
 
@@ -60,14 +60,14 @@
 	print.h					\
 	vector.h
 
-genmodel_SOURCES = genmodel_main.c
-genmodel_LDADD = lib4ti2util.la
+4ti2_genmodel_SOURCES = genmodel_main.c
+4ti2_genmodel_LDADD = lib4ti2util.la
 
-gensymm_SOURCES = gensymm_main.c
-gensymm_LDADD = lib4ti2util.la
+4ti2_gensymm_SOURCES = gensymm_main.c
+4ti2_gensymm_LDADD = lib4ti2util.la
 
-output_SOURCES = output_main.c
-output_LDADD = lib4ti2util.la
+4ti2_output_SOURCES = output_main.c
+4ti2_output_LDADD = lib4ti2util.la
 
 # normaliz_wrapper_SOURCES = normaliz_wrapper.c
 # normaliz_wrapper_LDADD = lib4ti2util.la
--- a/test/output/binomials/Makefile.am
+++ b/test/output/binomials/Makefile.am
@@ -2,6 +2,6 @@
 	cuww1.gro cuww1.gro.bin.chk cuww1.gro.vars
 
 check-local:
-	@../../check.template $(srcdir) "" src/util/output --binomials
+	@../../check.template $(srcdir) "" src/util/4ti2-output --binomials
 
 CLEANFILES = .num_failures
--- a/test/output/maple/Makefile.am
+++ b/test/output/maple/Makefile.am
@@ -2,7 +2,7 @@
 	cuww1.gro cuww1.gro.maple.chk
 
 check-local:
-	@../../check.template $(srcdir) "" src/util/output --maple
+	@../../check.template $(srcdir) "" src/util/4ti2-output --maple
 
 CLEANFILES = .num_failures
 
--- a/test/output/positive/Makefile.am
+++ b/test/output/positive/Makefile.am
@@ -2,6 +2,6 @@
 	cuww1.gro cuww1.gro.pos.chk
 
 check-local:
-	@../../check.template $(srcdir) "" src/util/output --positive
+	@../../check.template $(srcdir) "" src/util/4ti2-output --positive
 
 CLEANFILES = .num_failures
--- a/test/genmodel/Makefile.am
+++ b/test/genmodel/Makefile.am
@@ -5,6 +5,6 @@
 	k2_3.mod k2_3.mat.chk
 
 check-local:
-	@../check.template $(srcdir) "" src/util/genmodel -q
+	@../check.template $(srcdir) "" src/util/4ti2-genmodel -q
 
 CLEANFILES = .num_failures
--- a/test/gensymm/Makefile.am
+++ b/test/gensymm/Makefile.am
@@ -2,6 +2,6 @@
 	333.sym.chk
 
 check-local:
-	@../check.template $(srcdir) "" src/util/gensymm 3 3 3 1
+	@../check.template $(srcdir) "" src/util/4ti2-gensymm 3 3 3 1
 
 CLEANFILES = .num_failures
--- a/src/ppi/Makefile.am
+++ b/src/ppi/Makefile.am
@@ -18,9 +18,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
 
-bin_PROGRAMS = ppi
+bin_PROGRAMS = 4ti2-ppi
 
-ppi_SOURCES = ppi.cpp
+4ti2_ppi_SOURCES = ppi.cpp
 
 # Allow accessing general 4ti2 headers
 AM_CXXFLAGS = -I$(srcdir)/..
--- a/test/ppi/Makefile.am
+++ b/test/ppi/Makefile.am
@@ -4,6 +4,6 @@
 	ppi5.gra.chk
 
 check-local:
-	@./check-ppi $(srcdir) src/ppi/ppi
+	@./check-ppi $(srcdir) src/ppi/4ti2-ppi
 
 CLEANFILES = .num_failures
--- a/src/zsolve/Makefile.am
+++ b/src/zsolve/Makefile.am
@@ -21,7 +21,7 @@
 pkglibbindir = $(pkglibexecdir)/bin
 pkgliblibdir = $(libdir)
 
-bin_PROGRAMS = zsolve 
+bin_PROGRAMS = 4ti2-zsolve
 
 pkgliblib_LTLIBRARIES = libzsolve.la
 
@@ -79,14 +79,14 @@
 #noinst_HEADERS = 
 
 libzsolve_la_SOURCES = $(libzsolvesources)
-zsolve_SOURCES = $(zsolvesources)
-zsolve_LDADD = libzsolve.la
+4ti2_zsolve_SOURCES = $(zsolvesources)
+4ti2_zsolve_LDADD = libzsolve.la
 libzsolve_la_CPPFLAGS =
-zsolve_CPPFLAGS = 
+4ti2_zsolve_CPPFLAGS =
 if HAVE_GMP_WITH_CXX
 libzsolve_la_CPPFLAGS += ${GMP_CFLAGS}
-zsolve_CPPFLAGS += ${GMP_CFLAGS}
-zsolve_LDADD += ${GMP_LIBS}
+4ti2_zsolve_CPPFLAGS += ${GMP_CFLAGS}
+4ti2_zsolve_LDADD += ${GMP_LIBS}
 endif
 # Link in the "common" 4ti2 functions.
 # -no-undefined declares that no undefined symbols will remain after linking all these libraries.
@@ -94,13 +94,13 @@
 libzsolve_la_LDFLAGS = -L../4ti2 -l4ti2common ${GMP_LIBS} -no-undefined
 libzsolve_la_LDFLAGS += -version-info $(XLII_LT_VERSION)
 
-bin_SCRIPTS = hilbert graver
-DISTCLEANFILES = hilbert graver
+bin_SCRIPTS = 4ti2-hilbert 4ti2-graver
+DISTCLEANFILES = $(bin_SCRIPTS)
 
 EXTRA_DIST = hilbert.template graver.template
 
-hilbert: hilbert.template
+4ti2-hilbert: hilbert.template
 	$(install_sh) -c -m 755 $< $@
 
-graver: graver.template
+4ti2-graver: graver.template
 	$(install_sh) -c -m 755 $< $@
--- a/test/hilbert/Makefile.am
+++ b/test/hilbert/Makefile.am
@@ -11,6 +11,6 @@
 	zero-rows.hil.dont-chk zero-rows.mat zero-rows.sign zero-rows.zfree.dont-chk
 
 check-local:
-	@../check.template $(srcdir) "" src/zsolve/hilbert -q
+	@../check.template $(srcdir) "" src/zsolve/4ti2-hilbert -q
 
 CLEANFILES = .num_failures
--- a/test/graver/Makefile.am
+++ b/test/graver/Makefile.am
@@ -8,6 +8,6 @@
 	trivial-kernel.mat trivial-kernel.gra.chk
 
 check-local:
-	@../check.template $(srcdir) "" src/zsolve/graver -q 
+	@../check.template $(srcdir) "" src/zsolve/4ti2-graver -q
 
 CLEANFILES = .num_failures
--- a/test/zsolve/Makefile.am
+++ b/test/zsolve/Makefile.am
@@ -15,6 +15,6 @@
 
 
 check-local:
-	@../check.template $(srcdir) "" src/zsolve/zsolve -q
+	@../check.template $(srcdir) "" src/zsolve/4ti2-zsolve -q
 
 CLEANFILES = .num_failures
--- a/src/zsolve/graver.template.in
+++ b/src/zsolve/graver.template.in
@@ -5,9 +5,9 @@
 
 # We locate where this script is so we can call the executable zsolve which
 # should be in the same directory as this script.
-SCRIPT=`which "$0"`
-SCRIPTDIR=`dirname "$SCRIPT"`
-EXECUTABLE=zsolve
+SCRIPT=${0}
+SCRIPTDIR=${SCRIPT%/*}
+EXECUTABLE=4ti2-zsolve
 
 for DIR in "$SCRIPTDIR" "$PKGLIBEXECDIR/bin"; do
 	if [ -x "$DIR/$EXECUTABLE" ]; then break; fi
--- a/src/zsolve/hilbert.template.in
+++ b/src/zsolve/hilbert.template.in
@@ -5,9 +5,9 @@
 
 # We locate where this script is so we can call the executable zsolve which
 # should be in the same directory as this script.
-SCRIPT=`which "$0"`
-SCRIPTDIR=`dirname "$SCRIPT"`
-EXECUTABLE=zsolve
+SCRIPT=${0}
+SCRIPTDIR=${SCRIPT%/*}
+EXECUTABLE=4ti2-zsolve
 
 for DIR in "$SCRIPTDIR" "$PKGLIBEXECDIR/bin"; do
 	if [ -x "$DIR/$EXECUTABLE" ]; then break; fi
