Prevent: Prevent: .../bonobo/bonobo-i18n.h:47:1: warning: "_" redefined
[captive.git] / src / libcaptive / include / captive / config2.h
1 /* $Id$
2  * Supplemental include file for config.h of libcaptive
3  * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 #ifndef _CAPTIVE_CONFIG2_H
21 #define _CAPTIVE_CONFIG2_H 1
22
23
24 /* Prevent: /usr/include/libbonobo-2.0/bonobo/bonobo-i18n.h:47:1: warning: "_" redefined */
25 /* #undef's need to be out of AH_BOTTOM() of 'configure.ac' to not to be commented out. */
26 #ifdef CAPTIVE_USING_GNOMEUI
27 # include <bonobo/bonobo-i18n.h>
28 # undef textdomain
29 # undef gettext
30 # undef dgettext
31 # undef dcgettext
32 # undef bindtextdomain
33 # undef bind_textdomain_codeset
34 # undef _
35 # undef N_
36 #endif /* CAPTIVE_USING_GNOMEUI */
37 #ifdef ENABLE_NLS
38 /* <libintl.h> is taken from "$(top_srcdir)/intl" if system doesn't provide intl */
39 #       include <libintl.h>
40 #ifdef LIBCAPTIVE
41 #       define _(String) dgettext (PACKAGE,String)
42 #else
43 #       define _(String) gettext (String)
44 #endif /* LIBCAPTIVE */
45 #       ifdef gettext_noop
46 #               define N_(String) gettext_noop (String)
47 #       else
48 #               define N_(String) (String)
49 #       endif
50 #else /* !ENABLE_NLS */
51 /* Stubs that do something close enough.  */
52 #       define textdomain(String) (String)
53 #       define gettext(String) (String)
54 #       define dgettext(Domain,Message) (Message)
55 #       define dcgettext(Domain,Message,Type) (Message)
56 #       define bindtextdomain(Domain,Directory) (Domain)
57 #       define _(String) (String)
58 #       define N_(String) (String)
59 #endif /* !ENABLE_NLS */
60
61 #include <glib/gtypes.h>        /* for 'gchar' */
62 /* Prevent: /usr/include/glib-2.0/glib/gmessages.h:123:1: warning: this is the location of the previous definition */
63 #undef G_LOG_DOMAIN
64 #define G_LOG_DOMAIN ((const gchar *)"Captive")
65
66 /* Ensure we have proper -I options: */
67 #if defined(CAPTIVE_USE_GNOME_VFS_MODULE) || defined(CAPTIVE_USE_GNOME_VFS)
68 #ifndef HAVE_GNOME_VFS_READ_ENTIRE_FILE
69 #include <libgnomevfs/gnome-vfs-result.h>
70 GnomeVFSResult gnome_vfs_read_entire_file(const char *uri,int *file_size,char **file_contents);
71 #endif
72 #endif
73
74 /* We need to redefine it here as any '#undef' in config.h gets commented
75  * out during 'config.h.in' -> 'config.h' pass.
76  */
77 #if defined(__GNUC__) && (__GNUC__ >= 3)
78 #include <glib/gmacros.h>       /* for 'G_STRLOC' */
79 #  undef  G_STRLOC
80 /* '__func__' does not string-concatenate! */
81 #  define G_STRLOC      __func__
82 #endif
83
84
85 /* g_log() and g_logv() acceleration */
86 #ifdef LIBCAPTIVE
87 #include <glib/gmessages.h>     /* for g_log() */
88 #include <glib/gtypes.h>        /* for 'gboolean' */
89 extern gboolean captive_debug_messages_disabled;
90 #define g_log(log_domain,log_level,format,args...) ({ \
91                 GLogLevelFlags _captive_g_log_log_level=(log_level); \
92                 if ((_captive_g_log_log_level&~(G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_INFO|G_LOG_LEVEL_DEBUG)) \
93                                 || !captive_debug_messages_disabled) \
94                         g_log((log_domain),_captive_g_log_log_level,(format) , ## args); \
95                 })
96 #define g_logv(log_domain,log_level,format,args) ({ \
97                 GLogLevelFlags _captive_g_logv_log_level=(log_level); \
98                 if ((_captive_g_logv_log_level&~(G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_INFO|G_LOG_LEVEL_DEBUG)) \
99                                 || !captive_debug_messages_disabled) \
100                         g_logv((log_domain),_captive_g_logv_log_level,(format),(args)); \
101                 })
102 #endif /* LIBCAPTIVE */
103
104
105 #endif /* _CAPTIVE_CONFIG2_H */