Update the GCC3 infrastructure Stage 1/2. This commit generates the basic
[dragonfly.git] / gnu / usr.bin / cc3 / config / dragonfly-spec.h
1 /* Base configuration file for all DragonFly targets.
2    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /*
22  * $FreeBSD: src/contrib/gcc/config/freebsd-spec.h,v 1.15 2003/11/10 18:52:57 deischen Exp $
23  * $DragonFly: src/gnu/usr.bin/cc3/config/Attic/dragonfly-spec.h,v 1.1 2004/02/02 23:35:11 dillon Exp $
24  */
25
26 /* Common DragonFly configuration. 
27    All DragonFly architectures should include this file, which will specify
28    their commonalities.
29    Adapted from gcc/config/freebsd.h by 
30    David O'Brien <obrien@FreeBSD.org>
31    Loren J. Rittle <ljrittle@acm.org>.
32    Adapted for Dragonfly by Matthew Dillon <dillon@backplane.com>
33  */
34
35
36 /* In case we need to know.  */
37 #define USING_CONFIG_FREEBSD_SPEC 1
38
39 /* This defines which switch letters take arguments.  On DragonFly, most of
40    the normal cases (defined in gcc.c) apply, and we also have -h* and
41    -z* options (for the linker) (coming from SVR4).
42    We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
43
44 #define FBSD_SWITCH_TAKES_ARG(CHAR)                                     \
45   (DEFAULT_SWITCH_TAKES_ARG (CHAR)                                      \
46     || (CHAR) == 'h'                                                    \
47     || (CHAR) == 'z' /* ignored by ld */                                \
48     || (CHAR) == 'R')
49
50 /* This defines which multi-letter switches take arguments.  */
51
52 #define FBSD_WORD_SWITCH_TAKES_ARG(STR)                                 \
53   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                  \
54    || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")         \
55    || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym")            \
56    || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
57
58 #define FBSD_TARGET_OS_CPP_BUILTINS()                                   \
59   do                                                                    \
60     {                                                                   \
61         builtin_define ("__DragonFly__=1");                             \
62         builtin_define ("__DragonFly_cc_version=100001");               \
63         builtin_define_std ("unix");                                    \
64         builtin_define ("__ELF__");                                     \
65         builtin_define ("__KPRINTF_ATTRIBUTE__");                       \
66         builtin_assert ("system=unix");                                 \
67         builtin_assert ("system=bsd");                                  \
68         builtin_assert ("system=DragonFly");                            \
69         FBSD_NATIVE_TARGET_OS_CPP_BUILTINS();                           \
70         FBSD_TARGET_CPU_CPP_BUILTINS();                                 \
71     }                                                                   \
72   while (0)
73
74 /* Define the default DragonFly-specific per-CPU hook code. */
75 #define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
76
77 #ifdef FREEBSD_NATIVE
78 #define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS()                            \
79   do {                                                                  \
80   } while (0)
81 #else
82 #define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS()                            \
83   do {} while (0)
84 #endif
85
86 /* Provide a CPP_SPEC appropriate for DragonFly.  We just deal with the GCC 
87    option `-posix', and PIC issues.  Try to detect support for the
88    `long long' type.  Unfortunately the GCC spec parser will not allow us
89    to properly detect the "iso9899:1990" and "iso9899:199409" forms of
90    -std=c89.  Because of the ':' in the -std argument. :-(  I have left
91    them in the spec as a place holder in hopes someone knows a way to make
92    the detection of them work.  */
93
94 #define FBSD_CPP_SPEC "                                                 \
95   %(cpp_cpu)                                                            \
96   %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}               \
97   %{!ansi:%{!std=c89:%{!std=iso9899.1990:%{!std=iso9899.199409:-D_LONGLONG}}}} \
98   %{posix:-D_POSIX_SOURCE}"
99
100 /* Provide a STARTFILE_SPEC appropriate for DragonFly.  Here we add the magical
101    crtbegin.o file (see crtstuff.c) which provides part of the support for
102    getting C++ file-scope static object constructed before entering `main'.  */
103    
104 #define FBSD_STARTFILE_SPEC "\
105   %{!shared: \
106     %{pg:gcrt1.o%s} \
107     %{!pg: \
108       %{p:gcrt1.o%s} \
109       %{!p: \
110         %{profile:gcrt1.o%s} \
111         %{!profile:crt1.o%s}}}} \
112   crti.o%s \
113   %{!shared:crtbegin.o%s} \
114   %{shared:crtbeginS.o%s}"
115
116 /* Provide an ENDFILE_SPEC appropriate for DragonFly/i386.  Here we tack on
117    our own magical crtend.o file (see crtstuff.c) which provides part of
118    the support for getting C++ file-scope static object constructed before
119    entering `main', followed by the normal "finalizer" file, `crtn.o'.  */
120
121 #define FBSD_ENDFILE_SPEC "\
122   %{!shared:crtend.o%s} \
123   %{shared:crtendS.o%s} \
124   crtn.o%s "
125
126 /* XXX DragonFly */
127 /* Provide a LIB_SPEC appropriate for DragonFly as configured and as
128    required by the user-land thread model.  Before __FreeBSD_version
129    500016, select the appropriate libc, depending on whether we're
130    doing profiling or need threads support.  At __FreeBSD_version
131    500016 and later, thread libraries can be linked with libc.  To
132    make matters interesting, we can't actually use __FreeBSD_version
133    provided by <osreldate.h> directly since it breaks cross-compiling.
134    As a final twist, make it a hard error if -pthread is provided on
135    the command line and gcc was configured with --disable-threads
136    (this will help avoid bug reports from users complaining about
137    threading when they misconfigured the gcc bootstrap but are later
138    consulting FreeBSD manual pages that refer to the mythical -pthread
139    option).  */
140
141 /* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
142    libc, depending on whether we're doing profiling or need threads support.
143    (simular to the default, except no -lg, and no -p).  */
144
145 #ifdef FBSD_NO_THREADS
146 #define FBSD_LIB_SPEC "                                                 \
147   %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
148 is built with the --enable-threads configure-time option.}              \
149   %{!shared:                                                            \
150     %{!pg: -lc}                                                         \
151     %{pg:  -lc_p}                                                       \
152   }"
153 #else
154 #include <sys/param.h>
155 #if __FreeBSD_version >= 500016
156 #define FBSD_LIB_SPEC "                                                 \
157   %{!shared:                                                            \
158     %{!pg: %{pthread:-lc_r} -lc}                                        \
159     %{pg:  %{pthread:-lc_r_p} -lc_p}                                    \
160   }"
161 #else
162 #define FBSD_LIB_SPEC "                                                 \
163   %{!shared:                                                            \
164     %{!pg:                                                              \
165       %{!pthread:-lc}                                                   \
166       %{pthread:-lc_r}}                                                 \
167     %{pg:                                                               \
168       %{!pthread:-lc_p}                                                 \
169       %{pthread:-lc_r_p}}                                               \
170   }"
171 #endif
172 #endif