[PATCH libXaw] Publish API feature tokens via Xaw3dP.h (#46846)

Daniel Macks dmacks at netspace.org
Wed Aug 8 17:36:37 PDT 2012


Attached patch fixes bugzilla item. 

dan

 --
Daniel Macks
dmacks at netspace.org

-------------- next part --------------
This patchset revives the old (prior to switch from imake to
autotools) behavior of having #define for various XAW_* tokens in a
public header for use by other public headers. This aids migration
from older versions and now matches currently-published specs for how
to use xaw3d. It also makes the public interface self-consistent and
easier to use because the .h #include its own headers to get its own
tokens defined directly. User can just #include the .h and It Works
without having to read -D flags via xaw3d.pc and then re-feed them to
the compiler.

Gives xaw3d buildtime gcc warnings of redefined tokens, but harmless.
Could clean it by avoiding passing the -D flagset in XAW3D_CPPFLAGS to
the compiler (just storing them to xaw3d.pc), but I was not certain
that all internal parts of xaw3d #included Xaw3dP.h where these same
tokens are (now) #defined.

Also adds documentation of default behaviors of various --enable-*
flags to './configure --help' output.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=46846
Signed-off-by: Daniel Macks <dmacks at netspace.org>
---
 configure.ac                  | 38 ++++++++++++++++++---
 include/Makefile.am           |  6 +++-
 include/X11/Xaw3d/Xaw3dP.h    | 79 -------------------------------------------
 include/X11/Xaw3d/Xaw3dP.h.in | 79 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 117 insertions(+), 85 deletions(-)
 delete mode 100644 include/X11/Xaw3d/Xaw3dP.h
 create mode 100644 include/X11/Xaw3d/Xaw3dP.h.in

diff --git a/configure.ac b/configure.ac
index a38ce7f..a950789 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,27 +43,55 @@ AC_ARG_ENABLE([internationalization],
     [XAW_I18N=$enableval], [XAW_I18N=yes])
 if test "x$XAW_I18N" = xyes; then
     XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_INTERNATIONALIZATION"
+    DEF_I18N_SUPPORT="#define XAW_INTERNATIONALIZATION"
+else
+    DEF_I18N_SUPPORT="/* #undef XAW_INTERNATIONALIZATION */"
 fi
 AM_CONDITIONAL(XAW_INTERNATIONALIZATION, [test "x$XAW_I18N" = xyes])
+AC_SUBST(DEF_I18N_SUPPORT)
 
 AC_ARG_ENABLE([multiplane-bitmaps],
     [AS_HELP_STRING([--enable-multiplane-bitmaps], dnl
-     [enable XPM support])],
-     [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_MULTIPLANE_PIXMAPS" dnl
-      PKG_CHECK_MODULES(XPM, xpm)])
+     [enable XPM support (default: no)])],
+    [XAW_MULTIPLANE=$enableval], [XAW_MULTIPLANE=no])
+if test "x$XAW_MULTIPLANE" = xyes; then
+    PKG_CHECK_MODULES(XPM, xpm)
+    XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_MULTIPLANE_PIXMAPS"
+    DEF_XPM_SUPPORT="#define XAW_MULTIPLANE_PIXMAPS"
+else
+    DEF_XPM_SUPPORT="/* #undef XAW_MULTIPLANE_PIXMAPS */"
+fi
+AC_SUBST(DEF_XPM_SUPPORT)
 
 AC_ARG_ENABLE([gray-stipples],
     [AS_HELP_STRING([--enable-gray-stipples], dnl
-     [enable gray stipples])], [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_GRAY_BLKWHT_STIPPLES"])
+     [enable gray stipples (default: no)])],
+    [XAW_STIPPLES=$enableval], [XAW_STIPPLES=no])
+if test "x$XAW_SCROLLBARS" = xyes; then
+      XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_GRAY_BLKWHT_STIPPLES"
+      DEF_GRAY_STIPPLES="#define XAW_GRAY_BLKWHT_STIPPLES"
+else
+      DEF_GRAY_STIPPLES="/* #undef XAW_GRAY_BLKWHT_STIPPLES */"
+fi
+AC_SUBST(DEF_GRAY_STIPPLES)
 
 AC_ARG_ENABLE([arrow-scrollbars],
     [AS_HELP_STRING([--enable-arrow-scrollbars], dnl
-     [enable arrow scrollbars])], [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_ARROW_SCROLLBARS"])
+     [enable arrow scrollbars (default: no)])],
+    [XAW_SCROLLBARS=$enableval], [XAW_SCROLLBARS=no])
+if test "x$XAW_SCROLLBARS" = xyes; then
+      XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_ARROW_SCROLLBARS"
+      DEF_ARROW_SCROLLBARS="#define XAW_ARROW_SCROLLBARS"
+else
+      DEF_ARROW_SCROLLBARS="/* #undef XAW_ARROW_SCROLLBARS */"
+fi
+AC_SUBST(DEF_ARROW_SCROLLBARS)
 
 AC_SUBST(XAW3D_CPPFLAGS)
 
 AC_CONFIG_FILES([Makefile
 		include/Makefile
+		include/X11/Xaw3d/Xaw3dP.h
 		src/Makefile
 		xaw3d.pc])
 
