From 652517f6e99bca918bf2275003f5d51fe5f2f0c6 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 9 Jul 2022 08:37:02 -0700 Subject: [PATCH] Add header wrapper for glib to supply g_memdup2() for glib before 2.68. Friedrich Beckmann reported that some of our build targets have glib as old as 2.58. --- configure.ac | 1 + src/ui/gui/automake.mk | 16 ++++++++++++++++ src/ui/gui/include/glib.in.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/ui/gui/include/glib.in.h diff --git a/configure.ac b/configure.ac index b8e8b7ddce..20338a04b7 100644 --- a/configure.ac +++ b/configure.ac @@ -154,6 +154,7 @@ if test "$with_gui" != "no"; then fi +gl_NEXT_HEADERS([glib.h]) gl_NEXT_HEADERS([gtk/gtk.h]) dnl Checks needed for psql reader diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index 42500c049f..04da062f21 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -428,6 +428,22 @@ src/ui/gui/include/gtk/gtk.h: src/ui/gui/include/gtk/gtk.in.h CLEANFILES += src/ui/gui/include/gtk/gtk.h EXTRA_DIST += src/ui/gui/include/gtk/gtk.in.h src/ui/gui/resources.xml +# wrapper +BUILT_SOURCES += src/ui/gui/include/glib.h +src/ui/gui/include/glib.h: src/ui/gui/include/glib.in.h + @$(MKDIR_P) src/ui/gui/include + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + $(SED) -e 's|%''INCLUDE_NEXT''%|$(INCLUDE_NEXT)|g' \ + -e 's|%''PRAGMA_SYSTEM_HEADER''%|$(PRAGMA_SYSTEM_HEADER)|g' \ + -e 's|%''PRAGMA_COLUMNS''%|$(PRAGMA_COLUMNS)|g' \ + -e 's|%''NEXT_GLIB_H''%|$(NEXT_GLIB_H)|g' \ + < $(srcdir)/src/ui/gui/include/glib.in.h; \ + } > $@-t && \ + mv $@-t $@ +CLEANFILES += src/ui/gui/include/glib.h +EXTRA_DIST += src/ui/gui/include/glib.in.h + include $(top_srcdir)/src/ui/gui/icons/automake.mk src/ui/gui/pspp.res: src/ui/gui/pspp.rc $(w32_icons) diff --git a/src/ui/gui/include/glib.in.h b/src/ui/gui/include/glib.in.h new file mode 100644 index 0000000000..51178ac737 --- /dev/null +++ b/src/ui/gui/include/glib.in.h @@ -0,0 +1,32 @@ +/* Wrapper for . + Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef PSPP_GLIB_H +#define PSPP_GLIB_H + +#if __GNUC__ >= 3 +%PRAGMA_SYSTEM_HEADER% +#endif +%PRAGMA_COLUMNS% + +#%INCLUDE_NEXT% %NEXT_GLIB_H% + + +#if !GLIB_CHECK_VERSION(2,68,0) +#define g_memdup2 g_memdup +#endif + +#endif /* PSPP_GLIB_H */ -- 2.30.2