diff --git a/config.subr b/config.subr
index 0974221..569b5d8 100644
--- a/config.subr
+++ b/config.subr
@@ -55,14 +55,7 @@ c2prog() {
}
config_asan() {
- echo "int main (void) { return 0; }" > .config_asan.c
- if $LIBTOOL --tag CC --mode link $CC $CFLAGS .config_asan.c $LDFLAGS -lasan -o /dev/null 2>/dev/null; then
- HAVE_ASAN=true
- else
- HAVE_ASAN=false
- fi
- rm .config_asan.c
- echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
+ config_lib_have ASAN -lasan
}
config_define () {
@@ -104,7 +97,7 @@ config_include_have() {
echo "/* generated by configure */" > "$OUT_C"
echo "$@" >> "$OUT_C"
echo "int main (void) { return 0; }" >> "$OUT_C"
- if $LIBTOOL --tag CC --mode link ${CC} ${CPPFLAGS} ${CFLAGS} "$OUT_C" ${LIBS} $@ -o "$OUT"; then
+ if $LIBTOOL --tag CC --mode link ${CC} ${CPPFLAGS} ${CFLAGS} "$OUT_C" ${LIBS} -o "$OUT"; then
eval "HAVE_$NAME=true"
echo "HAVE_$NAME = true" >> ${CONFIG_MK}
else
@@ -121,7 +114,7 @@ config_lib() {
OUT=".config_$NAME"
echo "/* generated by configure */" > "$OUT_C"
echo "int main (void) { return 0; }" >> "$OUT_C"
- if $LIBTOOL --tag CC --mode link ${CC} ${CPPFLAGS} ${CFLAGS} "$OUT_C" ${LDFLAGS} ${LIBS} $@ -o "$OUT"; then
+ if $LIBTOOL --tag CC --mode link ${CC} ${CPPFLAGS} ${CFLAGS} "$OUT_C" ${LDFLAGS} ${LIBS} $@ -o "$OUT" >/dev/null 2>&1; then
LIBS="$LIBS $@"
fi
rm -f "$OUT" "$OUT_C"
@@ -134,7 +127,7 @@ config_lib_have() {
OUT=".config_$NAME"
echo "/* generated by configure */" > "$OUT_C"
echo "int main (void) { return 0; }" >> "$OUT_C"
- if $LIBTOOL --tag CC --mode link ${CC} ${CPPFLAGS} ${CFLAGS} "$OUT_C" ${LIBS} $@ -o "$OUT"; then
+ if $LIBTOOL --tag CC --mode link ${CC} ${CPPFLAGS} ${CFLAGS} "$OUT_C" ${LIBS} $@ -o "$OUT" >/dev/null 2>&1; then
eval "HAVE_$NAME=true"
echo "HAVE_$NAME = true" >> ${CONFIG_MK}
else
@@ -155,6 +148,54 @@ config_no_undefined() {
rm -f "$OUT" "$OUT_C"
}
+config_objc_include_have() {
+ NAME="$1"
+ shift
+ OUT_M=".config_$NAME.m"
+ OUT=".config_$NAME"
+ echo "/* generated by configure */" > "$OUT_M"
+ echo "$@" >> "$OUT_M"
+ echo "int main (void) { return 0; }" >> "$OUT_M"
+ if $LIBTOOL --tag CC --mode link ${OBJCC} ${CPPFLAGS} ${OBJCFLAGS} "$OUT_M" ${LIBS} -o "$OUT" >/dev/null 2>&1; then
+ eval "HAVE_$NAME=true"
+ echo "HAVE_$NAME = true" >> ${CONFIG_MK}
+ else
+ eval "HAVE_$NAME=false"
+ echo "HAVE_$NAME = false" >> ${CONFIG_MK}
+ fi
+ rm -f "$OUT" "$OUT_M"
+}
+
+config_objc_lib() {
+ NAME="$1"
+ shift
+ OUT_M=".config_$NAME.m"
+ OUT=".config_$NAME"
+ echo "/* generated by configure */" > "$OUT_M"
+ echo "int main (void) { return 0; }" >> "$OUT_M"
+ if $LIBTOOL --tag CC --mode link ${OBJCC} ${CPPFLAGS} ${OBJCFLAGS} "$OUT_M" ${LDFLAGS} ${LIBS} $@ -o "$OUT" >/dev/null 2>&1; then
+ LIBS="$LIBS $@"
+ fi
+ rm -f "$OUT" "$OUT_M"
+}
+
+config_objc_lib_have() {
+ NAME="$1"
+ shift
+ OUT_M=".config_$NAME.m"
+ OUT=".config_$NAME"
+ echo "/* generated by configure */" > "$OUT_M"
+ echo "int main (void) { return 0; }" >> "$OUT_M"
+ if $LIBTOOL --tag CC --mode link ${OBJCC} ${CPPFLAGS} ${OBJCFLAGS} "$OUT_M" ${LIBS} $@ -o "$OUT" >/dev/null 2>&1; then
+ eval "HAVE_$NAME=true"
+ echo "HAVE_$NAME = true" >> ${CONFIG_MK}
+ else
+ eval "HAVE_$NAME=false"
+ echo "HAVE_$NAME = false" >> ${CONFIG_MK}
+ fi
+ rm -f "$OUT" "$OUT_M"
+}
+
env_reset() {
CPPFLAGS="$ENV_CPPFLAGS"
CFLAGS="$ENV_CFLAGS"
diff --git a/libc3/window/cairo/configure b/libc3/window/cairo/configure
index 07e9b07..1d2d9a8 100755
--- a/libc3/window/cairo/configure
+++ b/libc3/window/cairo/configure
@@ -38,6 +38,7 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
# Common config for all targets
CPPFLAGS="-I../../../libffi/include -I../../.. $CPPFLAGS"
CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
+OBJCFLAGS="$CFLAGS -W -Wall -Werror"
LDFLAGS="--shared ${LDFLAGS}"
LIBS="$LIBS -rpath ${PREFIX}/lib"
config_asan
@@ -48,7 +49,7 @@ pkg_config freetype2
pkg_config xkbcommon
config_lib_have COCOA -framework Cocoa
if $HAVE_COCOA; then
- config_include_have COCOA '#import <Cocoa/Cocoa.h>'
+ config_objc_include_have COCOA '#import <Cocoa/Cocoa.h>'
fi
config_define PREFIX "\"${PREFIX}\""
diff --git a/libc3/window/cairo/quartz/configure b/libc3/window/cairo/quartz/configure
index 8fd6d69..b8341d0 100755
--- a/libc3/window/cairo/quartz/configure
+++ b/libc3/window/cairo/quartz/configure
@@ -50,6 +50,7 @@ echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
# Common config for all targets
CPPFLAGS="$CPPFLAGS -I../../../../libffi/include -I../../../.."
CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
+OBJCFLAGS="$CFLAGS -W -Wall -Werror"
LDFLAGS="--shared $LDFLAGS"
LIBS="$LIBS"
config_asan
@@ -57,7 +58,6 @@ config_gnu
pkg_config cairo
config_lib COCOA -framework Cocoa
pkg_config xkbcommon
-LIBS="$LIBS"
# Asan config
CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
diff --git a/libc3/window/cairo/quartz/demo/configure b/libc3/window/cairo/quartz/demo/configure
index 744a9fb..d0ef185 100755
--- a/libc3/window/cairo/quartz/demo/configure
+++ b/libc3/window/cairo/quartz/demo/configure
@@ -74,6 +74,7 @@ echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
# Common config for all targets
CPPFLAGS="$CPPFLAGS -I../../../../../libffi/include -I../../../../.."
CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
+OBJCFLAGS="$CFLAGS -W -Wall -Werror"
LDFLAGS="$LDFLAGS -framework Cocoa"
LIBS="$LIBS"
config_asan