diff --git a/include/Makefile.am b/include/Makefile.am
index 56824af..d222fee 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -84,4 +84,8 @@ xaw3dinclude_HEADERS = \
 
 EXTRA_DIST = \
 	X11/Xaw3d/Template.h \
-	X11/Xaw3d/TemplateP.h
\ No newline at end of file
+	X11/Xaw3d/TemplateP.h \
+	X11/Xaw3d/Xaw3dP.h.in
+
+BUILT_SOURCES = X11/Xaw3d/Xaw3dP.h
+X11/Xaw3d/Xaw3dP.h: X11/Xaw3d/Xaw3dP.h.in
diff --git a/include/X11/Xaw3d/Xaw3dP.h b/include/X11/Xaw3d/Xaw3dP.h
deleted file mode 100644
index 9082fbf..0000000
--- a/include/X11/Xaw3d/Xaw3dP.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Xaw3dP.h
- *
- * Global definitions and declarations. Not for public consumption.
- */
-
-/*********************************************************************
-Copyright (C) 1992 Kaleb Keithley
-Copyright (C) 2000, 2003 David J. Hawkey Jr.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of the copyright holders
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*********************************************************************/
-
-#ifndef _Xaw3dP_h
-#define _Xaw3dP_h
-
-#include <X11/IntrinsicP.h>
-
-/* These are set during the build to reflect capability and options. */
-/* I18n support */
-/* XPM support */
-/* gray stipples */
-/* arrow scrollbars */
-
-#ifndef XtX
-#define XtX(w)			(((RectObj)w)->rectangle.x)
-#endif
-#ifndef XtY
-#define XtY(w)			(((RectObj)w)->rectangle.y)
-#endif
-#ifndef XtWidth
-#define XtWidth(w)		(((RectObj)w)->rectangle.width)
-#endif
-#ifndef XtHeight
-#define XtHeight(w)		(((RectObj)w)->rectangle.height)
-#endif
-#ifndef XtBorderWidth
-#define XtBorderWidth(w)	(((RectObj)w)->rectangle.border_width)
-#endif
-
-#ifdef XAW_GRAY_BLKWHT_STIPPLES
-extern unsigned long
-grayPixel(
-    unsigned long,
-    Display *,
-    Screen *
-);
-#else
-#define grayPixel(p, dpy, scn)	(p)
-#endif
-
-#ifdef XAW_MULTIPLANE_PIXMAPS
-extern Pixmap
-stipplePixmap(
-    Widget,
-    Pixmap,
-    Colormap,
-    Pixel,
-    unsigned int
-);
-#endif
-
-#endif	/* _Xaw3dP_h */
diff --git a/include/X11/Xaw3d/Xaw3dP.h.in b/include/X11/Xaw3d/Xaw3dP.h.in
new file mode 100644
index 0000000..a99429b
--- /dev/null
+++ b/include/X11/Xaw3d/Xaw3dP.h.in
@@ -0,0 +1,79 @@
+/*
+ * Xaw3dP.h
+ *
+ * Global definitions and declarations. Not for public consumption.
+ */
+
+/*********************************************************************
+Copyright (C) 1992 Kaleb Keithley
+Copyright (C) 2000, 2003 David J. Hawkey Jr.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and
+its documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and
+that both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of the copyright holders
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*********************************************************************/
+
+#ifndef _Xaw3dP_h
+#define _Xaw3dP_h
+
+#include <X11/IntrinsicP.h>
+
+/* These are set during the build to reflect capability and options. */
+ at DEF_I18N_SUPPORT@
+ at DEF_XPM_SUPPORT@
+ at DEF_GRAY_STIPPLES@
+ at DEF_ARROW_SCROLLBARS@
+
+#ifndef XtX
+#define XtX(w)			(((RectObj)w)->rectangle.x)
+#endif
+#ifndef XtY
+#define XtY(w)			(((RectObj)w)->rectangle.y)
+#endif
+#ifndef XtWidth
+#define XtWidth(w)		(((RectObj)w)->rectangle.width)
+#endif
+#ifndef XtHeight
+#define XtHeight(w)		(((RectObj)w)->rectangle.height)
+#endif
+#ifndef XtBorderWidth
+#define XtBorderWidth(w)	(((RectObj)w)->rectangle.border_width)
+#endif
+
+#ifdef XAW_GRAY_BLKWHT_STIPPLES
+extern unsigned long
+grayPixel(
+    unsigned long,
+    Display *,
+    Screen *
+);
+#else
+#define grayPixel(p, dpy, scn)	(p)
+#endif
+
+#ifdef XAW_MULTIPLANE_PIXMAPS
+extern Pixmap
+stipplePixmap(
+    Widget,
+    Pixmap,
+    Colormap,
+    Pixel,
+    unsigned int
+);
+#endif
+
+#endif	/* _Xaw3dP_h */
-- 
1.7.11.4



More information about the xorg-devel mailing list