mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-11-24 20:20:35 +00:00
Add configure operations to support MINGW on Windows.
This commit is contained in:
parent
6d995b036e
commit
9d153cc1b1
10 changed files with 114 additions and 16 deletions
14
ChangeLog
14
ChangeLog
|
@ -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.
|
||||
|
|
14
Makefile.am
14
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.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
*.m4
|
||||
config.*
|
||||
mkinstalldirs
|
||||
texinfo.tex
|
||||
|
||||
Makefile Makefile.in
|
||||
|
|
26
configure.in
26
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
|
||||
|
|
19
main.c
19
main.c
|
@ -1025,6 +1025,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];
|
||||
|
|
|
@ -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;
|
||||
|
||||
# Find the full pathname of Make. For DOS systems this is more
|
||||
# complicated, so we ask make itself.
|
||||
print "Port type: $port_type\n" if $debug;
|
||||
print "Make path: $make_path\n" if $debug;
|
||||
|
||||
$make_path = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
|
||||
chop $make_path;
|
||||
# Find the full pathname of Make. For DOS systems this is more
|
||||
# complicated, so we ask make itself. The following shell code does not
|
||||
# work on W32 (MinGW/MSYS)
|
||||
|
||||
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/) {
|
||||
|
|
1
w32/.cvsignore
Normal file
1
w32/.cvsignore
Normal file
|
@ -0,0 +1 @@
|
|||
Makefile Makefile.in
|
8
w32/Makefile.am
Normal file
8
w32/Makefile.am
Normal file
|
@ -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)
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue