Commit e55a429c2154eb378550671bd6234276ffd83718

Thomas de Grivel 2023-02-04T14:00:20

fix build dependencies

diff --git a/c3s/configure b/c3s/configure
index 10b066c..413104f 100755
--- a/c3s/configure
+++ b/c3s/configure
@@ -59,19 +59,25 @@ config_lib libmd -lmd
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
 LDFLAGS_ASAN="$LDFLAGS"
 LIBC3_ASAN=../libc3/libc3_asan.la
-LIBS_ASAN="$LIBC3_ASAN $LIBS ../libtommath/libtommath_asan.la"
+LIBTOMMATH_ASAN=../libtommath/libtommath_asan.la
+LOCAL_LIBS_ASAN="$LIBC3_ASAN $LIBTOMMATH_ASAN"
+LIBS_ASAN="$LOCAL_LIBS_ASAN $LIBS"
 
 # Coverage config
 CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs"
 LDFLAGS_COV="$LDFLAGS"
 LIBC3_COV=../libc3/libc3_cov.la
-LIBS_COV="$LIBC3_COV $LIBS ../libtommath/libtommath_cov.la"
+LIBTOMMATH_COV=../libtommath/libtommath_cov.la
+LOCAL_LIBS_COV="$LIBC3_COV $LIBTOMMATH_COV"
+LIBS_COV="$LOCAL_LIBS_COV $LIBS"
 
 # Debug config
 CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -ggdb"
 LDFLAGS_DEBUG="$LDFLAGS"
 LIBC3_DEBUG=../libc3/libc3_debug.la
-LIBS_DEBUG="$LIBC3_DEBUG $LIBS ../libtommath/libtommath_debug.la"
+LIBTOMMATH_DEBUG=../libtommath/libtommath_debug.la
+LOCAL_LIBS_DEBUG="$LIBC3_DEBUG $LIBTOMMATH_DEBUG"
+LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
 
 # Main config
 if [ "x$ENV_CFLAGS" = "x" ]; then
@@ -79,7 +85,9 @@ if [ "x$ENV_CFLAGS" = "x" ]; then
 fi
 CFLAGS="$CFLAGS -DNDEBUG"
 LIBC3=../libc3/libc3.la
-LIBS="$LIBC3 $LIBS ../libtommath/libtommath.la"
+LIBTOMMATH=../libtommath/libtommath.la
+LOCAL_LIBS="$LIBC3 $LIBTOMMATH"
+LIBS="$LOCAL_LIBS $LIBS"
 
 echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
 echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
@@ -90,33 +98,31 @@ echo >> ${CONFIG_MK}
 echo "CFLAGS_ASAN = $CFLAGS_ASAN" >> ${CONFIG_MK}
 echo "LDFLAGS_ASAN = $LDFLAGS_ASAN" >> ${CONFIG_MK}
 echo "LIBS_ASAN = $LIBS_ASAN" >> ${CONFIG_MK}
-if $HAVE_GCOV; then
-    echo >> ${CONFIG_MK}
-    echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
-    echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
-    echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
-fi
+echo >> ${CONFIG_MK}
+echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
+echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
+echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
 echo >> ${CONFIG_MK}
 echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
 echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
 echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "$PROG: $LIBC3 $OBJECTS" >> ${CONFIG_MK}
+echo "$PROG: $LOCAL_LIBS $OBJECTS" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS} \${LDFLAGS} ${OBJECTS} ${LIBS} -o $PROG" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "$PROG_ASAN: $LIBC3_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
+echo "$PROG_ASAN: $LOCAL_LIBS_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_ASAN} \${LDFLAGS_ASAN} ${OBJECTS_ASAN} ${LIBS_ASAN} -o $PROG_ASAN" >> ${CONFIG_MK}
 
 if $HAVE_GCOV; then
     echo >> ${CONFIG_MK}
