Commit 32d7c77abb6c3a0934c203bc6ae40b1a5d35790c

Thomas de Grivel 2022-12-08T05:20:31

configure

diff --git a/c3s/configure b/c3s/configure
index 287ed8f..756348f 100755
--- a/c3s/configure
+++ b/c3s/configure
@@ -46,8 +46,9 @@ LIBS="${LIBS:=-lm}"
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
 config_asan
-config_libbsd
-config_libffi
+pkg_config libbsd
+pkg_config libffi
+pkg_config libmd
 
 # Asan config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
diff --git a/config.subr b/config.subr
index e066179..ffa4e15 100644
--- a/config.subr
+++ b/config.subr
@@ -14,6 +14,8 @@
 
 set -e
 
+echo "$(basename "$PWD")/$(basename "$0")"
+
 o_rule() {
     "$CC" $CPPFLAGS $CFLAGS -M "$1" || { echo "$1" | sed -e 's/^\(.*\)\.c$/\1.o: \1.c/'; }
     echo "$1" | sed -e 's/^\(.*\)\.c$/\1.o: Makefile config.mk/'
@@ -62,25 +64,10 @@ config_asan() {
     rm .config_asan.c
 }
 
-config_libbsd() {
-    if pkg-config libbsd-overlay; then
-	CPPFLAGS="$CPPFLAGS -D_NOT_GNU_SOURCE -D_GNU_SOURCE"
-	CFLAGS="$CFLAGS $(pkg-config --cflags libbsd-overlay)"
-	LIBS="$LIBS $(pkg-config --libs libbsd-overlay) -lmd"
-    fi
-}
-
-config_libcrypto() {
-    if pkg-config libcrypto; then
-	CFLAGS="$CFLAGS $(pkg-config --cflags libcrypto)"
-	LIBS="$LIBS $(pkg-config --libs libcrypto)"
-    fi
-}
-
-config_libffi() {
-    if pkg-config libffi; then
-        CFLAGS="$CFLAGS $(pkg-config --cflags libffi)"
-        LIBS="$LIBS $(pkg-config --libs libffi)"
+pkg_config() {
+    if pkg-config "$1"; then
+	CFLAGS="$CFLAGS $(pkg-config --cflags "$1")"
+	LIBS="$LIBS $(pkg-config --libs "$1")"
     fi
 }
 
@@ -94,7 +81,7 @@ require_pkg_config() {
 update_config_mk() {
     if ! cmp "${CONFIG_MK}" config.mk >/dev/null 2>&1; then
         mv "${CONFIG_MK}" config.mk
-        echo "$PWD/config.mk"
+        echo "-> $PWD/config.mk"
     else
         rm "${CONFIG_MK}"
     fi
diff --git a/ic3/configure b/ic3/configure
index c3031f2..fa5604e 100755
--- a/ic3/configure
+++ b/ic3/configure
@@ -46,8 +46,9 @@ LIBS="${LIBS:=-lm}"
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
 config_asan
-config_libbsd
-config_libffi
+pkg_config libbsd
+pkg_config libffi
+pkg_config libmd
 
 # Asan config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
diff --git a/libc3/configure b/libc3/configure
index f386000..a4e6da1 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -47,9 +47,9 @@ LIBS="${LIBS:=-lm}"
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
 config_asan
-config_libbsd
-config_libcrypto
-config_libffi
+pkg_config libbsd
+pkg_config libffi
+pkg_config libmd
 
 # Address Sanitizer config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
diff --git a/libtommath b/libtommath
index 61efdcc..14b1bf9 160000
--- a/libtommath
+++ b/libtommath
@@ -1 +1 @@
-Subproject commit 61efdcc94d9d98daf90e5d4e082b339e74a23af3
+Subproject commit 14b1bf9da7b4c6d8cec43249e7c8c59ca9b3cb8a
diff --git a/test/configure b/test/configure
index 0f42190..f64fc70 100755
--- a/test/configure
+++ b/test/configure
@@ -48,9 +48,9 @@ LIBS="${LIBS:=} -lm"
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
 config_asan
-config_libbsd
-config_libcrypto
-config_libffi
+pkg_config libbsd
+pkg_config libffi
+pkg_config libmd
 
 # Asan config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
diff --git a/ucd2c/configure b/ucd2c/configure
index 3fa6faf..fb17e9b 100755
--- a/ucd2c/configure
+++ b/ucd2c/configure
@@ -33,7 +33,7 @@ LIBS="${LIBS:=}"
 
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -O0 -ggdb"
-config_libbsd
+pkg_config libbsd
 
 # Main config
 if [ "x$ENV_CFLAGS" = "x" ]; then