Pass the same $CFLAGS to the library probe as the final build, to work with broken build environments that provide different libraries for --static and dynamic builds.
diff --git a/scripts/make.sh b/scripts/make.sh
index 5ed9df4..8a321ea 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -163,7 +163,7 @@
 # that doesn't exist, so we have to detect and skip nonexistent libraries
 # for it.
 
-OPTLIBS="$(for i in util crypt m; do echo "int main(int argc, char *argv[]) {return 0;}" | ${CROSS_COMPILE}${CC} -xc - -o /dev/null -Wl,--as-needed -l$i > /dev/null 2>/dev/null && echo -l$i; done)"
+OPTLIBS="$(for i in util crypt m; do echo "int main(int argc, char *argv[]) {return 0;}" | ${CROSS_COMPILE}${CC} $CFLAGS -xc - -o /dev/null -Wl,--as-needed -l$i > /dev/null 2>/dev/null && echo -l$i; done)"
 
 echo "Compile toybox..."