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 */"