diff --git a/kwsys_stl.hxx.in b/kwsys_stl.hxx.in
index 07a6fb12a5b449a5c503794c8a9c4e790c60acab..6b124b8a53c93fa3f39ac1a418d03ecff6f53c22 100644
--- a/kwsys_stl.hxx.in
+++ b/kwsys_stl.hxx.in
@@ -16,14 +16,33 @@
 
 #include <@KWSYS_NAMESPACE@/Configure.hxx>
 
+/* Avoid warnings in MSVC standard headers.  */
 #ifdef _MSC_VER
 # pragma warning (push, 1)
 # pragma warning (disable: 4702)
 # pragma warning (disable: 4786)
 #endif
 
+/* The HP standard library defines the functor "times" instead of
+   "multiplies" as specified by C++98 20.3.2 for backward
+   compatibility with earlier specifications.  Defining this macro
+   fixes this behavior.  The name "times" also conflicts with the
+   function declared in sys/times.h on that platform, so we must do
+   this as a work-around anyway.  */
+#if defined(__HP_aCC) && !defined(__HPACC_USING_MULTIPLIES_IN_FUNCTIONAL)
+# define __HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
+# define @KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
+#endif
+
+/* Include the real header.  */
 #include <@KWSYS_STL_HEADER@>
 
+/* Cleanup.  */
+#if defined(@KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL)
+# undef @KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
+# undef __HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
+#endif
+
 #ifdef _MSC_VER
 # pragma warning(pop)
 #endif