Index: nspr/mozilla/nsprpub/configure.in
===================================================================
--- nspr.orig/mozilla/nsprpub/configure.in	2012-02-24 09:14:49.321498512 +0100
+++ nspr/mozilla/nsprpub/configure.in	2012-02-24 09:14:51.701436782 +0100
@@ -739,6 +739,25 @@
 fi
 
 dnl ========================================================
+dnl Hardening support
+dnl ========================================================
+AC_ARG_ENABLE(hardening,
+    [  --enable-hardening              Enable hardening options],
+    [ if test "$enableval" != "no"; then
+          if test -z "$GNU_CC"; then
+              AC_MSG_ERROR([--enable-hardening is not supported on non-GNU toolchain-defaults])
+          fi
+          CFLAGS="-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security $CFLAGS"
+          CPPFLAGS="-D_FORTIFY_SOURCE=2 $CPPFLAGS"
+          LDFLAGS="-Wl,-z,relro $LDFLAGS"
+          AC_MSG_CHECKING([whether hardening flags work])
+          AC_TRY_LINK([],[],
+                      AC_MSG_RESULT([yes]),
+                      AC_MSG_RESULT([no])
+                      AC_MSG_ERROR([Building with hardening flags fails]))
+      fi ])
+
+dnl ========================================================
 dnl Profile guided optimization
 dnl ========================================================
 dnl Test for profiling options
