--- configure
+++ configure
@@ -3435,6 +3435,24 @@
 ## Main body of script. ##
 ## -------------------- ##
 
+cppflags_to_add="-D_REENTRANT -D_GNU_SOURCE"
+if test "x$CPPFLAGS" = "x"; then
+	CPPFLAGS="$cppflags_to_add"
+else
+	for i in $cppflags_to_add; do
+		flag_found="0"
+		for j in $CPPFLAGS; do
+			if test "x$i" = "x$j"; then
+				flag_found="1"
+				break
+			fi
+		done
+		if test "$flag_found" = "0"; then
+			CPPFLAGS="$CPPFLAGS $i"
+		fi
+	done
+fi
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
