From f2b401539cfc1bfad828c06b976319c70f0aaab9 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 4 Sep 2016 23:43:30 -0700 Subject: [PATCH] Pass CFLAGS to detect.sh Needed when cross-compiling with clang. --- Makefile | 2 +- programs/detect.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b81760d..f95856f 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,7 @@ PROG_OBJ := $(PROG_COMMON_OBJ) $(PROG_SPECIFIC_OBJ) # Generate autodetected configuration header programs/config.h:programs/detect.sh .prog-cflags - $(QUIET_GEN) CC=$(CC) $< > $@ + $(QUIET_GEN) CC="$(CC)" CFLAGS="$(CFLAGS)" $< > $@ # Compile program object files $(PROG_OBJ): %.o: %.c $(PROG_COMMON_HEADERS) $(COMMON_HEADERS) .prog-cflags diff --git a/programs/detect.sh b/programs/detect.sh index 0ba10b0..05bc3a3 100755 --- a/programs/detect.sh +++ b/programs/detect.sh @@ -17,7 +17,7 @@ check_function() { echo "int main() { $funcname(); }" > "$tmpfile" echo echo "/* Is the $funcname() function available? */" - if $CC -x c $tmpfile -o /dev/null > /dev/null 2>&1; then + if $CC $CFLAGS -x c $tmpfile -o /dev/null > /dev/null 2>&1; then echo "#define $macro 1" else echo "/* $macro is not set */"