gcc defaults to utf-8 for both (see -fexec-charset and -finput-charset in the
gcc man page) so we should use it with msvc as well.
msvc by default uses the locale encoding unless there is a BOM, see
https://msdn.microsoft.com/en-us/library/mt708821.aspx
Our minimum requirement is already greater than that, so we don't need
to add checks there. We can always add -Wl,-framework,CoreFoundation
flag.
Fixes#1380.
- Compiler checks were failing because it were using C compiler to build
objc code.
- xdgmime is needed on osx too.
- -DGIO_COMPILATION must be passed to objc compiler too.
- gapplication doesn't build on osx, it is excluded in autotools too.
We have to be careful when we use add_project_link_arguments(): All
targets are built using link arguments for the C language, except for
libgio on osx which use the objc language, because it contains some ".m"
source files. See https://github.com/mesonbuild/meson/issues/3585.
https://bugzilla.gnome.org/show_bug.cgi?id=796214
Some compilers, particularly Android on armv5 and old versions of Clang
provide atomic ops, but don't define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
so we need to define it ourselves.
This matches what configure does, with the exception that now it's only
done for Android since clang defines __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
now.
https://bugzilla.gnome.org/show_bug.cgi?id=796325
The latest patches have fixed the atomic check, which
uses __sync_bool_compare_and_swap , and thus fails on
MSVC.
As a result, in gatomic.c, we ended up trying to include
pthread.h, which failed.
This mimics the old behaviour a bit more closely, where
G_ATOMIC_LOCK_FREE was always defined in the win32
glibconfig.h
https://bugzilla.gnome.org/show_bug.cgi?id=796220
The 'no-builtin' checks were just plain wrong. For accurate detection of
functions, use has_function with a header in the prefix. This fixes
posix_memalign detection on Android and on MinGW32, MSYS-MinGW-w64, and
old versions of MSYS2-MinGW-w64.
Using the header in the `prefix:` is generally a good idea because of
how macOS does targetting of specific macOS releases at compile time.
This also allows cross-files to override the result by setting
`has_function_stpcpy = false`, etc in [extra properties]
https://bugzilla.gnome.org/show_bug.cgi?id=795876
The comment stated that the test isn't good enough, but it correctly
detects a C99 printf when I build with -D__USE_MINGW_ANSI_STDIO=1
and an incompatible printf without it.
Using mingw-w64 from current MSYS2.
https://bugzilla.gnome.org/show_bug.cgi?id=795569
This could have caused spurious test failures when running with -Werror,
due to the missing return statement in int main().
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
Commit 3e96523e6b did not entirely fix the test, as the compiled test
code did not have a main() function, so failed to link with:
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
This caused an invalid mixtures of builtin and non-builtin atomics/locks
to be used, which caused deadlocks in a number of tests.
Fix the atomic ops test in meson.build, and the unit tests all start
working again.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=796164
This allows building with posix threads on Windows. It is generally
better to use win32 threads implementation on Windows, but this option
can be used in case it causes issues, or for performance comparison for
example.
https://bugzilla.gnome.org/show_bug.cgi?id=784995
win32_cflags gets used globally as cflags and exposed in the .pc file.
win32_ldflags gets passed to glib-2.0 and exposed in the .pc file.
This should match what the autotools build is currently doing with
GLIB_EXTRA_CFLAGS and G_LIBS_EXTRA.
https://bugzilla.gnome.org/show_bug.cgi?id=784995
-z nodelete breaks the libresourceplugin module usage in the resources.c
test, which expects to be able to unload it.
Make the Meson build match what the autotools build does: only pass
glib_link_flags to the headline libraries (glib-2.0, gio-2.0,
gobject-2.0, gthread-2.0, gmodule-2.0) and omit it from all other build
targets.
https://bugzilla.gnome.org/show_bug.cgi?id=788771
On Windows we use gnulib and elsewhere we use glibc or similar.
Also change G_GNUC_PRINTF to use gnu_printf instead of __format__ if
possible because __format__ evaluates to ms_printf under MinGW,
but we use gnulib there and not the system printf.
gnu_printf is only available with GCC>=4.4 and not with clang.
https://bugzilla.gnome.org/show_bug.cgi?id=795569
In https://bugzilla.gnome.org/show_bug.cgi?id=794555 the tests for
posix_memalign and stpcpy were extended to catch the case where
the compiler provides an incomplete builtin.
Under MSYS2 the example code still compiles and links while the real usage
of stpcpy fails to build. To prevent the MSYS2 gcc from using the builtin
versions pass -fno-builtin.
https://bugzilla.gnome.org/show_bug.cgi?id=793729
The winsock2-using test does work perfectly, however this is a new
thing that didn't exist in autotools-based builds of glib in the past.
Autotools builds used the generic case where values were just defined
to some agreed-upon numbers, and this is what all autotools-glib
binaries and binaries built against autotools-glib (since these
values go into public glibconfig.h header) use. At least one value,
G_POLLIN, is different, thus breaking ABI if some binaries are
built with autotools and the others are built with meson.
Force meson buildscript to use the same G_POLL* constant values
for Windows builds that autotools builds use.
https://bugzilla.gnome.org/show_bug.cgi?id=794687
When cross compiling and not exe wrapper has been defined cc.run() raise
an exception. Avoid this by taking the value from [properties] in the
cross file and provide sensible default if the variable is not defined.
https://bugzilla.gnome.org/show_bug.cgi?id=794898
Add a test for monitoring an existing local file, with the
WATCH_HARD_LINKS flag specified. This would previously cause a crash;
now it doesn’t.
This test contains a FIXME where I suspect we should be getting some
additional file change notifications from changes made through the hard
link; this requires further follow up and probably further fixes to our
inotify backend.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=755721
Accurate G_HAVE_GNUC_VISIBILITY is needed to correctly
define G_GNUC_INTERNAL later on. Autotools did that,
meson currently doesn't and opts to just set
G_HAVE_GNUC_VISIBILITY to 1 for all compilers except MSVC.
This leads to MinGW GCC having G_HAVE_GNUC_VISIBILITY=1,
which results in G_GNUC_INTERNAL being defined to
__attribute__((visibility("hidden"))), which is not supported.
Because cc.compiles() does not support override_options or
anything like that, we just feed it '-Werror' as-is, since
MSVC is known as not supporting visibility attributes anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=794636
GCC has built-ins for these functions, which might give a compile-only
test an impression that the functions are actually present in the C runtime.
Use a linked test to be sure.
Specifically, both functions are missing on Windows.
https://bugzilla.gnome.org/show_bug.cgi?id=794555
Supports %OB (alternative, standalone, nominative) month name along
with the old %B (primary, in a complete date format context, genitive)
month name. Similarly %Ob and %Oh for abbreviated month names.
Depending on the underlying operating system uses nl_langinfo()
or provides our custom implementation.
(Tweaked by Philip Withnall <withnall@endlessm.com> to add test case
comment and bug reference.)
https://bugzilla.gnome.org/show_bug.cgi?id=749206
Since commit 96ebcee8c4, we don’t actually need libmount 2.28. Lower our
dependency to 2.23 so that we can continue to build against CentOS 7.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
https://bugzilla.gnome.org/show_bug.cgi?id=793288