* ./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.
This commit is contained in:
Sam Hocevar 2002-10-16 15:10:39 +00:00
parent 53cffc28bd
commit ec8c631800
5 changed files with 58 additions and 24 deletions

View File

@ -225,7 +225,7 @@ endif
# These dependencies are mandatory
$(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
@ -241,6 +241,17 @@ if BUILD_GETOPT
SOURCES_libgetopt = extras/GNUgetopt/getopt.c extras/GNUgetopt/getopt1.c
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
###############################################################################
@ -354,12 +365,13 @@ vlc_SOURCES = src/vlc.c $(SOURCES_libgetopt)
# @AUTOMAKE_SUCKS@ gets expanded to $(L_builtin) $(LDFLAGS_builtin)
# 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.
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)
# We use DEPENDENCIES_vlc instead of vlc_DEPENDENCIES because of an
# 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)
@rm -f vlc$(EXEEXT)
@ -459,3 +471,7 @@ libvlcdir = $(libdir)/vlc
include Modules.am
###############################################################################
# Force rule
###############################################################################
FORCE:

View File

@ -1,7 +1,7 @@
#! /bin/sh
## 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>
@ -169,26 +169,21 @@ echo "done."
###
set -x
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
if gettextize --version >/dev/null 2>&1
then
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
# We have gettext, and a recent version! Everything is cool.
autopoint --force || exit 1
autopoint || exit 1
GETTEXT=yes
else
# What?! User is not using a recent version of gettext? We'll have to
# 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!
# User's gettext is too old. try to continue anyway.
mkdir -p intl
test -f intl/Makefile.am || echo > intl/Makefile.am
# Yuck!
echo > intl/Makefile.am
echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
GETTEXT=old
fi;else

View File

@ -49,10 +49,17 @@ dnl Find the right ranlib, even when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(STRIP, strip, :)
dnl
dnl Gettext stuff
dnl
ALL_LINGUAS="de en_GB fr ja no ru nl pl se"
AM_GNU_GETTEXT_VERSION(0.10.40)
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
AC_PROG_INSTALL
@ -2262,6 +2269,7 @@ AC_SUBST(WINDRES)
AC_SUBST(BCBUILDER)
AC_SUBST(XPIDL)
AC_SUBST(LIBEXT)
AC_SUBST(INCLUDES)
AC_SUBST(CFLAGS_TUNING)
AC_SUBST(CFLAGS_OPTIM)

View 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.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>
* Vincent Seguin <seguin@via.ecp.fr>
@ -482,7 +482,8 @@ typedef __int64 off_t;
/*****************************************************************************
* 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>
# undef _
# define _(String) dgettext (PACKAGE, String)

View File

@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
@ -912,22 +912,36 @@ int VLC_FullScreen( int i_object )
*****************************************************************************/
static void SetLanguage ( char const *psz_lang )
{
#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
# if defined( HAVE_LOCALE_H ) && defined( HAVE_LC_MESSAGES )
if( !setlocale( LC_MESSAGES, psz_lang ) )
{
fprintf( stderr, "warning: unsupported locale settings\n" );
}
#if defined( ENABLE_NLS ) \
&& ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
setlocale( LC_CTYPE, psz_lang );
# if defined( HAVE_INCLUDED_GETTEXT ) && !defined( HAVE_LC_MESSAGES )
if( *psz_lang )
{
/* 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
# if defined( HAVE_LC_MESSAGES )
setlocale( LC_MESSAGES, psz_lang );
# endif
setlocale( LC_CTYPE, psz_lang );
/* Specify where to find the locales for current domain */
if( !bindtextdomain( PACKAGE, LOCALEDIR ) )
{
fprintf( stderr, "warning: no domain %s in directory %s\n",
PACKAGE, LOCALEDIR );
}
/* Set the default domain */
textdomain( PACKAGE );
#endif
}