Commit ec8c6318 authored by Sam Hocevar's avatar Sam Hocevar

* ./configure.ac.in, ./src/libvlc.c: attempt at activating gettext support

    under platforms without libintl such as Win32. Use --with-included-gettext
    to test. Might break compilation on systems I don't have access to.
parent 53cffc28
...@@ -225,7 +225,7 @@ endif ...@@ -225,7 +225,7 @@ endif
# These dependencies are mandatory # These dependencies are mandatory
$(SOURCES): include/vlc_symbols.h $(SOURCES): include/vlc_symbols.h
$(SOURCES_libvlc): src/misc/modules_plugin.h src/misc/modules_builtin.h $(SOURCES_libvlc): src/misc/modules_plugin.h src/misc/modules_builtin.h $(LIB_intl)
############################################################################### ###############################################################################
# Optional getopt # Optional getopt
...@@ -241,6 +241,17 @@ if BUILD_GETOPT ...@@ -241,6 +241,17 @@ if BUILD_GETOPT
SOURCES_libgetopt = extras/GNUgetopt/getopt.c extras/GNUgetopt/getopt1.c SOURCES_libgetopt = extras/GNUgetopt/getopt.c extras/GNUgetopt/getopt1.c
endif endif
###############################################################################
# Optional libintl - FIXME, bad dependencies
###############################################################################
intl/libintl.a: FORCE
cd intl && $(MAKE)
if BUILD_INTL
LIB_intl = intl/libintl.a
endif
############################################################################### ###############################################################################
# MacOS X project # MacOS X project
############################################################################### ###############################################################################
...@@ -354,12 +365,13 @@ vlc_SOURCES = src/vlc.c $(SOURCES_libgetopt) ...@@ -354,12 +365,13 @@ vlc_SOURCES = src/vlc.c $(SOURCES_libgetopt)
# @AUTOMAKE_SUCKS@ gets expanded to $(L_builtin) $(LDFLAGS_builtin) # @AUTOMAKE_SUCKS@ gets expanded to $(L_builtin) $(LDFLAGS_builtin)
# but we don't write it directly, otherwise automake will go amok and eat all # but we don't write it directly, otherwise automake will go amok and eat all
# the memory because of its 2^N crap algorithm. So we fool him. Nuahaha. # the memory because of its 2^N crap algorithm. So we fool him. Nuahaha.
vlc_LDADD = lib/libvlc.a $(LDFLAGS_vlc) $(DATA_win32_rc) @AUTOMAKE_SUCKS@ vlc_LDADD = lib/libvlc.a $(LDFLAGS_vlc) \
$(DATA_win32_rc) $(LIB_intl) @AUTOMAKE_SUCKS@
vlc_CFLAGS = $(CPPFLAGS_default) $(CFLAGS_default) vlc_CFLAGS = $(CPPFLAGS_default) $(CFLAGS_default)
# We use DEPENDENCIES_vlc instead of vlc_DEPENDENCIES because of an # We use DEPENDENCIES_vlc instead of vlc_DEPENDENCIES because of an
# old automake-1.5 bug (automake/279). # old automake-1.5 bug (automake/279).
DEPENDENCIES_vlc = lib/libvlc.a $(L_builtin) $(DATA_win32_rc) DEPENDENCIES_vlc = lib/libvlc.a $(L_builtin) $(DATA_win32_rc) $(LIB_intl)
vlc$(EXEEXT): $(vlc_OBJECTS) $(DEPENDENCIES_vlc) vlc$(EXEEXT): $(vlc_OBJECTS) $(DEPENDENCIES_vlc)
@rm -f vlc$(EXEEXT) @rm -f vlc$(EXEEXT)
...@@ -459,3 +471,7 @@ libvlcdir = $(libdir)/vlc ...@@ -459,3 +471,7 @@ libvlcdir = $(libdir)/vlc
include Modules.am include Modules.am
###############################################################################
# Force rule
###############################################################################
FORCE:
#! /bin/sh #! /bin/sh
## bootstrap file for vlc, the VideoLAN Client ## bootstrap file for vlc, the VideoLAN Client
## $Id: bootstrap,v 1.18 2002/10/04 13:13:54 sam Exp $ ## $Id: bootstrap,v 1.19 2002/10/16 15:10:38 sam Exp $
## ##
## Authors: Samuel Hocevar <sam@zoy.org> ## Authors: Samuel Hocevar <sam@zoy.org>
...@@ -169,26 +169,21 @@ echo "done." ...@@ -169,26 +169,21 @@ echo "done."
### ###
set -x set -x
rm -f aclocal.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh rm -f aclocal.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
rm -Rf intl
# Check for gettext # Check for gettext
if gettextize --version >/dev/null 2>&1 if gettextize --version >/dev/null 2>&1
then then
if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \ if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
'>' 0.11.3 >/dev/null 2>&1 '>' 0.11.2 >/dev/null 2>&1
then then
# We have gettext, and a recent version! Everything is cool. # We have gettext, and a recent version! Everything is cool.
autopoint --force || exit 1 autopoint || exit 1
GETTEXT=yes GETTEXT=yes
else else
# What?! User is not using a recent version of gettext? We'll have to # User's gettext is too old. try to continue anyway.
# cheat a bit, then.
rm -f po/ChangeLog~
gettextize --copy --force | grep '^from the' | cut -f3 -d' '
test -f po/ChangeLog~ && mv -f po/ChangeLog~ po/ChangeLog
# Yuck!
mkdir -p intl mkdir -p intl
test -f intl/Makefile.am || echo > intl/Makefile.am echo > intl/Makefile.am
# Yuck!
echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
GETTEXT=old GETTEXT=old
fi;else fi;else
......
...@@ -49,10 +49,17 @@ dnl Find the right ranlib, even when cross-compiling ...@@ -49,10 +49,17 @@ dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :) AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(STRIP, strip, :) AC_CHECK_TOOL(STRIP, strip, :)
dnl
dnl Gettext stuff dnl Gettext stuff
dnl
ALL_LINGUAS="de en_GB fr ja no ru nl pl se" ALL_LINGUAS="de en_GB fr ja no ru nl pl se"
AM_GNU_GETTEXT_VERSION(0.10.40) AM_GNU_GETTEXT_VERSION(0.10.40)
AM_GNU_GETTEXT AM_GNU_GETTEXT
if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
AC_DEFINE(HAVE_INCLUDED_GETTEXT, 1, Define if we use the local libintl)
INCLUDES="${INCLUDES} -I\\\$(top_srcdir)/intl"
fi
AM_CONDITIONAL(BUILD_INTL, test "${nls_cv_force_use_gnu_gettext}" = "yes")
dnl AM_PROG_LIBTOOL dnl AM_PROG_LIBTOOL
AC_PROG_INSTALL AC_PROG_INSTALL
...@@ -2262,6 +2269,7 @@ AC_SUBST(WINDRES) ...@@ -2262,6 +2269,7 @@ AC_SUBST(WINDRES)
AC_SUBST(BCBUILDER) AC_SUBST(BCBUILDER)
AC_SUBST(XPIDL) AC_SUBST(XPIDL)
AC_SUBST(LIBEXT) AC_SUBST(LIBEXT)
AC_SUBST(INCLUDES)
AC_SUBST(CFLAGS_TUNING) AC_SUBST(CFLAGS_TUNING)
AC_SUBST(CFLAGS_OPTIM) AC_SUBST(CFLAGS_OPTIM)
......
...@@ -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.29 2002/10/11 22:32:55 sam Exp $ * $Id: vlc_common.h,v 1.30 2002/10/16 15:10:39 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>
...@@ -482,7 +482,8 @@ typedef __int64 off_t; ...@@ -482,7 +482,8 @@ typedef __int64 off_t;
/***************************************************************************** /*****************************************************************************
* I18n stuff * I18n stuff
*****************************************************************************/ *****************************************************************************/
#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT ) && !defined( __BORLANDC__ ) && !defined( NEED_GNOMESUPPORT_H ) #if defined( ENABLE_NLS ) \
&& ( defined(HAVE_GETTEXT) || defined(HAVE_INCLUDED_GETTEXT) )
# include <libintl.h> # include <libintl.h>
# undef _ # undef _
# define _(String) dgettext (PACKAGE, String) # define _(String) dgettext (PACKAGE, String)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source * libvlc.c: main libvlc source
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.41 2002/10/15 12:30:00 sam Exp $ * $Id: libvlc.c,v 1.42 2002/10/16 15:10:39 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -912,22 +912,36 @@ int VLC_FullScreen( int i_object ) ...@@ -912,22 +912,36 @@ int VLC_FullScreen( int i_object )
*****************************************************************************/ *****************************************************************************/
static void SetLanguage ( char const *psz_lang ) static void SetLanguage ( char const *psz_lang )
{ {
#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT ) #if defined( ENABLE_NLS ) \
# if defined( HAVE_LOCALE_H ) && defined( HAVE_LC_MESSAGES ) && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
if( !setlocale( LC_MESSAGES, psz_lang ) )
# if defined( HAVE_INCLUDED_GETTEXT ) && !defined( HAVE_LC_MESSAGES )
if( *psz_lang )
{ {
fprintf( stderr, "warning: unsupported locale settings\n" ); /* We set LC_ALL manually because it is the only way to set
* the language at runtime under eg. Windows. Beware that this
* makes the environment unconsistent when libvlc is unloaded and
* should probably be moved to a safer place like vlc.c. */
static char psz_lcall[20];
snprintf( psz_lcall, 19, "LC_ALL=%s", psz_lang );
psz_lcall[19] = '\0';
putenv( psz_lcall );
} }
# endif
setlocale( LC_CTYPE, psz_lang ); # if defined( HAVE_LC_MESSAGES )
setlocale( LC_MESSAGES, psz_lang );
# endif # endif
setlocale( LC_CTYPE, psz_lang );
/* Specify where to find the locales for current domain */
if( !bindtextdomain( PACKAGE, LOCALEDIR ) ) if( !bindtextdomain( PACKAGE, LOCALEDIR ) )
{ {
fprintf( stderr, "warning: no domain %s in directory %s\n", fprintf( stderr, "warning: no domain %s in directory %s\n",
PACKAGE, LOCALEDIR ); PACKAGE, LOCALEDIR );
} }
/* Set the default domain */
textdomain( PACKAGE ); textdomain( PACKAGE );
#endif #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