+2008-03-12 Charles Wilson <libtool@cwilson.fastmail.fm>
+
+ * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src) [file
+ scope]: additional #includes and #defines to support...
+ (func_emit_cwrapperexe_src) [main]: ensure stdout is set to
+ binary mode for cygwin|mingw builds. Ensure temporary script
+ file is written in binary mode for cygwin|mingw builds.
+ (func_mode_link) [cygwin|mingw]: cross-build support - only
+ use cwrapper to generate shell wrapper if building native;
+ otherwise use func_emit_wrapper()
+
2008-03-12 Henning Nielsen Lund <hnl_dk@amigaos.dk>
* libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER)
#ifdef _MSC_VER
# include <direct.h>
# include <process.h>
+# include <io.h>
#else
# include <unistd.h>
# include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
+#include <fcntl.h>
#include <sys/stat.h>
#if defined(PATH_MAX)
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__)
# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
# ifndef DIR_SEPARATOR_2
# define DIR_SEPARATOR_2 '\\'
# endif
# 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
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \
if (stale) { free ((void *) stale); stale = 0; } \
{
if (strcmp (argv[i], dumpscript_opt) == 0)
{
+EOF
+ case "$host" in
+ *mingw* | *cygwin* )
+ # make stdout use "unix" line endings
+ echo " _setmode(1,_O_BINARY);"
+ ;;
+ esac
+
+ cat <<EOF
printf ("%s", script_text);
return 0;
}
XFREE (shwrapper_name);
XFREE (actual_cwrapper_path);
- /* note: do NOT use "wt" here! -- defer to underlying
- * mount type on cygwin
- */
- if ((shwrapper = fopen (newargz[1], "w")) == 0)
+ /* always write in binary mode */
+ if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
{
lt_fatal ("Could not open %s for writing", newargz[1]);
}
$RM $func_ltwrapper_scriptname_result
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
$opt_dry_run || {
- $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ # note: this script will not be executed, so do not chmod.
+ if test "x$build" = "x$host" ; then
+ $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ else
+ func_emit_wrapper no > $func_ltwrapper_scriptname_result
+ fi
}
;;
* )