Commit dc5ad5375c37db7b2114d8f028d13ee496a3abb9

Thomas de Grivel 2023-11-15T00:29:17

fix configure

diff --git a/libc3/configure b/libc3/configure
index fabafdd..5469566 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -31,15 +31,16 @@ OBJECTS_COV="$(c2ext .cov.lo "$LO_SOURCES")"
 OBJECTS_DEBUG="$(c2ext .debug.lo "$LO_SOURCES")"
 
 # Default config
-CPPFLAGS="${CPPFLAGS:=}"
-ENV_CFLAGS="${CFLAGS:=}"
-DEFAULT_CFLAGS="-O2 -pipe"
-LDFLAGS="--shared --no-undefined ${LDFLAGS}"
-LIBS="${LIBS} -lm -pthread -rpath ${PREFIX}/lib"
+ENV_CPPFLAGS="$CPPFLAGS"
+ENV_CFLAGS="$CFLAGS"
+ENV_LDFLAGS="$LDFLAGS"
+ENV_LIBS="$LIBS"
 
 # Common config for all targets
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -fPIC"
 CPPFLAGS="$CPPFLAGS -I../libffi/include"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -fPIC"
+LDFLAGS="--shared --no-undefined ${LDFLAGS}"
+LIBS="${LIBS} -lm -pthread -rpath ${PREFIX}/lib"
 config_asan
 config_gnu
 pkg_config libbsd-overlay
@@ -72,6 +73,7 @@ LDFLAGS_DEBUG="$LDFLAGS"
 LIBS_DEBUG="$LIBS"
 
 # Main config
+DEFAULT_CFLAGS="-O2 -pipe"
 if [ "x$ENV_CFLAGS" = "x" ]; then
     CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
 fi
@@ -142,4 +144,9 @@ done
 
 update_config_mk
 
+CPPFLAGS="$ENV_CPPFLAGS"
+CFLAGS="$ENV_CFLAGS"
+LDFLAGS="$ENV_LDFLAGS"
+LIBS="$ENV_LIBS"
+
 ( cd window && ./configure; )
diff --git a/libc3/window/cairo/configure b/libc3/window/cairo/configure
index 13cde27..f8fba28 100755
--- a/libc3/window/cairo/configure
+++ b/libc3/window/cairo/configure
@@ -41,20 +41,20 @@ OBJECTS_COV="$(c2ext .cov.lo "$SOURCES")"
 OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
 
 # Default config
-CPPFLAGS="${CPPFLAGS:=}"
-ENV_CFLAGS="${CFLAGS:=}"
-DEFAULT_CFLAGS="-O2 -pipe"
-LDFLAGS="--shared --no-undefined ${LDFLAGS}"
-LIBS="${LIBS} -rpath ${PREFIX}/lib"
+ENV_CPPFLAGS="$CPPFLAGS"
+ENV_CFLAGS="$CFLAGS"
+ENV_LDFLAGS="$LDFLAGS"
+ENV_LIBS="$LIBS"
 
 # Common config for all targets
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -fPIC"
 CPPFLAGS="$CPPFLAGS -I../../../libffi/include -I../../.."
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -fPIC"
+LDFLAGS="--shared --no-undefined ${LDFLAGS}"
+LIBS="$LIBS -rpath ${PREFIX}/lib"
 config_asan
 config_gnu
 pkg_config cairo
 config_define PREFIX "\"${PREFIX}\""
-LIBS="$LIBS"
 
 # Address Sanitizer config
 CFLAGS_ASAN="$CFLAGS -O1 -fsanitize=address -fno-omit-frame-pointer -g"
@@ -75,6 +75,7 @@ LIBS_LOCAL_DEBUG="$LIBC3_DEBUG"
 LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
 
 # Main config
+DEFAULT_CFLAGS="-O2 -pipe"
 if [ "x$ENV_CFLAGS" = "x" ]; then
     CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
 fi
@@ -151,6 +152,11 @@ echo "HAVE_XCB = $HAVE_XCB" >> ${CONFIG_MK}
 
 update_config_mk
 
+CPPFLAGS="$ENV_CPPFLAGS"
+CFLAGS="$ENV_CFLAGS"
+LDFLAGS="$ENV_LDFLAGS"
+LIBS="$ENV_LIBS"
+
 if ${HAVE_SWIFT}; then
     ( cd quartz && ./configure; )
 fi
diff --git a/libc3/window/cairo/xcb/configure b/libc3/window/cairo/xcb/configure
index 5acdbeb..3ed0c46 100755
--- a/libc3/window/cairo/xcb/configure
+++ b/libc3/window/cairo/xcb/configure
@@ -41,11 +41,12 @@ OBJECTS_COV="$(c2ext .cov.lo "$SOURCES")"
 OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
 
 # Default config
-CPPFLAGS="${CPPFLAGS:=}"
-ENV_CFLAGS="${CFLAGS:=}"
-DEFAULT_CFLAGS="-O2 -pipe"
+ENV_CPPFLAGS="$CPPFLAGS"
+ENV_CFLAGS="$CFLAGS"
+ENV_LDFLAGS="$LDFLAGS"
+ENV_LIBS="$LIBS"
 LDFLAGS="--shared --no-undefined ${LDFLAGS}"
-LIBS="${LIBS} -rpath ${PREFIX}/lib"
+LIBS="$LIBS -rpath ${PREFIX}/lib"
 
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -fPIC"
@@ -77,6 +78,7 @@ LIBS_LOCAL_DEBUG="$LIBC3_DEBUG"
 LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
 
 # Main config
+DEFAULT_CFLAGS="-O2 -pipe"
 if [ "x$ENV_CFLAGS" = "x" ]; then
     CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
 fi
@@ -146,4 +148,9 @@ done
 
 update_config_mk
 
+CPPFLAGS="$ENV_CPPFLAGS"
+CFLAGS="$ENV_CFLAGS"
+LDFLAGS="$ENV_LDFLAGS"
+LIBS="$ENV_LIBS"
+
 ( cd demo && ./configure; )
diff --git a/libc3/window/cairo/xcb/demo/configure b/libc3/window/cairo/xcb/demo/configure
index e2f6a66..cb9a4f9 100755
--- a/libc3/window/cairo/xcb/demo/configure
+++ b/libc3/window/cairo/xcb/demo/configure
@@ -44,11 +44,10 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
 echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
 
 # Default config
-CPPFLAGS="${CPPFLAGS:-}"
-ENV_CFLAGS="${CFLAGS:-}"
-DEFAULT_CFLAGS="-O2 -pipe -fPIC"
-LDFLAGS="${LDFLAGS:-}"
-LIBS="${LIBS:-}"
+ENV_CPPFLAGS="${CPPFLAGS}"
+ENV_CFLAGS="${CFLAGS}"
+ENV_LDFLAGS="${LDFLAGS}"
+ENV_LIBS="${LIBS}"
 
 # Common config for all targets
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
@@ -78,11 +77,11 @@ LOCAL_LIBS_DEBUG="../libc3_window_cairo_xcb_debug.la"
 LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
 
 # Main config
+DEFAULT_CFLAGS="-O2 -pipe -fPIC"
 if [ "x$ENV_CFLAGS" = "x" ]; then
     CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
 fi
 CFLAGS="$CFLAGS -DNDEBUG"
-LIBC3=../libc3/libc3.la
 LOCAL_LIBS="../libc3_window_cairo_xcb.la"
 LIBS="$LOCAL_LIBS $LIBS"