]> git.sesse.net Git - vlc/commitdiff
* ./configure.ac.in, ./src/libvlc.c: attempt at activating gettext support
authorSam Hocevar <sam@videolan.org>
Wed, 16 Oct 2002 15:10:39 +0000 (15:10 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 16 Oct 2002 15:10:39 +0000 (15:10 +0000)
    under platforms without libintl such as Win32. Use --with-included-gettext
    to test. Might break compilation on systems I don't have access to.

Makefile.am
bootstrap
configure.ac.in
include/vlc_common.h
src/libvlc.c

index 78dfa42a919df9ddb2ddd54bee4fc42c825c58c4..07e4d1b1ebb4b985c7bcb5a2add50a0aeb34327a 100644 (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:
index 09c99571fa396e4137883cb15eb7880e4bccf220..07cba450cff3fe85a92c27067fb7b739d8c8a697 100755 (executable)
--- 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 <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
index ac28d973f09b691c4b28b8d7b85f0bffd3c239d0..22b194821c31891917bc67062071b498a88f9f56 100644 (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)
index c0f30fce5636a7f2e4fc40e2ae87fbe3809eae7a..3796830d76a9cf731df361e62c54e4b16fcbd92e 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.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)
index 30d5aae0f818fa4713ae16b3fe9b827a4178c7b2..0aa7d72e98d7d266d26c41a2d1bff6fb0d4cc250 100644 (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 ) )
+#if defined( ENABLE_NLS ) \
+     && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
+
+#   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
+    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
 }