FIX:build: Make --disable-nls and --with-included-gettext work.
authorzaxl <zaxl@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 31 Oct 2008 20:12:34 +0000 (20:12 +0000)
committerzaxl <zaxl@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 31 Oct 2008 20:12:34 +0000 (20:12 +0000)
Add navit_nls.h which defines gettext wrappers, please,
include navit_nls.h and do not include libintl.h directly.
Fix Makefiles.ams to pass make distcheck

git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@1624 ffa7fe5e-494d-0410-b361-a75ebd5db220

19 files changed:
Makefile.am
configure.in
navit/Makefile.am
navit/country.c
navit/gui/clutter/gui_clutter_main.c
navit/gui/directfb/gui_directfb.c
navit/gui/gtk/destination.c
navit/gui/gtk/gui_gtk_statusbar.c
navit/gui/gtk/gui_gtk_window.c
navit/gui/internal/gui_internal.c
navit/gui/win32/gui_win32.c
navit/main.c
navit/navigation.c
navit/navit.c
navit/navit_nls.h [new file with mode: 0644]
navit/popup.c
navit/start.c
navit/support/Makefile.am
navit/support/libc/Makefile.am

index 3a86bec..92f705f 100644 (file)
@@ -1,4 +1,10 @@
 include $(top_srcdir)/Makefile.inc
-SUBDIRS=intl navit po
+SUBDIRS=
+if ENABLE_NLS
+SUBDIRS+=intl po
+else
+SUBDIRS+=navit
+endif
 pkgdoc_DATA = README
 EXTRA_DIST = README COPYRIGHT
+DIST_SUBDIRS=intl po navit
index d17cb02..881eb0d 100644 (file)
@@ -541,9 +541,9 @@ MOFILES=""
 POFILES=""
 LINGUAS=""
 
-if test x$enable_nls = xyes; then
+if test "x$enable_nls" = "xyes"; then
 
-  AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
+  AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"] 
             AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
                         INTLIBS="" ))
 
@@ -573,6 +573,7 @@ if test x$enable_nls = xyes; then
    LINGUAS=""
    PO=""
    echo "xgettext and libintl.a don't both exist; will not build i18n support"
+   enable_nls = no
  fi
  for lang in $LINGUAS; do
     MOFILES="$MOFILES $lang.mo"
@@ -580,8 +581,16 @@ if test x$enable_nls = xyes; then
  for lang in $LINGUAS; do
     POFILES="$POFILES $lang.po"
  done
-fi
 
