diff options
author | John Malmberg <wb8tyw@qsl.net> | 2014-09-13 20:20:22 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2014-10-20 01:28:46 -0400 |
commit | 894ee7f6c8b96ed89d4672da6cde4105c15cbf31 (patch) | |
tree | 1d10c4e86225e29358467266a4eb8b8e9a9ade1a /main.c | |
parent | e75662bc6a96571f041bdad799eb557ff580135c (diff) | |
download | make-894ee7f6c8b96ed89d4672da6cde4105c15cbf31.tar.gz |
[SV 42447]: VMS simulate exporting symbols
This also includes fixing the most of the exit handling code for VMS.
Self tests:
Previously about 94 Tests in 36 categories fail.
Now about 45 tests in 22 categories fail.
Because some tests do not properly clean up, the number of tests that
fail can vary by one or two test cases between consecutive runs.
* Makefile.am: Add new VMS files.
* job.c: add prototype for vms_strsignal().
* job.c: (child_error): Remove VMS specific code as no longer needed.
* job.c: (reap_children): The VMS specific code was setting the
status to 0 instead of setting it to the proper exit status.
* job.h: Add vms_launch_status to struct child.
* main.c: (main): Use environment variables for options to use MCR
* instead of a foreign command, and to always use command files for
subprocesses.
For VMS use (set_program_name) routine which is common to ports of
other GNU packages to VMS to set the program name used internally.
Use (vms_putenv_symbol) to set up symbols to be visible in child
programs, including recursive make launched by execve()
Start of Bash shell detection code for VMS.
* makefile.com: Need nested_include=none for building on VMS search
lists. Add vms_progname, vms_exit, and vms_export_symbol.
* makefile.vms: Need nested_include=none for building on VMS search
lists. Add vms_progname, vms_exit, vms_export_symbol.
* makeint.h: Make sure non-standard "VMS" macro is defined. Add
prototypes for new VMS routines. Remove VMS-specific failure codes.
* vmsjobs.c: Add VMS POSIX exit code constants.
(_is_unixy_shell): Detect Bash shell.
(vms_strsignal): simulate strsignal() on VMS.
(vmsHandleChildTerm): fix to properly report failed LIB$SPAWN() exit
status codes. Remove code that duplicated code in job.c.
(child_execute_job): Export environment symbols before spawning a
child and restore afterward unless option to use command files for
subprocesses is set. Improve handling of UNIX null commands ":".
* vms_exit.c: Provides vms_exit() to detect if an exit code is UNIX
or VMS, and converts the UNIX code into a VMS exit code.
* vms_export_symbol.c: Routines to create DCL symbols that work like
shell aliases or exported shell symbols and clean them up on exit.
* vms_export_symbol_test.com: Unit test for vms_export_symbol.c
* vms_progname.c: New file: VMS specific replace for progname.c that
is used in some GNU projects.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 56 |
1 files changed, 48 insertions, 8 deletions
@@ -47,6 +47,10 @@ this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef _AMIGA int __stack = 20000; /* Make sure we have 20K of stack space */ #endif +#ifdef VMS +int vms_use_mcr_command = 0; +int vms_always_use_cmd_file = 0; +#endif void init_dir (void); void remote_setup (void); @@ -1190,14 +1194,38 @@ main (int argc, char **argv, char **envp) } } #endif - if (program == 0) #ifdef VMS - program = vms_progname(argv[0]); + set_program_name (argv[0]); + program = program_name; + { + const char *value; + value = getenv ("GNV$MAKE_USE_MCR"); + if (value != NULL) + vms_use_mcr_command = 1; + + value = getenv ("GNV$MAKE_USE_CMD_FILE"); + if (value != NULL) + switch (value[0]) + { + case '1': + case 'T': + case 't': + case 'e': + case 'E': + vms_always_use_cmd_file = 1; + break; + default: + vms_always_use_cmd_file = 0; + } + } + if (need_vms_symbol () && !vms_use_mcr_command) + create_foreign_command (program_name, argv[0]); #else + if (program == 0) program = argv[0]; -#endif else ++program; +#endif } /* Set up to access user data (files). */ @@ -1593,8 +1621,12 @@ main (int argc, char **argv, char **envp) /* The extra indirection through $(MAKE_COMMAND) is done for hysterical raisins. */ + #ifdef VMS - define_variable_cname("MAKE_COMMAND", vms_command(argv[0]), o_default, 0); + if (vms_use_mcr_command) + define_variable_cname ("MAKE_COMMAND", vms_command (argv[0]), o_default, 0); + else + define_variable_cname ("MAKE_COMMAND", program, o_default, 0); #else define_variable_cname ("MAKE_COMMAND", argv[0], o_default, 0); #endif @@ -1742,7 +1774,7 @@ main (int argc, char **argv, char **envp) _("Makefile from standard input specified twice.")); #ifdef VMS -# define DEFAULT_TMPDIR "sys$scratch:" +# define DEFAULT_TMPDIR "/sys$scratch/" #else # ifdef P_tmpdir # define DEFAULT_TMPDIR P_tmpdir @@ -1900,7 +1932,7 @@ main (int argc, char **argv, char **envp) no_default_sh_exe = !find_and_set_default_shell (NULL); #endif /* WINDOWS32 */ -#if defined (__MSDOS__) || defined (__EMX__) +#if defined (__MSDOS__) || defined (__EMX__) || defined (VMS) /* We need to know what kind of shell we will be using. */ { extern int _is_unixy_shell (const char *_path); @@ -2355,12 +2387,18 @@ main (int argc, char **argv, char **envp) { *p = alloca (40); sprintf (*p, "%s=%u", MAKELEVEL_NAME, makelevel); +#ifdef VMS + vms_putenv_symbol (*p); +#endif } else if (strneq (*p, "MAKE_RESTARTS=", CSTRLEN ("MAKE_RESTARTS="))) { *p = alloca (40); sprintf (*p, "MAKE_RESTARTS=%s%u", OUTPUT_IS_TRACED () ? "-" : "", restarts); +#ifdef VMS + vms_putenv_symbol (*p); +#endif restarts = 0; } } @@ -2385,6 +2423,9 @@ main (int argc, char **argv, char **envp) sprintf (b, "MAKE_RESTARTS=%s%u", OUTPUT_IS_TRACED () ? "-" : "", restarts); putenv (b); +#ifdef __VMS + vms_putenv_symbol (b); +#endif } fflush (stdout); @@ -2529,8 +2570,7 @@ main (int argc, char **argv, char **envp) makefile_status = MAKE_TROUBLE; break; case us_failed: - /* Updating failed. POSIX.2 specifies exit status >1 for this; - but in VMS, there is only success and failure. */ + /* Updating failed. POSIX.2 specifies exit status >1 for this; */ makefile_status = MAKE_FAILURE; break; } |