So what I'm going to do is pull all the _LP64 amendments to longlong.h
and instead avoid it completely with this in factor.c:
diff --git a/src/factor.c b/src/factor.c
index 473eee7..95451a5 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -118,7 +118,14 @@
#endif
#ifndef USE_LONGLONG_H
-# define USE_LONGLONG_H 1
+/* With the way we use longlong.h, it's only safe to use
+ when UWtype = UHWtype, as there were various cases
+ (as can be seen in the history for longlong.h) where
+ for example, _LP64 was required to enable W_TYPE_SIZE==64 code,
+ to avoid compile time or run time issues. */
+# if LONG_MAX == INTMAX_MAX
+# define USE_LONGLONG_H 1
+# endif
#endif
#if USE_LONGLONG_H
That works for i686 x86_64 and sparcv7 and sparcv9 at least.