* configure.in (arm-*-netbsdelf*): Enable building java libraries.
[official-gcc.git] / gcc / gccspec.c
blobc30306c54f96516d624993786e55e49ee3b9b341
1 /* Specific flags and argument handling of the C front-end.
2 Copyright (C) 1999, 2001 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "gcc.h"
27 /* Filter argc and argv before processing by the gcc driver proper. */
28 void
29 lang_specific_driver (in_argc, in_argv, in_added_libraries)
30 int *in_argc ATTRIBUTE_UNUSED;
31 const char *const **in_argv ATTRIBUTE_UNUSED;
32 int *in_added_libraries ATTRIBUTE_UNUSED;
34 #ifdef ENABLE_SHARED_LIBGCC
35 int i;
37 /* The new argument list will be contained in this. */
38 const char **arglist;
40 /* True if we should add -shared-libgcc to the command-line. */
41 int shared_libgcc = 0;
43 /* The total number of arguments with the new stuff. */
44 int argc;
46 /* The argument list. */
47 const char *const *argv;
49 argc = *in_argc;
50 argv = *in_argv;
52 for (i = 1; i < argc; i++)
54 if (argv[i][0] == '-')
56 if (strcmp (argv[i], "-static-libgcc") == 0
57 || strcmp (argv[i], "-static") == 0)
58 return;
60 else
62 int len;
64 /* If the filename ends in .m or .mi, we are compiling ObjC
65 and want to pass -shared-libgcc. */
66 len = strlen (argv[i]);
67 if ((len > 2 && argv[i][len - 2] == '.' && argv[i][len - 1] == 'm')
68 || (len > 3 && argv[i][len - 3] == '.' && argv[i][len - 2] == 'm'
69 && argv[i][len - 1] == 'i'))
70 shared_libgcc = 1;
74 if (shared_libgcc)
76 /* Make sure to have room for the trailing NULL argument. */
77 arglist = (const char **) xmalloc ((argc+2) * sizeof (char *));
79 i = 0;
82 arglist[i] = argv[i];
83 i++;
85 while (i < argc);
87 arglist[i++] = "-shared-libgcc";
89 arglist[i] = NULL;
91 *in_argc = i;
92 *in_argv = arglist;
94 #endif
97 /* Called before linking. Returns 0 on success and -1 on failure. */
98 int
99 lang_specific_pre_link ()
101 return 0; /* Not used for C. */
104 /* Number of extra output files that lang_specific_pre_link may generate. */
105 int lang_specific_extra_outfiles = 0; /* Not used for C. */
107 /* Table of language-specific spec functions. */
108 const struct spec_function lang_specific_spec_functions[] =
110 { 0, 0 }