-    echo "$PROG_COV: $LIBC3_COV $OBJECTS_COV" >> ${CONFIG_MK}
+    echo "$PROG_COV: $LOCAL_LIBS_COV $OBJECTS_COV" >> ${CONFIG_MK}
     echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_COV} \${LDFLAGS_COV} ${OBJECTS_COV} ${LIBS_COV} -o $PROG_COV" >> ${CONFIG_MK}
 fi
 
 echo >> ${CONFIG_MK}
-echo "$PROG_DEBUG: $LIBC3_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
+echo "$PROG_DEBUG: $LOCAL_LIBS_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_DEBUG} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} ${LIBS_DEBUG} -o $PROG_DEBUG" >> ${CONFIG_MK}
 
 for SRC in $SOURCES; do
diff --git a/ic3/configure b/ic3/configure
index 1a76591..ed145a7 100755
--- a/ic3/configure
+++ b/ic3/configure
@@ -59,19 +59,25 @@ config_lib libmd -lmd
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
 LDFLAGS_ASAN="$LDFLAGS"
 LIBC3_ASAN=../libc3/libc3_asan.la
-LIBS_ASAN="$LIBC3_ASAN $LIBS ../libtommath/libtommath_asan.la"
+LIBTOMMATH_ASAN=../libtommath/libtommath_asan.la
+LOCAL_LIBS_ASAN="$LIBC3_ASAN $LIBTOMMATH_ASAN"
+LIBS_ASAN="$LOCAL_LIBS_ASAN $LIBS"
 
 # Coverage config
 CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs"
 LDFLAGS_COV="$LDFLAGS"
 LIBC3_COV=../libc3/libc3_cov.la
-LIBS_COV="$LIBC3_COV $LIBS ../libtommath/libtommath_cov.la"
+LIBTOMMATH_COV=../libtommath/libtommath_cov.la
+LOCAL_LIBS_COV="$LIBC3_COV $LIBTOMMATH_COV"
+LIBS_COV="$LOCAL_LIBS_COV $LIBS"
 
 # Debug config
 CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -ggdb"
 LDFLAGS_DEBUG="$LDFLAGS"
 LIBC3_DEBUG=../libc3/libc3_debug.la
-LIBS_DEBUG="$LIBC3_DEBUG $LIBS ../libtommath/libtommath_debug.la"
+LIBTOMMATH_DEBUG=../libtommath/libtommath_debug.la
+LOCAL_LIBS_DEBUG="$LIBC3_DEBUG $LIBTOMMATH_DEBUG"
+LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
 
 # Main config
 if [ "x$ENV_CFLAGS" = "x" ]; then
@@ -79,7 +85,9 @@ if [ "x$ENV_CFLAGS" = "x" ]; then
 fi
 CFLAGS="$CFLAGS -DNDEBUG"
 LIBC3=../libc3/libc3.la
-LIBS="$LIBC3 $LIBS ../libtommath/libtommath.la"
+LIBTOMMATH=../libtommath/libtommath.la
+LOCAL_LIBS="$LIBC3 $LIBTOMMATH"
+LIBS="$LOCAL_LIBS $LIBS"
 
 echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
 echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
@@ -90,33 +98,31 @@ echo >> ${CONFIG_MK}
 echo "CFLAGS_ASAN = $CFLAGS_ASAN" >> ${CONFIG_MK}
 echo "LDFLAGS_ASAN = $LDFLAGS_ASAN" >> ${CONFIG_MK}
 echo "LIBS_ASAN = $LIBS_ASAN" >> ${CONFIG_MK}
-if $HAVE_GCOV; then
-    echo >> ${CONFIG_MK}
-    echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
-    echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
-    echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
-fi
+echo >> ${CONFIG_MK}
+echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
+echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
+echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
 echo >> ${CONFIG_MK}
 echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
 echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
 echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "$PROG: $LIBC3 $OBJECTS" >> ${CONFIG_MK}
