gnucash master: Change the Glib version test for C-standard to a compile check.

John Ralls jralls at code.gnucash.org
Thu Jun 18 18:03:25 EDT 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/06d5d0a2 (commit)
	from  https://github.com/Gnucash/gnucash/commit/9343ebe9 (commit)



commit 06d5d0a20aaad7ead1aa182cfa644d12ceda5f5c
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Jun 18 14:19:12 2015 -0700

    Change the Glib version test for C-standard to a compile check.
    
    The actual problem occurred in only a couple of Glib releases before
    being reverted.

diff --git a/configure.ac b/configure.ac
index 8120f82..b6644b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -329,12 +329,9 @@ fi
 # 2.44 requires C11.
 # 2.36 deprecated g_type_init
 # 2.32 deprecated some gthread functions
-ac_cv_cstd=gnu99
 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.44 gio-2.0 >= 2.25 gthread-2.0
                         gobject-2.0 gmodule-2.0,
 [
-  ac_cv_cstd=c11
-  AC_DEFINE([HAVE_GLIB_2_44], [1], [Requires C11])
   AC_DEFINE([HAVE_GLIB_2_38], [1], [Configure leading quote around assertions])
   AC_DEFINE([HAVE_GLIB_2_36], [1], [Configure g_type_init deprecation])
   AC_DEFINE([HAVE_GLIB_2_32], [1], [Configure gthread deprecations])
@@ -370,9 +367,6 @@ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.44 gio-2.0 >= 2.25 gthread-2.0
 AC_CHECK_HEADERS(dirent.h dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
 
 GLIB_GSETTINGS
-dnl First remove any existing -std= setting from CFLAGS then add the one we want.
-CFLAGS=`echo ${CFLAGS} | sed -E -e "s,-std=[[a-z0-9]]+,,g"`
-CFLAGS="${CFLAGS} -std=${ac_cv_cstd}"
 
 # I'm sure we (used to?) require this in various places, so don't remove
 # this test unless you've done sufficient code review/testing.
@@ -394,8 +388,18 @@ AC_TRY_RUN([
 ],[
   AC_MSG_RESULT(assuming yes)
 ])
+dnl Check for redefinition of typedef GListStore, briefly in GLib 2.44.
+dnl Redefinition of typdefs is a C11 feature.
+dnl Note that We use gnu99 or gnu11 because strdup is a gnu extension in gcc.
+CFLAGS="${CFLAGS} -Werror"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <gio/gio.h>
+])], [ac_cv_cstd=gnu99], [ac_cv_cstd=gnu11])
 CFLAGS="$GNC_OLDCFLAGS"
 LDFLAGS="$GNC_OLDLDFLAGS"
+dnl First remove any existing -std= setting from CFLAGS then add the one we want.
+CFLAGS=`echo ${CFLAGS} | sed -E -e "s,-std=[[a-z0-9]]+,,g"`
+CFLAGS="${CFLAGS} -std=${ac_cv_cstd}"
 
 # Gnucash replaced dlopen/dlsym by the g_module functions; dlsym
 # is needed optionally in one place for BSD linkers, though.



Summary of changes:
 configure.ac | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list