1 /* Id: ccconfig.h,v 1.20 2014/06/04 06:43:50 gmcgarry Exp */ 2 /* $NetBSD: ccconfig.h,v 1.1.1.5 2014/07/24 19:29:33 plunky Exp $ */ 3 4 /* 5 * Copyright (c) 2004 Anders Magnusson (ragge@ludd.luth.se). 6 * All rights reserved. 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 AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /* 30 * Various settings that controls how the C compiler works. 31 */ 32 33 /* common cpp predefines */ 34 #define CPPADD { "-D__Darwin__", "-D__APPLE__", "-D__MACH__", "-D__APPLE_CPP__", NULL } 35 #define CRT0 "crt1.o" 36 #define GCRT0 "gcrt1.o" 37 #define CRTBEGIN_T 0 38 #define CRTEND_T 0 39 #define CRTBEGIN 0 40 #define CRTEND 0 41 #define CRTBEGIN_S "dylib1.o" 42 #define CRTEND_S 0 43 #define CRTI 0 44 #define CRTN 0 45 #define DEFLIBS { "-lSystem", "-lpcc", NULL } 46 #define DEFPROFLIBS { "-lSystem_profile", "-lpcc", NULL } 47 #define STARTLABEL "start" 48 49 #ifdef LANG_F77 50 #define F77LIBLIST { "-L" PCCLIBDIR, "-lF77", "-lI77", "-lm", "-lc", NULL }; 51 #endif 52 53 /* 54 ld -arch ppc -weak_reference_mismatches non-weak -o a.out -lcrt1.o -lcrt2.o -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1 hello_ppc.o -lgcc -lSystemStubs -lSystem 55 */ 56 57 #if defined(mach_i386) 58 #define CPPMDADD { "-D__i386__", "-D__LITTLE_ENDIAN__", NULL } 59 #elif defined(mach_powerpc) 60 #define CPPMDADD { "-D__ppc__", "-D__BIG_ENDIAN__", NULL } 61 #elif defined(mach_amd64) 62 #define CPPMDADD { "-D__x86_64__", "-D__LITTLE_ENDIAN__", NULL } 63 #elif define(mach_m68k) 64 #define CPPMDADD { "-D__m68k__", "-D__BIG_ENDIAN__", NULL } 65 #else 66 #error defines for arch missing 67 #endif 68 69 70 /* 71 * Deal with some darwin-specific args. 72 */ 73 #define PCC_EARLY_ARG_CHECK { \ 74 if (match(argp, "-install_name")) { \ 75 strlist_append(&middle_linker_flags, argp); \ 76 strlist_append(&middle_linker_flags, nxtopt(0)); \ 77 continue; \ 78 } else if (match(argp, "-compatibility_version") || \ 79 match(argp, "-current_version")) { \ 80 strlist_append(&middle_linker_flags, argp); \ 81 strlist_append(&middle_linker_flags, nxtopt(0)); \ 82 continue; \ 83 } else if (strcmp(argp, "-dynamiclib") == 0) { \ 84 shared = 1; \ 85 continue; \ 86 } else if (strcmp(argp, "-shared") == 0) { \ 87 oerror(argp); \ 88 continue; \ 89 } else if (strncmp(argp, "-mmacosx-version-min", 20) == 0) { \ 90 char tmp[10]; \ 91 char *p = &argp[21]; \ 92 int idx = 0; \ 93 while (*p != 0) { \ 94 if (*p != '.') \ 95 tmp[idx++] = *p; \ 96 p++; \ 97 } \ 98 while (idx < 4) \ 99 tmp[idx++] = '0'; \ 100 tmp[idx] = 0; \ 101 strlist_append(&preprocessor_flags, cat("-D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=", tmp)); \ 102 strlist_append(&middle_linker_flags, "-macosx_version_min"); \ 103 strlist_append(&middle_linker_flags, &argp[21]); \ 104 continue; \ 105 } else if (strcmp(argp, "-framework") == 0) { \ 106 strlist_append(&middle_linker_flags, argp); \ 107 strlist_append(&middle_linker_flags, nxtopt(0)); \ 108 continue; \ 109 } \ 110 } 111 112 113