Commit f357e3e1 authored by Sam Hocevar's avatar Sam Hocevar

* ./src/extras/libc.c: if configure is called with --with-included-gettext,

    we export vlc_dgettext to plugins so that their messages can be translated
    as well.
parent 22a39c27
...@@ -289,7 +289,7 @@ EXTRA_DIST += \ ...@@ -289,7 +289,7 @@ EXTRA_DIST += \
$(NULL) $(NULL)
show-libvlc-sources: FORCE show-libvlc-sources: FORCE
@echo X: $(SOURCES_libvlc_common) $(SOURCES_libvlc_win32) $(SOURCES_libvlc_dirent) $(SOURCES_libvlc_getopt) $(SOURCES_libvlc_libc) @echo X: $(SOURCES_libvlc_common) $(SOURCES_libvlc_win32) $(SOURCES_libvlc_dirent) $(SOURCES_libvlc_getopt)
show-libvlc-headers: FORCE show-libvlc-headers: FORCE
@echo X: $(HEADERS_include) $(HEADERS_include_built) @echo X: $(HEADERS_include) $(HEADERS_include_built)
...@@ -328,9 +328,6 @@ endif ...@@ -328,9 +328,6 @@ endif
if BUILD_GETOPT if BUILD_GETOPT
OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt) OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
endif endif
if BUILD_LIBC
OPT_SOURCES_libvlc_libc = $(SOURCES_libvlc_libc)
endif
if BUILD_MOZILLA if BUILD_MOZILLA
LIBRARIES_libvlc_pic = lib/libvlc_pic.a LIBRARIES_libvlc_pic = lib/libvlc_pic.a
endif endif
...@@ -341,7 +338,6 @@ EXTRA_DIST += \ ...@@ -341,7 +338,6 @@ EXTRA_DIST += \
$(SOURCES_libvlc_win32) \ $(SOURCES_libvlc_win32) \
$(SOURCES_libvlc_dirent) \ $(SOURCES_libvlc_dirent) \
$(SOURCES_libvlc_getopt) \ $(SOURCES_libvlc_getopt) \
$(SOURCES_libvlc_libc) \
$(NULL) $(NULL)
SOURCES_libvlc_beos = \ SOURCES_libvlc_beos = \
...@@ -367,10 +363,6 @@ SOURCES_libvlc_getopt = \ ...@@ -367,10 +363,6 @@ SOURCES_libvlc_getopt = \
src/extras/getopt1.c \ src/extras/getopt1.c \
$(NULL) $(NULL)
SOURCES_libvlc_libc = \
src/extras/libc.c
$(NULL)
SOURCES_libvlc_common = \ SOURCES_libvlc_common = \
src/libvlc.c \ src/libvlc.c \
src/libvlc.h \ src/libvlc.h \
...@@ -411,6 +403,7 @@ SOURCES_libvlc_common = \ ...@@ -411,6 +403,7 @@ SOURCES_libvlc_common = \
src/misc/objects.c \ src/misc/objects.c \
src/misc/variables.c \ src/misc/variables.c \
src/misc/error.c \ src/misc/error.c \
src/extras/libc.c \
$(NULL) $(NULL)
SOURCES_libvlc = \ SOURCES_libvlc = \
...@@ -420,7 +413,6 @@ SOURCES_libvlc = \ ...@@ -420,7 +413,6 @@ SOURCES_libvlc = \
$(OPT_SOURCES_libvlc_win32) \ $(OPT_SOURCES_libvlc_win32) \
$(OPT_SOURCES_libvlc_dirent) \ $(OPT_SOURCES_libvlc_dirent) \
$(OPT_SOURCES_libvlc_getopt) \ $(OPT_SOURCES_libvlc_getopt) \
$(OPT_SOURCES_libvlc_libc) \
$(NULL) $(NULL)
############################################################################### ###############################################################################
......
...@@ -255,14 +255,9 @@ need_libc=false ...@@ -255,14 +255,9 @@ need_libc=false
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll getenv putenv setenv) AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll getenv putenv setenv)
dnl Check for usual libc functions dnl Check for usual libc functions
AC_CHECK_FUNCS(strdup,,[need_libc=:]) AC_CHECK_FUNCS(strdup strndup atof lseek)
AC_CHECK_FUNCS(strndup,,[need_libc=:]) AC_CHECK_FUNC(strcasecmp,,[AC_CHECK_FUNC(stricmp)])
AC_CHECK_FUNCS(atof,,[need_libc=:]) AC_CHECK_FUNC(strncasecmp,,[AC_CHECK_FUNC(strnicmp)])
AC_CHECK_FUNCS(lseek,,[need_libc=:])
AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp,,[need_libc=:])])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp,,[need_libc=:])])
AM_CONDITIONAL(BUILD_LIBC, ${need_libc})
AC_CHECK_FUNC(connect,,[ AC_CHECK_FUNC(connect,,[
AC_CHECK_LIB(socket,connect, AC_CHECK_LIB(socket,connect,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.45 2002/12/18 11:47:35 sam Exp $ * $Id: vlc_common.h,v 1.46 2002/12/27 15:31:55 sam Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -635,19 +635,21 @@ typedef __int64 off_t; ...@@ -635,19 +635,21 @@ typedef __int64 off_t;
/***************************************************************************** /*****************************************************************************
* I18n stuff * I18n stuff
*****************************************************************************/ *****************************************************************************/
#if defined( ENABLE_NLS ) \ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
&& ( defined(HAVE_GETTEXT) || defined(HAVE_INCLUDED_GETTEXT) )
#if defined( ENABLE_NLS ) && defined( HAVE_INCLUDED_GETTEXT )
# include "libintl.h"
# undef _
# define _(String) vlc_dgettext (PACKAGE, String)
# define N_(String) ((char*)(String))
#elif defined( ENABLE_NLS ) && defined( HAVE_GETTEXT )
# include <libintl.h> # include <libintl.h>
# undef _ # undef _
# define _(String) dgettext (PACKAGE, String) # define _(String) dgettext (PACKAGE, String)
# ifdef gettext_noop # define N_(String) ((char*)(String))
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#elif !defined( NEED_GNOMESUPPORT_H ) #elif !defined( NEED_GNOMESUPPORT_H )
# define _(String) (String) # define _(String) ((char*)(String))
# define N_(String) (String) # define N_(String) ((char*)(String))
#endif #endif
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libc.c: Extra libc function for some systems. * libc.c: Extra libc function for some systems.
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: libc.c,v 1.4 2002/11/20 08:58:24 sam Exp $ * $Id: libc.c,v 1.5 2002/12/27 15:31:56 sam Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
/***************************************************************************** /*****************************************************************************
* getenv: just in case, but it should never be called * getenv: just in case, but it should never be called
*****************************************************************************/ *****************************************************************************/
#ifndef HAVE_GETENV #if !defined( HAVE_GETENV )
char *vlc_getenv( const char *name ) char *vlc_getenv( const char *name )
{ {
return NULL; return NULL;
...@@ -39,7 +39,7 @@ char *vlc_getenv( const char *name ) ...@@ -39,7 +39,7 @@ char *vlc_getenv( const char *name )
/***************************************************************************** /*****************************************************************************
* strdup: returns a malloc'd copy of a string * strdup: returns a malloc'd copy of a string
*****************************************************************************/ *****************************************************************************/
#ifndef HAVE_STRDUP #if !defined( HAVE_STRDUP )
char *vlc_strdup( const char *string ) char *vlc_strdup( const char *string )
{ {
return strndup( string, strlen( string ) ); return strndup( string, strlen( string ) );
...@@ -50,7 +50,7 @@ char *vlc_strdup( const char *string ) ...@@ -50,7 +50,7 @@ char *vlc_strdup( const char *string )
* strndup: returns a malloc'd copy of at most n bytes of string * strndup: returns a malloc'd copy of at most n bytes of string
* Does anyone know whether or not it will be present in Jaguar? * Does anyone know whether or not it will be present in Jaguar?
*****************************************************************************/ *****************************************************************************/
#ifndef HAVE_STRNDUP #if !defined( HAVE_STRNDUP )
char *vlc_strndup( const char *string, size_t n ) char *vlc_strndup( const char *string, size_t n )
{ {
char *psz; char *psz;
...@@ -126,7 +126,7 @@ int vlc_strncasecmp( const char *s1, const char *s2, size_t n ) ...@@ -126,7 +126,7 @@ int vlc_strncasecmp( const char *s1, const char *s2, size_t n )
/***************************************************************************** /*****************************************************************************
* atof: convert a string to a double. * atof: convert a string to a double.
*****************************************************************************/ *****************************************************************************/
#ifndef HAVE_ATOF #if !defined( HAVE_ATOF )
double vlc_atof( const char *nptr ) double vlc_atof( const char *nptr )
{ {
double f_result; double f_result;
...@@ -154,3 +154,16 @@ off_t vlc_lseek( int fildes, off_t offset, int whence ) ...@@ -154,3 +154,16 @@ off_t vlc_lseek( int fildes, off_t offset, int whence )
} }
#endif #endif
/*****************************************************************************
* dgettext: gettext for plugins.
*****************************************************************************/
char *vlc_dgettext( const char *package, const char *msgid )
{
#if defined( ENABLE_NLS ) \
&& ( defined(HAVE_GETTEXT) || defined(HAVE_INCLUDED_GETTEXT) )
return dgettext( package, msgid );
#else
return (char *)msgid;
#endif
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment