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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
dnl -------------------------------------------------------------------------
dnl $Id$
dnl
dnl compiler.m4
dnl
dnl ACE M4 include file which contains ACE specific M4 macros
dnl that set/determine compiler configurations for ACE.
dnl
dnl -------------------------------------------------------------------------
dnl Copyright (C) 1998, 1999, 2003 Ossama Othman
dnl
dnl All Rights Reserved
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the current ACE distribution terms.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dnl Macros to set flags for a given compiler on a given platform.
dnl The flags set here are generally only useful for _KNOWN_ compilers.
dnl ACE_SET_COMPILER_FLAGS
dnl Usage: ACE_SET_COMPILER_FLAGS
AC_DEFUN([ACE_SET_COMPILER_FLAGS],
[
dnl AC_BEFORE([$0], [AC_PROG_LIBTOOL])
dnl Make sure we know what C++ compiler and preprocessor we have!
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([AC_PROG_CXXCPP])
AC_LANG([C++])
AC_REQUIRE([AC_LANG])
AC_REQUIRE([ACE_COMPILATION_OPTIONS])
if test "$GXX" = yes; then
case `$CXX --version` in
2.9* | 3*)
if test "$ace_user_enable_exceptions" != yes; then
ACE_CXXFLAGS="$ACE_CXXFLAGS -fcheck-new"
fi
;;
esac
fi
dnl Compiler Flag Key
dnl CXXFLAGS - C++ flags to use during the configure script run and
dnl during ACE compilation. The user may set this prior to
dnl running the configure script. As such, it is important
dnl not to replace the existing value of CXXFLAGS; rather
dnl one should only add to it.
dnl ACE_CXXFLAGS
dnl - General C++ flags the configure script should set before
dnl CXXFLAGS to allow the user override them.
dnl DCXXFLAGS - C++ debugging flags
dnl OCXXFLAGS - C++ optimization flags
dnl CPPFLAGS - C++ preprocessor flags
dnl ACE_CPPFLAGS
dnl - General C++ preprocessor flags the configure
dnl script should set before CPPFLAGS to allow the
dnl user to override them.
dnl WERROR - Compiler flag that converts warnings to errors
if test "$GXX" = yes; then
WERROR="-Werror"
fi
case "$target" in
*aix*)
dnl In case anything here or in the config depends on OS
dnl version number, grab it here and pass it all to the
dnl compiler as well.
AIX_MAJOR_VERS=`uname -v`
AIX_MINOR_VERS=`uname -r`
ACE_CPPFLAGS="$ACE_CPPFLAGS -DACE_AIX_MAJOR_VERS=$AIX_MAJOR_VERS"
ACE_CPPFLAGS="$ACE_CPPFLAGS -DACE_AIX_MINOR_VERS=$AIX_MINOR_VERS"
case "$CXX" in
xlC*)
dnl IBM C/C++ compiler 3.6.x produces a bazillion warnings about
dnl 0-valued preprocessor defs. Since both 3.1 and 3.4 could
dnl be installed, don't ask lslpp for one or the
dnl other. Instead, compile a file and see which compiler the
dnl user has set up for use. This trick was submitted by
dnl Craig Rodrigues <rodrigc@mediaone.net>, originally from
dnl the vacpp compiler newsgroup. It relies on the
dnl preprocessor defining __xlC__ to the proper version
dnl number of the compiler.
AC_EGREP_CPP([0x0306],
[
__xlC__
],
[
CXXFLAGS="$CXXFLAGS -qflag=e:e"
],
[
CXXFLAGS="$CXXFLAGS -qflag=w:w"
])
if test "$ace_user_enable_rtti" = yes; then
CXXFLAGS="$CXXFLAGS -qrtti=dynamiccast"
else
CXXFLAGS="$CXXFLAGS -DACE_LACKS_RTTI"
fi
;;
esac
;;
esac
case "$target" in
*aix4.2* | *aix4.3*)
case "$CXX" in
xlC*)
CXXFLAGS="$CXXFLAGS"
ACE_CXXFLAGS="$ACE_CXXFLAGS "
DCXXFLAGS="-g -qcheck=nobounds:div:null"
OCXXFLAGS="-qarch=com"
CPPFLAGS="$CPPFLAGS -qlanglvl=ansi"
;;
*)
if test "$GXX" = yes; then
ACE_CXXFLAGS="-mcpu=common"
fi
;;
esac
;;
*aix4.1*)
case "$CXX" in
xlC*)
CXXFLAGS="$CXXFLAGS"
ACE_CXXFLAGS="$ACE_CXXFLAGS -qxcall -qtempinc"
DCXXFLAGS="-g"
OCXXFLAGS="-qarch=ppc -qtune=604"
;;
*)
if test "$GXX" = yes; then
ACE_CXXFLAGS="-mcpu=common"
fi
;;
esac
;;
*chorus*)
;;
*cray*)
;;
*dgux*)
case "$CXX" in
ec++)
CXXFLAGS="$CXXFLAGS"
ACE_CXXFLAGS="$ACE_CXXFLAGS -relax -v -eh"
DCXXFLAGS="-g"
OCXXFLAGS=""
;;
*)
if test "$GXX" = yes; then
ACE_CXXFLAGS="$ACE_CXXFLAGS"
fi
;;
esac
;;
*freebsd*)
case "$CXX" in
*)
if test "$GXX" = yes; then
CXXFLAGS="$CXXFLAGS"
ACE_CXXFLAGS="$ACE_CXXFLAGS -w -fno-strict-prototypes"
DCXXFLAGS=""
OCXXFLAGS=""
fi
;;
esac
;;
*hpux*)
# In case anything here or in the config depends on OS
# version number, grab it here and pass it all to the
# compiler as well.
OSVERS=`uname -r | $AWK 'BEGIN{FS=".";OFS="";}{print [$][2],[$][3]}' -`
ACE_CPPFLAGS="$ACE_CPPFLAGS -DHPUX_VERS=$OSVERS"
# HP-UX OS version specific settings.
case "$target" in
*hpux11*)
# aCC's "-mt" flag detected by the configure script should already set
# the appropriate preprocessor, compiler and linker flags.
# if test "$ace_user_enable_threads" = yes; then
# # Prefer kernel threads over CMA (user) threads.
# ACE_CPPFLAGS="$ACE_CPPFLAGS -D_POSIX_C_SOURCE=199506L"
# fi
;;
esac
# HP-UX compiler specific settings.
case "$CXX" in
CC)
CXXFLAGS="$CXXFLAGS -pta -ti,/bin/true -tr,/bin/true"
ACE_CXXFLAGS="$ACE_CXXFLAGS -Aa -z +a1"
DCXXFLAGS="-g"
OCXXFLAGS=""
;;
aCC)
CFLAGS = "${CFLAGS:-} -Ae"
# -AA has been available since aC++ x.27 (2001?) - if using a
# compiler without this support, must --enable_stdcpplib=no.
if test "$ace_user_enable_stdcpplib" = yes; then
CXXFLAGS="$CXXFLAGS -AA"
fi
# Warning 930 is spurious when new(std::nothrow) is
# used. Reported to HP as support call 3201224717. (Steve
# Huston, 23-Nov-2002)
#
# Suppress warning 302 ((...) parameter list is a
# non-portable feature)
#
# Additionally, on HP-UX 10.20, suppress 495 to shut up the
# warnings from the system header files. 667 is also
# suppressed, but the compiler still tells you there was a
# future error, but at least you can pick out any real errors
# by quickly scanning the output. 829 is suppressed because
# the system headers have offending string literals assigned
# to char *.
ACE_CXXFLAGS="$ACE_CXXFLAGS +W302,495,667,829,908,930"
DCXXFLAGS="-g"
OCXXFLAGS="-O"
# Warning 67: Invalid pragma name -- needed for
# ACE_LACKS_PRAGMA_ONCE
WERROR="+We67 +p"
# If exception support is explicitly disabled, tell the
# compiler. This is not recommended since the run-time
# library can throw exceptions.
if test "$ace_user_enable_exceptions" != yes; then
ACE_CXXFLAGS="$ACE_CXXFLAGS +noeh"
fi
;;
*)
if test "$GXX" = yes; then
ACE_CXXFLAGS="$ACE_CXXFLAGS -w"
fi
;;
esac
;;
*irix5*)
case "$CXX" in
CC)
CXXFLAGS="$CXXFLAGS -ptused -prelink +pp -woff 3203,3209,3161,3262,3665"
ACE_CXXFLAGS="$ACE_CXXFLAGS "
DCXXFLAGS="-g"
OCXXFLAGS=""
;;
*)
;;
esac
;;
*irix6*)
case "$CXX" in
CC)
CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE"
CXXFLAGS="$CXXFLAGS -exceptions -ptnone -no_prelink -Wl,-woff,15 -Wl,-woff,84 -Wl,-woff,85 -Wl,-woff,133"
ACE_CXXFLAGS="$ACE_CXXFLAGS "
DCXXFLAGS="-g"
OCXXFLAGS="-O -OPT:Olimit=0"
;;
esac
;;
*linux*)
case "$CXX" in
*)
if test "$GXX" = yes; then
CXXFLAGS="$CXXFLAGS"
ACE_CXXFLAGS="$ACE_CXXFLAGS"
DCXXFLAGS="$DCXXFLAGS"
OCXXFLAGS="-O3"
fi
;;
esac
;;
*lynxos*)
;;
*m88k*)
;;
*mvs*)
;;
*netbsd*)
;;
*osf*)
;;
*psos*)
;;
*sco*)
;;
*sunos4*)
;;
*solaris2*)
case "$CXX" in
CC)
WERROR="-xwe"
if test "$ace_user_enable_exceptions" != yes; then
CXXFLAGS="$CXXFLAGS -noex"
fi
dnl Some flags only work with Sun C++ 4.2
if (CC -V 2>&1 | $EGREP 'Compilers 4\.2' > /dev/null); then
CXXFLAGS="$CXXFLAGS -features=castop"
if test "$ace_user_enable_rtti" = yes; then
CXXFLAGS="$CXXFLAGS -features=rtti"
fi
fi
dnl Sun C++ 5.0 weirdness
if (CC -V 2>&1 | $EGREP 'Compilers 5\.0' > /dev/null); then
if test "$ace_user_enable_stdcpplib" = yes; then
CXXFLAGS="$CXXFLAGS -library=Cstd"
else
CXXFLAGS="$CXXFLAGS -library=iostream,no%Cstd"
AC_DEFINE([ACE_USES_OLD_IOSTREAMS])
fi
dnl Inlining appears to cause link problems with early
dnl releases of CC 5.0.
AC_DEFINE([ACE_LACKS_INLINE_FUNCTIONS])
if test "$ace_user_enable_exceptions" != yes; then
dnl See /opt/SUNWspro_5.0/SC5.0/include/CC/stdcomp.h.
ACE_CPPFLAGS="$ACE_CPPFLAGS -D_RWSTD_NO_EXCEPTIONS"
fi
CXXFLAGS="$CXXFLAGS -instances=explicit"
else
CXXFLAGS="$CXXFLAGS -library=iostream"
AC_DEFINE([ACE_USES_OLD_IOSTREAMS])
fi
CXXFLAGS="$CXXFLAGS"
ACE_CXXFLAGS="$ACE_CXXFLAGS"
DCXXFLAGS="$DCXXFLAGS -g"
OCXXFLAGS="$OCXXFLAGS -O"
;;
esac
;;
*tandem*)
;;
*unixware*)
;;
*vxworks*)
;;
*)
CXXFLAGS="$CXXFLAGS"
ACE_CXXFLAGS="$ACE_CXXFLAGS"
DCXXFLAGS="-g"
OCXXFLAGS="-O"
;;
esac
dnl Additional flags
if test "$GXX" = yes; then
ACE_CXXFLAGS="$ACE_CXXFLAGS -W -Wall -Wpointer-arith"
dnl if test "$ace_user_enable_repo" = no; then
dnl ACE_CXXFLAGS="$ACE_CXXFLAGS -fno-implicit-templates"
dnl fi
fi
if test "$GCC" = yes; then
ACE_CFLAGS="$ACE_CFLAGS -W -Wall -Wpointer-arith"
fi
])
|