Home | History | Annotate | Line # | Download | only in dist
      1 /*-
      2  * Copyright (c) 2010, 2013 The NetBSD Foundation, Inc.
      3  * All rights reserved.
      4  *
      5  * This code is derived from software contributed to The NetBSD Foundation
      6  * by David A. Holland.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27  * POSSIBILITY OF SUCH DAMAGE.
     28  */
     29 
     30 /*
     31  * Config for predefined macros. If this doesn't do what you want you
     32  * can set any or all of the CONFIG_ defines from the compiler command
     33  * line; or patch the list in main.c; or both.
     34  */
     35 
     36 /*
     37  * Paths
     38  */
     39 
     40 #ifndef CONFIG_LOCALINCLUDE
     41 #define CONFIG_LOCALINCLUDE "/usr/local/include"
     42 #endif
     43 
     44 #ifndef CONFIG_SYSTEMINCLUDE
     45 #define CONFIG_SYSTEMINCLUDE "/usr/include"
     46 #endif
     47 
     48 /*
     49  * Operating system
     50  */
     51 
     52 #ifndef CONFIG_OS
     53 #if defined(__NetBSD__)
     54 #define CONFIG_OS "__NetBSD__"
     55 #define CONFIG_OS_2 "__unix__"
     56 #elif defined(__FreeBSD__)
     57 #define CONFIG_OS "__FreeBSD__"
     58 #define CONFIG_OS_2 "__unix__"
     59 #elif defined(__OpenBSD__)
     60 #define CONFIG_OS "__OpenBSD__"
     61 #define CONFIG_OS_2 "__unix__"
     62 #elif defined(__DragonFly__)
     63 #define CONFIG_OS "__DragonFly__"
     64 #define CONFIG_OS_2 "__unix__"
     65 #elif defined(__bsdi__)
     66 #define CONFIG_OS "__bsdi__"
     67 #define CONFIG_OS_2 "__unix__"
     68 #elif defined(__sun)
     69 #define CONFIG_OS "__sun"
     70 #define CONFIG_OS_2 "__unix__"
     71 #elif defined(__sgi)
     72 #define CONFIG_OS "__sgi"
     73 #define CONFIG_OS_2 "__unix__"
     74 #elif defined(__SVR4)
     75 #define CONFIG_OS "__SVR4"
     76 #define CONFIG_OS_2 "__unix__"
     77 #elif defined(__APPLE__)
     78 #define CONFIG_OS "__APPLE__"
     79 #define CONFIG_OS_2 "__unix__"
     80 #elif defined(__linux__)
     81 #define CONFIG_OS "__linux__"
     82 #elif defined(__CYGWIN__)
     83 #define CONFIG_OS "__CYGWIN__"
     84 #elif defined(__INTERIX)
     85 #define CONFIG_OS "__INTERIX"
     86 #elif defined(__MINGW32)
     87 #define CONFIG_OS "__MINGW32"
     88 #else
     89 /* we could error... but let's instead assume generic unix */
     90 #define CONFIG_OS "__unix__"
     91 #endif
     92 #endif
     93 
     94 /*
     95  * CPU
     96  */
     97 
     98 #ifndef CONFIG_CPU
     99 #if defined(__x86_64__)
    100 #define CONFIG_CPU "__x86_64__"
    101 #define CONFIG_CPU_2 "__amd64__"
    102 #elif defined(__i386__) || defined(__i386)
    103 #define CONFIG_CPU "__i386__"
    104 #define CONFIG_CPU_2 "__i386"
    105 #elif defined(__sparc)
    106 #define CONFIG_CPU "__sparc"
    107 #elif defined(__mips)
    108 #define CONFIG_CPU "__mips"
    109 #elif defined(__mips__)
    110 #define CONFIG_CPU "__mips__"
    111 #elif defined(__mipsel__)
    112 #define CONFIG_CPU "__mipsel__"
    113 #elif defined(__POWERPC__)
    114 #define CONFIG_CPU "__POWERPC__"
    115 #elif defined(__POWERPC__)
    116 #define CONFIG_CPU "__powerpc__"
    117 #elif defined(__PPC__)
    118 #define CONFIG_CPU "__PPC__"
    119 #elif defined(__ppc__)
    120 #define CONFIG_CPU "__ppc__"
    121 #elif defined(__PPC64__)
    122 #define CONFIG_CPU "__PPC64__"
    123 #elif defined(__ppc64__)
    124 #define CONFIG_CPU "__ppc64__"
    125 #elif defined(__ARM__)
    126 #define CONFIG_CPU "__ARM__"
    127 #elif defined(__AARCH64__)
    128 #define CONFIG_CPU "__AARCH64__"
    129 #elif defined(__aarch64__)
    130 #define CONFIG_CPU "__aarch64__"
    131 #elif defined(__RISCV__)
    132 #define CONFIG_CPU "__RISCV__"
    133 #elif defined(__riscv__)
    134 #define CONFIG_CPU "__riscv__"
    135 #elif defined(__RISCV64__)
    136 #define CONFIG_CPU "__RISCV64__"
    137 #elif defined(__riscv64__)
    138 #define CONFIG_CPU "__riscv64__"
    139 #elif defined(__riscv64)
    140 #define CONFIG_CPU "__riscv64"
    141 #elif defined(__ia64__)
    142 #define CONFIG_CPU "__ia64__"
    143 #else
    144 /* let it go */
    145 #endif
    146 #endif
    147 
    148 /*
    149  * Other stuff
    150  */
    151 
    152 #ifndef CONFIG_SIZE
    153 #ifdef __LP64__
    154 #define CONFIG_SIZE "__LP64__"
    155 #else
    156 #define CONFIG_SIZE "__ILP32__"
    157 #endif
    158 #endif
    159 
    160 #ifndef CONFIG_BINFMT
    161 #ifdef __ELF__
    162 #define CONFIG_BINFMT "__ELF__"
    163 #endif
    164 #endif
    165 
    166 /*
    167  * We are __TRADCPP__ by default, but if you want to masquerade as
    168  * some other compiler this is a convenient place to change it.
    169  */
    170 
    171 #ifndef CONFIG_COMPILER
    172 #define CONFIG_COMPILER "__TRADCPP__"
    173 #define CONFIG_COMPILER_MINOR "__TRADCPP_MINOR__"
    174 #endif
    175