Skip to content

Commit

Permalink
configure.ac: set minimum GLIB version to 2.68
Browse files Browse the repository at this point in the history
This fixes clang++ compilation as explained here:
  https://gitlab.gnome.org/GNOME/glib/-/issues/3193#note_1935964

It also introduces a lot of glib deprecated warnings

Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
  • Loading branch information
bazsi committed Dec 7, 2023
1 parent 9ef8708 commit fbc2dd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -229,7 +229,7 @@ find_package(BISON 3.7.6 REQUIRED)
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\..*$" _dummy "${BISON_VERSION}")

set(GLIB_COMPILE_DEFINITIONS
GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32
GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_68
)
find_package(GLIB 2.32.0 REQUIRED COMPONENTS gmodule gthread)

Expand Down
12 changes: 10 additions & 2 deletions configure.ac
Expand Up @@ -1025,8 +1025,6 @@ if test "$linking_mode" != "dynamic"; then
LIBS=$old_LIBS
fi

GLIB_CFLAGS="${GLIB_CFLAGS} -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"

old_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$GLIB_CFLAGS"
old_LDFLAGS=$LDFLAGS
Expand All @@ -1039,6 +1037,16 @@ AC_CHECK_FUNCS(g_list_copy_deep \
g_canonicalize_filename)
LIBS=$old_LIBS

if "$HAVE_G_MEMDUP2" = "1"; then
dnl only set MIN_REQUIRED to 2.68 if we know that we are at least on that version.
dnl On CentOS7/SLES12 we don't have recent enough glib but with compat
dnl wrappers we can compile. Bad news is that if we don't set to 2_68 at least,
dnl we can't compile on new platforms with clang. Best of both worlds.
GLIB_CFLAGS="${GLIB_CFLAGS} -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_68"
else
GLIB_CFLAGS="${GLIB_CFLAGS} -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"
fi

AC_CACHE_CHECK(sanity checking Glib headers,
blb_cv_glib_sane,
[AC_TRY_RUN([
Expand Down

0 comments on commit fbc2dd5

Please sign in to comment.