$NetBSD: patch-af,v 1.4 2007/09/18 21:20:12 wiz Exp $

--- builtins/printf.def.orig	2007-09-18 15:24:09.000000000 +0000
+++ builtins/printf.def
@@ -74,6 +74,11 @@ $END
 #  undef PRIdMAX
 #endif
 
+#if defined (_AIX) && !defined (_AIX51)
+   /* AIX defines do not work.  Undefine them.  */
+#  undef PRIdMAX
+#  undef PRIuMAX
+#endif
 #if !defined (PRIdMAX)
 #  if HAVE_LONG_LONG
 #    define PRIdMAX	"lld"
@@ -81,6 +86,13 @@ $END
 #    define PRIdMAX	"ld"
 #  endif
 #endif
+#if !defined (PRIuMAX) && defined (_AIX)
+#  if HAVE_LONG_LONG
+#    define PRIuMAX "llu"
+#  else
+#    define PRIuMAX "lu"
+#  endif
+#endif
 
 #if !defined (errno)
 extern int errno;
@@ -466,7 +478,11 @@ printf_builtin (list)
 		p = pp = getintmax ();
 		if (p != pp)
 		  {
+#if defined (_AIX) && !defined (_AIX51)
+		    f = mklong (start, PRIdMAX, sizeof (intmax_t) - 2);
+#else
 		    f = mklong (start, PRIdMAX, sizeof (PRIdMAX) - 2);
+#endif
 		    PF (f, pp);
 		  }
 		else
@@ -493,7 +509,11 @@ printf_builtin (list)
 		p = pp = getuintmax ();
 		if (p != pp)
 		  {
+#if defined (_AIX) && !defined (_AIX51)
+		    f = mklong (start, PRIuMAX, sizeof (uintmax_t) - 2);
+#else
 		    f = mklong (start, PRIdMAX, sizeof (PRIdMAX) - 2);
+#endif
 		    PF (f, pp);
 		  }
 		else
