trylink: respect compiler settings when probing features
[oweals/busybox.git] / scripts / trylink
index 5a67fcfa8f23624f240a1ba26bd9016292032ec2..48c487bcd30f92f3029bf7f18a704da15a498264 100755 (executable)
@@ -49,7 +49,7 @@ check_cc() {
     local tempname="$(mktemp)"
     # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :(
     # "-xc": C language. "/dev/null" is an empty source file.
-    if $CC $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then
+    if $CC $CPPFLAGS $CFLAGS $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then
        echo "$1";
     else
        echo "$2";
@@ -66,7 +66,7 @@ check_libc_is_glibc() {
        syntax error here
        #endif
        " >"$tempname".c
-    if $CC "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then
+    if $CC $CPPFLAGS $CFLAGS "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then
        echo "$2";
     else
        echo "$1";