diff options
author | Richard Stallman <rms@gnu.org> | 1993-06-29 04:37:51 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-06-29 04:37:51 +0000 |
commit | d19184d67aa96de07e25e8f8f6adb4f33042caa6 (patch) | |
tree | b5c2b6c6ba722ebeee9bffc2277b59393951b077 /gcc/cccp.c | |
parent | b9654711e95a6cfe8f482c446cf9eba6e2310956 (diff) | |
download | gcc-d19184d67aa96de07e25e8f8f6adb4f33042caa6.zip gcc-d19184d67aa96de07e25e8f8f6adb4f33042caa6.tar.gz gcc-d19184d67aa96de07e25e8f8f6adb4f33042caa6.tar.bz2 |
(main): For -iwithprefix, if no include_prefix,
make a default from GCC_INCLUDE_DIR.
Support -iwithprefixbefore.
From-SVN: r4793
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r-- | gcc/cccp.c | 43 |
1 files changed, 41 insertions, 2 deletions
@@ -1101,6 +1101,16 @@ main (argc, argv) with the default prefix at the front of its name. */ if (!strcmp (argv[i], "-iwithprefix")) { struct file_name_list *dirtmp; + char *prefix; + + if (include_prefix != 0) + prefix = include_prefix; + else { + prefix = savestring (GCC_INCLUDE_DIR); + /* Remove the `include' from /usr/local/lib/gcc.../include. */ + if (!strcmp (prefix + strlen (prefix) - 8, "/include")) + prefix[strlen (prefix) - 7] = 0; + } dirtmp = (struct file_name_list *) xmalloc (sizeof (struct file_name_list)); @@ -1110,8 +1120,8 @@ main (argc, argv) fatal ("Directory name missing after `-iwithprefix' option"); dirtmp->fname = (char *) xmalloc (strlen (argv[i+1]) - + strlen (include_prefix) + 1); - strcpy (dirtmp->fname, include_prefix); + + strlen (prefix) + 1); + strcpy (dirtmp->fname, prefix); strcat (dirtmp->fname, argv[++i]); if (after_include == 0) @@ -1120,6 +1130,35 @@ main (argc, argv) last_after_include->next = dirtmp; last_after_include = dirtmp; /* Tail follows the last one */ } + /* Add directory to main path for includes, + with the default prefix at the front of its name. */ + if (!strcmp (argv[i], "-iwithprefixbefore")) { + struct file_name_list *dirtmp; + char *prefix; + + if (include_prefix != 0) + prefix = include_prefix; + else { + prefix = savestring (GCC_INCLUDE_DIR); + /* Remove the `include' from /usr/local/lib/gcc.../include. */ + if (!strcmp (prefix + strlen (prefix) - 8, "/include")) + prefix[strlen (prefix) - 7] = 0; + } + + dirtmp = (struct file_name_list *) + xmalloc (sizeof (struct file_name_list)); + dirtmp->next = 0; /* New one goes on the end */ + dirtmp->control_macro = 0; + if (i + 1 == argc) + fatal ("Directory name missing after `-iwithprefixbefore' option"); + + dirtmp->fname = (char *) xmalloc (strlen (argv[i+1]) + + strlen (prefix) + 1); + strcpy (dirtmp->fname, prefix); + strcat (dirtmp->fname, argv[++i]); + + append_include_chain (dirtmp, dirtmp); + } /* Add directory to end of path for includes. */ if (!strcmp (argv[i], "-idirafter")) { struct file_name_list *dirtmp; |