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 += \
$(NULL)
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
@echo X: $(HEADERS_include) $(HEADERS_include_built)
......@@ -328,9 +328,6 @@ endif
if BUILD_GETOPT
OPT_SOURCES_libvlc_getopt = $(SOURCES_libvlc_getopt)
endif
if BUILD_LIBC
OPT_SOURCES_libvlc_libc = $(SOURCES_libvlc_libc)
endif
if BUILD_MOZILLA
LIBRARIES_libvlc_pic = lib/libvlc_pic.a
endif
......@@ -341,7 +338,6 @@ EXTRA_DIST += \
$(SOURCES_libvlc_win32) \
$(SOURCES_libvlc_dirent) \
$(SOURCES_libvlc_getopt) \
$(SOURCES_libvlc_libc) \
$(NULL)
SOURCES_libvlc_beos = \
......@@ -367,10 +363,6 @@ SOURCES_libvlc_getopt = \
src/extras/getopt1.c \
$(NULL)
SOURCES_libvlc_libc = \
src/extras/libc.c
$(NULL)
SOURCES_libvlc_common = \
src/libvlc.c \
src/libvlc.h \
......@@ -411,6 +403,7 @@ SOURCES_libvlc_common = \
src/misc/objects.c \
src/misc/variables.c \
src/misc/error.c \
src/extras/libc.c \
$(NULL)
SOURCES_libvlc = \
......@@ -420,7 +413,6 @@ SOURCES_libvlc = \
$(OPT_SOURCES_libvlc_win32) \
$(OPT_SOURCES_libvlc_dirent) \
$(OPT_SOURCES_libvlc_getopt) \
$(OPT_SOURCES_libvlc_libc) \
$(NULL)
###############################################################################
......
......@@ -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)
dnl Check for usual libc functions
AC_CHECK_FUNCS(strdup,,[need_libc=:])
AC_CHECK_FUNCS(strndup,,[need_libc=:])
AC_CHECK_FUNCS(atof,,[need_libc=:])
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_FUNCS(strdup strndup atof lseek)
AC_CHECK_FUNC(strcasecmp,,[AC_CHECK_FUNC(stricmp)])
AC_CHECK_FUNC(strncasecmp,,[AC_CHECK_FUNC(strnicmp)])
AC_CHECK_FUNC(connect,,[
AC_CHECK_LIB(socket,connect,
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* 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>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -635,19 +635,21 @@ typedef __int64 off_t;
/*****************************************************************************
* I18n stuff
*****************************************************************************/
#if defined( ENABLE_NLS ) \
&& ( defined(HAVE_GETTEXT) || defined(HAVE_INCLUDED_GETTEXT) )
VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
#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>
# undef _
# define _(String) dgettext (PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
# define N_(String) ((char*)(String))
#elif !defined( NEED_GNOMESUPPORT_H )
# define _(String) (String)
# define N_(String) (String)
# define _(String) ((char*)(String))
# define N_(String) ((char*)(String))
#endif
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* libc.c: Extra libc function for some systems.
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -11,7 +11,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -29,7 +29,7 @@
/*****************************************************************************
* getenv: just in case, but it should never be called
*****************************************************************************/
#ifndef HAVE_GETENV
#if !defined( HAVE_GETENV )
char *vlc_getenv( const char *name )
{
return NULL;
......@@ -37,9 +37,9 @@ char *vlc_getenv( const char *name )
#endif
/*****************************************************************************
* 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 )
{
return strndup( string, strlen( string ) );
......@@ -47,16 +47,16 @@ char *vlc_strdup( const char *string )
#endif
/*****************************************************************************
* 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?
*****************************************************************************/
#ifndef HAVE_STRNDUP
#if !defined( HAVE_STRNDUP )
char *vlc_strndup( const char *string, size_t n )
{
char *psz;
size_t len = strlen( string );
len = __MIN( len, n );
len = __MIN( len, n );
psz = (char*)malloc( len + 1 );
if( psz != NULL )
......@@ -126,13 +126,13 @@ int vlc_strncasecmp( const char *s1, const char *s2, size_t n )
/*****************************************************************************
* atof: convert a string to a double.
*****************************************************************************/
#ifndef HAVE_ATOF
#if !defined( HAVE_ATOF )
double vlc_atof( const char *nptr )
{
{
double f_result;
wchar_t *psz_tmp;
int i_len = strlen( nptr ) + 1;
psz_tmp = malloc( i_len * sizeof(wchar_t) );
MultiByteToWideChar( CP_ACP, 0, nptr, -1, psz_tmp, i_len );
f_result = wcstod( psz_tmp, NULL );
......@@ -154,3 +154,16 @@ off_t vlc_lseek( int fildes, off_t offset, int whence )
}
#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