]> git.lyx.org Git - lyx.git/commitdiff
MSVC compiles out of the box.
authorAngus Leeming <leeming@lyx.org>
Tue, 3 May 2005 20:32:55 +0000 (20:32 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 3 May 2005 20:32:55 +0000 (20:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9901 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
configure.ac
development/Win32/config.h
development/Win32/readme.txt
development/Win32/win32_kludge.diff [deleted file]
src/support/ChangeLog
src/support/filetools.C
src/support/tempname.C

index 61a9c7eb14128c0ccacff94021d6134547e414f0..3816fc8f63f88298fabcf1d5fce07798dca44fbb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-05-03  Angus Leeming  <leeming@lyx.org>
+
+       * configure.ac: test for io.h and process.h.
+       Test the spelling of close(), getpid(), open(), pclose() and
+       popen(). Do they have a leading underscore or not?
+
 2005-05-02  Angus Leeming  <leeming@lyx.org>
 
        * configure.ac: test for utime.h and sys/utime.h
index 7741e6d963848db656a44788577bdb4c434b100b..22f641f306515fac38a0c0de11add4af5b14fbf0 100644 (file)
@@ -236,7 +236,7 @@ AC_LANG_POP(C)
 # some standard header files
 AC_HEADER_DIRENT
 AC_HEADER_MAJOR
-AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h utime.h sys/utime.h)
+AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h utime.h sys/utime.h io.h process.h)
 
 # some standard structures
 AC_HEADER_STAT
@@ -282,7 +282,7 @@ dnl work correctly because of some conflict with stdlib.h with g++ 2.96
 dnl We aim to remove this eventually, since we should test as much as
 dnl possible with the compiler which will use the functions (JMarc)
 AC_LANG_PUSH(C)
-AC_CHECK_FUNCS(mkfifo mkstemp mktemp lstat readlink)
+AC_CHECK_FUNCS(close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
 AC_LANG_POP(C)
 
 LYX_CHECK_SPELL_ENGINES
index fc15d2afdde7600260e115a3e30539666f55a15d..f4cdb3d53ad24928b862950ff8aedbab361e7391 100644 (file)
@@ -96,6 +96,9 @@
 /* Define to 1 if you have the `asprintf' function. */
 /* #undef HAVE_ASPRINTF */
 
+/* Define to 1 if you have the `close' function. */
+/* #undef HAVE_CLOSE */
+
 /* Define if the GNU dcgettext() function is already present or preinstalled.
    */
 /* #undef HAVE_DCGETTEXT */
 /* Define to 1 if you have the `getpagesize' function. */
 #define HAVE_GETPAGESIZE 1
 
+/* Define to 1 if you have the `getpid' function. */
+/* #undef HAVE_GETPID */
+
 /* Define if the GNU gettext() function is already present or preinstalled. */
 /* #undef HAVE_GETTEXT */
 
 /* Define to 1 if you have the <ios> header file. */
 #define HAVE_IOS 1
 
+/* Define to 1 if you have the <io.h> header file. */
+#define HAVE_IO_H 1
+
 /* Define to 1 if you have the <istream> header file. */
 #define HAVE_ISTREAM 1
 
 /* #define HAVE_MKDIR */
 
 /* Define to 1 if you have the `mkfifo' function. */
-/* #undef HAVE_MKFIFO */
+/* #undef HAVE_MKFIFO */
 
 /* Define to 1 if you have the `mkstemp' function. */
 /* #undef HAVE_MKSTEMP */
 /* Define to 1 if you have the <nl_types.h> header file. */
 #define HAVE_NL_TYPES_H 1
 
+/* Define to 1 if you have the `open' function. */
+/* #undef HAVE_OPEN */
+
 /* Define to 1 if you have the <ostream> header file. */
 #define HAVE_OSTREAM 1
 
+/* Define to 1 if you have the `pclose' function. */
+/* #undef HAVE_PCLOSE */
+
+/* Define to 1 if you have the `popen' function. */
+/* #undef HAVE_POPEN */
+
 /* Define if your printf() function supports format strings with positions. */
 #define HAVE_POSIX_PRINTF 1
 
+/* Define to 1 if you have the <process.h> header file. */
+#define HAVE_PROCESS_H 1
+
 /* Define to 1 if you have the <pspell/pspell.h> header file. */
 /* #undef HAVE_PSPELL_PSPELL_H */
 
 /* Define to 1 if you have the <zlib.h> header file. */
 #define HAVE_ZLIB_H 1
 
+/* Define to 1 if you have the `_close' function. */
+#define HAVE__CLOSE 1
+
+/* Define to 1 if you have the `_getpid' function. */
+#define HAVE__GETPID 1
+
 /* Define to 1 if you have the `_mkdir' function. */
 #define HAVE__MKDIR 1
 
+/* Define to 1 if you have the `_open' function. */
+#define HAVE__OPEN 1
+
+/* Define to 1 if you have the `_pclose' function. */
+#define HAVE__PCLOSE 1
+
+/* Define to 1 if you have the `_popen' function. */
+#define HAVE__POPEN 1
+
 /* Define to 1 if you have the `__argz_count' function. */
 /* #undef HAVE___ARGZ_COUNT */
 
index 1de92c00c3c80d421aa36d1b3f59f5a39da511aa..0e8e3ae592cd33a239ad4f2a302119e0886e4dec 100644 (file)
@@ -7,15 +7,9 @@ To compile using MicroSoft Visual Studio 2003.NET, do this:
 
 2) Make sure QTDIR is set in your global environment, and QTDIR\bin
    is in your path. Control panel, system, advanced, environment
