diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6673c237b..518b53e0f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -386,11 +386,10 @@ freebsd-12-x86_64:
- bash .gitlab-ci/show-execution-environment.sh
script:
# We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
- # FreeBSD iconv doesn't handle transliteration, so we use (external) GNU libiconv here.
# FreeBSD supports xattr, but its API is different from Linux xattr.
# FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
# localstatedir is needed for access to /var/lib/dbus/machine-id
- - meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Diconv=external -Dxattr=false _build
+ - meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
- ninja -C _build
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
@@ -417,7 +416,7 @@ freebsd-13-x86_64:
before_script:
- bash .gitlab-ci/show-execution-environment.sh
script:
- - meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Diconv=external -Dxattr=false _build
+ - meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
- ninja -C _build
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
diff --git a/NEWS b/NEWS
index 42fedb9b4..dd55ab257 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+Overview of changes in GLib 2.73.1
+==================================
+
+* Remove the `-Diconv` configure option, as GLib now uses Meson’s built-in logic for
+ finding which iconv implementation to use (work by Eli Schwartz) (!2734)
+
+
Overview of changes in GLib 2.73.0
==================================
diff --git a/docs/reference/glib/building.xml b/docs/reference/glib/building.xml
index d165c5c23..62f1c3bc2 100644
--- a/docs/reference/glib/building.xml
+++ b/docs/reference/glib/building.xml
@@ -29,7 +29,7 @@
On FreeBSD:
- env CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -Wl,--disable-new-dtags" meson -Dxattr=false -Dinstalled_tests=true -Diconv=external -Db_lundef=false _build
+ env CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -Wl,--disable-new-dtags" meson -Dxattr=false -Dinstalled_tests=true -Db_lundef=false _buildninja -C _build
@@ -98,16 +98,12 @@
If your system has an iconv() implementation but
- you want to use libiconv instead, you can pass the
- option to meson. This
- forces libiconv to be used.
-
-
- Note that if you have libiconv installed in your default include
- search path (for instance, in /usr/local/), but
- don't enable it, you will get an error while compiling GLib because
- the iconv.h that libiconv installs hides the
- system iconv.
+ you want to use libiconv instead, make sure it is installed to the
+ default compiler header/library search path (for instance, in
+ /usr/local/). The iconv.h
+ that libiconv installs hides the system iconv. Meson then detects
+ this, recognizes that the system iconv is unusable and the external
+ one is mandatory, and automatically forces it to be used.
If you are using the native iconv implementation on Solaris
diff --git a/meson.build b/meson.build
index ee0a6234c..172a9a038 100644
--- a/meson.build
+++ b/meson.build
@@ -1976,28 +1976,12 @@ glibconfig_conf.set10('G_HAVE_GROWING_STACK', growing_stack)
# We should never use the MinGW C library's iconv because it may not be
# available in the actual runtime environment. On Windows, we always use
# the built-in implementation
-iconv_opt = get_option('iconv')
if host_system == 'windows'
- libiconv = []
# We have a #include "win_iconv.c" in gconvert.c on Windows, so we don't need
# any external library for it
- if iconv_opt != 'auto'
- warning('-Diconv was set to @0@, which was ignored')
- endif
+ libiconv = []
else
- found_iconv = false
- if ['auto', 'libc'].contains(iconv_opt) and cc.has_function('iconv_open')
- libiconv = []
- found_iconv = true
- endif
- if not found_iconv and ['auto', 'external'].contains(iconv_opt) and cc.has_header_symbol('iconv.h', 'iconv_open')
- libiconv = [cc.find_library('iconv')]
- found_iconv = true
- endif
-
- if not found_iconv
- error('iconv implementation "@0@" not found'.format(iconv_opt))
- endif
+ libiconv = dependency('iconv')
endif
pcre = dependency('libpcre', version: '>= 8.31', required : false) # Should check for Unicode support, too. FIXME
@@ -2046,42 +2030,37 @@ libz_dep = dependency('zlib')
# FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
# implementations. This could be extended if issues are found in some platforms.
libintl_deps = []
-if cc.has_function('ngettext')
- have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
-else
- # First just find the bare library.
- libintl = cc.find_library('intl', required : false)
- # The bare library probably won't link without help if it's static.
- if libintl.found() and not cc.has_function('ngettext', dependencies : libintl)
- libintl_iconv = cc.find_library('iconv', required : false)
- # libintl supports different threading APIs, which may not
- # require additional flags, but it defaults to using pthreads if
- # found. Meson's "threads" dependency does not allow you to
- # prefer pthreads. We may not be using pthreads for glib itself
- # either so just link the library to satisfy libintl rather than
- # also defining the macros with the -pthread flag.
- libintl_pthread = cc.find_library('pthread', required : false)
- # Try linking with just libiconv.
- if libintl_iconv.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_iconv])
- libintl_deps += [libintl_iconv]
- # Then also try linking with pthreads.
- elif libintl_iconv.found() and libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_iconv, libintl_pthread])
- libintl_deps += [libintl_iconv, libintl_pthread]
- else
- libintl = disabler()
- endif
- endif
- if not libintl.found()
- libintl = subproject('proxy-libintl').get_variable('intl_dep')
- libintl_deps = [libintl] + libintl_deps
- have_bind_textdomain_codeset = true # proxy-libintl supports it
+libintl = dependency('intl', required: false)
+if libintl.found()
+ # libintl supports different threading APIs, which may not
+ # require additional flags, but it defaults to using pthreads if
+ # found. Meson's "threads" dependency does not allow you to
+ # prefer pthreads. We may not be using pthreads for glib itself
+ # either so just link the library to satisfy libintl rather than
+ # also defining the macros with the -pthread flag.
+ #
+ # Meson's builtin dependency lookup as of 0.60.0 doesn't check for
+ # pthread, so we do this manually here.
+ if cc.has_function('ngettext', dependencies : libintl)
+ libintl_deps += [libintl]
else
- libintl_deps = [libintl] + libintl_deps
- have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset',
- dependencies : libintl_deps)
+ libintl_pthread = cc.find_library('pthread', required : false)
+ if libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_pthread])
+ libintl_deps += [libintl, libintl_pthread]
+ else
+ libintl = disabler()
+ endif
endif
endif
+if libintl.found()
+ have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', dependencies: libintl_deps)
+else
+ libintl = subproject('proxy-libintl').get_variable('intl_dep')
+ libintl_deps = [libintl]
+ have_bind_textdomain_codeset = true # proxy-libintl supports it
+endif
+
glib_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
# We require gettext to always be present
diff --git a/meson_options.txt b/meson_options.txt
index d1859e939..a52eed9d2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,7 +7,7 @@ option('iconv',
type : 'combo',
choices : ['auto', 'libc', 'external'],
value : 'auto',
- description : 'iconv implementation to use (\'libc\' = \'Part of the C library\'; \'external\' = \'External libiconv\'; \'auto\' = \'Auto-detect which iconv is available\')')
+ deprecated: true,)
option('charsetalias_dir',
type : 'string',
@@ -116,4 +116,4 @@ option('glib_checks',
option('libelf',
type : 'feature',
value : 'auto',
- description : 'Enable support for listing and extracting from ELF resource files with gresource tool')
\ No newline at end of file
+ description : 'Enable support for listing and extracting from ELF resource files with gresource tool')