diff --git a/Makefile.am b/Makefile.am index 78dfa42a91..07e4d1b1eb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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: diff --git a/bootstrap b/bootstrap index 09c99571fa..07cba450cf 100755 --- a/bootstrap +++ b/bootstrap @@ -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 @@ -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 diff --git a/configure.ac.in b/configure.ac.in index ac28d973f0..22b194821c 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -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) diff --git a/include/vlc_common.h b/include/vlc_common.h index c0f30fce56..3796830d76 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -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 * Vincent Seguin @@ -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 # undef _ # define _(String) dgettext (PACKAGE, String) diff --git a/src/libvlc.c b/src/libvlc.c index 30d5aae0f8..0aa7d72e98 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -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 * Samuel Hocevar @@ -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 }