summaryrefslogtreecommitdiff
path: root/doc/guide
diff options
context:
space:
mode:
Diffstat (limited to 'doc/guide')
-rw-r--r--doc/guide/files/fixes.xml46
1 files changed, 37 insertions, 9 deletions
diff --git a/doc/guide/files/fixes.xml b/doc/guide/files/fixes.xml
index 13db0d5126d..086132c638c 100644
--- a/doc/guide/files/fixes.xml
+++ b/doc/guide/files/fixes.xml
@@ -1,4 +1,4 @@
-<!-- $NetBSD: fixes.xml,v 1.38 2005/11/13 03:27:20 minskim Exp $ -->
+<!-- $NetBSD: fixes.xml,v 1.39 2005/11/21 09:27:04 rillig Exp $ -->
<chapter id="fixes"> <?dbhtml filename="fixes.html"?>
<title>Making your package work</title>
@@ -838,9 +838,9 @@
<programlisting><![CDATA[
#include <sys/param.h>
#if (defined(BSD) && BSD >= 199306)
- /* your BSD-specific code goes here */
+ /* BSD-specific code goes here */
#else
- /* non-BSD-specific code */
+ /* non-BSD-specific code goes here */
#endif
]]></programlisting>
@@ -854,7 +854,7 @@
Linux linux, __linux, __linux__
NetBSD __NetBSD__
OpenBSD __OpenBSD__
- Solaris sun, __sun (GCC and SunPro), __sun__ (only GCC)
+ Solaris sun, __sun
</programlisting>
</sect3><sect3 id="fixes-build-cpp-cpu">
@@ -871,23 +871,51 @@
<programlisting>
GCC __GNUC__ (major version), __GNUC_MINOR__
+ SunPro __SUNPRO_C (0x570 for version 5.7)
</programlisting>
</sect3>
</sect2>
+ <sect2 id="cpp-list-examples">
+ <title>Examples of CPP defines for some platforms</title>
+
+ <para>The list of the CPP identification macros for hardware and
+ operating system may depend on the compiler that is used. The
+ following list contains some examples that may help you to choose
+ the right ones. For example, if you want to conditionally compile
+ code on Solaris, don't use <varname>__sun__</varname>, as the
+ SunPro compiler does not define it. Use <varname>__sun</varname>
+ instead.</para>
+
+ <variablelist>
+ <varlistentry><term>SunPro 5.7 + Solaris 8 + SPARC</term>
+ <listitem><para>__SVR4 __sparc __sun __unix sparc sun
+ unix</para></listitem></varlistentry>
+
+ <varlistentry><term>GCC 4 + Solaris 8 + SPARC</term>
+ <listitem><para>__ELF__ __sparc __sparc__ __sun __sun__ __SVR4
+ __svr4__ __unix __unix__ sparc sun unix</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </sect2>
+
<sect2 id="cpp-list">
<title>Getting a list of CPP defines</title>
- <para>
- When your system uses the GNU C Compiler, you can get a list
- of symbols that are defined by default, e.g. to identify
- the platform, with the following command:
- </para>
+ <para>If your system uses the GNU C Compiler, you can get a list
+ of symbols that are defined by default, e.g. to identify the
+ platform, with the following command:</para>
<programlisting>
<![CDATA[gcc -E -dM - < /dev/null ]]>
</programlisting>
+
+ <para>On other systems you may get the list by using the system's
+ syscall trace utility (ktrace, truss, strace) to have a look which
+ arguments are passed to the actual compiler.</para>
+
</sect2>
</sect1>