summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-01-16 00:24:13 -0500
committerPaul Smith <psmith@gnu.org>2023-01-16 00:24:13 -0500
commit9b9f3351d1294b8e6d11f339f7b47d705c69e64f (patch)
tree89ba7ef3fedd86aef0a401191193175638e73ba6
parent6f3e9e9b844cf5e9cd95e9af9ae5fa9409993bd7 (diff)
downloadmake-git-9b9f3351d1294b8e6d11f339f7b47d705c69e64f.tar.gz
Use MK_OS_OS2 macro instead of __EMX__
* src/makeint.h: Set MK_OS_OS2 to 1 if __EMX__ is set. * src/*: Convert #if refs to __EMX__, to use MK_OS_OS2.
-rw-r--r--src/default.c4
-rw-r--r--src/dir.c2
-rw-r--r--src/job.c52
-rw-r--r--src/main.c18
-rw-r--r--src/makeint.h8
-rw-r--r--src/misc.c6
-rw-r--r--src/posixos.c2
-rw-r--r--src/read.c4
-rw-r--r--src/variable.c4
-rw-r--r--src/vpath.c2
10 files changed, 53 insertions, 49 deletions
diff --git a/src/default.c b/src/default.c
index f5cfe8a2..fd12ecf9 100644
--- a/src/default.c
+++ b/src/default.c
@@ -27,7 +27,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
/* Define GCC_IS_NATIVE if gcc is the native development environment on
your system (gcc/bison/flex vs cc/yacc/lex). */
-#if MK_OS_DOS || defined(__EMX__)
+#if MK_OS_DOS || MK_OS_OS2
# define GCC_IS_NATIVE
#endif
@@ -43,7 +43,7 @@ static char default_suffixes[]
.for .f .r .y .l .ym .yl .mar .s .ss .i .ii .mod .sym .def .h .info .dvi \
.tex .texinfo .texi .txinfo .mem .hlp .brn .rnh .rno .rnt .rnx .w .ch .cweb \
.web .com .sh .elc .el";
-#elif defined(__EMX__)
+#elif MK_OS_OS2
= ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \
.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
.w .ch .web .sh .elc .el .obj .exe .dll .lib";
diff --git a/src/dir.c b/src/dir.c
index 991f2bd9..9a26e031 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -653,7 +653,7 @@ dir_contents_file_exists_p (struct directory *dir,
filename = downcase (filename);
#endif
-#ifdef __EMX__
+#if MK_OS_OS2
if (filename != NULL)
{
size_t len = strlen (filename);
diff --git a/src/job.c b/src/job.c
index 6a116044..9cbdd2be 100644
--- a/src/job.c
+++ b/src/job.c
@@ -46,7 +46,7 @@ HANDLE main_thread;
const char *default_shell = "command.com";
int batch_mode_shell = 0;
-#elif defined (__EMX__)
+#elif MK_OS_OS2
const char *default_shell = "/bin/sh";
int batch_mode_shell = 0;
@@ -102,7 +102,7 @@ static void vmsWaitForChildren (int *);
# define WAIT_NOHANG 1
#endif /* MK_OS_W32 */
-#ifdef __EMX__
+#if MK_OS_OS2
# include <process.h>
#endif
@@ -368,7 +368,7 @@ create_batch_file (char const *base, int unixy, int *fd)
}
#endif /* MK_OS_W32 */
-#ifdef __EMX__
+#if MK_OS_OS2
/* returns whether path is assumed to be a unix like shell. */
int
_is_unixy_shell (const char *path)
@@ -412,7 +412,7 @@ _is_unixy_shell (const char *path)
/* in doubt assume a unix like shell */
return 1;
}
-#endif /* __EMX__ */
+#endif /* MK_OS_OS2 */
/* determines whether path looks to be a Bourne-like shell. */
int
@@ -600,7 +600,7 @@ child_handler (int sig UNUSED)
jobserver_signal ();
-#ifdef __EMX__
+#if MK_OS_OS2
/* The signal handler must called only once! */
signal (SIGCHLD, SIG_DFL);
#endif
@@ -1353,7 +1353,7 @@ start_job_command (struct child *child)
#if !MK_OS_VMS
if (
-#if MK_OS_DOS || defined (__EMX__)
+#if MK_OS_DOS || MK_OS_OS2
unixy_shell /* the test is complicated and we already did it */
#else
(argv[0] && is_bourne_compatible_shell (argv[0]))
@@ -2171,7 +2171,7 @@ start_waiting_jobs (void)
#if !MK_OS_W32
/* EMX: Start a child process. This function returns the new pid. */
-# if defined __EMX__
+# if MK_OS_OS2
pid_t
child_execute_job (struct childbase *child, int good_stdin, char **argv)
{
@@ -2547,7 +2547,7 @@ exec_command (char **argv, char **envp)
pid_t pid = -1;
-# ifdef __EMX__
+# if MK_OS_OS2
/* Run the program. */
pid = spawnvpe (P_NOWAIT, argv[0], argv, envp);
if (pid >= 0)
@@ -2569,7 +2569,7 @@ exec_command (char **argv, char **envp)
environ = envp;
execvp (argv[0], argv);
-# endif /* !__EMX__ */
+# endif /* !MK_OS_OS2 */
switch (errno)
{
@@ -2584,7 +2584,7 @@ exec_command (char **argv, char **envp)
int argc;
int i=1;
-# ifdef __EMX__
+# if MK_OS_OS2
/* Do not use $SHELL from the environment */
struct variable *p = lookup_variable ("SHELL", 5);
if (p)
@@ -2601,7 +2601,7 @@ exec_command (char **argv, char **envp)
while (argv[argc] != 0)
++argc;
-# ifdef __EMX__
+# if MK_OS_OS2
if (!unixy_shell)
++argc;
# endif
@@ -2609,7 +2609,7 @@ exec_command (char **argv, char **envp)
new_argv = alloca ((1 + argc + 1) * sizeof (char *));
new_argv[0] = (char *)shell;
-# ifdef __EMX__
+# if MK_OS_OS2
if (!unixy_shell)
{
new_argv[1] = (char *)"/c";
@@ -2625,7 +2625,7 @@ exec_command (char **argv, char **envp)
--argc;
}
-# ifdef __EMX__
+# if MK_OS_OS2
pid = spawnvpe (P_NOWAIT, shell, new_argv, envp);
if (pid >= 0)
break;
@@ -2639,7 +2639,7 @@ exec_command (char **argv, char **envp)
break;
}
-# ifdef __EMX__
+# if MK_OS_OS2
case EINVAL:
/* this nasty error was driving me nuts :-( */
O (error, NILF, _("spawnvpe: environment space might be exhausted"));
@@ -2725,7 +2725,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
const char *sh_chars;
const char **sh_cmds;
-#elif defined (__EMX__)
+#elif MK_OS_OS2
static const char *sh_chars_dos = "*?[];|<>%^&()";
static const char *sh_cmds_dos[] =
{ "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date",
@@ -2856,7 +2856,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
if (slow_flag)
goto slow;
#else /* not MK_OS_W32 */
-#if MK_OS_DOS || defined (__EMX__)
+#if MK_OS_DOS || MK_OS_OS2
else if (strcasecmp (shell, default_shell))
{
extern int _is_unixy_shell (const char *_path);
@@ -2877,7 +2877,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
{
sh_chars = sh_chars_dos;
sh_cmds = sh_cmds_dos;
-# ifdef __EMX__
+# if MK_OS_OS2
if (_osmode == OS2_MODE)
{
sh_chars = sh_chars_os2;
@@ -2888,7 +2888,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
#else /* !MK_OS_DOS */
else if (strcmp (shell, default_shell))
goto slow;
-#endif /* !MK_OS_DOS && !__EMX__ */
+#endif /* !MK_OS_DOS && !MK_OS_OS2 */
#endif /* not MK_OS_W32 */
if (ifs)
@@ -2938,7 +2938,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
DOS/Windows/OS2, if we don't have a POSIX shell, we keep the
pre-POSIX behavior of removing the backslash-newline. */
if (instring == '"'
-#if MK_OS_DOS || defined (__EMX__) || MK_OS_W32
+#if MK_OS_DOS || MK_OS_OS2 || MK_OS_W32
|| !unixy_shell
#endif
)
@@ -3096,7 +3096,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
{
if (streq (sh_cmds[j], new_argv[0]))
goto slow;
-#if defined(__EMX__) || MK_OS_W32
+#if MK_OS_OS2 || MK_OS_W32
/* Non-Unix shells are case insensitive. */
if (!unixy_shell
&& strcasecmp (sh_cmds[j], new_argv[0]) == 0)
@@ -3191,7 +3191,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
char *command_ptr = NULL; /* used for batch_mode_shell mode */
#endif
-# ifdef __EMX__ /* is this necessary? */
+# if MK_OS_OS2 /* is this necessary? */
if (!unixy_shell && shellflags)
{
size_t len = strlen (shellflags);
@@ -3218,7 +3218,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
/* Remove and ignore interior prefix chars [@+-] because they're
meaningless given a single shell. */
-#if MK_OS_DOS || defined (__EMX__)
+#if MK_OS_DOS || MK_OS_OS2
if (unixy_shell) /* the test is complicated and we already did it */
#else
if (is_bourne_compatible_shell (shell)
@@ -3414,7 +3414,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
/* POSIX says we keep the backslash-newline. If we don't have a
POSIX shell on DOS/Windows/OS2, mimic the pre-POSIX behavior
and remove the backslash/newline. */
-#if MK_OS_DOS || defined (__EMX__) || MK_OS_W32
+#if MK_OS_DOS || MK_OS_OS2 || MK_OS_W32
# define PRESERVE_BSNL unixy_shell
#else
# define PRESERVE_BSNL 1
@@ -3516,7 +3516,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
new_argv = construct_command_argv_internal (new_line, 0, 0, 0, 0,
flags, 0);
-#ifdef __EMX__
+#if MK_OS_OS2
else if (!unixy_shell)
{
/* new_line is local, must not be freed therefore
@@ -3649,7 +3649,7 @@ construct_command_argv (char *line, char **restp, struct file *file,
strcpy (shell, p);
}
#endif
-#ifdef __EMX__
+#if MK_OS_OS2
{
static const char *unixroot = NULL;
static const char *last_shell = "";
@@ -3691,7 +3691,7 @@ construct_command_argv (char *line, char **restp, struct file *file,
free (buf);
}
}
-#endif /* __EMX__ */
+#endif /* MK_OS_OS2 */
var = lookup_variable_for_file (STRING_SIZE_TUPLE (".SHELLFLAGS"), file);
if (!var)
diff --git a/src/main.c b/src/main.c
index 1d5651d4..f7d398cd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -34,7 +34,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
# include "sub_proc.h"
# include "w32err.h"
#endif
-#ifdef __EMX__
+#if MK_OS_OS2
# include <sys/types.h>
# include <sys/wait.h>
#endif
@@ -1694,7 +1694,7 @@ main (int argc, char **argv, char **envp)
|| strneq (argv[0], "//", 2))
argv[0] = xstrdup (w32ify (argv[0], 1));
#else /* MK_OS_W32 */
-#if MK_OS_DOS || defined (__EMX__)
+#if MK_OS_DOS || MK_OS_OS2
if (strchr (argv[0], '\\'))
{
char *p;
@@ -1710,7 +1710,7 @@ main (int argc, char **argv, char **envp)
if (current_directory[0] != '\0'
&& argv[0] != 0
&& (argv[0][0] != '/' && (argv[0][0] == '\0' || argv[0][1] != ':'))
-# ifdef __EMX__
+# if MK_OS_OS2
/* do not prepend cwd if argv[0] contains no '/', e.g. "make" */
&& (strchr (argv[0], '/') != 0 || strchr (argv[0], '\\') != 0)
# endif
@@ -1946,7 +1946,7 @@ main (int argc, char **argv, char **envp)
f->last_mtime = f->mtime_before_update = f_mtime (f, 0);
}
-#ifndef __EMX__ /* Don't use a SIGCHLD handler for OS/2 */
+#if !MK_OS_OS2 /* Don't use a SIGCHLD handler for OS/2 */
#if !defined(HAVE_WAIT_NOHANG) || defined(MAKE_JOBSERVER)
/* Set up to handle children dying. This must be done before
reading in the makefiles so that 'shell' function calls will work.
@@ -2110,7 +2110,7 @@ main (int argc, char **argv, char **envp)
no_default_sh_exe = !find_and_set_default_shell (NULL);
#endif /* MK_OS_W32 */
-#if MK_OS_DOS || defined (__EMX__) || MK_OS_VMS
+#if MK_OS_DOS || MK_OS_OS2 || MK_OS_VMS
/* We need to know what kind of shell we will be using. */
{
extern int _is_unixy_shell (const char *_path);
@@ -2130,7 +2130,7 @@ main (int argc, char **argv, char **envp)
default_shell = shell_path;
}
}
-#endif /* MK_OS_DOS || __EMX__ */
+#endif /* MK_OS_DOS || MK_OS_OS2 */
/* Final jobserver configuration.
@@ -2155,9 +2155,9 @@ main (int argc, char **argv, char **envp)
else
job_slots = arg_job_slots;
-#if MK_OS_DOS || defined (__EMX__) || MK_OS_VMS
+#if MK_OS_DOS || MK_OS_OS2 || MK_OS_VMS
if (job_slots != 1
-# ifdef __EMX__
+# if MK_OS_OS2
&& _osmode != OS2_MODE /* turn off -j if we are in DOS mode */
# endif
)
@@ -2731,7 +2731,7 @@ main (int argc, char **argv, char **envp)
/* The exec'd "child" will be another make, of course. */
jobserver_pre_child(1);
-#if defined (__EMX__)
+#if MK_OS_OS2
{
/* It is not possible to use execve() here because this
would cause the parent process to be terminated with
diff --git a/src/makeint.h b/src/makeint.h
index 29a28f66..b92b761a 100644
--- a/src/makeint.h
+++ b/src/makeint.h
@@ -93,6 +93,10 @@ extern int errno;
# define MK_OS_ZOS 1
#endif
+#if defined(__EMX__)
+# define MK_OS_OS2 1
+#endif
+
#ifdef __VMS
# define MK_OS_VMS 1
/* In strict ANSI mode, VMS compilers should not be defining the
@@ -834,7 +838,7 @@ extern volatile sig_atomic_t handling_fatal_signal;
#endif
#ifndef initialize_main
-# ifdef __EMX__
+# if MK_OS_OS2
# define initialize_main(pargc, pargv) \
{ _wildcard(pargc, pargv); _response(pargc, pargv); }
# else
@@ -842,7 +846,7 @@ extern volatile sig_atomic_t handling_fatal_signal;
# endif
#endif
-#ifdef __EMX__
+#if MK_OS_OS2
# if !defined chdir
# define chdir _chdir2
# endif
diff --git a/src/misc.c b/src/misc.c
index 3ab44b34..c362e87e 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -28,7 +28,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
# include <io.h>
#endif
-#ifdef __EMX__
+#if MK_OS_OS2
# define INCL_DOS
# include <os2.h>
#endif
@@ -585,7 +585,7 @@ get_tmpdir ()
if (!tmpdir)
{
-#if MK_OS_DOS || MK_OS_W32 || defined (__EMX__)
+#if MK_OS_DOS || MK_OS_W32 || MK_OS_OS2
# define TMP_EXTRAS "TMP", "TEMP",
#else
# define TMP_EXTRAS
@@ -786,7 +786,7 @@ get_tmpfile (char **name)
}
-#if HAVE_TTYNAME && defined(__EMX__)
+#if HAVE_TTYNAME && MK_OS_OS2
/* OS/2 kLIBC has a declaration for ttyname(), so configure finds it.
But, it is not implemented! Roll our own. */
char *ttyname (int fd)
diff --git a/src/posixos.c b/src/posixos.c
index 0cc0a585..66f6e49c 100644
--- a/src/posixos.c
+++ b/src/posixos.c
@@ -557,7 +557,7 @@ set_child_handler_action_flags (int set_handler, int set_alarm)
{
struct sigaction sa;
-#ifdef __EMX__
+#if MK_OS_OS2
/* The child handler must be turned off here. */
signal (SIGCHLD, SIG_DFL);
#endif
diff --git a/src/read.c b/src/read.c
index f07cce15..a8539c3e 100644
--- a/src/read.c
+++ b/src/read.c
@@ -1895,7 +1895,7 @@ check_specials (struct nameseq *files, int set_default)
continue;
}
-#if !MK_OS_DOS && !defined (__EMX__)
+#if !MK_OS_DOS && !MK_OS_OS2
if (!one_shell && streq (nm, ".ONESHELL"))
{
one_shell = 1;
@@ -2673,7 +2673,7 @@ readline (struct ebuffer *ebuf)
/* We got a newline, so add one to the count of lines. */
++nlines;
-#if !MK_OS_W32 && !MK_OS_DOS && !defined(__EMX__)
+#if !MK_OS_W32 && !MK_OS_DOS && !MK_OS_OS2
/* Check to see if the line was really ended with CRLF; if so ignore
the CR. */
if ((p - start) > 1 && p[-2] == '\r')
diff --git a/src/variable.c b/src/variable.c
index 269d229b..cfb7dc03 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -893,7 +893,7 @@ define_automatic_variables (void)
(void) define_variable (shell_str, shlen, comp->value, o_env, 0);
}
}
-#elif defined(__EMX__)
+#elif MK_OS_OS2
{
static char shell_str[] = "SHELL";
const int shlen = sizeof (shell_str) - 1;
@@ -954,7 +954,7 @@ define_automatic_variables (void)
environment variable on MSDOS, so whoever sets it, does that on purpose.
On OS/2 we do not use SHELL from environment but we have already handled
that problem above. */
-#if !MK_OS_DOS && !defined(__EMX__)
+#if !MK_OS_DOS && !MK_OS_OS2
/* Don't let SHELL come from the environment. */
if (*v->value == '\0' || v->origin == o_env || v->origin == o_env_override)
{
diff --git a/src/vpath.c b/src/vpath.c
index a9f3f827..bb369455 100644
--- a/src/vpath.c
+++ b/src/vpath.c
@@ -231,7 +231,7 @@ construct_vpath_list (char *pattern, char *dirpath)
len = p - v;
/* Make sure there's no trailing slash,
but still allow "/" as a directory. */
-#if MK_OS_DOS || defined(__EMX__) || defined(HAVE_DOS_PATHS)
+#if MK_OS_DOS || MK_OS_OS2 || defined(HAVE_DOS_PATHS)
/* We need also to leave alone a trailing slash in "d:/". */
if (len > 3 || (len > 1 && v[1] != ':'))
#endif