Move G_DIR_SEPARATOR* and G_SEARCHPATH_SEPARATOR* into glibconfig.h

As platform-dependent macros, they belong in glibconfig.h.
This also makes it one less place where g-ir-scanner picks definitions
from the wrong ifdef branch; see
https://bugzilla.gnome.org/show_bug.cgi?id=696935

Meson configuration support is also added in this commit.

https://bugzilla.gnome.org/show_bug.cgi?id=757284
This commit is contained in:
Mikhail Zabaluev 2015-10-29 08:53:00 +02:00 committed by Philip Withnall
parent 045b805199
commit 6dafc1ce13
5 changed files with 27 additions and 8 deletions

View File

@ -127,6 +127,8 @@ case "$host" in
glib_pid_type='void *' glib_pid_type='void *'
glib_pid_format='p' glib_pid_format='p'
glib_pollfd_format='%#x' glib_pollfd_format='%#x'
glib_dir_separator='\\'
glib_searchpath_separator=';'
glib_cv_stack_grows=no glib_cv_stack_grows=no
# Unfortunately the mingw implementations of C99-style snprintf and vsnprintf # Unfortunately the mingw implementations of C99-style snprintf and vsnprintf
# don't seem to be quite good enough, at least not in mingw-runtime-3.14. # don't seem to be quite good enough, at least not in mingw-runtime-3.14.
@ -151,6 +153,8 @@ case "$host" in
glib_pid_type=int glib_pid_type=int
glib_pid_format='i' glib_pid_format='i'
glib_pollfd_format='%d' glib_pollfd_format='%d'
glib_dir_separator='/'
glib_searchpath_separator=':'
;; ;;
esac esac
case $host in case $host in
@ -2945,6 +2949,11 @@ typedef $g_pid_type GPid;
#define GLIB_SYSDEF_MSG_PEEK $g_msg_peek #define GLIB_SYSDEF_MSG_PEEK $g_msg_peek
#define GLIB_SYSDEF_MSG_DONTROUTE $g_msg_dontroute #define GLIB_SYSDEF_MSG_DONTROUTE $g_msg_dontroute
#define G_DIR_SEPARATOR '$g_dir_separator'
#define G_DIR_SEPARATOR_S "$g_dir_separator"
#define G_SEARCHPATH_SEPARATOR '$g_searchpath_separator'
#define G_SEARCHPATH_SEPARATOR_S "$g_searchpath_separator"
G_END_DECLS G_END_DECLS
#endif /* __GLIBCONFIG_H__ */ #endif /* __GLIBCONFIG_H__ */
@ -3217,6 +3226,9 @@ g_memory_barrier_needed="$glib_memory_barrier_needed"
g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations" g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations"
g_module_suffix="$glib_gmodule_suffix" g_module_suffix="$glib_gmodule_suffix"
g_dir_separator="$glib_dir_separator"
g_searchpath_separator="$glib_searchpath_separator"
g_pid_type="$glib_pid_type" g_pid_type="$glib_pid_type"
g_pid_format="\"$glib_pid_format\"" g_pid_format="\"$glib_pid_format\""
g_pollfd_format="\"$glib_pollfd_format\"" g_pollfd_format="\"$glib_pollfd_format\""

View File

@ -23,6 +23,7 @@
#error "Only <glib.h> can be included directly." #error "Only <glib.h> can be included directly."
#endif #endif
#include <glibconfig.h>
#include <glib/gerror.h> #include <glib/gerror.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -145,19 +146,11 @@ gint g_mkdir_with_parents (const gchar *pathname,
* the search path separator is the semicolon. Note that also the * the search path separator is the semicolon. Note that also the
* (forward) slash works as directory separator. * (forward) slash works as directory separator.
*/ */
#define G_DIR_SEPARATOR '\\'
#define G_DIR_SEPARATOR_S "\\"
#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/') #define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/')
#define G_SEARCHPATH_SEPARATOR ';'
#define G_SEARCHPATH_SEPARATOR_S ";"
#else /* !G_OS_WIN32 */ #else /* !G_OS_WIN32 */
#define G_DIR_SEPARATOR '/'
#define G_DIR_SEPARATOR_S "/"
#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR) #define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR)
#define G_SEARCHPATH_SEPARATOR ':'
#define G_SEARCHPATH_SEPARATOR_S ":"
#endif /* !G_OS_WIN32 */ #endif /* !G_OS_WIN32 */

View File

@ -204,6 +204,11 @@ typedef @g_pid_type@ GPid;
#define GLIB_SYSDEF_MSG_PEEK @g_msg_peek@ #define GLIB_SYSDEF_MSG_PEEK @g_msg_peek@
#define GLIB_SYSDEF_MSG_DONTROUTE @g_msg_dontroute@ #define GLIB_SYSDEF_MSG_DONTROUTE @g_msg_dontroute@
#define G_DIR_SEPARATOR '@g_dir_separator@'
#define G_DIR_SEPARATOR_S "@g_dir_separator@"
#define G_SEARCHPATH_SEPARATOR '@g_searchpath_separator@'
#define G_SEARCHPATH_SEPARATOR_S "@g_searchpath_separator@"
G_END_DECLS G_END_DECLS
#endif /* __GLIBCONFIG_H__ */ #endif /* __GLIBCONFIG_H__ */

View File

@ -252,6 +252,11 @@ typedef void * GPid;
#define GLIB_SYSDEF_MSG_PEEK 2 #define GLIB_SYSDEF_MSG_PEEK 2
#define GLIB_SYSDEF_MSG_DONTROUTE 4 #define GLIB_SYSDEF_MSG_DONTROUTE 4
#define G_DIR_SEPARATOR '\\'
#define G_DIR_SEPARATOR_S "\\"
#define G_SEARCHPATH_SEPARATOR ';'
#define G_SEARCHPATH_SEPARATOR_S ";"
G_END_DECLS G_END_DECLS
#endif /* GLIBCONFIG_H */ #endif /* GLIBCONFIG_H */

View File

@ -997,10 +997,14 @@ if host_system == 'windows'
else else
glibconfig_conf.set_quoted('g_pollfd_format', '%#x') glibconfig_conf.set_quoted('g_pollfd_format', '%#x')
endif endif
glibconfig_conf.set('g_dir_separator', '\\')
glibconfig_conf.set('g_searchpath_separator', ';')
else else
glibconfig_conf.set('g_pid_type', 'int') glibconfig_conf.set('g_pid_type', 'int')
glibconfig_conf.set_quoted('g_pid_format', 'i') glibconfig_conf.set_quoted('g_pid_format', 'i')
glibconfig_conf.set_quoted('g_pollfd_format', '%d') glibconfig_conf.set_quoted('g_pollfd_format', '%d')
glibconfig_conf.set('g_dir_separator', '/')
glibconfig_conf.set('g_searchpath_separator', ':')
endif endif
if sizet_size == short_size if sizet_size == short_size