[PATCH xaw3d 1/2] Restore recording of build options in Xaw3dP.h

Javier Pello javier.pello at urjc.es
Sun Jun 9 02:04:45 PDT 2013


> I'm inclined to push these, but they cause redefinition warnings
> during compilation:

Well, I think I tested the patch and did not see those warnings,
but now I am getting them as well.

> Since they are added to the .h file, perhaps they should be removed
> from XAW3D_CPPFLAGS and xaw3d.pc's Cflags section?

Apparently, XAW3D_CPPFLAGS was added to xaw3d.pc in
d50aaed45a5770d9f84fe94279d4fd49ff834b85 to fix a bug about compiling
other packages against libXaw3d, but it could be that those packages
stopped building because the defines were removed from Xaw3dP.h.
There was also some discussion on the list regarding the fact that
applications should have never been including Xaw3dP.h in the first
place [1], because it is a private header, but at the time there was
no other way for them to know what features libXaw3d was built with.

[1] http://lists.x.org/archives/xorg-devel/2012-January/028749.html

So we are now in the situation that old packages include that header,
but are not getting the defines, which breaks API compatibility for
them (some will error out if a certain define is not present), while
including that header is not something we should encourage.

What we could do is to remove XAW3D_CPPFLAGS from AM_CPPFLAGS in the
build, but not from xaw3d.pc. This will mean that compilation of
libXaw3d itself will get the flags from Xaw3dP.h (which is fine),
and so will old apps (keeping API compatibility), but new apps would
be directed to pkg-config. (Of course, once an app starts detecting
libXaw3d through pkg-config, it will get redefinition warnings if
it also includes Xaw3dP.h, but that is what we want.)

I am attaching a patch with this solution; apply with
'git am --scissors'.

----8<------
Xaw3d 1.5 had special magic in Imakefile to record the options with
which the library was built (internationalization, xpm support, gray
stipples, arrow scrollbars) in Xaw3dP.h, but this was lost in commits
892b45fdb681a18c7ecaf456457fd7e4c588998d and
85bdcab66a56ca93a7eee0eadf12a90056dfa41d. Restore this behaviour by
making Xaw3dP.h be generated at configure time, so that old packages
continue to build against newer libXaw3d.

Signed-off-by: Javier Pello <javier.pello at urjc.es>
---
 .gitignore                                  |  1 +
 configure.ac                                | 12 ++++++++----
 include/Makefile.am                         |  4 +++-
 include/X11/Xaw3d/{Xaw3dP.h => Xaw3dP.h.in} |  8 ++++----
 src/Makefile.am                             |  3 +--
 5 files changed, 17 insertions(+), 11 deletions(-)
 rename include/X11/Xaw3d/{Xaw3dP.h => Xaw3dP.h.in} (94%)

diff --git a/.gitignore b/.gitignore
index 2f10f060..c569ad9a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,3 +76,4 @@ core
 #		Edit the following section as needed
 # For example, !report.pc overrides *.pc. See 'man gitignore'
 #
+include/X11/Xaw3d/Xaw3dP.h
diff --git a/configure.ac b/configure.ac
index 32e21e97..59e0fb72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_PREREQ([2.60])
 AC_INIT([libXaw3d], [1.6.2],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXaw3d])
 AC_CONFIG_SRCDIR([Makefile.am])
-AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_HEADERS([config.h include/X11/Xaw3d/Xaw3dP.h])
 
 # Initialize Automake
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -43,6 +43,7 @@ AC_ARG_ENABLE([internationalization],
     [XAW_I18N=$enableval], [XAW_I18N=yes])
 if test "x$XAW_I18N" = xyes; then
     XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_INTERNATIONALIZATION"
+    AC_DEFINE([XAW_INTERNATIONALIZATION], [], [I18n support])
 fi
 AM_CONDITIONAL(XAW_INTERNATIONALIZATION, [test "x$XAW_I18N" = xyes])
 
