Index: lyx-devel/config/progtest.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/progtest.m4,v
retrieving revision 1.2
diff -u -r1.2 progtest.m4
--- lyx-devel/config/progtest.m4	2000/01/08 21:02:55	1.2
+++ lyx-devel/config/progtest.m4	2001/01/01 01:09:00
@@ -11,6 +11,19 @@
 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
+[case "`uname -s 2> /dev/null`" in
+OS/2)
+  PATH=`echo -E "$PATH" | sed 's+\\\\+/+g'`
+  PATH_IFS=';'
+  EXE_EXT='.exe'
+  CMD_EXT='.cmd'
+  ;;
+*)
+  PATH_IFS=':'
+  EXE_EXT=''
+  CMD_EXT=''
+  ;;
+esac]
 [# Extract the first word of "$2", so it can be a program name with args.
 set dummy $2; ac_word=[$]2
 AC_MSG_CHECKING([for $ac_word])
@@ -20,10 +33,12 @@
   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
   ;;
   *)
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}$PATH_IFS"
   for ac_dir in ifelse([$5], , $PATH, [$5]); do
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
+    if test -f $ac_dir/$ac_word \
+	 -o -f $ac_dir/$ac_word$EXE_EXT \
+	 -o -f $ac_dir/$ac_word$CMD_EXT; then
       if [$3]; then
 	ac_cv_path_$1="$ac_dir/$ac_word"
 	break
Index: lyx-devel/lib/configure.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v
retrieving revision 1.17
diff -u -r1.17 configure.m4
--- lyx-devel/lib/configure.m4	2000/11/21 15:45:42	1.17
+++ lyx-devel/lib/configure.m4	2001/01/01 01:09:05
@@ -28,6 +28,19 @@
 dnl
 define(SEARCH_PROG,[dnl
 changequote([,])dnl
+case "`uname -s 2> /dev/null`" in
+OS/2)
+  PATH=`echo -E "$PATH" | sed 's+\\\\+/+g'`
+  PATH_IFS=';'
+  EXE_EXT='.exe'
+  CMD_EXT='.cmd'
+  ;;
+*)
+  PATH_IFS=':'
+  EXE_EXT=''
+  CMD_EXT=''
+  ;;
+esac
 MSG_CHECKING($1)
 MSG_RESULT(($3))
 $2=
@@ -37,10 +50,12 @@
 set dummy $ac_prog ; ac_word=$[2]
 if test -n "$ac_word"; then
   MSG_CHECKING([for \"$ac_word\"],[+])
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="$PATH_IFS"
   for ac_dir in $PATH; do
     test -z "$ac_dir" && ac_dir=.
-    if test -x [$ac_dir/$ac_word]; then
+    if test -x [$ac_dir/$ac_word] \
+	-o -x [$ac_dir/$ac_word$EXE_EXT] \
+	-o -x [$ac_dir/$ac_word$CMD_EXT]; then
       $2="$ac_prog"
       break
     fi
@@ -180,8 +195,17 @@
 fi
 
 # Search for an installed reLyX or a ready-to-install one
+case "`uname -s 2> /dev/null`" in
+OS/2)
+save_PATH=`echo -E "$PATH" | sed 's+\\\\+/+g'`
+PATH_IFS=';'
+;;
+*)
 save_PATH=${PATH}
-PATH=${PATH}:./reLyX/
+PATH_IFS=':'
+;;
+esac
+PATH=${PATH}${PATH_IFS}./reLyX/
 SEARCH_PROG([for a LaTeX -> LyX converter],tex_to_lyx_command,reLyX)
 PATH=${save_PATH}
 test $tex_to_lyx_command = "reLyX" && tex_to_lyx_command="reLyX -f \$\$i"
Index: lyx-devel/lib/reLyX/acinclude.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/reLyX/acinclude.m4,v
retrieving revision 1.2
diff -u -r1.2 acinclude.m4
--- lyx-devel/lib/reLyX/acinclude.m4	2000/11/07 12:07:13	1.2
+++ lyx-devel/lib/reLyX/acinclude.m4	2001/01/01 01:09:06
@@ -10,15 +10,24 @@
 dnl RELYX_SEARCH_PROG(VARIABLE-NAME,PROGRAMS-LIST,ACTION-IF-FOUND)
 dnl             
 define(RELYX_SEARCH_PROG,[dnl
+case "`uname -s 2> /dev/null`" in
+OS/2)
+  PATH=`echo -E "$PATH" | sed 's+\\\\+/+g'`
+  PATH_IFS=';'
+  ;;
+*)
+  PATH_IFS=':'
+  ;;
+esac
 for ac_prog in $2 ; do
 # Extract the first word of "$ac_prog", so it can be a program name with
 # args.
   set dummy $ac_prog ; ac_word=$[2]
   if test ! -n "[$]$1"; then
