Add:Core:Added libc stubs for devices which don't have a libc
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Wed, 29 Oct 2008 11:50:13 +0000 (11:50 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Wed, 29 Oct 2008 11:50:13 +0000 (11:50 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1610 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/configure.in
navit/navit/support/libc/Makefile.am [new file with mode: 0644]
navit/navit/support/libc/errno.h [new file with mode: 0644]
navit/navit/support/libc/libc.c [new file with mode: 0644]
navit/navit/support/libc/libc_init.c [new file with mode: 0644]
navit/navit/support/libc/locale.h [new file with mode: 0644]
navit/navit/support/libc/signal.h [new file with mode: 0644]

index 9a06205..484f660 100644 (file)
@@ -621,6 +621,12 @@ then
        NAVIT_LIBS="$NAVIT_LIBS -L\$(top_builddir)/navit/support/win32 -lsupport_win32"
 fi
 AM_CONDITIONAL(SUPPORT_WIN32, [test "x$win32" = "xyes"])
+support_libc=no
+AC_ARG_ENABLE(support_libc, [  --enable-support-libc enable builtin mini libc ], support_libc=$enableval)
+AM_CONDITIONAL(SUPPORT_LIBC, [test "x$support_libc" = "xyes"])
+if test "x$support_libc" = "xyes"; then
+       CFLAGS="$CFLAGS -I\$(top_srcdir)/navit/support/libc"
+fi
 
 ## graphics
 # gtk_drawing_area
@@ -737,6 +743,7 @@ navit/speech/speech_dispatcher/Makefile
 navit/support/Makefile
 navit/support/ezxml/Makefile
 navit/support/glib/Makefile
+navit/support/libc/Makefile
 navit/support/win32/Makefile
 navit/support/wordexp/Makefile
 navit/support/zlib/Makefile
diff --git a/navit/navit/support/libc/Makefile.am b/navit/navit/support/libc/Makefile.am
new file mode 100644 (file)
index 0000000..9811dac
--- /dev/null
@@ -0,0 +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
diff --git a/navit/navit/support/libc/errno.h b/navit/navit/support/libc/errno.h
new file mode 100644 (file)
index 0000000..5ef0a7b
--- /dev/null
@@ -0,0 +1,4 @@
+extern int errno;
+#define ENOMEM 12
+#define EINVAL 22
+#define ERANGE 34 
diff --git a/navit/navit/support/libc/libc.c b/navit/navit/support/libc/libc.c
new file mode 100644 (file)
index 0000000..ca75cdc
--- /dev/null
@@ -0,0 +1,82 @@
+#include "locale.h"
+int errno;
+
+char *
+getenv(char *name)
+{
+       return 0;
+}
+
+void
+setenv(void)
+{
+}
+
+char *
+getcwd(void)
+{
+       return "dummy";
+}
+
+char *
+getwd(void)
+{
+       return "dummy";
+}
+
+char *strtok_r(char *str, const char *delim, char **saveptr)
+{
+       return strtok(str, delim);
+}
+
+void
+perror(char *x)
+{
+}
+
+void
+raise(void)
+{
+}
+
+void *
+popen(void)
+{
+       return 0;
+}
+
+void
+pclose(void)
+{
+}
+
+void
+rewind(void)
+{
+}
+
+int
+GetThreadLocale(void)
+{
+       return 0;
+}
+
+int
+signal(void)
+{
+       return 0;
+}
+
+void
+setlocale(void)
+{
+       return 0;
+}
+
+static struct lconv localedata={"."};
+
+struct lconv *
+localeconv(void)
+{
+       return &localedata;
+}
diff --git a/navit/navit/support/libc/libc_init.c b/navit/navit/support/libc/libc_init.c
new file mode 100644 (file)
index 0000000..32be387
--- /dev/null
@@ -0,0 +1,6 @@
+#include "plugin.h"
+
+void
+plugin_init(void)
+{
+}
diff --git a/navit/navit/support/libc/locale.h b/navit/navit/support/libc/locale.h
new file mode 100644 (file)
index 0000000..fad4f95
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef _LOCALE_H
+#define _LOCALE_H       1
+#define SUBLANG_BENGALI_BANGLADESH 0x02
+#define SUBLANG_PUNJABI_PAKISTAN 0x02
+#define SUBLANG_ROMANIAN_MOLDOVA 0x02
+struct lconv {
+       char *decimal_point;
+};
+
+#define LC_ALL 1
+#define LC_NUMERIC 2
+#endif
diff --git a/navit/navit/support/libc/signal.h b/navit/navit/support/libc/signal.h
new file mode 100644 (file)
index 0000000..18b6539
--- /dev/null
@@ -0,0 +1,2 @@
+#define SIGFPE 8
+#define SIGSEGV 11