#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
#endif
+/* This macro defines command-line switches that modify the default
+ target name.
+
+ The definition is be an initializer for an array of structures. Each
+ array element has have three elements: the switch name, one of the
+ enumeration codes ADD or DELETE to indicate whether the string should be
+ inserted or deleted, and the string to be inserted or deleted. */
+#define MODIFY_TARGET_NAME {{"-32", DELETE, "64"}, {"-64", ADD, "64"}}
+
/* Make gcc agree with <machine/ansi.h> */
#define SIZE_TYPE "unsigned int"
static const char *cross_compile = "0";
#endif
+#ifdef MODIFY_TARGET_NAME
+
+/* Information on how to alter the target name based on a command-line
+ switch. The only case we support now is simply appending or deleting a
+ string to or from the end of the first part of the configuration name. */
+
+struct modify_target
+{
+ const char *sw;
+ enum add_del {ADD, DELETE} add_del;
+ const char *str;
+}
+modify_target[] = MODIFY_TARGET_NAME;
+#endif
+
/* The number of errors that have occurred; the link phase will not be
run if this is non-zero. */
static int error_count = 0;
const char *const *argv;
{
register int i;
+ unsigned int j;
const char *temp;
char *temp1;
const char *spec_lang = 0;
int have_c = 0;
int have_o = 0;
int lang_n_infiles = 0;
+#ifdef MODIFY_TARGET_NAME
+ int is_modify_target_name;
+#endif
GET_ENV_PATH_LIST (gcc_exec_prefix, "GCC_EXEC_PREFIX");
/* Scan argv twice. Here, the first time, just count how many switches
there will be in their vector, and how many input files in theirs.
+ Also parse any switches that determine the configuration name, such as -b.
Here we also parse the switches that cc itself uses (e.g. -v). */
for (i = 1; i < argc; i++)
default:
normal_switch:
+
+#ifdef MODIFY_TARGET_NAME
+ is_modify_target_name = 0;
+
+ for (j = 0;
+ j < sizeof modify_target / sizeof modify_target[0]; j++)
+ if (! strcmp (argv[i], modify_target[j].sw))
+ {
+ char *new_name
+ = (char *) xmalloc (strlen (modify_target[j].str)
+ + strlen (spec_machine));
+ const char *p, *r;
+ char *q;
+ int made_addition = 0;
+
+ is_modify_target_name = 1;
+ for (p = spec_machine, q = new_name; *p != 0; )
+ {
+ if (modify_target[j].add_del == DELETE
+ && (! strncmp (q, modify_target[j].str,
+ strlen (modify_target[j].str))))
+ p += strlen (modify_target[j].str);
+ else if (modify_target[j].add_del == ADD
+ && ! made_addition && *p == '-')
+ {
+ for (r = modify_target[j].str; *r != 0; )
+ *q++ = *r++;
+ made_addition = 1;
+ }
+
+ *q++ = *p++;
+ }
+
+ spec_machine = new_name;
+ }
+
+ if (is_modify_target_name)
+ break;
+#endif
+
n_switches++;
if (SWITCH_TAKES_ARG (c) > (p[1] != 0))
for (i = 1; i < argc; i++)
{
/* Just skip the switches that were handled by the preceding loop. */
+#ifdef MODIFY_TARGET_NAME
+ is_modify_target_name = 0;
+
+ for (j = 0; j < sizeof modify_target / sizeof modify_target[0]; j++)
+ if (! strcmp (argv[i], modify_target[j].sw))
+ is_modify_target_name = 1;
+
+ if (is_modify_target_name)
+ ;
+ else
+#endif
if (! strncmp (argv[i], "-Wa,", 4))
;
else if (! strncmp (argv[i], "-Wp,", 4))
Cross compilers do not use this macro and do not search either
@file{/usr/local/include} or its replacement.
+@findex MODIFY_TARGET_NAME
+@item MODIFY_TARGET_NAME
+Define this macro if you with to define command-line switches that modify the
+default target name
+
+For each switch, you can include a string to be appended to the first
+part of the configuration name or a string to be deleted from the
+configuration name, if present. The definition should be an initializer
+for an array of structures. Each array element should have three
+elements: the switch name (a string constant, including the initial
+dash), one of the enumeration codes @code{ADD} or @code{DELETE} to
+indicate whether the string should be inserted or deleted, and the string
+to be inserted or deleted (a string constant).
+
+For example, on a machine where @samp{64} at the end of the
+configuration name denotes a 64-bit target and you want the @samp{-32}
+and @samp{-64} switches to select between 32- and 64-bit targets, you would
+code
+
+@smallexample
+#define MODIFY_TARGET_NAME \
+ @{ @{ "-32", DELETE, "64"@}, \
+ @{"-64", ADD, "64"@}@}
+@end smallexample
+
+
@findex SYSTEM_INCLUDE_DIR
@item SYSTEM_INCLUDE_DIR
Define this macro as a C string constant if you wish to specify a