]> git.lyx.org Git - features.git/commitdiff
Check for NewAPIs.h. Use it to enable runtime support for Windows95 in Boost.Filesystem.
authorAngus Leeming <leeming@lyx.org>
Fri, 30 Sep 2005 09:44:37 +0000 (09:44 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 30 Sep 2005 09:44:37 +0000 (09:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10499 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
boost/ChangeLog
boost/libs/filesystem/src/operations_posix_windows.cpp
configure.ac

index 229dd985c0d4425381e87155f54ff2eec2fcfc88..9c6efa5af4d84ede65ec876e36a3276261f5c126 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-30  Angus Leeming  <leeming@lyx.org>
+
+       * configure.ac: check for NewAPIs.h. If found, define the
+       WANT_GETFILEATTRIBUTESEX_WRAPPER to enable runtime support
+       for Windows 95 in Boost.Filesystem.
+
 2005-09-29  Angus Leeming  <leeming@lyx.org>
 
        * configure.ac: Use the new MSYS_AC_CANONICAL_PATH to generate
index 508b5ba8aec1a2a429f354c72a1a360d2ee1da27..89688b0a686fbe4b782c5836a20cb029056ad1e0 100644 (file)
@@ -1,3 +1,13 @@
+2005-09-30  Angus Leeming  <leeming@lyx.org>
+
+       * libs/filesystem/src/operations_posix_windows.cpp: add a block
+       of preprocessor code to include NewAPIs.h conditioned on the
+       WANT_GETFILEATTRIBUTESEX_WRAPPER macro. Enables runtime support
+       for Windows 95.
+       (_is_empty, file_size): replace GetFileAttributesExA with the
+       macro GetFileAttributesEx to enable the stub magic in NewAPIs.h
+       to work.
+
 2005-01-05  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * boost/detail/lwm_win32_nt.h: new file
index 55a6a7c89c24bd8665b1bad57a765743f8e5a369..a75a1bca8e48b8534d7c709d135f63440e6c3e79 100644 (file)
@@ -46,6 +46,51 @@ namespace fs = boost::filesystem;
 
 # if defined(BOOST_WINDOWS)
 #   include "windows.h"
+
+    //////////////////////////////////////////////////////////////////////
+    //
+    // Enable Boost.Filesystem to run on Win95 using the emulation
+    // of GetFileAttributesEx available in the Microsoft Platform SDK
+    // header file NewAPIs.h.
+    //
+    // The user needs only to define WANT_GETFILEATTRIBUTESEX_WRAPPER
+    // to enable this emulation.
+    //
+    // Please note, however, that this block of preprocessor code enables
+    // the user to compile against the emulation code. To link the
+    // executable the user must also compile the function definitions in
+    // NewAPIs.h. See NewAPIs.h for further details.
+    //
+    // This code should work both with Microsoft's native implementation
+    // of the winapi headers and also with MinGW/Cygwin's version.
+    //
+    //////////////////////////////////////////////////////////////////////
+#   if defined(WANT_GETFILEATTRIBUTESEX_WRAPPER)
+#     if (defined(__MINGW__) || defined(__CYGWIN__)) && WINVER < 0x040A
+        // MinGW/Cygwin's winapi header files and NewAPIs.h do not live
+        // well together because NewAPIs.h redefines
+        // WIN32_FILE_ATTRIBUTE_DATA and GET_FILEEX_INFO_LEVELS
+        // if WINVER < 0x04A.
+#       include <w32api.h>
+#       if __W32API_MAJOR_VERSION < 3 || \
+           __W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION <= 3
+#         define BOOST_FILESYSTEM_WINVER WINVER
+#         undef WINVER
+#         define WINVER 0x040A
+#       endif
+#     endif
+
+#     include <NewAPIs.h>
+
+      // Return macro definitions to their original state.
+#     ifdef BOOST_FILESYSTEM_WINVER
+#       undef WINVER
+#       define WINVER BOOST_FILESYSTEM_WINVER
+#       undef BOOST_FILESYSTEM_WINVER
+#     endif
+#   endif
+    //////////////////////////////////////////////////////////////////////
+
 #   if defined(__BORLANDC__) || defined(__MWERKS__)
 #     if defined(__BORLANDC__)
         using std::time_t;
@@ -391,7 +436,7 @@ namespace boost
         : path_stat.st_size == 0;
 #   else
       WIN32_FILE_ATTRIBUTE_DATA fad;
-      if ( !::GetFileAttributesExA( ph.string().c_str(),
+      if ( !::GetFileAttributesEx( ph.string().c_str(),
         ::GetFileExInfoStandard, &fad ) )
         boost::throw_exception( filesystem_error(
           "boost::filesystem::is_empty",
@@ -538,7 +583,7 @@ namespace boost
 #   else
       // by now, intmax_t is 64-bits on all Windows compilers
       WIN32_FILE_ATTRIBUTE_DATA fad;
-      if ( !::GetFileAttributesExA( ph.string().c_str(),
+      if ( !::GetFileAttributesEx( ph.string().c_str(),
         ::GetFileExInfoStandard, &fad ) )
         boost::throw_exception( filesystem_error(
           "boost::filesystem::file_size",
index 2281d12caf5e1be53e1c5a9e3cc35543276bb419..0e22032ade05622610f07f934f3aedd5e0a1f5df 100644 (file)
@@ -249,7 +249,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 io.h process.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 NewAPIs.h)
 
 # some standard structures
 AC_HEADER_STAT
@@ -407,6 +407,10 @@ int mkstemp(char*);
 #define BOOST_POSIX 1
 #endif
 
+#if defined(HAVE_NEWAPIS_H)
+#define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
+#endif
+
 #endif
 ])