56968bf230668912a6aa093b68b5ff4c9fda59c6
[dragonfly.git] / gnu / usr.bin / cc41 / cc_prep / config / dragonfly-spec.h
1 /* $DragonFly: src/gnu/usr.bin/cc41/cc_prep/config/dragonfly-spec.h,v 1.4 2007/04/17 12:18:37 corecode Exp $ */
2
3 /* Base configuration file for all DragonFly targets.
4    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 /* Common DragonFly configuration. 
24    All DragonFly architectures should include this file, which will specify
25    their commonalities.
26
27    Adapted from gcc/config/freebsd-spec.h by
28    Joerg Sonnenberger <joerg@bec.de>
29
30    Adapted from gcc/config/freebsd.h by 
31    David O'Brien <obrien@FreeBSD.org>
32    Loren J. Rittle <ljrittle@acm.org>.  */
33
34
35 /* This defines which switch letters take arguments.  On DragonFly, most of
36    the normal cases (defined in gcc.c) apply, and we also have -h* and
37    -z* options (for the linker) (coming from SVR4).
38    We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
39
40 #define DFBSD_SWITCH_TAKES_ARG(CHAR)                                    \
41   (DEFAULT_SWITCH_TAKES_ARG (CHAR)                                      \
42     || (CHAR) == 'h'                                                    \
43     || (CHAR) == 'z' /* ignored by ld */                                \
44     || (CHAR) == 'R')
45
46 /* This defines which multi-letter switches take arguments.  */
47
48 #define DFBSD_WORD_SWITCH_TAKES_ARG(STR)                                        \
49   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                  \
50    || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")         \
51    || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym")            \
52    || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
53
54 #define DFBSD_TARGET_OS_CPP_BUILTINS()                                  \
55   do                                                                    \
56     {                                                                   \
57         if (DFBSD_MAJOR == 3)                                   \
58           builtin_define ("__DragonFly__=3");                           \
59         else if (DFBSD_MAJOR == 2)                                      \
60           builtin_define ("__DragonFly__=2");                           \
61         else if (DFBSD_MAJOR == 1)                                      \
62           builtin_define ("__DragonFly__=1");                           \
63         else                                                            \
64           builtin_define ("__DragonFly__");                             \
65         builtin_define ("__DragonFly_cc_version=100001");               \
66         builtin_define_std ("unix");                                    \
67         builtin_define ("__KPRINTF_ATTRIBUTE__");                       \
68         builtin_assert ("system=unix");                                 \
69         builtin_assert ("system=bsd");                                  \
70         builtin_assert ("system=DragonFly");                            \
71         DFBSD_TARGET_CPU_CPP_BUILTINS();                                        \
72     }                                                                   \
73   while (0)
74
75 /* Define the default DragonFly-specific per-CPU hook code. */
76 #define DFBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
77
78 /* Provide a CPP_SPEC appropriate for DragonFly.  We just deal with the GCC 
79    option `-posix', and PIC issues.  */
80
81 #define DFBSD_CPP_SPEC "                                                        \
82   %(cpp_cpu)                                                            \
83   %{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__}                            \
84   %{posix:-D_POSIX_SOURCE}"
85
86 /* Provide a STARTFILE_SPEC appropriate for DragonFly.  Here we add
87    the magical crtbegin.o file (see crtstuff.c) which provides part 
88         of the support for getting C++ file-scope static object constructed 
89         before entering `main'.  */
90    
91 #define DFBSD_STARTFILE_SPEC \
92   "%{!shared: \
93      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
94                        %{!p:%{profile:gcrt1.o%s} \
95                          %{!profile:crt1.o%s}}}} \
96    crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
97
98 /* Provide a ENDFILE_SPEC appropriate for DragonFly.  Here we tack on
99    the magical crtend.o file (see crtstuff.c) which provides part of 
100         the support for getting C++ file-scope static object constructed 
101         before entering `main', followed by a normal "finalizer" file, 
102         `crtn.o'.  */
103
104 #define DFBSD_ENDFILE_SPEC \
105   "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
106
107 /* Provide a LIB_SPEC appropriate for DragonFly as configured and as
108    required by the user-land thread model.  Select the appropriate libc,
109    depending on whether we're doing profiling or need threads support.
110    Make it a hard error if -pthread is provided on the command line and gcc
111    was configured with --disable-threads (this will help avoid bug
112    reports from users complaining about threading when they
113    misconfigured the gcc bootstrap but are later consulting DragonFly
114    manual pages that refer to the mythical -pthread option).  */
115
116 /* Provide a LIB_SPEC appropriate for DragonFly.  Just select the appropriate
117    libc, depending on whether we're doing profiling or need threads support.
118    (simular to the default, except no -lg, and no -p).  */
119
120 #ifdef DFBSD_NO_THREADS
121 #define DFBSD_LIB_SPEC "                                                \
122   %{pthread: %eThe -pthread option is only supported on DragonFly when gcc \
123 is built with the --enable-threads configure-time option.}              \
124   %{!nostdlib{!nostartfiles{!nolibc: -lc}}}                             \
125   }"
126 #else
127 #define DFBSD_LIB_SPEC "                                                \
128   %{!shared: %{pthread:-lpthread}}                                      \
129   %{!nostdlib: %{!nostartfiles: %{!nolibc: -lc}}}                       \
130   "
131 #endif
132
133 #define LINK_LIBGCC_SPEC ""
134 #define LIBGCC_SPEC "%{shared: -lgcc_pic} %{!shared: -lgcc}"
135
136 #define PRE_LIB_SPEC "                                                  \
137   %{pg: -L"PREFIX2"/lib/gcc41/profiling                                 \
138     %{!static: -rpath /usr/lib/gcc41/profiling                          \
139       -rpath-link "PREFIX2"/lib/gcc41/profiling}}                       \
140   %{g: -L"PREFIX2"/lib/gcc41/debug                                      \
141     %{!static: -rpath /usr/lib/gcc41/debug                              \
142       -rpath-link "PREFIX2"/lib/gcc41/debug}}                           \
143   -L"PREFIX2"/lib/gcc41                                                 \
144   %{!static: -rpath /usr/lib/gcc41  -rpath-link "PREFIX2"/lib/gcc41}    \
145   %{pg: -L"PREFIX2"/lib/profiling                                       \
146     %{!static: -rpath /usr/lib/profiling                                \
147       -rpath-link "PREFIX2"/lib/profiling}}                             \
148   %{g: -L"PREFIX2"/lib/debug                                            \
149     %{!static: -rpath /usr/lib/debug -rpath-link "PREFIX2"/lib/debug}}  \
150   %{!static: -rpath /usr/lib -rpath-link "PREFIX2"/lib}                 \
151   "
152
153 #define DFBSD_LINK_COMMAND_SPEC "\
154 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
155     %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
156     %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
157     %{static:} %{L*} %(link_libgcc) %o \
158     %{fprofile-arcs|fprofile-generate: -lgcov}\
159     %{!nostdlib:%{!nodefaultlibs:%(pre_lib)}}\
160     %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
161     %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
162
163 #ifndef PREFIX2
164 #define PREFIX2         "/usr"
165 #endif
166
167 #define DFBSD_DYNAMIC_LINKER            "/usr/libexec/ld-elf.so.2"
168 #ifndef STANDARD_STARTFILE_PREFIX_1
169 #define STANDARD_STARTFILE_PREFIX_1     PREFIX2"/lib/gcc41/"
170 #endif
171 #ifndef STANDARD_EXEC_PREFIX
172 #define STANDARD_EXEC_PREFIX            PREFIX2"/libexec/gcc41/"
173 #endif
174 #ifndef STANDARD_STARTFILE_PREFIX
175 #define STANDARD_STARTFILE_PREFIX       PREFIX2"/lib/gcc41/"
176 #endif
177 #ifndef TOOLDIR_BASE_PREFIX
178 #define TOOLDIR_BASE_PREFIX             PREFIX2"/libexec/gcc41"
179 #endif
180 #ifndef STANDARD_BINDIR_PREFIX
181 #define STANDARD_BINDIR_PREFIX          PREFIX2"/libexec/gcc41"
182 #endif
183 #ifndef STANDARD_LIBEXEC_PREFIX
184 #define STANDARD_LIBEXEC_PREFIX         PREFIX2"/libexec/gcc41"
185 #endif
186
187 #ifndef GPLUSPLUS_INCLUDE_DIR
188 #define GPLUSPLUS_INCLUDE_DIR           PREFIX2"/include/c++"
189 #endif
190 #ifndef GPLUSPLUS_TOOL_INCLUDE_DIR
191 #define GPLUSPLUS_TOOL_INCLUDE_DIR      PREFIX2"/include/c++/4.1"
192 #endif
193 #ifndef GPLUSPLUS_BACKWARD_INCLUDE_DIR
194 #define GPLUSPLUS_BACKWARD_INCLUDE_DIR  PREFIX2"/include/c++/4.1/backward"
195 #endif
196 #ifndef GCC_LOCAL_INCLUDE_DIR
197 #define GCC_LOCAL_INCLUDE_DIR           PREFIX2"/libdata/gcc41"
198 #endif
199 #ifndef GCC_INCLUDE_DIR
200 #define GCC_INCLUDE_DIR                 PREFIX2"/include"
201 #endif
202
203 #undef INCLUDE_DEFAULTS
204 #define INCLUDE_DEFAULTS                                \
205   {                                                     \
206     { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },             \
207     { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0 },     \
208     { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0 }, \
209     { GCC_INCLUDE_DIR, "GCC", 0, 0 },                   \
210     { GCC_LOCAL_INCLUDE_DIR, "GCC", 0, 0 },             \
211     { NULL, NULL, 0, 0 }                                \
212   }