# DP: Add D options and specs for the gcc driver.

--- /dev/null
+++ b/src/gcc/d/lang-specs.h
@@ -0,0 +1,53 @@
+/* GDC -- D front-end for GCC
+   Copyright (C) 2004 David Friedman
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef D_D_SPEC
+#define D_D_SPEC 0
+#endif
+
+/* %{!M} probably doesn't make sense because we would need
+   to do that -- -MD and -MMD doesn't sound like a plan for D.... */
+
+/* %(d_options) ? */
+
+#if D_DRIVER_ONLY
+{".html", "@d", 0, 1, 0 },
+{".HTML", "@d", 0, 1, 0 },
+{".htm", "@d", 0, 1, 0 },
+{".HTM", "@d", 0, 1, 0 },
+{".xhtml", "@d", 0, 1, 0 },
+{".XHTML", "@d", 0, 1, 0 },
+{".d", "@d", 0, 1, 0 },
+{".D", "@d", 0, 1, 0 },
+{".dd", "@d", 0, 1, 0 },
+{".DD", "@d", 0, 1, 0 },
+{".di", "@d", 0, 1, 0 },
+{".DI", "@d", 0, 1, 0 },
+{"@d",
+     "%{!E:cc1d %i %(cc1_options) %(cc1d) %I %N %{nostdinc*} %{+e*} %{I*} %{J*}\
+      %{M} %{MM} %{!fsyntax-only:%(invoke_as)}}", D_D_SPEC, 1, 0 },
+#else
+{".d", "@d", 0, 1, 0 },
+{".D", "@d", 0, 1, 0 },
+{".di", "@d", 0, 1, 0 },
+{".DI", "@d", 0, 1, 0 },
+{"@d",
+     "%{!E:cc1d %i %(cc1_options) %(cc1d) %I %N %{nostdinc*} %{+e*} %{I*} %{J*}\
+      %{M} %{MM} %{!fsyntax-only:%(invoke_as)}}", D_D_SPEC, 1, 0 },
+#endif
+
--- /dev/null
+++ b/src/gcc/d/lang.opt
@@ -0,0 +1,215 @@
+; GDC -- D front-end for GCC
+; Copyright (C) 2004 David Friedman
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License as published by
+; the Free Software Foundation; either version 2 of the License, or
+; (at your option) any later version.
+;
+; This program is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this program; if not, write to the Free Software
+; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+; This is used in GCC 3.4+
+; %% TODO cleanup in ASCII collating order.
+
+Language
+D
+
+I
+D Joined Separate
+-I <dir>	Add <dir> to the end of the main include path.
+
+J
+D Joined Separate
+-J <dir>	Add <dir> to the end of the string import path.
+
+fdeprecated
+D
+Allow use of deprecated features
+
+fassert
+D
+Generate runtime code for assert()'s
+
+frelease
+D
+Compile release version
+
+; For D: defaults to on
+fbounds-check
+D
+Generate code to check bounds before indexing arrays
+
+funittest
+D
+Compile in unittest code
+
+fversion=
+D Joined RejectNegative
+-fversion=<level|ident> Compile in version code >= <level> or identified by <ident>
+
+fdebug=
+D Joined RejectNegative
+-fdebug,-fdebug=<level>,-fdebug=<ident> Compile in debug code, code <= level, or code identified by ident
+
+fdebug
+D
+Compile in debug code
+
+fdebug-c
+D
+With -g, generate C debug information for debugger compatibility
+
+fdeps=
+D Joined RejectNegative
+-fdeps=<filename> Write module dependencies to filename
+
+fd-verbose
+D
+Print information about D language processing to stdout
+
+fd-vtls
+D
+List all variables going into thread local storage
+
+fd-version=1
+D RejectNegative
+Compile as D language version 1
+
+femit-templates=
+D Joined RejectNegative
+-femit-templates=[normal|private|all|none|auto]	Control template emission
+
+femit-templates
+D
+-femit-templates Emit templates code and data even if the linker cannot merge multiple copies
+
+nostdinc
+D
+Do not search standard system include directories
+
+fonly=
+D Joined RejectNegative
+Process all modules specified on the command line, but only generate code for the module specified by the argument.
+
+fignore-unknown-pragmas
+D
+Ignore unsupported pragmas
+
+fproperty
+D
+Enforce property syntax
+
+fintfc
+Generate D interface files
+
+fintfc-dir=
+D Joined RejectNegative
+-fintfc-dir=<dir> Write D interface files to directory <dir>
+
+fintfc-file=
+D Joined RejectNegative
+-fintfc-file=<filename> Write D interface file to <filename>
+
+fdoc
+D
+Generate documentation
+
+fdoc-dir=
+D Joined RejectNegative
+-fdoc-dir=<docdir> Write documentation file to docdir directory
+
+fdoc-file=
+D Joined RejectNegative
+-fdoc-file=<filename> Write documentation file to filename
+
+fdoc-inc=
+D Joined RejectNegative
+-fdoc-inc=<filename> Include a Ddoc macro file
+
+fmultilib-dir=
+D Joined RejectNegative
+-fmultilib-dir=<dir> Select header multilib subdirectory
+
+Wsign-compare
+D
+Warn about signed-unsigned comparisons
+
+fdump-source
+D RejectNegative
+Dump decoded UTF-8 text and source from HTML
+
+fasm
+D
+Recognize the \"asm\" keyword
+
+fbuiltin
+D
+Recognize built-in functions
+
+funsigned-char
+D
+Make \"char\" unsigned by default (silently ignored in D)
+
+fsigned-char
+D
+Make \"char\" signed by default (silently ignored in D)
+
+imultilib
+D Joined Separate
+-imultilib <dir> Set <dir> to be the multilib include subdirectory
+
+iprefix
+D Joined Separate
+-iprefix <path>	Specify <path> as a prefix for next two options
+
+isysroot
+D Joined Separate
+-isysroot <dir>	Set <dir> to be the system root directory
+
+isystem
+D Joined Separate
+-isystem <dir>	Add <dir> to the start of the system include path
+
+Wall
+D
+Enable most warning messages
+
+Werror
+D
+Error out the compiler on warnings
+
+fXf=
+D Joined RejectNegative
+-fXf=<filename> Write JSON file to <filename>
+
+
+; Everything below this line is used in 4.6+
+
+debuglib=
+Driver Joined
+Debug library to use instead of phobos
+
+defaultlib=
+Driver Joined
+Default library to use instead of phobos
+
+fod=
+Driver Joined
+-fod=<directory> Specify the object output directory.
+
+fop
+Driver
+Specify that the source file's parent directories should be appended to the object output directory.
+
+nophoboslib
+Driver
+
+static_libphobos
+Driver
--- a/src/gcc/gcc.c
+++ b/src/gcc/gcc.c
@@ -373,6 +373,7 @@
 	assembler has done its job.
  %D	Dump out a -L option for each directory in startfile_prefixes.
 	If multilib_dir is set, extra entries are generated with it affixed.
+ %N	Output the currently selected multilib directory name.
  %l     process LINK_SPEC as a spec.
  %L     process LIB_SPEC as a spec.
  %G     process LIBGCC_SPEC as a spec.
@@ -5095,6 +5096,17 @@
 	      return value;
 	    break;
 
+          case 'N':
+	    if (multilib_dir)
+	      {
+		arg_going = 1;
+		obstack_grow (&obstack, "-fmultilib-dir=",
+			      strlen ("-fmultilib-dir="));
+		obstack_grow (&obstack, multilib_dir,
+			      strlen (multilib_dir));
+	      }
+	    break;
+
 	    /* Here we define characters other than letters and digits.  */
 
 	  case '{':
