Commit 922894e2f02a7504763ef8e1c3514b602ca14978

Thomas de Grivel 2022-12-08T03:01:27

fix compilation

diff --git a/c3s/configure b/c3s/configure
index 0a75cfc..287ed8f 100755
--- a/c3s/configure
+++ b/c3s/configure
@@ -41,12 +41,13 @@ CPPFLAGS="${CPPFLAGS:=}"
 ENV_CFLAGS="${CFLAGS:=}"
 DEFAULT_CFLAGS="-O2 -pipe -fPIC"
 LDFLAGS="${LDFLAGS:=}"
-LIBS="${LIBS:=-lm -lffi}"
+LIBS="${LIBS:=-lm}"
 
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
 config_asan
 config_libbsd
+config_libffi
 
 # Asan config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
diff --git a/config.subr b/config.subr
index 38de84d..e066179 100644
--- a/config.subr
+++ b/config.subr
@@ -77,6 +77,13 @@ config_libcrypto() {
     fi
 }
 
+config_libffi() {
+    if pkg-config libffi; then
+        CFLAGS="$CFLAGS $(pkg-config --cflags libffi)"
+        LIBS="$LIBS $(pkg-config --libs libffi)"
+    fi
+}
+
 require_pkg_config() {
     if ! which pkg-config >/dev/null; then
         echo "please install pkg-config" >&2
diff --git a/ic3/buf_linenoise.c b/ic3/buf_linenoise.c
index b38c5f7..f4abb12 100644
--- a/ic3/buf_linenoise.c
+++ b/ic3/buf_linenoise.c
@@ -18,7 +18,7 @@
 #include <string.h>
 #include <unistd.h>
 #include "../libc3/c3.h"
-#include "linenoise.h"
+#include "../linenoise/linenoise.h"
 
 typedef struct buf_linenoise {
   s_buf       buf;
diff --git a/ic3/configure b/ic3/configure
index 6427ea3..c3031f2 100755
--- a/ic3/configure
+++ b/ic3/configure
@@ -41,12 +41,13 @@ CPPFLAGS="${CPPFLAGS:=}"
 ENV_CFLAGS="${CFLAGS:=}"
 DEFAULT_CFLAGS="-O2 -pipe -fPIC"
 LDFLAGS="${LDFLAGS:=}"
-LIBS="${LIBS:=-lm -lffi}"
+LIBS="${LIBS:=-lm}"
 
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
 config_asan
 config_libbsd
+config_libffi
 
 # Asan config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
diff --git a/ic3/linenoise.c b/ic3/linenoise.c
new file mode 100644
index 0000000..c06fcf9
--- /dev/null
+++ b/ic3/linenoise.c
@@ -0,0 +1 @@
+#include "../linenoise/linenoise.c"
diff --git a/libc3/configure b/libc3/configure
index e605c6a..f386000 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -42,13 +42,14 @@ CPPFLAGS="${CPPFLAGS:=}"
 ENV_CFLAGS="${CFLAGS:=}"
 DEFAULT_CFLAGS="-O2 -pipe -fPIC"
 LDFLAGS="${LDFLAGS:=}"
-LIBS="${LIBS:=-lm -lffi}"
+LIBS="${LIBS:=-lm}"
 
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
 config_asan
 config_libbsd
 config_libcrypto
+config_libffi
 
 # Address Sanitizer config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
diff --git a/linenoise b/linenoise
index 97d2850..9ae49b8 160000
--- a/linenoise
+++ b/linenoise
@@ -1 +1 @@
-Subproject commit 97d2850af13c339369093b78abe5265845d78220
+Subproject commit 9ae49b8d6ce982dba63f464838db0bc7cfb7ec58
diff --git a/test/configure b/test/configure
index f3cbc91..0f42190 100755
--- a/test/configure
+++ b/test/configure
@@ -43,13 +43,14 @@ CPPFLAGS="${CPPFLAGS:=}"
 ENV_CFLAGS="${CFLAGS:=}"
 DEFAULT_CFLAGS="-O2 -pipe"
 LDFLAGS="${LDFLAGS:=}"
-LIBS="${LIBS:=} -lm -lffi"
+LIBS="${LIBS:=} -lm"
 
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
 config_asan
 config_libbsd
 config_libcrypto
+config_libffi
 
 # Asan config
 CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"