Merge from vendor branch ZLIB:
[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.2 2004/02/03 03:47:12 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 /* In case we need to know.  */
36 #define USING_CONFIG_FREEBSD_SPEC 1
37
38 /* This defines which switch letters take arguments.  On DragonFly, most of
39    the normal cases (defined in gcc.c) apply, and we also have -h* and
40    -z* options (for the linker) (coming from SVR4).
41    We also have -R (alias --rpath), no -z, --soname (-h), --assert etc.  */
42
43 #define FBSD_SWITCH_TAKES_ARG(CHAR)                                     \
44   (DEFAULT_SWITCH_TAKES_ARG (CHAR)                                      \
45     || (CHAR) == 'h'                                                    \
46     || (CHAR) == 'z' /* ignored by ld */                                \
47     || (CHAR) == 'R')
48
49 /* This defines which multi-letter switches take arguments.  */
50
51 #define FBSD_WORD_SWITCH_TAKES_ARG(STR)                                 \
52   (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                                  \
53    || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link")         \
54    || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym")            \
55    || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
56
57 #define FBSD_TARGET_OS_CPP_BUILTINS()                                   \
58   do                                                                    \
59     {                                                                   \
60         builtin_define ("__DragonFly__=1");                             \
61         builtin_define ("__DragonFly_cc_version=100001");               \
62         builtin_define_std ("unix");                                    \
63         builtin_define ("__ELF__");                                     \
64         builtin_define ("__KPRINTF_ATTRIBUTE__");                       \
65         builtin_assert ("system=unix");                                 \
66         builtin_assert ("system=bsd");                                  \
67         builtin_assert ("system=DragonFly");                            \
68         FBSD_NATIVE_TARGET_OS_CPP_BUILTINS();                           \
69         FBSD_TARGET_CPU_CPP_BUILTINS();                                 \
70     }                                                                   \
71   while (0)
72
73 /* Define the default DragonFly-specific per-CPU hook code. */
74 #define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
75
76 #ifdef FREEBSD_NATIVE
77 #define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS()                            \
78   do {                                                                  \
79   } while (0)
80 #else
81 #define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS()                            \
82   do {} while (0)
83 #endif
84
85 /* Provide a CPP_SPEC appropriate for DragonFly.  We just deal with the GCC 
86    option `-posix', and PIC issues.  Try to detect support for the
87    `long long' type.  Unfortunately the GCC spec parser will not allow us
88    to properly detect the "iso9899:1990" and "iso9899:199409" forms of
89    -std=c89.  Because of the ':' in the -std argument. :-(  I have left
90    them in the spec as a place holder in hopes someone knows a way to make
91    the detection of them work.  */
92
93 #define FBSD_CPP_SPEC "                                                 \
94   %(cpp_cpu)                                                            \
95   %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}               \
96   %{!ansi:%{!std=c89:%{!std=iso9899.1990:%{!std=iso9899.199409:-D_LONGLONG}}}} \
97   %{posix:-D_POSIX_SOURCE}"
98
99 /* Provide a STARTFILE_SPEC appropriate for DragonFly.  Here we add the magical
100    crtbegin.o file (see crtstuff.c) which provides part of the support for
101    getting C++ file-scope static object constructed before entering `main'.  */
102    
103 #define FBSD_STARTFILE_SPEC "\
104   %{!shared: \
105     %{pg:gcrt1.o%s} \
106     %{!pg: \
107       %{p:gcrt1.o%s} \
108       %{!p: \
109         %{profile:gcrt1.o%s} \
110         %{!profile:crt1.o%s}}}} \
111   crti.o%s \
112   %{!shared:crtbegin.o%s} \
113   %{shared:crtbeginS.o%s}"
114
115 /* Provide an ENDFILE_SPEC appropriate for DragonFly/i386.  Here we tack on
116    our own magical crtend.o file (see crtstuff.c) which provides part of
117    the support for getting C++ file-scope static object constructed before
118    entering `main', followed by the normal "finalizer" file, `crtn.o'.  */
119
120 #define FBSD_ENDFILE_SPEC "\
121   %{!shared:crtend.o%s} \
122   %{shared:crtendS.o%s} \
123   crtn.o%s "
124
125 /* XXX DragonFly */
126 /* Provide a LIB_SPEC appropriate for DragonFly as configured and as
127    required by the user-land thread model.  Before __FreeBSD_version
128    500016, select the appropriate libc, depending on whether we're
129    doing profiling or need threads support.  At __FreeBSD_version
130    500016 and later, thread libraries can be linked with libc.  To
131    make matters interesting, we can't actually use __FreeBSD_version
132    provided by <osreldate.h> directly since it breaks cross-compiling.
133    As a final twist, make it a hard error if -pthread is provided on
134    the command line and gcc was configured with --disable-threads
135    (this will help avoid bug reports from users complaining about
136    threading when they misconfigured the gcc bootstrap but are later
137    consulting FreeBSD manual pages that refer to the mythical -pthread
138    option).  */
139
140 /* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
141    libc, depending on whether we're doing profiling or need threads support.
142    (simular to the default, except no -lg, and no -p).  */
143
144 #ifdef FBSD_NO_THREADS
145 #define FBSD_LIB_SPEC "                                                 \
146   %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
147 is built with the --enable-threads configure-time option.}              \
148   %{!shared:                                                            \
149     %{!pg: -lc}                                                         \
150     %{pg:  -lc_p}                                                       \
151   }"
152 #else
153 #include <sys/param.h>
154 #if __FreeBSD_version >= 500016
155 #define FBSD_LIB_SPEC "                                                 \
156   %{!shared:                                                            \
157     %{!pg: %{pthread:-lc_r} -lc}                                        \
158     %{pg:  %{pthread:-lc_r_p} -lc_p}                                    \
159   }"
160 #else
161 #define FBSD_LIB_SPEC "                                                 \
162   %{!shared:                                                            \
163     %{!pg:                                                              \
164       %{!pthread:-lc}                                                   \
165       %{pthread:-lc_r}}                                                 \
166     %{pg:                                                               \
167       %{!pthread:-lc_p}                                                 \
168       %{pthread:-lc_r_p}}                                               \
169   }"
170 #endif
171 #endif