]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
[cygwin|mingw] cwrapper cleanups.
authorCharles Wilson <libtool@cwilson.fastmail.fm>
Fri, 23 Jan 2009 13:45:38 +0000 (08:45 -0500)
committerCharles Wilson <libtool@cwilson.fastmail.fm>
Sat, 24 Jan 2009 16:44:53 +0000 (11:44 -0500)
* libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src)
[file scope]: re-organized includes and portability
macros. Avoid oldnames on MINGW32 and MSVC for
setmode/stat/chmod/getcwd/putenv. Declare _putenv on
MINGW32 when -ansi. Use namespaced macro LT_DEBUGWRAPPER.

ChangeLog
libltdl/config/ltmain.m4sh

index 952de787159ca1bffc7895beace4b1c89e0e8710..91bf875642d4cd2821829d4ed19a0bd120c0c481 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-01-24  Charles Wilson  <libtool@cwilson.fastmail.fm>
+
+       [cygwin|mingw] cwrapper cleanups.
+       * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src)
+       [file scope]: re-organized includes and portability
+       macros. Avoid oldnames on MINGW32 and MSVC for
+       setmode/stat/chmod/getcwd/putenv. Declare _putenv on
+       MINGW32 when -ansi. Use namespaced macro LT_DEBUGWRAPPER.
+
 2009-01-24  Peter Rosin  <peda@lysator.liu.se>
 
        Expand exit status test in LT_AT_NOINST_EXEC_CHECK correctly
index 3f1a30ca8987d87fc964278bb2ab43fe9976e1e8..82ee723540788c6a960a08942484ca746cc00fbb 100644 (file)
@@ -2716,18 +2716,11 @@ EOF
 # include <direct.h>
 # include <process.h>
 # include <io.h>
-# define setmode _setmode
 #else
 # include <unistd.h>
 # include <stdint.h>
 # ifdef __CYGWIN__
 #  include <io.h>
-#  define HAVE_SETENV
-#  ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-#  endif
 # endif
 #endif
 #include <malloc.h>
@@ -2741,6 +2734,44 @@ int setenv (const char *, const char *, int);
 #include <fcntl.h>
 #include <sys/stat.h>
 
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__) && !defined(__MINGW32CE__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
 #if defined(PATH_MAX)
 # define LT_PATHMAX PATH_MAX
 #elif defined(MAXPATHLEN)
@@ -2756,14 +2787,7 @@ int setenv (const char *, const char *, int);
 # define S_IXGRP 0
 #endif
 
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#endif
-
+/* path handling portability macros */
 #ifndef DIR_SEPARATOR
 # define DIR_SEPARATOR '/'
 # define PATH_SEPARATOR ':'
@@ -2794,10 +2818,6 @@ int setenv (const char *, const char *, int);
 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 #endif /* PATH_SEPARATOR_2 */
 
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
 #ifndef FOPEN_WB
 # define FOPEN_WB "w"
 #endif
@@ -2811,7 +2831,7 @@ int setenv (const char *, const char *, int);
 } while (0)
 
 #undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
+#if defined LT_DEBUGWRAPPER
 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
 static void
 ltwrapper_debugprintf (const char *fmt, ...)