From 0e274dc979c6f22970dfca1eec6574e473d14b31 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Tue, 18 May 2021 18:13:19 +0200 Subject: [PATCH] WRaster: Fix incorrect use of macro USE_XSHM in installed header The header "wraster.h" needs different behaviour depending on whether the support for X Shared Memory extension was enabled or not; but the related macro USE_XSHM is defined by WindowMaker's configure. After this header have been installed, the macro is no more useable. This patch makes the "wraster.h" a generated file, so it will be different depending on USE_XSHM, but will not make use of the macro itself. Signed-off-by: Christophe CURIS --- WINGs/Makefile.am | 2 +- WPrefs.app/Makefile.am | 2 +- src/Makefile.am | 2 +- util/Makefile.am | 2 +- wrlib/Makefile.am | 18 ++++++++++++++---- wrlib/{wraster.h => wraster.h.in} | 13 ++++--------- 6 files changed, 22 insertions(+), 17 deletions(-) rename wrlib/{wraster.h => wraster.h.in} (99%) diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am index ec9f48eb..887fb9cb 100644 --- a/WINGs/Makefile.am +++ b/WINGs/Makefile.am @@ -91,7 +91,7 @@ AM_CFLAGS = AM_CPPFLAGS = -DRESOURCE_PATH=\"$(datadir)/WINGs\" \ -I$(top_srcdir)/WINGs/WINGs -I$(top_builddir)/WINGs/WINGs \ - -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \ + -I$(top_builddir)/wrlib -I$(top_srcdir)/src \ @XFTFLAGS@ @HEADER_SEARCH_PATH@ pkgconfigdir = $(libdir)/pkgconfig diff --git a/WPrefs.app/Makefile.am b/WPrefs.app/Makefile.am index 91b1e968..f5568ba2 100644 --- a/WPrefs.app/Makefile.am +++ b/WPrefs.app/Makefile.am @@ -48,7 +48,7 @@ WPrefs_SOURCES = \ AM_CFLAGS = AM_CPPFLAGS = -DRESOURCE_PATH=\"$(wpdatadir)\" -DWMAKER_RESOURCE_PATH=\"$(pkgdatadir)\" \ - -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs -I$(top_builddir)/WINGs \ + -I$(top_builddir)/wrlib -I$(top_srcdir)/WINGs -I$(top_builddir)/WINGs \ @HEADER_SEARCH_PATH@ WPrefs_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la diff --git a/src/Makefile.am b/src/Makefile.am index 103c8bb8..0e193870 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -151,7 +151,7 @@ endif AM_CFLAGS = AM_CPPFLAGS = $(DFLAGS) \ - -I$(top_srcdir)/wrlib \ + -I$(top_builddir)/wrlib \ -I$(top_srcdir)/WINGs -I$(top_builddir)/WINGs \ @HEADER_SEARCH_PATH@ diff --git a/util/Makefile.am b/util/Makefile.am index 2a8c5f35..8ff2de65 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -12,7 +12,7 @@ bin_SCRIPTS = wmaker.inst wm-oldmenu2new wkdemenu.pl EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new wkdemenu.pl AM_CPPFLAGS = \ - $(DFLAGS) -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib \ + $(DFLAGS) -I$(top_srcdir)/WINGs -I$(top_builddir)/wrlib \ @HEADER_SEARCH_PATH@ \ -DETCDIR=\"sysconfdir\" -DDATADIR=\"pkgdatadir\" diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am index c1facfb6..37c8e37a 100644 --- a/wrlib/Makefile.am +++ b/wrlib/Makefile.am @@ -11,13 +11,17 @@ lib_LTLIBRARIES = libwraster.la libwraster_la_LDFLAGS = -version-info @WRASTER_VERSION@ +CLEANFILES = wraster.h +EXTRA_DIST += wraster.h.in + if HAVE_LD_VERSION_SCRIPT libwraster_la_LDFLAGS += -Wl,--version-script=libwraster.map EXTRA_libwraster_la_DEPENDENCIES = libwraster.map -CLEANFILES = libwraster.map +CLEANFILES += libwraster.map endif -include_HEADERS = wraster.h +BUILT_SOURCES = wraster.h +nodist_include_HEADERS = wraster.h libwraster_la_SOURCES = \ imgformat.h \ @@ -94,9 +98,15 @@ wrlib.pc: Makefile @echo 'Libs.private: $(GFXLIBS) $(MAGICKLIBS) $(XLIBS) -lm' >> $@ @echo 'Cflags: $(inc_search_path)' >> $@ +wraster.h: wraster.h.in $(top_builddir)/config.h + $(AM_V_GEN)$(top_srcdir)/script/replace-ac-keywords.sh \ + --header "$(top_builddir)/config.h" \ + --filter "USE_XSHM" \ + -o $@ $< + if HAVE_LD_VERSION_SCRIPT -libwraster.map: $(include_HEADERS) $(top_srcdir)/script/generate-mapfile-from-header.sh +libwraster.map: $(nodist_include_HEADERS) $(top_srcdir)/script/generate-mapfile-from-header.sh $(AM_V_GEN)$(top_srcdir)/script/generate-mapfile-from-header.sh \ - -n LIBWRASTER -v $(WRASTER_VERSION) $(srcdir)/$(include_HEADERS) > libwraster.map + -n LIBWRASTER -v $(WRASTER_VERSION) $< > $@ endif diff --git a/wrlib/wraster.h b/wrlib/wraster.h.in similarity index 99% rename from wrlib/wraster.h rename to wrlib/wraster.h.in index e90c6ab6..62d369f8 100644 --- a/wrlib/wraster.h +++ b/wrlib/wraster.h.in @@ -46,10 +46,7 @@ #include #include - -#ifdef USE_XSHM -#include -#endif +@USE_XSHM@#include /* @@ -261,11 +258,9 @@ typedef struct RImage { typedef struct RXImage { XImage *image; - /* Private data. Do not access */ -#ifdef USE_XSHM - XShmSegmentInfo info; - char is_shared; -#endif +@USE_XSHM@ /* Private data. Do not access */ +@USE_XSHM@ XShmSegmentInfo info; +@USE_XSHM@ char is_shared; } RXImage;