summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog24
-rw-r--r--Makefile2
-rw-r--r--argp/argp-help.c5
-rw-r--r--argp/argp-parse.c3
-rw-r--r--cppflags-iterator.mk7
-rw-r--r--extra-lib.mk10
-rw-r--r--include/libintl.h12
-rw-r--r--intl/dcgettext.c3
-rw-r--r--intl/dgettext.c4
-rw-r--r--intl/gettext.c4
-rw-r--r--locale/SYS_libc.c1
-rw-r--r--posix/regcomp.c3
-rw-r--r--posix/regex_internal.c3
13 files changed, 69 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index c935875552..912c88ada6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2002-04-08  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makeconfig (CPPFLAGS): Also add CPPFLAGS-<basename> where <basename>
+	is the name of the source file without extension.
+	* Makefile (distribute): Add cppflags-iterator.mk.
+	* cppflags-iterator.mk: New file.
+	* extra-lib.mk: For the sources of the library run
+	cppflags-iterator.mk.
+
+	* include/libintl.h: Declare __dcgettext_internal and
+	_libc_intl_domainname_internal.  Define __dcgettext using these
+	two symbols if used in libc itself.
+	* argp/argp-help.c: Define dgettext using __dcgettext_internal and
+	_libc_intl_domainname_internal.
+	* argp/argp-parse.c: Likewise.
+	* intl/dcgettext.c (__dcgettext): Use INTDEF to define alias.
+	* intl/dgettext.c: Call __dcgettext_internal instead of __dcgettext.
+	* intl/gettext.c: Likewise.
+	* locale/SYS_libc.c (_libc_intl_domainname): Use INTDEF to define
+	alias.
+	* posix/regcomp.c (gettext): Use __dcgettext_internal instead of
+	__dcgettext.
+	* posix/regex_internal.c (gettext): Likewise.
+
 2002-04-08  Andreas Jaeger  <aj@suse.de>
 
 	* sysdeps/x86_64/fpu/s_llrint.S: New.
diff --git a/Makefile b/Makefile
index eba8cad1dd..95adfc959e 100644
--- a/Makefile
+++ b/Makefile
@@ -258,7 +258,7 @@ distribute  :=	README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS	\
 		rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h	\
 		test-skeleton.c include/des.h include/libc-internal.h	\
 		include/shlib-compat.h include/pthread.h Versions.def	\