+echo "$PROG: $LOCAL_LIBS $OBJECTS" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS} \${LDFLAGS} ${OBJECTS} ${LIBS} -o $PROG" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "$PROG_ASAN: $LIBC3_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
+echo "$PROG_ASAN: $LOCAL_LIBS_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_ASAN} \${LDFLAGS_ASAN} ${OBJECTS_ASAN} ${LIBS_ASAN} -o $PROG_ASAN" >> ${CONFIG_MK}
 
 if $HAVE_GCOV; then
     echo >> ${CONFIG_MK}
-    echo "$PROG_COV: $LIBC3_COV $OBJECTS_COV" >> ${CONFIG_MK}
+    echo "$PROG_COV: $LOCAL_LIBS_COV $OBJECTS_COV" >> ${CONFIG_MK}
     echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_COV} \${LDFLAGS_COV} ${OBJECTS_COV} ${LIBS_COV} -o $PROG_COV" >> ${CONFIG_MK}
 fi
 
 echo >> ${CONFIG_MK}
-echo "$PROG_DEBUG: $LIBC3_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
+echo "$PROG_DEBUG: $LOCAL_LIBS_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_DEBUG} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} ${LIBS_DEBUG} -o $PROG_DEBUG" >> ${CONFIG_MK}
 
 for SRC in $SOURCES; do
diff --git a/libc3/configure b/libc3/configure
index 27db14e..3089e94 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -53,24 +53,28 @@ update_config_h
 # Address Sanitizer config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
 LDFLAGS_ASAN="$LDFLAGS"
-LIBS_ASAN="$LIBS ../libtommath/libtommath_asan.la"
+LIBTOMMATH_ASAN=../libtommath/libtommath_asan.la
+LIBS_ASAN="$LIBTOMMATH_ASAN $LIBS"
 
 # Coverage config
 CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs"
 LDFLAGS_COV="$LDFLAGS"
-LIBS_COV="$LIBS ../libtommath/libtommath_cov.la"
+LIBTOMMATH_COV=../libtommath/libtommath_cov.la
+LIBS_COV="$LIBTOMMATH_COV $LIBS"
 
 # Debug config
 CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -ggdb"
 LDFLAGS_DEBUG="$LDFLAGS"
-LIBS_DEBUG="$LIBS ../libtommath/libtommath_debug.la"
+LIBTOMMATH_DEBUG=../libtommath/libtommath_debug.la
+LIBS_DEBUG="$LIBTOMMATH_DEBUG $LIBS"
 
 # Main config
 if [ "x$ENV_CFLAGS" = "x" ]; then
     CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
 fi
 CFLAGS="$CFLAGS -DNDEBUG"
-LIBS="$LIBS ../libtommath/libtommath.la"
+LIBTOMMATH=../libtommath/libtommath.la
+LIBS="$LIBTOMMATH $LIBS"
 
 make -f gen.mk
 
@@ -97,19 +101,19 @@ echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
 echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "$LIB: $OBJECTS" >> ${CONFIG_MK}
+echo "$LIB: $LIBTOMMATH $OBJECTS" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${LDFLAGS} ${OBJECTS} \${LIBS} -o ${LIB} -rpath ${LIBDIR}" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "$LIB_ASAN: $OBJECTS_ASAN" >> ${CONFIG_MK}
+echo "$LIB_ASAN: $LIBTOMMATH_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} -o ${LIB_ASAN}" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "$LIB_COV: $OBJECTS_COV" >> ${CONFIG_MK}
+echo "$LIB_COV: $LIBTOMMATH_COV $OBJECTS_COV" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} -o ${LIB_COV}" >> ${CONFIG_MK}
 
 echo >> ${CONFIG_MK}
-echo "$LIB_DEBUG: $OBJECTS_DEBUG" >> ${CONFIG_MK}
+echo "$LIB_DEBUG: $LIBTOMMATH_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
 echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
 
 for SRC in $SOURCES; do
diff --git a/libtommath b/libtommath
index af774dd..936be18 160000
--- a/libtommath
+++ b/libtommath
@@ -1 +1 @@
-Subproject commit af774dd891ee44a2439a5e0cbe64b4cb246e1ba9
+Subproject commit 936be18d88d845dc7782dd406244b873fbc3ac03