-   variables in your friend on Windows XP.
+   variables is your friend on Windows XP.
 
-3) Apply the win32_kludge.diff using GNU patch. Download from
-   http://gnuwin32.sourceforge.net/packages/patch.htm
-   and type "patch -p0 < development\win32\win32_kludge.diff"
-   in cmd box with current working directory lyx-devel. 
-   Make sure that patch is in your path. (c:\program files\gnuwin32\bin)
-
-4) Open the development\win32\lyx.sln file in Visual Studio,
+3) Open the development\win32\lyx.sln file in Visual Studio,
    compile and run. You can probably also use the free version
    of Microsoft's compiler, but I haven't tried that.
 
diff --git a/development/Win32/win32_kludge.diff b/development/Win32/win32_kludge.diff
deleted file mode 100644 (file)
index e7fdb70..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-Index: src/support/filetools.C
-===================================================================
-RCS file: /cvs/lyx/lyx-devel/src/support/filetools.C,v
-retrieving revision 1.209
-diff -u -r1.209 filetools.C
---- src/support/filetools.C    2005/04/21 14:03:30     1.209
-+++ src/support/filetools.C    2005/04/26 15:43:13
-@@ -1051,6 +1051,11 @@
- cmd_ret const RunCommand(string const & cmd)
- {
-+#ifdef _WIN32
-+      // TODO: Implement this, or merge it into forkedcall.
-+      // Used for lyx2lyx in buffer.C, echo in math_extern and kpse in this file
-+      return make_pair(-1, string());
-+#else
-       // FIXME: replace all calls to RunCommand with ForkedCall
-       // (if the output is not needed) or the code in ispell.C
-       // (if the output is needed).
-@@ -1080,6 +1085,7 @@
-               perror("RunCommand:: could not terminate child process");
-       return make_pair(pret, ret);
-+#endif
- }
-Index: src/support/tempname.C
-===================================================================
-RCS file: /cvs/lyx/lyx-devel/src/support/tempname.C,v
-retrieving revision 1.26
-diff -u -r1.26 tempname.C
---- src/support/tempname.C     2005/04/26 10:30:24     1.26
-+++ src/support/tempname.C     2005/04/26 15:51:22
-@@ -32,6 +32,10 @@
- # endif
- #endif
-+#ifdef _WIN32
-+# include <io.h>
-+#endif
-+
- using boost::scoped_array;
- using std::string;
-@@ -44,6 +48,9 @@
- {
- #if defined(HAVE_MKSTEMP)
-       return ::mkstemp(templ);
-+#elif defined(_WIN32)
-+    ::_mktemp(templ);
-+    return (int) ::fopen(templ, "w");
- #elif defined(HAVE_MKTEMP)
-       // This probably just barely works...
-       ::mktemp(templ);
-@@ -60,7 +67,9 @@
- {
-       string const tmpdir(dir.empty() ? package().temp_dir() : dir);
-       string tmpfl(AddName(tmpdir, mask));
-+#ifndef _WIN32
-       tmpfl += convert<string>(getpid());
-+#endif
-       tmpfl += "XXXXXX";
-       // The supposedly safe mkstemp version
-@@ -71,7 +80,11 @@
-       int const tmpf = make_tempfile(tmpl.get());
-       if (tmpf != -1) {
-               string const t(tmpl.get());
-+#ifdef _WIN32
-+        ::fclose((FILE *) tmpf);
-+#else
-               ::close(tmpf);
-+#endif
-               lyxerr[Debug::FILES] << "Temporary file `" << t
-                                    << "' created." << endl;
-               return t;
index 6cc734913707d8895d45587246c5d0b2f8c2616d..e12c034643765a23fe01213afb3075d0c5023b09 100644 (file)
@@ -1,3 +1,11 @@
+2005-05-03  Angus Leeming  <leeming@lyx.org>
+
+       * filetools.C (RunCommand): protect calls to popen() and pclose()
+       with preprocessor guards.
+
+       * tempname.C: protect calls to close(), getpid() and open()
+       with preprocessor guards.
+
 2005-05-02  Angus Leeming  <leeming@lyx.org>
 
        * socktools.C: make compilation dependent on HAVE_FCNTL rather
index 6bdc9336abe4304399a92cb98ff425148ed8a901..35609982ae0a86fb8ef2d4184c1b77e5b9b4c94a 100644 (file)
@@ -1061,7 +1061,13 @@ cmd_ret const RunCommand(string const & cmd)
        // pstream (process stream), with the
        // variants ipstream, opstream
 
+#if defined (HAVE_POPEN)
        FILE * inf = ::popen(cmd.c_str(), os::popen_read_mode());
+#elif defined (HAVE__POPEN)
+       FILE * inf = ::_popen(cmd.c_str(), os::popen_read_mode());
+#else
+#error No popen() function.
+#endif
 
        // (Claus Hentschel) Check if popen was succesful ;-)
        if (!inf) {
@@ -1075,7 +1081,15 @@ cmd_ret const RunCommand(string const & cmd)
                ret += static_cast<char>(c);
                c = fgetc(inf);
        }
+
+#if defined (HAVE_PCLOSE)
        int const pret = pclose(inf);
+#elif defined (HAVE__PCLOSE)
+       int const pret = _pclose(inf);
+#else
+#error No pclose() function.
+#endif
+
        if (pret == -1)
                perror("RunCommand:: could not terminate child process");
 
index 18699223a6b1952f48e4b9857c3ce65b09e57c3b..afad6dedcfa1853e510b1f208c2fbaa869fa3bd4 100644 (file)
 # ifdef HAVE_SYS_STAT_H
 #  include <sys/stat.h>
 # endif
+# ifdef HAVE_IO_H
+#  include <io.h>
+# endif
+# ifdef HAVE_PROCESS_H
+#  include <process.h>
+# endif
 #endif
 
 using boost::scoped_array;
@@ -47,7 +53,15 @@ int make_tempfile(char * templ)
 #elif defined(HAVE_MKTEMP)
        // This probably just barely works...
        ::mktemp(templ);
+# if defined (HAVE_OPEN)
        return ::open(templ, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+# elif defined (HAVE__OPEN)
+       return ::_open(templ,
+                      _O_RDWR | _O_CREAT | _O_EXCL,
+                      _S_IREAD | _S_IWRITE);
+# else
+#  error No open() function.
+# endif
 #else
 #error FIX FIX FIX
 #endif
@@ -60,7 +74,13 @@ string const lyx::support::tempName(string const & dir, string const & mask)
 {
        string const tmpdir(dir.empty() ? package().temp_dir() : dir);
        string tmpfl(AddName(tmpdir, mask));
+#if defined (HAVE_GETPID)
        tmpfl += convert<string>(getpid());
+#elif defined (HAVE__GETPID)
+       tmpfl += convert<string>(_getpid());
+#else
+# error No getpid() function
+#endif
        tmpfl += "XXXXXX";
 
        // The supposedly safe mkstemp version
@@ -71,7 +91,13 @@ string const lyx::support::tempName(string const & dir, string const & mask)
        int const tmpf = make_tempfile(tmpl.get());
        if (tmpf != -1) {
                string const t(tmpl.get());
+#if defined (HAVE_CLOSE)
                ::close(tmpf);
+#elif defined (HAVE__CLOSE)
+               ::_close(tmpf);
+#else
+# error No close() function.
+#endif
                lyxerr[Debug::FILES] << "Temporary file `" << t
                                     << "' created." << endl;
                return t;