]> git.sesse.net Git - vlc/commitdiff
* ./src/extras/libc.c: if configure is called with --with-included-gettext,
authorSam Hocevar <sam@videolan.org>
Fri, 27 Dec 2002 15:31:56 +0000 (15:31 +0000)
committerSam Hocevar <sam@videolan.org>
Fri, 27 Dec 2002 15:31:56 +0000 (15:31 +0000)
    we export vlc_dgettext to plugins so that their messages can be translated
    as well.

Makefile.am
configure.ac.in
include/vlc_common.h
src/extras/libc.c

index 506884d1646afbc8c9a0aaf05cb20f5d209c959e..46e8da86f982bca400e5fba68f6705a2e77ed53c 100644 (file)
@@ -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)
 
 ###############################################################################
index 580cf8eb7722169e161a1591c222dd3c369bb00a..17715a250d154d0aa2f3cd9e288966d8ec959de0 100644 (file)
@@ -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,
index b869a8638bf105ce87ee49c4e06c29e995db9c17..e431f660781818d992d196fdfb335ca8f9f6588b 100644 (file)
@@ -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
 
 /*****************************************************************************
index b78c775dc0c36a7b7621502f874e070065c59ff2..b7858b026f054a9e51567e63acfe0c116e7c1453 100644 (file)
@@ -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
+}
+