+AC_SUBST(INTLIBS)
+AC_SUBST(MOFILES)
+AC_SUBST(POFILES)
+AM_GNU_GETTEXT_VERSION
+AM_GNU_GETTEXT(no-libtool, need-ngettext)
+AC_SUBST(LIBINTL)
+AC_SUBST(LTLIBINTL)
+fi
+AM_CONDITIONAL(ENABLE_NLS, [test "x$enable_nls" = "xyes"])
 AC_CHECK_HEADER(
        byteswap.h,
        AC_DEFINE(
@@ -592,13 +601,10 @@ AC_CHECK_HEADER(
                ,
 )
 
-AC_SUBST(INTLIBS)
-AC_SUBST(MOFILES)
-AC_SUBST(POFILES)
-AM_GNU_GETTEXT_VERSION
-AM_GNU_GETTEXT
-
-LIBS="$LIBS -lm -rdynamic"
+LIBS="$LIBS -lm"
+if test "$win32" == "no"; then
+       LIBS="$LIBS -rdynamic"
+fi
 
 PACKAGE=navit
 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
@@ -701,8 +707,8 @@ AC_SUBST(GYPSY_CFLAGS)
 AC_SUBST(GYPSY_LIBS)
 AM_CONDITIONAL(VEHICLE_GYPSY, test "x${vehicle_gypsy}" = "xyes")
 
-NAVIT_CFLAGS="$NAVIT_CFLAGS $GLIB_CFLAGS $GMODULE_CFLAGS -I\$(top_builddir)/intl"
-NAVIT_LIBS="$NAVIT_LIBS $GLIB_LIBS $GMODULE_LIBS -L\$(top_builddir)/intl"
+NAVIT_CFLAGS="$NAVIT_CFLAGS $GLIB_CFLAGS $GMODULE_CFLAGS"
+NAVIT_LIBS="$NAVIT_LIBS $GLIB_LIBS $GMODULE_LIBS $LIBINTL"
 AC_SUBST(NAVIT_CFLAGS)
 AC_SUBST(NAVIT_LIBS)
 
@@ -826,9 +832,16 @@ if test x"${USE_GARMIN}" = xyes
        else 
                echo "Garmin IMG  : DISABLED (you requested it)"
 fi
+
+if test x"$LIBINTL" = "x" ;then
+       nls_libs="system gettext support"
+else
+       nls_libs="$LIBINTL"
+fi
 echo "Plugins:             $plugins ($plugins_reason)"
 echo "Postgresql:          $postgresql ($postgresql_reason)"
 echo "Samplemap:           $samplemap ($samplemap_reason)"
+echo "NLS Support:         $enable_nls($nls_libs)"
 echo "Graphics types:"
 echo "  gtk_drawing_area:  $graphics_gtk_drawing_area ($graphics_gtk_drawing_area_reason)"
 echo "  qt_qpainter:       $graphics_qt_qpainter ($graphics_qt_qpainter_reason)"
index 5db02dc..616d339 100644 (file)
@@ -27,7 +27,8 @@ libnavit_la_SOURCES = attr.c cache.c callback.c compass.c coord.c country.c curs
        file.h graphics.h gtkext.h gui.h item.h item_def.h keys.h log.h layer.h layout.h main.h map-share.h map.h\
        map_data.h mapset.h maptype.h menu.h navigation.h navit.h osd.h \
        param.h phrase.h plugin.h point.h plugin_def.h projection.h popup.h route.h profile.h search.h speech.h \
-       transform.h track.h util.h vehicle.h window.h xmlconfig.h zipfile.h
+       transform.h track.h util.h vehicle.h window.h xmlconfig.h zipfile.h \
+       navit_nls.h
 
 navit_SOURCES = start.c
 navit_LDADD = libnavit.la @NAVIT_LIBS@ @ZLIB_LIBS@ @INTLLIBS@ -Lfib-1.1 -lfib
index 97cdb97..729349e 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <glib.h>
-#include <libintl.h>
 #include "debug.h"
 #include "item.h"
 #include "country.h"
 #include "search.h"
+#include "navit_nls.h"
 
 struct country {
        int id;
@@ -35,10 +35,6 @@ struct country {
        char *name;
 };
 
-#define gettext_noop(String) String
-#define _(STRING)    gettext(STRING)
-#define _n(STRING)    gettext_noop(STRING)
-
 static struct country country[]= {
   { 20,        "AND",  "AD", "AND", /* 020 */ _n("Andorra")},
   {784,        "UAE",  "AE", "ARE", /* 784 */ _n("United Arab Emirates")},
index 7b7baea..4b60d1a 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "glib.h"
 #include <stdio.h>
-#include <libintl.h>
 
 #include "navit.h"
 #include "config.h"
@@ -47,6 +46,7 @@
 #include "track.h"
 #include "menu.h"
 #include "map.h"
+#include "navit_nls.h"
 
 // Specific to this gui :
 #include "gui_clutter.h"
index 2f986a2..7c29abd 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "glib.h"
 #include <stdio.h>
-#include <libintl.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -46,7 +45,7 @@
 #include "track.h"
 #include "menu.h"
 #include "map.h"
-
+#include "navit_nls.h"
 
 #include <directfb.h>
 
index 02face3..ca3b0e7 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <libintl.h>
 #include <gtk/gtk.h>
 #include "debug.h"
 #include "destination.h"
 #include "country.h"
 #include "search.h"
 #include "projection.h"
+#include "navit_nls.h"
 
 #define COL_COUNT 8
 
-#define gettext_noop(String) String
-#define _(STRING)    gettext(STRING)
-#define _n(STRING)    gettext_noop(STRING)
-
 static struct search_param {
        struct navit *nav;
        struct mapset *ms;
index c8269a5..e80e19b 100644 (file)
@@ -22,7 +22,6 @@
 #include <time.h>
 #include <math.h>
 #include <gtk/gtk.h>
-#include <libintl.h>
 #include "item.h"
 #include "coord.h"
 #include "debug.h"
@@ -34,9 +33,7 @@
 #include "map.h"
 #include "navigation.h"
 #include "gui_gtk.h"
-
-
-#define _(STRING) gettext(STRING)
+#include "navit_nls.h"
 
 struct statusbar_priv {
        struct gui_priv *gui;
index 1186939..488c11a 100644 (file)
@@ -24,7 +24,6 @@
 #if !defined(GDK_Book) || !defined(GDK_Calendar)
 #include <X11/XF86keysym.h>
 #endif
-#include <libintl.h>
 #include <gtk/gtk.h>
 #include "config.h"
 #include "item.h"
@@ -43,6 +42,7 @@
 #include "vehicle.h"
 #include "map.h"
 #include "coord.h"
+#include "navit_nls.h"
 
 #ifdef USE_HILDON
 #include "hildon-widgets/hildon-defines.h"
@@ -67,8 +67,6 @@
 #define KEY_RIGHT GDK_Right
 #endif
 
-#define _(text) gettext(text)
-
 static gboolean
 keypress(GtkWidget *widget, GdkEventKey *event, struct gui_priv *this)
 {
index 6ac3115..f54ec3c 100644 (file)
@@ -31,7 +31,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <math.h>
-#include <libintl.h>
 #include <glib.h>
 #include "config.h"
 #include "item.h"
@@ -58,6 +57,7 @@
 #include "track.h"
 #include "country.h"
 #include "config.h"
+#include "navit_nls.h"
 
 #define STATE_VISIBLE 1
 #define STATE_SELECTED 2
index 6d6d0c0..bbe506e 100644 (file)
@@ -2,7 +2,6 @@
 #include <process.h>
 #include <windows.h>
 #include <glib.h>
-#include <libintl.h>
 #include "config.h"
 #include "plugin.h"
 #include "gui.h"
@@ -14,6 +13,7 @@
 #include "callback.h"
 #include <commctrl.h>
 #include "debug.h"
+#include "navit_nls.h"
 #ifdef __CEGCC__
 #include <sipapi.h>
 #include <aygshell.h>
index 1b65c71..6e91fb1 100644 (file)
@@ -32,7 +32,6 @@
 #endif
 
 #include <unistd.h>
-#include <libintl.h>
 #include "config.h"
 #include "file.h"
 #include "debug.h"
@@ -45,8 +44,7 @@
 #include "route.h"
 #include "navigation.h"
 #include "event.h"
-
-#define _(STRING)    gettext(STRING)
+#include "navit_nls.h"
 
 struct map_data *map_data_default;
 
index b705ac3..82fb307 100644 (file)
@@ -22,7 +22,6 @@
 #include <string.h>
 #include <math.h>
 #include <glib.h>
-#include <libintl.h>
 #include "debug.h"
 #include "profile.h"
 #include "navigation.h"
@@ -36,8 +35,7 @@
 #include "navit.h"
 #include "callback.h"
 #include "plugin.h"
-
-#define _(STRING)    gettext(STRING)
+#include "navit_nls.h"
 
 struct suffix {
        char *fullname;
index cebc206..de75062 100644 (file)
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <glib.h>
-#include <libintl.h>
 #include <math.h>
 #include "config.h"
 #include "debug.h"
@@ -54,8 +53,8 @@
 #include "layout.h"
 #include "log.h"
 #include "attr.h"
+#include "navit_nls.h"
 
-#define _(STRING)    gettext(STRING)
 /**
  * @defgroup navit the navit core instance. navit is the object containing nearly everything: A set of maps, one or more vehicle, a graphics object for rendering the map, a gui object for displaying the user interface, a route object, a navigation object and so on. Be warned that it is theoretically possible to have more than one navit object
  * @{
diff --git a/navit/navit_nls.h b/navit/navit_nls.h
new file mode 100644 (file)
index 0000000..d6ac7fe
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef __NAVIT_NLS_H__
+#include "config.h"
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(STRING)    gettext(STRING)
+#define gettext_noop(String) String
+#define _n(STRING)    gettext_noop(STRING)
+#else
+#define _(STRING) STRING
+#define _n(STRING) STRING
+#define gettext(STRING) STRING
+static inline const char *ngettext(const char *msgid, const char *msgid_plural, unsigned long int n)
+{
+       if (n == 1) {
+               return msgid;
+       } else {
+               return msgid_plural;
+       }
+}
+#endif
+#define __NAVIT_NLS_H__
+#endif
index 444b5df..9ba1812 100644 (file)
@@ -22,7 +22,6 @@
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <libintl.h>
 #include <glib.h>
 #include "popup.h"
 #include "debug.h"
@@ -38,8 +37,8 @@
 #include "item.h"
 #include "callback.h"
 #include "route.h"
+#include "navit_nls.h"
 
-#define _(STRING)      gettext(STRING)
 #if 0
 static void
 popup_set_no_passing(struct popup_item *item, void *param)
index b0baf9d..0a46edd 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <glib.h>
 #include <getopt.h>
-#include <libintl.h>
 #include "config.h"
 #include "version.h"
 #include "item.h"
@@ -36,8 +35,8 @@
 #include "xmlconfig.h"
 #include "file.h"
 #include "search.h"
+#include "navit_nls.h"
 
-#define _(STRING)    gettext(STRING)
 
 static void
 print_usage(void)
index 188cf11..8a488cd 100644 (file)
@@ -14,3 +14,7 @@ endif
 if SUPPORT_ZLIB
   SUBDIRS+=zlib
 endif
+if SUPPORT_LIBC
+ SUBDIRS+=libc
+endif
+DIST_SUBDIRS=ezxml glib wordexp win32 zlib libc
index 9811dac..fd98ea7 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
 AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=support_libc
 noinst_LTLIBRARIES = libsupport_libc.la
-libsupport_libc_la_SOURCES = libc.c libc_init.c libc.h
+libsupport_libc_la_SOURCES = libc.c libc_init.c