File: ccdefs.c

package info (click to toggle)
virtuoso-opensource 6.1.6+dfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (191 lines) | stat: -rw-r--r-- 4,604 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
 *  ccdefs.c
 *
 *  $Id$
 *
 *  Determine & report the Makeconfig variables
 *  
 *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 *  project.
 *  
 *  Copyright (C) 1998-2012 OpenLink Software
 *  
 *  This project is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the
 *  Free Software Foundation; only version 2 of the License, dated June 1991.
 *  
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 *  
 *  
*/

#include <stdio.h>
#include <ctype.h>
#include <string.h>


/*
 *  Check for toupper problems
 */
int
working_toupper ()
{
  /*
   *  Toupper ok?
   */
  if (toupper ('9') == '9')
    return 1;
  else
    {
      fputs ("NOTE: toupper() gives problems\n", stderr);
      return 0;
    }
}


int
main (argc, argv)
int argc;
char **argv;
{
  static char CCDEFS[800];
  static char CCWARN[800];
  static char CCOPT[800];
  static char CCDEBUG[800];
  static char CCLIBS[800];

  CCDEFS[0] = CCWARN[0] = CCOPT[0] = CCDEBUG[0] = CCLIBS[0] = 0;

  /*
   *  Build releases by default
   */
  strcat (CCDEBUG, "-DNDEBUG");

  /*
   *  Check ctypes
   */
  if (!working_toupper ())
    strcat (CCDEFS, "-DBROKEN_CTYPES ");

  if (sizeof (void *) == 8)
    strcat (CCDEFS, "-DPOINTER_64 ");

#if defined (__GNUC__)
  /*
   *  For GNU C COMPILER (Linux ea)
   *  --with-pthreads works on linux redhat >= 5
   */

# if !defined (M_I386) && !defined (__i386__) && defined (NOTDEF)
  /*
   *  GNU C library bug work around (See spromo.c)
   *  libudbc.a causes core dumps when stdarg.h doesn't work...
   */
  strcat (CCDEFS, "-D__i386__ ");
# endif

# if defined (i386)
  strcat (CCOPT, "-fomit-frame-pointer ");
# endif
# if (__GNUC__ > 3)
  strcat (CCOPT, "-fno-strict-aliasing ");
# endif
  strcat (CCOPT, "-O2 ");
  strcat (CCWARN, "-Wall ");
  strcat (CCLIBS, "`gcc -print-libgcc-file-name` ");


  /* NATIVE C COMPILERS FOR VARIOUS PLATFORMS */

#elif defined (_AIX)
  /*
   *  For IBM Aix (tested with 4.2)
   *  --with-pthreads works if configured with CC="cc_r" ./configure
   */
  strcat (CCOPT, "-O2 ");

#elif defined (__osf__)
  /*
   *  For DEC OSF (tested with 3.2, 4.0)
   *  --with-pthreads works on 3.2
   *  --with-pthreads fails on 4.0
   */
  strcat (CCOPT, "-O2 ");
  strcat (CCDEFS, "-std1 -readonly_strings ");
  strcat (CCWARN, "-verbose ");

#elif defined (__hpux)
  /*
   *  For HP/UX (tested with 10.0 and 11.0)
   *  --with-pthreads : only for release 11
   */
  strcat (CCDEFS, "-D_PROTOTYPES ");
  strcat (CCDEFS, "-D_INCLUDE_HPUX_SOURCE ");
  strcat (CCDEFS, "-D_INCLUDE_POSIX_SOURCE ");
  strcat (CCDEFS, "-D_INCLUDE_XOPEN_SOURCE ");
  strcat (CCDEFS, "-D_INCLUDE_XOPEN_SOURCE_EXTENDED ");
  /* strcat (CCDEFS, "-DSUSPICIOUS_C_COMPILER "); */
  strcat (CCDEFS, "-Dconst= ");
  strcat (CCDEFS, "-Aa +ESlit +e ");
  strcat (CCOPT, "-O ");

#elif defined (__sgi)
  /*
   *  For Silicon Graphics IRIX (tested with 6.4 with MIPSProC compiler)
   *  --with-pthreads works
   */
# if _MIPS_SZLONG == 32
  /* 32 bit mode */
  strcat (CCDEFS, "-DSTDC_HEADERS -D_BSD_TYPES -D_BSD_COMPAT -common ");
  strcat (CCOPT, "-O2 -use_readonly_const");

# elif _MIPS_SZLONG == 64
  /* 64 bit mode - TODO Make this work! */
#  error 64 bit is broken because of struct timeval assumptions

# else
#  error *****************************************************
#  error *** Please restart with : CC="cc -32" ./configure ***
#  error *****************************************************
# endif

#elif defined (sun)
  /*
   *  For Sun Solaris (tested with 5.5.1 with Sun PRO C compiler - SUNWspro)
   *  --with-pthreads works
   */
  strcat (CCOPT, "-O ");

#elif defined (_SCO_DS)
  /*
   *  For SCO 5 ODT
   *  No support for pthreads
   */
  strcat (CCOPT, "-O ");
  strcat (CCDEFS, "-belf -Kalloca,i486 ");
  strcat (CCWARN, "-w3 ");

#else /* No special rules for this platform */

  strcat (CCOPT, "-O ");

#endif

  /*
   *  Output Makeconfig flags
   */
  printf ("CCOPT=\"%s\"\n", CCOPT);
  printf ("CCDEFS=\"%s\"\n", CCDEFS);
  printf ("CCWARN=\"%s\"\n", CCWARN);
  printf ("CCDEBUG=\"%s\"\n", CCDEBUG);
  printf ("CCLIBS=\"%s\"\n", CCLIBS);

  return 0;
}