1 /* @(#)nlsdefs.h	1.7 20/10/09 Copyright 2004-2020 J. Schilling */
2 /*
3  *	Native language support
4  *
5  *	Copyright (c) 2004-2020 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #ifndef	_SCHILY_NLSDEFS_H
22 #define	_SCHILY_NLSDEFS_H
23 
24 #ifndef _SCHILY_MCONFIG_H
25 #include <schily/mconfig.h>
26 #endif
27 
28 #ifndef	NO_NLS
29 #ifndef	USE_NLS
30 #define	USE_NLS			/* Make nls the default */
31 #endif
32 #endif
33 
34 #ifdef	HAVE_LIBINTL_H
35 #ifndef	_INCL_LIBINTL_H
36 #include <libintl.h>		/* gettext() */
37 #define	_INCL_LIBINTL_H
38 #endif
39 #else
40 #undef	USE_NLS
41 #endif
42 
43 #ifndef	_SCHILY_LOCALE_H
44 #include <schily/locale.h>	/* LC_* definitions */
45 #endif
46 #ifndef	_INCL_LOCALE_H
47 #undef	USE_NLS
48 #endif
49 
50 #ifdef	HAVE_LANGINFO_H
51 #ifndef	_INCL_LAGINFO_H
52 #include <langinfo.h>		/* YESSTR amnd similar */
53 #define	_INCL_LANGINFO_H
54 #endif
55 #else
56 #undef	USE_NLS
57 #endif
58 
59 #ifndef	HAVE_GETTEXT
60 #undef	USE_NLS
61 #endif
62 
63 #ifdef	NO_NLS
64 #undef	USE_NLS
65 #endif
66 
67 #ifdef	NO_TEXT_DOMAIN
68 #undef	TEXT_DOMAIN
69 #endif
70 
71 #ifndef	USE_NLS
72 #undef	gettext
73 #define	gettext(s)			((char *)s)
74 #undef	dgettext
75 #define	dgettext(d, s)			((char *)s)
76 #undef	dcgettext
77 #define	dcgettext(d, s, c)		((char *)s)
78 
79 #undef	textdomain
80 #define	textdomain(a)			((char *)0)
81 #undef	bindtextdomain
82 #define	bindtextdomain(d, dir)		((char *)0)
83 #undef	bind_textdomain_codeset
84 #define	bind_textdomain_codeset(d, c)	((char *)0)
85 #endif
86 
87 #ifdef	lint
88 /*
89  * Allow lint to check printf() format strings.
90  */
91 #define	_(s)				s
92 #else	/* lint */
93 
94 #ifdef	USE_DGETTEXT			/* e.g. in a library */
95 #define	_(s)				dgettext(TEXT_DOMAIN, s)
96 #else
97 #define	_(s)				gettext(s)
98 #endif
99 #endif	/* lint */
100 
101 #ifdef	NLS_XGETTEXT_MARKER
102 /*
103  * Allow to mark strings for xgettext(1)
104  * Since this definition is on conflict with a definition from newer
105  * HP-UX versions that has the same purpose as out __PR() macro,
106  * we cannot easily use this as long as this is mixed with system include
107  * files.
108  */
109 #define	__(s)				s
110 #endif
111 
112 #endif	/* _SCHILY_NLSDEFS_H */
113