diff options
Diffstat (limited to 'contrib/gcc/gcc.c')
-rw-r--r-- | contrib/gcc/gcc.c | 77 |
1 files changed, 71 insertions, 6 deletions
diff --git a/contrib/gcc/gcc.c b/contrib/gcc/gcc.c index 08a37cd..42b3094 100644 --- a/contrib/gcc/gcc.c +++ b/contrib/gcc/gcc.c @@ -22,6 +22,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA This paragraph is here to try to keep Sun CC from dying. The number of chars here seems crucial!!!! */ +/* $FreeBSD$ */ + /* This program is the user interface to the C compiler and possibly to other compilers. It is used because compilation is a complicated procedure which involves running several programs and passing temporary files between @@ -1320,9 +1322,11 @@ static const char *gcc_exec_prefix; #ifndef TOOLDIR_BASE_PREFIX #define TOOLDIR_BASE_PREFIX "/usr/local/" #endif +#ifndef FREEBSD_NATIVE #ifndef STANDARD_BINDIR_PREFIX #define STANDARD_BINDIR_PREFIX "/usr/local/bin" #endif +#endif /* not FREEBSD_NATIVE */ static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX; static const char *const standard_exec_prefix_1 = "/usr/lib/gcc/"; @@ -1337,7 +1341,9 @@ static const char *const standard_startfile_prefix_2 = "/usr/lib/"; static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX; static const char *tooldir_prefix; +#ifndef FREEBSD_NATIVE static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX; +#endif /* not FREEBSD_NATIVE */ /* Subdirectory to use for locating libraries. Set by set_multilib_dir based on the compilation options. */ @@ -1556,9 +1562,6 @@ init_spec () #else "-lgcc_s%M" #endif -#ifdef USE_LIBUNWIND_EXCEPTIONS - " -lunwind" -#endif , "-lgcc", "-lgcc_eh"); @@ -3088,6 +3091,7 @@ process_command (argc, argv) /* Set up the default search paths. If there is no GCC_EXEC_PREFIX, see if we can create it from the pathname specified in argv[0]. */ +#ifndef FREEBSD_NATIVE #ifndef VMS /* FIXME: make_relative_prefix doesn't yet work for VMS. */ if (!gcc_exec_prefix) @@ -3098,6 +3102,7 @@ process_command (argc, argv) putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL)); } #endif +#endif /* not FREEBSD_NATIVE */ if (gcc_exec_prefix) { @@ -3224,6 +3229,44 @@ process_command (argc, argv) } } + /* Options specified as if they appeared on the command line. */ + temp = getenv ("GCC_OPTIONS"); + if ((temp) && (strlen (temp) > 0)) + { + int len; + int optc = 1; + int new_argc; + const char **new_argv; + char *envopts; + + while (isspace (*temp)) + temp++; + len = strlen (temp); + envopts = (char *) xmalloc (len + 1); + strcpy (envopts, temp); + + for (i = 0; i < (len - 1); i++) + if ((isspace (envopts[i])) && ! (isspace (envopts[i+1]))) + optc++; + + new_argv = (const char **) alloca ((optc + argc) * sizeof(char *)); + + for (i = 0, new_argc = 1; new_argc <= optc; new_argc++) + { + while (isspace (envopts[i])) + i++; + new_argv[new_argc] = envopts + i; + while (!isspace (envopts[i]) && (envopts[i] != '\0')) + i++; + envopts[i++] = '\0'; + } + for (i = 1; i < argc; i++) + new_argv[new_argc++] = argv[i]; + + argv = new_argv; + argc = new_argc; + } + /* Convert new-style -- options to old-style. */ translate_options (&argc, &argv); @@ -3623,19 +3666,27 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" (such as cpp) rather than those of the host system. */ /* Use 2 as fourth arg meaning try just the machine as a suffix, as well as trying the machine and the version. */ +#ifdef FREEBSD_NATIVE + add_prefix (&exec_prefixes, PREFIX"/bin/", "BINUTILS", + 0, 0, warn_std_ptr, 0); +#endif /* FREEBSD_NATIVE */ #ifndef OS2 add_prefix (&exec_prefixes, standard_exec_prefix, "GCC", PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0); add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0); +#ifndef FREEBSD_NATIVE add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS", PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0); +#endif /* not FREEBSD_NATIVE */ #endif +#ifndef FREEBSD_NATIVE add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0); add_prefix (&startfile_prefixes, standard_exec_prefix_1, "BINUTILS", PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0); +#endif /* not FREEBSD_NATIVE */ tooldir_prefix = concat (tooldir_base_prefix, spec_machine, dir_separator_str, NULL); @@ -3670,12 +3721,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" dir_separator_str, tooldir_prefix, NULL); } +#ifndef FREEBSD_NATIVE add_prefix (&exec_prefixes, concat (tooldir_prefix, "bin", dir_separator_str, NULL), "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 0); add_prefix (&startfile_prefixes, concat (tooldir_prefix, "lib", dir_separator_str, NULL), "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1); +#endif /* FREEBSD_NATIVE */ /* More prefixes are enabled in main, after we read the specs file and determine whether this is cross-compilation or not. */ @@ -5757,6 +5810,7 @@ is_directory (path1, path2, linker) *cp++ = '.'; *cp = '\0'; +#ifndef FREEBSD_NATIVE /* Exclude directories that the linker is known to search. */ if (linker && ((cp - path == 6 @@ -5767,6 +5821,7 @@ is_directory (path1, path2, linker) dir_separator_str, "lib", dir_separator_str, ".", NULL)) == 0))) return 0; +#endif /* FREEBSD_NATIVE */ return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode)); } @@ -5957,9 +6012,13 @@ main (argc, argv) /* Read specs from a file if there is one. */ +#ifdef FREEBSD_NATIVE + just_machine_suffix = ""; +#else /* FREEBSD_NATIVE */ machine_suffix = concat (spec_machine, dir_separator_str, spec_version, dir_separator_str, NULL); just_machine_suffix = concat (spec_machine, dir_separator_str, NULL); +#endif /* FREEBSD_NATIVE */ specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, 0); /* Read the specs file unless it is a default one. */ @@ -5970,11 +6029,11 @@ main (argc, argv) /* We need to check standard_exec_prefix/just_machine_suffix/specs for any override of as, ld and libraries. */ - specs_file = (char *) alloca (strlen (standard_exec_prefix) + specs_file = (char *) alloca (strlen (FBSD_DATA_PREFIX) + strlen (just_machine_suffix) + sizeof ("specs")); - strcpy (specs_file, standard_exec_prefix); + strcpy (specs_file, FBSD_DATA_PREFIX); strcat (specs_file, just_machine_suffix); strcat (specs_file, "specs"); if (access (specs_file, R_OK) == 0) @@ -6022,10 +6081,12 @@ main (argc, argv) NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1); } +#ifndef FREEBSD_NATIVE add_prefix (&startfile_prefixes, standard_startfile_prefix_1, "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1); add_prefix (&startfile_prefixes, standard_startfile_prefix_2, "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1); +#endif /* not FREEBSD_NATIVE */ #if 0 /* Can cause surprises, and one can use -B./ instead. */ add_prefix (&startfile_prefixes, "./", NULL, PREFIX_PRIORITY_LAST, 1, NULL, 0); @@ -6039,6 +6100,10 @@ main (argc, argv) concat (gcc_exec_prefix, machine_suffix, standard_startfile_prefix, NULL), "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1); +#ifdef CROSS_STARTFILE_PREFIX + add_prefix (&startfile_prefixes, CROSS_STARTFILE_PREFIX, "BINUTILS", + PREFIX_PRIORITY_LAST, 0, NULL, 1); +#endif } if (*startfile_prefix_spec != 0 @@ -6194,7 +6259,7 @@ main (argc, argv) } if (n_infiles == added_libraries) - fatal ("no input files"); + fatal ("No input files specified"); /* Make a place to record the compiler output file names that correspond to the input files. */ |