-    IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+    IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}$PATH_IFS"
     for ac_dir in $PATH; do
       test -z "$ac_dir" && ac_dir=.
-      if test -f [$ac_dir/$ac_word]; then
+      if test -f [$ac_dir/$ac_word] -o -f [$ac_dir/$ac_word$ac_exeext]; then
         $1="$ac_prog"
         break
       fi
Index: lyx-devel/lib/reLyX/configure.in
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/reLyX/configure.in,v
retrieving revision 1.8
diff -u -r1.8 configure.in
--- lyx-devel/lib/reLyX/configure.in	2000/06/26 15:33:12	1.8
+++ lyx-devel/lib/reLyX/configure.in	2001/01/01 01:09:06
@@ -2,6 +2,7 @@
 AC_INIT(reLyX.in)
 AC_PREREQ(2.13) dnl We want to use autoconf 2.13
 AC_CONFIG_AUX_DIR(../../config)
+AC_EXEEXT
 
 dnl PACKAGE=reLyX
 dnl Do this to install in $datadir/lyx/reLyX instead of $datadir/reLyX/reLyX
Index: lyx-devel/src/os2_defines.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/os2_defines.h,v
retrieving revision 1.5
diff -u -r1.5 os2_defines.h
--- lyx-devel/src/os2_defines.h	2000/11/08 09:39:44	1.5
+++ lyx-devel/src/os2_defines.h	2001/01/01 01:09:07
@@ -13,16 +13,22 @@
 #ifndef OS2_DEFINES_H
 #define OS2_DEFINES_H
 
+#if defined (__cplusplus)
 #include <cctype>
-#include <process.h>
 #include <cstdlib>
+extern "C" inline int readlink(const char *, char *, size_t) {return -1;}
+#else
+#include <ctype.h>
+#include <stdlib.h>
+#define readlink(s, t, l) (-1)
+#endif
+#include <process.h>
 #include <unistd.h>
 #include <X11/Xlocale.h>
 /* #include <malloc.h> */
 #define lstat stat
 #define S_ISLNK(x) false
 #define S_ISBLK(x) false
-#define readlink(s, t, l) (strcpy(t, s), strlen(t))
 /*#define mkfifo(p, m) (0) *//* LyXserver is temporary disabled. */
 #define chdir _chdir2
 #define strcasecmp stricmp
Index: lyx-devel/src/support/rename.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/rename.C,v
retrieving revision 1.5
diff -u -r1.5 rename.C
--- lyx-devel/src/support/rename.C	2000/11/13 10:35:02	1.5
+++ lyx-devel/src/support/rename.C	2001/01/01 01:09:10
@@ -6,6 +6,9 @@
 
 bool lyx::rename(string const & from, string const & to)
 {
+#ifdef __EMX__
+	::unlink(to.c_str());
+#endif
 	if (::rename(from.c_str(), to.c_str()) == -1)
 		if (lyx::copy(from, to)) {
 			lyx::unlink(from);
Index: lyx-devel/src/support/syscall.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/syscall.C,v
retrieving revision 1.18
diff -u -r1.18 syscall.C
--- lyx-devel/src/support/syscall.C	2000/10/11 21:06:43	1.18
+++ lyx-devel/src/support/syscall.C	2001/01/01 01:09:10
@@ -15,6 +15,7 @@
 #include "syscontr.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
+#include "support/filetools.h"
 
 using std::endl;
 
Index: lyx-devel/src/support/tempname.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/tempname.C,v
retrieving revision 1.4
diff -u -r1.4 tempname.C
--- lyx-devel/src/support/tempname.C	2000/11/15 03:22:08	1.4
+++ lyx-devel/src/support/tempname.C	2001/01/01 01:09:10
@@ -12,6 +12,17 @@
 
 extern string system_tempdir;
 
+#ifdef __EMX__
+	// EMX mkstemp() behaviour may be problematic, however,
+	// as noted by Lgb in the comment to CreateTmpDir(),
+	// there is no point for using mkstemp() here.
+#undef HAVE_MKSTEMP
+#include <sys/types.h>
+#include <sys/stat.h>
+#define INCL_DOSFILEMGR
+#include <os2.h>
+#endif
+
 static inline
 int make_tempfile(char * templ) 
 {
@@ -19,9 +30,14 @@
 	return ::mkstemp(templ);
 #else
 #ifdef HAVE_MKTEMP
+#ifdef __EMX__
+	ULONG cur = 0;
+	LONG  req = 1;
+	DosSetRelMaxFH(&req, &cur);	// No need to check error code.
+#endif
 	// This probably just barely works...
 	::mktemp(templ);
-	return ::open(templ, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+	return ::open(templ, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
 #else
 #warning FIX FIX FIX
 #endif
