diff --git a/Makefile b/Makefile
index 2713ba2343..4ca552f44b 100644
--- a/Makefile
+++ b/Makefile
@@ -190,7 +190,7 @@ ifeq ($(DEBUG), 1)
    OPTIMIZE_FLAG = -O0
 endif
 
-CFLAGS += -Wall -Wno-unused-result $(OPTIMIZE_FLAG) -g -I. -pedantic
+CFLAGS += -Wall $(OPTIMIZE_FLAG) -g -I. -pedantic
 ifeq ($(CXX_BUILD), 1)
    CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS
 else
@@ -201,6 +201,10 @@ else
 endif
 endif
 
+ifeq ($(NOUNUSED), yes)
+   CFLAGS += -Wno-unused-result
+endif
+
 all: $(TARGET) config.mk
 
 config.mk: configure qb/*
diff --git a/qb/config.libs.sh b/qb/config.libs.sh
index 5e654194b7..5382eeb8e9 100644
--- a/qb/config.libs.sh
+++ b/qb/config.libs.sh
@@ -3,6 +3,9 @@
 check_switch_c C99 -std=gnu99
 check_critical C99 "Cannot find C99 compatible compiler."
 
+check_switch_c NOUNUSED -Wno-unused-result
+add_define_make NOUNUSED $HAVE_NOUNUSED
+
 # There are still broken 64-bit Linux distros out there. :)
 if [ -d /usr/lib64 ]; then
    add_library_dirs /usr/lib64