*** gcc/gcc/gcc.c Tue Mar 11 01:42:18 2003 --- gcc.qnx/gcc/gcc.c Mon Apr 14 16:41:57 2003 *************** static int target_system_root_changed; *** 215,220 **** --- 215,231 ---- /* Nonzero means write "temp" files in source directory and use the source file's name in them, and don't delete them. */ + /* Nonzero means append this string to target_system_root. */ + + static const char *target_sysroot_subdir = 0; + + /* Nonzero means append this string to target_system_root for headers. */ + + static const char *target_sysroot_hdrs_subdir = 0; + + /* Nonzero means write "temp" files in source directory + and use the source file's name in them, and don't delete them. */ + static int save_temps_flag; /* Nonzero means use pipes to communicate between subprocesses. *************** proper position among the other output f *** 699,704 **** --- 710,723 ---- # define STARTFILE_PREFIX_SPEC "" #endif + #ifndef SYSROOT_SUBDIR_SPEC + # define SYSROOT_SUBDIR_SPEC "" + #endif + + #ifndef SYSROOT_HEADERS_SUBDIR_SPEC + # define SYSROOT_HEADERS_SUBDIR_SPEC "" + #endif + static const char *asm_debug; static const char *cpp_spec = CPP_SPEC; static const char *cpp_predefines = CPP_PREDEFINES; *************** static const char *linker_name_spec = LI *** 717,722 **** --- 736,743 ---- static const char *link_command_spec = LINK_COMMAND_SPEC; static const char *link_libgcc_spec = LINK_LIBGCC_SPEC; static const char *startfile_prefix_spec = STARTFILE_PREFIX_SPEC; + static const char *target_sysroot_subdir_spec = SYSROOT_SUBDIR_SPEC; + static const char *sysroot_headers_subdir_spec = SYSROOT_HEADERS_SUBDIR_SPEC; /* Standard options to cpp, cc1, and as, to reduce duplication in specs. There should be no need to override these in target dependent files, *************** add_sysrooted_prefix (pprefix, prefix, c *** 2594,2600 **** --- 2615,2632 ---- if (target_system_root) { + if (target_sysroot_subdir) + { + prefix = concat (target_sysroot_subdir, prefix, NULL); + + /* Make sure there is a directory separator + between target_system_root and target_sysroot_subdir. */ + if (!IS_DIR_SEPARATOR (target_sysroot_subdir[0]) + && !IS_DIR_SEPARATOR (target_system_root[strlen(target_system_root) -1])) + prefix = concat (dir_separator_str, prefix, NULL); + } prefix = concat (target_system_root, prefix, NULL); + /* We have to override this because GCC's notion of sysroot moves along with GCC. */ component = "GCC"; *************** do_spec_1 (spec, inswitch, soft_matched_ *** 4756,4767 **** do_spec_1 (" ", 0, NULL); } ! if (target_system_root_changed) { do_spec_1 ("-isysroot", 1, NULL); /* Make this a separate argument. */ do_spec_1 (" ", 0, NULL); do_spec_1 (target_system_root, 1, NULL); do_spec_1 (" ", 0, NULL); } --- 4788,4810 ---- do_spec_1 (" ", 0, NULL); } ! if (target_system_root_changed || ! (target_system_root && target_sysroot_hdrs_subdir)) { do_spec_1 ("-isysroot", 1, NULL); /* Make this a separate argument. */ do_spec_1 (" ", 0, NULL); do_spec_1 (target_system_root, 1, NULL); + if (target_sysroot_hdrs_subdir) + { + /* Make sure there is a directory separator between + target_system_root and target_sysroot_hdrs_subdir. */ + if (!IS_DIR_SEPARATOR (target_sysroot_hdrs_subdir[0]) + && !IS_DIR_SEPARATOR (target_system_root[strlen(target_system_root) -1])) + do_spec_1 (dir_separator_str, 0, NULL); + + do_spec_1 (target_sysroot_hdrs_subdir, 1, NULL); + } do_spec_1 (" ", 0, NULL); } *************** do_spec_1 (spec, inswitch, soft_matched_ *** 5133,5140 **** /* We assume there is a directory separator at the end of this string. */ if (target_system_root) ! obstack_grow (&obstack, target_system_root, ! strlen (target_system_root)); break; case 'S': --- 5176,5196 ---- /* We assume there is a directory separator at the end of this string. */ if (target_system_root) ! { ! obstack_grow (&obstack, target_system_root, ! strlen (target_system_root)); ! if (target_sysroot_subdir) ! { ! /* Make sure there is a directory separator ! between target_system_root and target_sysroot_subdir. */ ! if (!IS_DIR_SEPARATOR (target_sysroot_subdir[0]) ! && !IS_DIR_SEPARATOR (target_system_root[strlen(target_system_root) -1])) ! obstack_grow (&obstack, dir_separator_str, ! strlen (dir_separator_str)); ! obstack_grow (&obstack, target_sysroot_subdir, ! strlen (target_sysroot_subdir)); ! } ! } break; case 'S': *************** main (argc, argv) *** 6209,6214 **** --- 6265,6286 ---- add_prefix (&exec_prefixes, md_exec_prefix, "GCC", PREFIX_PRIORITY_LAST, 0, NULL, 0); } + } + + /* Process target_sysroot_subdir_spec. */ + if (*target_sysroot_subdir_spec != 0 + && do_spec_2 (target_sysroot_subdir_spec) == 0) + { + if (argbuf_index > 0) + target_sysroot_subdir = xstrdup(argbuf[argbuf_index -1]); + } + + /* Process sysroot_headers_subdir_spec. */ + if (*sysroot_headers_subdir_spec != 0 + && do_spec_2 (sysroot_headers_subdir_spec) == 0) + { + if (argbuf_index > 0) + target_sysroot_hdrs_subdir = xstrdup(argbuf[argbuf_index -1]); } /* Look for startfiles in the standard places. */