Index: configure.ac
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/configure.ac,v
retrieving revision 1.22
diff -u -r1.22 configure.ac
--- configure.ac	3 Jan 2005 20:24:21 -0000	1.22
+++ configure.ac	11 Feb 2005 11:08:09 -0000
@@ -171,6 +171,12 @@
 esac
 
 dnl ---------------------------------------------
+dnl enable builtin libdvdread
+dnl ---------------------------------------------
+AC_ARG_ENABLE(builtin-dvdread,
+[  --disable-builtin-dvdread       use external libdvdread (default builtin)])
+
+dnl ---------------------------------------------
 dnl cflags
 dnl ---------------------------------------------
 dnl Common cflags for all platforms
@@ -218,13 +224,20 @@
 fi
 AC_SUBST(DEPCOMP)
 
+if test "${enable_builtin_dvdread}" != "no"; then
+  BUILTIN_DVDREAD=dvdread
+  BUILTIN_DVDREAD_LIB='$(top_builddir)/src/dvdread/libdvdread.la'
+  AC_SUBST(BUILTIN_DVDREAD)
+  AC_SUBST(BUILTIN_DVDREAD_LIB)
+  AC_OUTPUT([src/dvdread/Makefile])
+fi
+
 dnl ---------------------------------------------
 dnl Output configuration files
 dnl ---------------------------------------------
 AC_OUTPUT([
 Makefile 
 src/Makefile
-src/dvdread/Makefile
 src/vm/Makefile
 misc/Makefile
 misc/dvdnav-config
Index: src/Makefile.am
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/Makefile.am,v
retrieving revision 1.28
diff -u -r1.28 Makefile.am
--- src/Makefile.am	3 Jan 2005 20:24:21 -0000	1.28
+++ src/Makefile.am	11 Feb 2005 11:08:09 -0000
@@ -1,6 +1,6 @@
 include $(top_srcdir)/misc/Makefile.common
 
-SUBDIRS = dvdread vm
+SUBDIRS = $(BUILTIN_DVDREAD) vm
 
 includedir = ${prefix}/include/dvdnav
 
@@ -17,7 +17,7 @@
 	dvdnav_internal.h read_cache.h remap.h
 
 libdvdnav_la_LIBADD = $(THREAD_LIBS) \
-	$(top_builddir)/src/dvdread/libdvdread.la \
+	$(BUILTIN_DVDREAD_LIB) \
 	$(top_builddir)/src/vm/libdvdvm.la
 
 libdvdnav_la_LDFLAGS = \
Index: src/dvdnav.c
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/dvdnav.c,v
retrieving revision 1.65
diff -u -r1.65 dvdnav.c
--- src/dvdnav.c	15 Dec 2004 21:16:58 -0000	1.65
+++ src/dvdnav.c	11 Feb 2005 11:08:09 -0000
@@ -31,7 +31,6 @@
 
 #include "dvdnav_internal.h"
 #include "read_cache.h"
-#include "nav_read.h"
 
 #include <stdlib.h>
 #include <stdio.h>
Index: src/dvdnav.h
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/dvdnav.h,v
retrieving revision 1.31
diff -u -r1.31 dvdnav.h
--- src/dvdnav.h	9 Jun 2003 15:17:44 -0000	1.31
+++ src/dvdnav.h	11 Feb 2005 11:08:10 -0000
@@ -33,16 +33,19 @@
 extern "C" {
 #endif
 
+#include <inttypes.h>
+
+#include <dvdread/dvd_reader.h>
+#include <dvdread/nav_types.h>
+#include <dvdread/nav_read.h>
+#include <dvdread/ifo_types.h> /* For vm_cmd_t */
+
 #ifdef DVDNAV_COMPILE
 #  include "dvdnav_events.h"
 #  include "dvd_types.h"
-#  include "dvd_reader.h"
-#  include "ifo_types.h" /* For vm_cmd_t */
 #else
 #  include <dvdnav/dvdnav_events.h>
 #  include <dvdnav/dvd_types.h>
-#  include <dvdnav/dvd_reader.h>
-#  include <dvdnav/ifo_types.h> /* For vm_cmd_t */
 #endif
 
 
Index: src/dvdnav_events.h
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/dvdnav_events.h,v
retrieving revision 1.12
diff -u -r1.12 dvdnav_events.h
--- src/dvdnav_events.h	27 Apr 2003 01:26:18 -0000	1.12
+++ src/dvdnav_events.h	11 Feb 2005 11:08:10 -0000
@@ -28,10 +28,6 @@
 #ifndef DVDNAV_EVENTS_H_INCLUDED
 #define DVDNAV_EVENTS_H_INCLUDED
 
-#include "ifo_types.h"
-#include "dvd_reader.h"
-#include "nav_types.h"
-
 
 /*
  * DVDNAV_BLOCK_OK
Index: src/highlight.c
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/highlight.c,v
retrieving revision 1.32
diff -u -r1.32 highlight.c
--- src/highlight.c	20 Jan 2004 01:22:24 -0000	1.32
+++ src/highlight.c	11 Feb 2005 11:08:10 -0000
@@ -26,7 +26,6 @@
 #endif
 
 #include <assert.h>
-#include "nav_types.h"
 #include "dvdnav_internal.h"
 
 /*
Index: src/remap.c
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/remap.c,v
retrieving revision 1.4
diff -u -r1.4 remap.c
--- src/remap.c	27 Aug 2003 13:54:19 -0000	1.4
+++ src/remap.c	11 Feb 2005 11:08:10 -0000
@@ -189,7 +189,11 @@
     remap_t *map;
 
     /* Build the map filename */
-    home = getenv("HOME"); assert(home);
+    home = getenv("HOME");
+    if (!home) {
+	fprintf(MSG_OUT, "libdvdnav: Unable to find map for title '%s'\n", title);
+	return NULL;
+    }
     strncpy(fname, home, sizeof(fname));
     strncat(fname, "/.dvdnav/", sizeof(fname));
     strncat(fname, title, sizeof(fname));
Index: src/vm/decoder.c
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/vm/decoder.c,v
retrieving revision 1.2
diff -u -r1.2 decoder.c
--- src/vm/decoder.c	3 Mar 2004 16:50:42 -0000	1.2
+++ src/vm/decoder.c	11 Feb 2005 11:08:10 -0000
@@ -31,7 +31,6 @@
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>  /* For memset */
-#include "ifo_types.h" /* vm_cmd_t */
 
 #include "dvdnav_internal.h"
 
Index: src/vm/decoder.h
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/vm/decoder.h,v
retrieving revision 1.1
diff -u -r1.1 decoder.h
--- src/vm/decoder.h	11 Jan 2004 21:43:13 -0000	1.1
+++ src/vm/decoder.h	11 Feb 2005 11:08:10 -0000
@@ -28,7 +28,7 @@
 #include <inttypes.h>
 #include <sys/time.h>
 
-#include "ifo_types.h" /*  vm_cmd_t */
+#include <dvdread/ifo_types.h> /*  vm_cmd_t */
 #include "dvdnav_internal.h"
 
 /* link command types */
Index: src/vm/vm.c
===================================================================
RCS file: /cvsroot/dvd/libdvdnav/src/vm/vm.c,v
retrieving revision 1.11
diff -u -r1.11 vm.c
--- src/vm/vm.c	16 Jan 2005 16:47:05 -0000	1.11
+++ src/vm/vm.c	11 Feb 2005 11:08:11 -0000
@@ -38,13 +38,17 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "ifo_types.h"
-#include "ifo_read.h"
+/* from dvdread */
+#include <dvdread/ifo_types.h>
+#include <dvdread/ifo_read.h>
 
 #include "dvdnav_internal.h"
 
 #ifdef _MSC_VER
 #include <io.h>   /* read() */
+#elif defined(WIN32)
+#   define lseek _lseeki64
+#   define off_t int64_t
 #endif /* _MSC_VER */
 
 /*
