Index: trunk/psLib/m4/ipp_stdopts.m4
===================================================================
--- trunk/psLib/m4/ipp_stdopts.m4	(revision 23793)
+++ trunk/psLib/m4/ipp_stdopts.m4	(revision 34089)
@@ -1,5 +1,7 @@
 
+dnl IPP_STDCFLAGS must go *after* external probes (to avoid Werror confusing things)
 AC_DEFUN([IPP_STDCFLAGS],
 [
+    dnl this section currently overrides a user-defined CFLAGS
     AC_ARG_ENABLE(optimize,
       [AS_HELP_STRING(--enable-optimize,enable compiler optimization)],
@@ -12,5 +14,45 @@
       ]
     )
+    dnl this section accepts a user-defined CFLAGS, and sets CFLAGS to the empty string if not present
+    AC_ARG_ENABLE(debug-build,
+      [AS_HELP_STRING(--enable-debug-build,enable debug build: ie disable Werror)],
+      [AC_MSG_RESULT(debug build enabled)
+        if test x"${CFLAGS}" == x; then
+          CFLAGS="-Wall"
+	else
+          CFLAGS="${CFLAGS=} -Wall"
+        fi
+      ],
+      [AC_MSG_RESULT([compile optimization disabled])
+        if test x"${CFLAGS}" == x; then
+          CFLAGS="-Wall -Werror"
+	else
+          CFLAGS="${CFLAGS=} -Wall -Werror"
+        fi
+      ]
+    )
 ])
+
+dnl IPP_STDLDFLAGS must go *before* external probes (so linking is done with --no-as-needed if needed)
+AC_DEFUN([IPP_STDLDFLAGS],
+[
+    dnl this section accepts a user-defined LDFLAGS, and sets LDFLAGS to the empty string if not present
+    AC_ARG_ENABLE(no-as-needed, 
+      [AS_HELP_STRING(--enable-no-as-needed, prevent as-needed option sometimes supplied to gcc such as Ubuntu after 11.11)],
+      [AC_MSG_RESULT(no-as-needed passed to linker) 
+      	if test x"${LDFLAGS}" == x; then
+          LDFLAGS="-Wl,--no-as-needed"
+	else
+          LDFLAGS="${LDFLAGS=} -Wl,--no-as-needed"
+	fi
+      ],
+      [AC_MSG_RESULT(as-needed linker flags accepted) 
+      	if test x"${LDFLAGS}" == x; then
+          LDFLAGS=""
+	fi
+      ]
+    )
+])
+dnl
 
 AC_DEFUN([IPP_STDOPTS],
