Add preprocessor macros for different platforms

* configure.ac: MK_CONFIGURE shows config.h was generated by configure.
* src/config.ami: Define MK_AMIGAOS.
* src/config.h-vms: Define MK_VMS.
* src/configh.dos: Define MK_DJGPP.
* src/config.h.W32: Define MK_W32 and WINDOWS32.
* src/build_w32.bat: Let WINDOWS32 be defined by config.h.  Remove
unused setting of WIN32.
* src/job.c: Clean up use of WIN32.
* src/main.c: Ditto.
* tests/scripts/features/default_names: Ditto.
This commit is contained in:
Paul Smith 2022-10-17 17:56:18 -04:00
parent 9d24d41801
commit b79791533b
9 changed files with 25 additions and 9 deletions

View File

@ -313,21 +313,21 @@ if "%COMPILER%" == "tcc" goto TccCompile
:: MSVC Compile
if "%VERBOSE%" == "Y" echo on
call %COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I %OUTDIR%/lib /I lib /I src/w32/include /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c
call %COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I %OUTDIR%/lib /I lib /I src/w32/include /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c
@echo off
goto CompileDone
:GccCompile
:: GCC Compile
if "%VERBOSE%" == "Y" echo on
call %COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
call %COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
@echo off
goto CompileDone
:TccCompile
:: TCC Compile
if "%VERBOSE%" == "Y" echo on
call %COMPILER% -mthreads -Wall -std=c11 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -D_cdecl= -D_MSC_VER -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
call %COMPILER% -mthreads -Wall -std=c11 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -D_cdecl= -D_MSC_VER -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
@echo off
goto CompileDone

View File

@ -425,8 +425,8 @@ AS_CASE([$host],
[*-*-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])
AC_DEFINE([WINDOWS32], [1], [Build for the WINDOWS32 API.])
AC_DEFINE([HAVE_DOS_PATHS], [1], [Support DOS-style pathnames.])
])
AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
@ -435,6 +435,11 @@ AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
AC_DEFINE_UNQUOTED([HAVE_DECL_GETLOADAVG],[$HAVE_DECL_GETLOADAVG],
[Define to 1 if you have the declaration of 'getloadavg'.])
# Remember that we ran configure to generate config.h
AC_DEFINE([MK_CONFIGURE], [1],
[Define to 1 if config.h is generated by running the configure script.])
# Include the Maintainer's Makefile section, if it's here.
MAINT_MAKEFILE=/dev/null

View File

@ -16,6 +16,8 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_AMIGAOS 1
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */

View File

@ -17,6 +17,8 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_VMS 1
/* Pull in types.h here to get __CRTL_VER defined for old versions of the
compiler which don't define it. */
#ifdef __DECC

View File

@ -17,6 +17,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_W32 1
/* Build for the WINDOWS32 API. */
#define WINDOWS32 1
/* Suppress some Visual C++ warnings.
Maybe after the code cleanup for ISO C we can remove some/all of these. */
#if _MSC_VER > 1000
@ -106,7 +111,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
# define HAVE_DIRECT_H 1
#endif
/* Use platform specific coding */
/* Support DOS-style pathnames. */
#define HAVE_DOS_PATHS 1
/* Define to 1 if you have the 'dup' function. */

View File

@ -17,6 +17,8 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_DJGPP 1
/* Include this header to make __DJGPP_MINOR__ available because DJGPP ports
of GCC 4.3.0 and later no longer do it automatically. */
#include <sys/version.h>

View File

@ -3480,7 +3480,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
#ifdef WINDOWS32
/* Some shells do not work well when invoked as 'sh -c xxx' to run a
command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). In these
command line (e.g. Cygnus GNUWIN32 sh.exe on W32 systems). In these
cases, run commands via a script file. */
if (just_print_flag && !(flags & COMMANDS_RECURSE))
{

View File

@ -989,7 +989,7 @@ handle_runtime_exceptions (struct _EXCEPTION_POINTERS *exinfo)
}
/*
* On WIN32 systems we don't have the luxury of a /bin directory that
* On W32 systems we don't have the luxury of a /bin directory that
* is mapped globally to every drive mounted to the system. Since make could
* be invoked from any drive, and we don't want to propagate /bin/sh
* to every single drive. Allow ourselves a chance to search for

View File

@ -15,7 +15,7 @@ open(MAKEFILE,"> makefile");
print MAKEFILE "SECOND: ; \@echo It chose makefile\n";
close(MAKEFILE);
# DOS/WIN32/MacOSX platforms are case-insensitive / case-preserving, so
# DOS/W32/MacOSX platforms are case-insensitive / case-preserving, so
# Makefile is the same file as makefile. Just test what we can here.
my $case_sensitive = 0;