@@ -52,7 +53,8 @@ AC_ARG_ENABLE([multiplane-bitmaps],
     [enable_multiplane_bitmaps=no])
 
 AS_IF([test "x$enable_multiplane_bitmaps" != xno],
-     [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_MULTIPLANE_PIXMAPS" dnl
+    [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_MULTIPLANE_PIXMAPS"
+      AC_DEFINE([XAW_MULTIPLANE_PIXMAPS], [], [XPM support])
       PKG_CHECK_MODULES(XPM, xpm)])
 
 AC_ARG_ENABLE([gray-stipples],
@@ -61,7 +63,8 @@ AC_ARG_ENABLE([gray-stipples],
     [enable_gray_stipples=no])
 
 AS_IF([test "x$enable_gray_stipples" != xno],
-    [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_GRAY_BLKWHT_STIPPLES"])
+    [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_GRAY_BLKWHT_STIPPLES"
+      AC_DEFINE([XAW_GRAY_BLKWHT_STIPPLES], [], [gray stipples])])
 
 AC_ARG_ENABLE([arrow-scrollbars],
     [AS_HELP_STRING([--enable-arrow-scrollbars], [enable arrow scrollbars])],
@@ -69,7 +72,8 @@ AC_ARG_ENABLE([arrow-scrollbars],
     [enable_arrow_scrollbars=no])
 
 AS_IF([test "x$enable_arrow_scrollbars" != xno],
-    [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_ARROW_SCROLLBARS"])
+    [XAW3D_CPPFLAGS="${XAW3D_CPPFLAGS} -DXAW_ARROW_SCROLLBARS"
+      AC_DEFINE([XAW_ARROW_SCROLLBARS], [], [arrow scrollbars])])
 
 AC_SUBST(XAW3D_CPPFLAGS)
 
diff --git a/include/Makefile.am b/include/Makefile.am
index 56824af6..1fa77345 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,5 +1,8 @@
 xaw3dincludedir=${includedir}/X11/Xaw3d
 
+nodist_xaw3dinclude_HEADERS = \
+	X11/Xaw3d/Xaw3dP.h
+
 if XAW_INTERNATIONALIZATION
 I18N_HDRS = \
        X11/Xaw3d/MultiSrc.h \
@@ -78,7 +81,6 @@ xaw3dinclude_HEADERS = \
 	X11/Xaw3d/TreeP.h \
 	X11/Xaw3d/Viewport.h \
 	X11/Xaw3d/ViewportP.h \
-	X11/Xaw3d/Xaw3dP.h \
 	X11/Xaw3d/XawInit.h \
 	$(I18N_HDRS)
 
diff --git a/include/X11/Xaw3d/Xaw3dP.h b/include/X11/Xaw3d/Xaw3dP.h.in
similarity index 94%
rename from include/X11/Xaw3d/Xaw3dP.h
rename to include/X11/Xaw3d/Xaw3dP.h.in
index 9082fbff..d2f8af25 100644
--- a/include/X11/Xaw3d/Xaw3dP.h
+++ b/include/X11/Xaw3d/Xaw3dP.h.in
@@ -33,10 +33,10 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <X11/IntrinsicP.h>
 
 /* These are set during the build to reflect capability and options. */
-/* I18n support */
-/* XPM support */
-/* gray stipples */
-/* arrow scrollbars */
+#undef XAW_INTERNATIONALIZATION
+#undef XAW_MULTIPLANE_PIXMAPS
+#undef XAW_GRAY_BLKWHT_STIPPLES
+#undef XAW_ARROW_SCROLLBARS
 
 #ifndef XtX
 #define XtX(w)			(((RectObj)w)->rectangle.x)
diff --git a/src/Makefile.am b/src/Makefile.am
index 9423839a..424137b2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,8 +8,7 @@ AM_CFLAGS =		\
 	$(XPM_CFLAGS)
 
 AM_CPPFLAGS = \
-	-I${top_srcdir}/include	\
-	$(XAW3D_CPPFLAGS)
+	-I${top_srcdir}/include
 
 #
 # This doesn't appear to be used on any
-- 1.8.2


More information about the xorg-devel mailing list