-		INTERFACE CONFORMANCE NAMESPACE				\
+		cppflags-iterator.mk INTERFACE CONFORMANCE NAMESPACE	\
 		$(addprefix scripts/,					\
 			    rellns-sh config.sub config.guess		\
 			    mkinstalldirs move-if-change install-sh	\
diff --git a/argp/argp-help.c b/argp/argp-help.c
index e51825c28b..af23d93fe2 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing help output
-   Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -62,7 +62,8 @@ char *alloca ();
 #  include <libintl.h>
 #  ifdef _LIBC
 #   undef dgettext
-#   define dgettext(domain, msgid) __dcgettext (domain, msgid, LC_MESSAGES)
+#   define dgettext(domain, msgid) \
+  INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
 #  endif
 # else
 #  define dgettext(domain, msgid) (msgid)
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 5a5146fba3..6d5f08cf83 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -35,7 +35,8 @@
 #  include <libintl.h>
 #  ifdef _LIBC
 #   undef dgettext
-#   define dgettext(domain, msgid) __dcgettext (domain, msgid, LC_MESSAGES)
+#   define dgettext(domain, msgid) \
+  INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
 #  endif
 # else
 #  define dgettext(domain, msgid) (msgid)
diff --git a/cppflags-iterator.mk b/cppflags-iterator.mk
new file mode 100644
index 0000000000..07488850aa
--- /dev/null
+++ b/cppflags-iterator.mk
@@ -0,0 +1,7 @@
+# This file is included several times in a row, once
+# for each element of $(lib)-routines and $(lib)-sysdeps_routines.
+
+cpp-src := $(firstword $(cpp-srcs-left))
+cpp-srcs-left := $(filter-out $(cpp-src),$(cpp-srcs-left))
+
+CPPFLAGS-$(cpp-src) = -DNOT_IN_LIBC -DIS_IN_$(lib)
diff --git a/extra-lib.mk b/extra-lib.mk
index cdb48e2fff..2a8227f369 100644
--- a/extra-lib.mk
+++ b/extra-lib.mk
@@ -78,3 +78,13 @@ $(objpfx)$(lib).so: $(firstword $($(lib)-map) \
 endif
 
 endif
+
+cpp-srcs-left = $(lib)-routines
+ifneq (,$($(lib)-routines))
+cpp-srcs-left = $($(lib)-routines)
+include $(patsubst %,$(..)cppflags-iterator.mk,$($(lib)-routines))
+endif
+ifneq (,$($(lib)-sysdep_routines))
+cpp-srcs-left = $($(lib)-sysdep_routines)
+include $(patsubst %,$(..)cppflags-iterator.mk,$($(lib)-sysdep_routines))
+endif
diff --git a/include/libintl.h b/include/libintl.h
index dc54ccfc7b..a4d6148d8d 100644
--- a/include/libintl.h
+++ b/include/libintl.h
@@ -8,12 +8,16 @@ extern char *__dgettext (__const char *__domainname,
 			 __const char *__msgid);
 extern char *__dcgettext (__const char *__domainname,
 			  __const char *__msgid, int __category);
+extern char *__dcgettext_internal (__const char *__domainname,
+				   __const char *__msgid, int __category)
+     attribute_hidden;
 extern char *__textdomain (__const char *__domainname);
 extern char *__bindtextdomain (__const char *__domainname,
 			       __const char *__dirname);
 extern char *__bind_textdomain_codeset (__const char *__domainname,
 					__const char *__codeset);
 extern const char _libc_intl_domainname[];
+extern const char _libc_intl_domainname_internal[] attribute_hidden;
 
 /* Define the macros `_' and `N_' for conveniently marking translatable
    strings in the libc source code.  We have to make sure we get the
@@ -24,6 +28,12 @@ extern const char _libc_intl_domainname[];
 
 # undef _
 /* This is defined as an optimizing macro, so use it.  */
-# define _(msgid) __dcgettext (_libc_intl_domainname, (msgid), LC_MESSAGES)
+# if !defined NOT_IN_LIBC && defined SHARED
+#  define _(msgid) \
+  __dcgettext_internal (_libc_intl_domainname_internal, (msgid), LC_MESSAGES)
+# else
+#  define _(msgid) \
+  __dcgettext (_libc_intl_domainname, (msgid), LC_MESSAGES)
+#endif
 
 #endif
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
index c250da42b3..feea12c0ba 100644
--- a/intl/dcgettext.c
+++ b/intl/dcgettext.c
@@ -1,5 +1,5 @@
 /* Implementation of the dcgettext(3) function.
-   Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -55,5 +55,6 @@ DCGETTEXT (domainname, msgid, category)
 
 #ifdef _LIBC
 /* Alias for function name in GNU C Library.  */
+INTDEF(__dcgettext)
 weak_alias (__dcgettext, dcgettext);
 #endif
diff --git a/intl/dgettext.c b/intl/dgettext.c
index 02ca2b1687..0fa9fc2e82 100644
--- a/intl/dgettext.c
+++ b/intl/dgettext.c
@@ -1,5 +1,5 @@
 /* Implementation of the dgettext(3) function.
-   Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -38,7 +38,7 @@
    prefix.  So we have to make a difference here.  */
 #ifdef _LIBC
 # define DGETTEXT __dgettext
-# define DCGETTEXT __dcgettext
+# define DCGETTEXT INTUSE(__dcgettext)
 #else
 # define DGETTEXT dgettext__
 # define DCGETTEXT dcgettext__
diff --git a/intl/gettext.c b/intl/gettext.c
index 1f992c8e77..ec5fa3a84a 100644
--- a/intl/gettext.c
+++ b/intl/gettext.c
@@ -1,5 +1,5 @@
 /* Implementation of gettext(3) function.
-   Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,7 +43,7 @@
    prefix.  So we have to make a difference here.  */
 #ifdef _LIBC
 # define GETTEXT __gettext
-# define DCGETTEXT __dcgettext
+# define DCGETTEXT INTUSE(__dcgettext)
 #else
 # define GETTEXT gettext__
 # define DCGETTEXT dcgettext__
diff --git a/locale/SYS_libc.c b/locale/SYS_libc.c
index 53c9a6034e..4f9e946cf3 100644
--- a/locale/SYS_libc.c
+++ b/locale/SYS_libc.c
@@ -2,3 +2,4 @@
    so the string constant is not repeated in dozens of object files.  */
 
 const char _libc_intl_domainname[] = "libc";
+INTDEF(_libc_intl_domainname)
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 7e3954fdad..b5f8800569 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -42,7 +42,8 @@
 # include <libintl.h>
 # ifdef _LIBC
 #  undef gettext
-#  define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
+#  define gettext(msgid) \
+  INTUSE(__dcgettext) (_libc_intl_domainname_internal, msgid, LC_MESSAGES)
 # endif
 #else
 # define gettext(msgid) (msgid)
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index c2b0f9b4b0..8b16dd6cef 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -41,7 +41,8 @@
 # include <libintl.h>
 # ifdef _LIBC
 #  undef gettext
-#  define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
+#  define gettext(msgid) \
+  INTUSE(__dcgettext) (_libc_intl_domainname_internal, msgid, LC_MESSAGES)
 # endif
 #else
 # define gettext(msgid) (msgid)