diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | Makefile.am | 14 | ||||
-rw-r--r-- | config/.cvsignore | 1 | ||||
-rw-r--r-- | configure.in | 26 | ||||
-rw-r--r-- | main.c | 19 | ||||
-rwxr-xr-x | tests/run_make_tests.pl | 25 | ||||
-rw-r--r-- | w32/.cvsignore | 1 | ||||
-rw-r--r-- | w32/Makefile.am | 8 | ||||
-rw-r--r-- | w32/subproc/sub_proc.c | 13 | ||||
-rw-r--r-- | w32/subproc/w32err.c | 7 |
10 files changed, 113 insertions, 15 deletions
@@ -1,3 +1,17 @@ +2005-02-24 Jonathan Grant <jg@jguk.org> + + * configure.in: Add MinGW configuration options, and extra w32 code + directory. + * Makefile.am: Add MinGW configuration options, and extra w32 code + directory. + * main.c: Determine correct program string (after last \ without .exe). + * subproc/sub_proc.c: `GetExitCodeProcess' from incompatible pointer + type fix x2 + * w32/Makefile.am: Import to build win32 lib of sub_proc etc. + * subproc/w32err.c: MSVC thread directive not applied to MinGW builds. + * tests/run_make_tests.pl, tests/test_driver.pl: MSYS testing + environment support. + 2005-02-09 Paul D. Smith <psmith@gnu.org> * maintMakefile: Update the CVS download URL to simplify them. diff --git a/Makefile.am b/Makefile.am index b3d85c5..0877aa2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,12 @@ AUTOMAKE_OPTIONS = 1.8 dist-bzip2 check-news ansi2knr ACLOCAL_AMFLAGS = -I config SUBDIRS = glob config po doc +# Only process if target is MS-Windows +if WINDOWSENV + SUBDIRS += w32 + W32INC := -I $(top_srcdir)/w32/include + W32LIB := -Lw32 -lw32 +endif bin_PROGRAMS = make @@ -25,12 +31,20 @@ noinst_HEADERS = commands.h dep.h filedef.h job.h make.h rule.h variable.h \ debug.h getopt.h gettext.h hash.h make_LDADD = @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ @LIBINTL@ +# Only process if target is MS-Windows +if WINDOWSENV + make_LDADD += $(W32LIB) +endif man_MANS = make.1 DEFS = -DLOCALEDIR=\"$(localedir)\" -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" @DEFS@ AM_CPPFLAGS = $(GLOBINC) +# Only process if target is MS-Windows +if WINDOWSENV + AM_CPPFLAGS += $(W32INC) +endif # Extra stuff to include in the distribution. diff --git a/config/.cvsignore b/config/.cvsignore index a183a3d..33b30ed 100644 --- a/config/.cvsignore +++ b/config/.cvsignore @@ -1,5 +1,6 @@ *.m4 config.* mkinstalldirs +texinfo.tex Makefile Makefile.in diff --git a/configure.in b/configure.in index a8c35ec..7e4d545 100644 --- a/configure.in +++ b/configure.in @@ -235,6 +235,15 @@ AC_ARG_WITH(customs, # Tell automake about this, so it can include the right .c files. AM_CONDITIONAL(USE_CUSTOMS, test "$use_customs" = true) +# See if the user asked to handle case insensitive file systems. + +AH_TEMPLATE(HAVE_CASE_INSENSITIVE_FS, [Use case insensitive file names]) +AC_ARG_ENABLE(case-insensitive-file-system, + AC_HELP_STRING([--enable-case-insensitive-file-system], + [enable case insensitive file system support]), + case_insensitive_fs="yes" AC_DEFINE(HAVE_CASE_INSENSITIVE_FS), + case_insensitive_fs="no") + # See if we can handle the job server feature, and if the user wants it. AC_ARG_ENABLE(job-server, @@ -331,6 +340,18 @@ AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.]) MAKE_HOST="$host" AC_SUBST(MAKE_HOST) +w32_target_env=no +AM_CONDITIONAL(WINDOWSENV, false) + +case "$host" in + *-*-mingw32) + AM_CONDITIONAL(WINDOWSENV, true) + w32_target_env=yes + AC_DEFINE([WINDOWS32], [1], [Use platform specific coding]) + AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding]) + ;; +esac + # Include the Maintainer's Makefile section, if it's here. MAINT_MAKEFILE=/dev/null @@ -391,6 +412,11 @@ esac # Specify what files are to be created. AC_CONFIG_FILES(Makefile glob/Makefile po/Makefile.in config/Makefile doc/Makefile) +# Only process if target is MS-Windows +if test "$w32_target_env" == yes; then + AC_CONFIG_FILES(w32/Makefile) +fi + # OK, do it! AC_OUTPUT @@ -1026,6 +1026,25 @@ main (int argc, char **argv, char **envp) if (program == 0 && argv[0][1] == ':') program = argv[0] + 1; #endif +#ifdef WINDOWS32 + if (program == 0) + { + /* Extract program from full path */ + int argv0_len; + char *p = strrchr (argv[0], '\\'); + if (!p) + p = argv[0]; + argv0_len = strlen(p); + if (argv0_len > 4 + && streq (&p[argv0_len - 4], ".exe")) + { + /* Remove .exe extension */ + p[argv0_len - 4] = '\0'; + /* Increment past the initial '\' */ + program = p + 1; + } + } +#endif if (program == 0) program = argv[0]; else diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl index aeba4e8..5276d29 100755 --- a/tests/run_make_tests.pl +++ b/tests/run_make_tests.pl @@ -12,6 +12,7 @@ # (and others) $valgrind = 0; # invoke make with valgrind +$pure_log = undef; require "test_driver.pl"; @@ -215,7 +216,7 @@ sub set_more_defaults # # This is probably not specific enough. # - if ($osname =~ /Windows/i) { + if ($osname =~ /Windows/i || $osname =~ /MINGW32/i) { $port_type = 'W32'; } # Bleah, the osname is so variable on DOS. This kind of bites. @@ -243,11 +244,17 @@ sub set_more_defaults # $wtime = $port_type eq 'UNIX' ? 1 : $port_type eq 'OS/2' ? 2 : 4; + print "Port type: $port_type\n" if $debug; + print "Make path: $make_path\n" if $debug; + # Find the full pathname of Make. For DOS systems this is more - # complicated, so we ask make itself. + # complicated, so we ask make itself. The following shell code does not + # work on W32 (MinGW/MSYS) - $make_path = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`; - chop $make_path; + if ($port_type ne 'W32') { + $make_path = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`; + chop $make_path; + } print "Make\t= `$make_path'\n" if $debug; $string = `$make_path -v -f /dev/null 2> /dev/null`; @@ -283,10 +290,12 @@ sub set_more_defaults # Get Purify log info--if any. - $ENV{PURIFYOPTIONS} =~ /.*-logfile=([^ ]+)/; - $pure_log = $1 || ''; - $pure_log =~ s/%v/$make_name/; - $purify_errors = 0; + if (exists $ENV{PURIFYOPTIONS} + && $ENV{PURIFYOPTIONS} =~ /.*-logfile=([^ ]+)/) { + $pure_log = $1 || ''; + $pure_log =~ s/%v/$make_name/; + $purify_errors = 0; + } $string = `sh -c "$make_path -j 2 -f /dev/null 2>&1"`; if ($string =~ /not supported/) { diff --git a/w32/.cvsignore b/w32/.cvsignore new file mode 100644 index 0000000..6179e0d --- /dev/null +++ b/w32/.cvsignore @@ -0,0 +1 @@ +Makefile Makefile.in diff --git a/w32/Makefile.am b/w32/Makefile.am new file mode 100644 index 0000000..fd6743d --- /dev/null +++ b/w32/Makefile.am @@ -0,0 +1,8 @@ +# Makefile.am to create libw32.a for mingw32 host. + +noinst_LIBRARIES = libw32.a + +libw32_a_SOURCES = subproc/misc.c subproc/sub_proc.c subproc/w32err.c \ + pathstuff.c + +libw32_a_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/subproc -I$(top_srcdir) diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c index bf1e732..63911fc 100644 --- a/w32/subproc/sub_proc.c +++ b/w32/subproc/sub_proc.c @@ -664,13 +664,13 @@ process_pipe_io( DWORD wait_return; HANDLE ready_hand; bool_t child_dead = FALSE; - + BOOL GetExitCodeResult; /* * Create stdin thread, if needed */ - pproc->inp = stdin_data; - pproc->incnt = stdin_data_len; + pproc->inp = stdin_data; + pproc->incnt = stdin_data_len; if (!pproc->inp) { stdin_eof = TRUE; CloseHandle((HANDLE)pproc->sv_stdin[0]); @@ -762,7 +762,8 @@ process_pipe_io( } else if (ready_hand == childhand) { - if (GetExitCodeProcess(childhand, &pproc->exit_code) == FALSE) { + GetExitCodeResult = GetExitCodeProcess(childhand, (DWORD*)&pproc->exit_code); + if (GetExitCodeResult == FALSE) { pproc->last_err = GetLastError(); pproc->lerrno = E_SCALL; goto done; @@ -809,6 +810,7 @@ process_file_io( sub_process *pproc; HANDLE childhand; DWORD wait_return; + BOOL GetExitCodeResult; if (proc == NULL) pproc = process_wait_for_any_private(); @@ -852,7 +854,8 @@ process_file_io( goto done2; } - if (GetExitCodeProcess(childhand, &pproc->exit_code) == FALSE) { + GetExitCodeResult = GetExitCodeProcess(childhand, (DWORD*)&pproc->exit_code); + if (GetExitCodeResult == FALSE) { pproc->last_err = GetLastError(); pproc->lerrno = E_SCALL; } diff --git a/w32/subproc/w32err.c b/w32/subproc/w32err.c index 9bfa2c4..712fccd 100644 --- a/w32/subproc/w32err.c +++ b/w32/subproc/w32err.c @@ -11,9 +11,12 @@ */
char *
map_windows32_error_to_string (DWORD ercode) {
-/* __declspec (thread) necessary if you will use multiple threads */
+/* __declspec (thread) necessary if you will use multiple threads on MSVC */
+#ifdef _MSC_VER
__declspec (thread) static char szMessageBuffer[128];
-
+#else
+static char szMessageBuffer[128];
+#endif
/* Fill message buffer with a default message in
* case FormatMessage fails
*/
|