summaryrefslogtreecommitdiff
path: root/trunk/ACE/m4/platform.m4
blob: 3c7839e4d5d99c443e664200d266552d9bfc477d (plain)
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
dnl -------------------------------------------------------------------------
dnl       $Id$
dnl 
dnl       platform.m4
dnl
dnl       ACE M4 include file which contains ACE specific M4 macros
dnl       that set/determine which known platform specific C++ macros
dnl       to define.
dnl 
dnl -------------------------------------------------------------------------

dnl  Copyright (C) 1998, 1999, 2000, 2002, 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 Check for thread related libraries and compiler flags
dnl Usage: ACE_SET_PLATFORM_MACROS
AC_DEFUN([ACE_SET_PLATFORM_MACROS],
[
dnl Begin ACE_SET_PLATFORM_MACROS

dnl At some point the below platform specific settings should be
dnl automated as much as possible!  We set things manually just to get
dnl things going with the auto{conf,make}/libtool integration into the
dnl ACE source tree.

dnl Platform specific flags
case "$host" in
  *aix3*)
    AC_DEFINE([AIX])
    AC_DEFINE([ACE_DEFAULT_BASE_ADDR], [((char *) 0x80000000)])
    ;;
  *aix4.1*)
    AC_DEFINE([AIX])
    dnl Use BSD 4.4 socket definitions for pre-AIX 4.2.  The _BSD
    dnl setting also controls the data type used for waitpid(),
    dnl wait(), and wait3().
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_BSD=44"
    dnl pre-AIX 4.3 requires _BSD_INCLUDES
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_BSD_INCLUDES"
    AC_DEFINE([ACE_DEFAULT_BASE_ADDR], [((char *) 0x80000000)])
    AC_DEFINE([ACE_HAS_AIX_BROKEN_SOCKET_HEADER])
    ;;
  *aix4.2*)
    AC_DEFINE([AIX])
    dnl pre-AIX 4.3 requires _BSD_INCLUDES
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_BSD_INCLUDES"
    AC_DEFINE([ACE_DEFAULT_BASE_ADDR], [((char *) 0x80000000)])
dnl    AC_DEFINE([ACE_HAS_AIX_BROKEN_SOCKET_HEADER])
    AC_DEFINE([ACE_TLI_TCP_DEVICE], ["/dev/xti/tcp"])
    ;;
  *aix*)
    AC_DEFINE([AIX])
    ;;
dnl /* Cray specific configuration parameters */
dnl /*
dnl  *  The following predefined macros are used within ACE ifdefs.
dnl  *  These are defined when using the Cray compilers.  _CRAYMPP
dnl  *  is defined, for example, if you are running on a Cray T3E
dnl  *  massively parallel machine.  Moreover, in the case of the T3E,
dnl  *  _CRAYT3E will be defined.  This is used to determine the
dnl  *  ACE_SIZEOF defines for primitive types.
dnl  *
dnl  *  _UNICOS is defined as either the major version of UNICOS being run,
dnl  *  e.g. 9 or 10 on the vector machines (e.g. C90, T90, J90, YMP, ...)
dnl  *  or the major+minor+level UNICOS/mk version, e.g. 2.0.3 => 203,
dnl  *  being run on an MPP machine.
dnl  *
dnl  *  Summary:
dnl  *
dnl  *  _CRAYMPP  (defined only if running on MPP machine, e.g. T3E, UNICOS/mk)
dnl  *  _CRAYT3E  (defined specifically if compiling on a Cray T3E)
dnl  *  _UNICOS   (defined if running UNICOS or UNICOS/mk)
dnl  *
dnl  *  Tested on UNICOS 10.0.0.2, UNICOS/mk 2.0.3.10
dnl  *
dnl  *  Contributed by Doug Anderson <doug "at" clark.net>
dnl  */
  t3e-cray-unicosmk*)
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_CRAYMPP -D_CRAYT3E -D_UNICOS"
    ;;
  t3e-cray*)
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_CRAYT3E -D_UNICOS"
    ;;
  *cray-unicos*)
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_UNICOS"
    ;;
  *dgux4.11*)
    AC_DEFINE([ACE_DGUX])
    AC_DEFINE([IP_ADD_MEMBERSHIP], [0x13])
    AC_DEFINE([IP_DROP_MEMBERSHIP], [0x14])
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_POSIX_SOURCE -D_DGUX_SOURCE"
    ;;
  *dgux4*)
    AC_DEFINE([ACE_DGUX])
    AC_DEFINE([IP_ADD_MEMBERSHIP], [0x13])
    AC_DEFINE([IP_DROP_MEMBERSHIP], [0x14])
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_POSIX4A_DRAFT10_SOURCE -D_POSIX4_DRAFT_SOURCE"
    ;;
  *fsu*)
dnl FIXME: "FSU" isn't a platform!  We need to move this somewhere.
    AC_DEFINE([PTHREAD_STACK_MIN], [(1024*10)])
    ;;
  *hpux9*)
    AC_DEFINE([HPUX])
    ;;
  *hpux10*)
    AC_DEFINE([HPUX])
    AC_DEFINE([HPUX_10])
    dnl _HPUX_SOURCE : Enable HP-UX specific features in platform headers
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_HPUX_SOURCE"
    AC_DEFINE([ACE_DEFAULT_BASE_ADDR], [((char *) 0x80000000)])
    AC_DEFINE([ACE_TLI_TCP_DEVICE], ["/dev/inet_cots"])
    ;;
  *hpux11*)
    AC_DEFINE([HPUX])
    AC_DEFINE([HPUX_11])
    AC_EGREP_CPP([ACE_ON_64BIT_HP],
      [
#ifdef __LP64__
          ACE_ON_64BIT_HP
#endif
      ],
      [
       AC_DEFINE([ACE_DEFAULT_BASE_ADDR],  [((char *) 0x0000001100000000)])
       AC_DEFINE([ACE_DEFAULT_BASE_ADDRL], [((char *) 0x0000001100000000)])
      ],
      [
       AC_DEFINE([ACE_DEFAULT_BASE_ADDR], [((char *) 0x80000000)])
      ])
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    ;;
  *irix5.2*)
    AC_DEFINE([IRIX5])
    ;;
  *irix5.3*)
    AC_DEFINE([IRIX5])
    if test "$GXX" = no; then
      ACE_CPPFLAGS="$ACE_CPPFLAGS -D_BSD_TYPES"
    fi
    ;;
  *irix6*)
    AC_DEFINE([IRIX6])
    AC_DEFINE([ACE_DEFAULT_BASE_ADDR], [((char *) (1024U * 1024 * 1024))])
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    dnl _MODERN_C_ : Enable modern features in SGI C++ compiler
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_SGI_MP_SOURCE -D_MODERN_C_"

    case "$host" in
      *irix6.2*)
        dnl Recent versions of IRIX do not appear to require this macro.
        if test "$ace_user_enable_threads" = yes; then
          AC_DEFINE([ACE_HAS_IRIX62_THREADS])
        fi
        ;;
    esac
    ;;
  *linux*)
    AC_DEFINE([ACE_DEFAULT_MAX_SOCKET_BUFSIZ], [65535])
    AC_DEFINE([ACE_DEFAULT_BASE_ADDR], [((char *) 0x80000000)])
    AC_DEFINE([ACE_HAS_BIG_FD_SET]) dnl FIXME: We need a test for this!
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    ;;
  *lynxos*)
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_POSIX_THREADS_CALLS"
    AC_DEFINE([__NO_INCLUDE_WARN__])
    AC_DEFINE([ACE_MALLOC_ALIGN], [8])
    AC_DEFINE([ACE_MAP_PRIVATE], [ACE_MAP_SHARED])
    AC_DEFINE([ACE_USE_RCSID], [0])
    AC_DEFINE([ACE_HAS_LYNXOS_SIGNALS])
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    ;;
  *m88k*)
    AC_DEFINE([m88k])
    AC_DEFINE([__m88k__])
    AC_DEFINE([IP_ADD_MEMBERSHIP], [0x13])
    AC_DEFINE([IP_DROP_MEMBERSHIP], [0x14])
    ;;
  *mvs*)
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_ALL_SOURCE"
    ;;
  *osf3.2*)
    AC_EGREP_CPP([ACE_DEC_CXX],
      [
#if defined(__DECCXX)
          ACE_DEC_CXX
#endif
      ],
      [
       AC_DEFINE([DEC_CXX])
      ],)
    ;;
  *osf4.0*)
dnl We need to add checks for g++, DEC C++ and Rational C++
    AC_EGREP_CPP([ACE_DEC_CXX],
      [
#if defined(__DECCXX)
          ACE_DEC_CXX
#endif
      ],
      [
       AC_DEFINE([DEC_CXX])
      ],)
dnl Check for _POSIX_C_SOURCE macro
    AC_EGREP_CPP([ACE_ON_DEC_WITH_POS_SRC],
      [
       /* Include unistd.h to define _POSIX_C_SOURCE. */
#ifndef ACE_LACKS_UNISTD_H
# include <unistd.h>
#endif

#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 199506L)
          ACE_ON_DEC_WITH_POS_SRC
#endif
      ],
      [
       AC_DEFINE([DIGITAL_UNIX])
      ],)
    AC_DEFINE([ACE_DEFAULT_BASE_ADDR], [((char *) 0x80000000)])
    AC_DEFINE([ACE_NEEDS_HUGE_THREAD_STACKSIZE], [(1024 * 1024)])
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    ;;
  *psos*)
    AC_DEFINE([ACE_PSOS])
    AC_DEFINE([ACE_PSOSIM])
    AC_DEFINE([ACE_PSOSTBD])
    dnl need ACE_HAS_TSS_EMULATION for ACE_DEFAULT_THREAD_KEYS!
    AC_EGREP_CPP([ACE_TSS_EMULATION],
      [
#if defined (ACE_HAS_TSS_EMULATION)
         ACE_TSS_EMULATION
#endif
      ], [AC_DEFINE([ACE_DEFAULT_THREAD_KEYS], [256])],[])
    AC_DEFINE([ACE_MAIN], [extern "C" void root])
    AC_DEFINE([ACE_MALLOC_ALIGN], [8])
    AC_DEFINE([ACE_USE_RCSID], [0])
    ;;
  *sco4.2*)
    AC_DEFINE([SCO])
    AC_DEFINE([ACE_DEFAULT_CLOSE_ALL_HANDLES], [0])
    ;;
  *sco5*)
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_SVID3"
    AC_DEFINE([SCO])
    AC_DEFINE([ACE_DEFAULT_CLOSE_ALL_HANDLES], [0])
    AC_DEFINE([ACE_HAS_BIG_FD_SET]) dnl FIXME: We need a test for this!
    ;;
  *sunos4*)
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    ;;
  *solaris2.4*)
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    AC_DEFINE([ACE_NEEDS_LWP_PRIO_SET])
    ;;
  *solaris2.5*)
    AC_DEFINE([ACE_MALLOC_ALIGN], [8])
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    AC_DEFINE([ACE_NEEDS_LWP_PRIO_SET])
    ;;
  *solaris2.6*)
    AC_DEFINE([ACE_MALLOC_ALIGN], [8])
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    AC_DEFINE([ACE_NEEDS_LWP_PRIO_SET])
    ;;
  *solaris2.7*)
    AC_DEFINE([ACE_MALLOC_ALIGN], [8])
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    AC_DEFINE([ACE_NEEDS_LWP_PRIO_SET])
    ;;
  *86*solaris*)
    AC_DEFINE([ACE_HAS_X86_STAT_MACROS])
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    AC_DEFINE([ACE_NEEDS_LWP_PRIO_SET])
    ;;
  *tandem*)
    AC_DEFINE([ACE_TIMER_SKEW], [(1000 * 10)])
    ;;
  *unixware2.0*)
    AC_DEFINE([UNIXWARE])
    AC_DEFINE([UNIXWARE_2_0])
    ;;
  *unixware2.1*)
    AC_DEFINE([UNIXWARE])
    AC_DEFINE([UNIXWARE_2_1])
    ;;
  *UnixWare7.1*)
    AC_DEFINE([UNIXWARE])
    AC_DEFINE([UNIXWARE_7_1])
    AC_DEFINE([__IOCTL_VERSIONED__])
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_REENTRANT"
    ;;
  *vxworks*)
    AC_DEFINE([VXWORKS])
    AC_DEFINE([ACE_MAIN], [ace_main])
    AC_DEFINE([ACE_DEFAULT_MAX_SOCKET_BUFSIZ], [32768])
    dnl need ACE_HAS_TSS_EMULATION for ACE_DEFAULT_THREAD_KEYS!
    AC_EGREP_CPP([ACE_TSS_EMULATION],
      [
#if defined (ACE_HAS_TSS_EMULATION)
         ACE_TSS_EMULATION
#endif
      ], [AC_DEFINE([ACE_DEFAULT_THREAD_KEYS], [16])],[])
    AC_DEFINE([ACE_THR_PRI_FIFO_DEF], [101])
    AC_DEFINE([ACE_USE_RCSID], [0])
    ;;
  *cygwin32*)
    AC_DEFINE([CYGWIN32])
    ;;
  *win32*)
    AC_DEFINE([ACE_WIN32])
    AC_DEFINE([ACE_UINT64_FORMAT_SPECIFIER], ["%I64u"])
dnl    AC_DEFINE(ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL)
    if test "$ace_u_long_long_typedef_set" != yes; then
      ACE_UINT64="unsigned __int64"
      ace_u_long_long_typedef_set=yes
    fi  dnl "$ace_u_long_long_typedef_set" != yes
    ;;
  *qnx* | *nto* | *neutrino*)
    dnl These should be defined on the command line, not in config.h.
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_QNX_SOURCE -D_POSIX_C_SOURCE=199506"
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_POSIX_NAME_MAX=14"  # Max bytes in a
                                                       # filename
    ACE_CPPFLAGS="$ACE_CPPFLAGS -D_POSIX_PATH_MAX=256" # Num. bytes in
                                                       # pathname (excl. NULL)
    case "$host" in
      i[[3456]]86*)
        if test "$GXX" = yes; then
          # Neutrino defines memcpy as a macro on x86, which then
          # hoses the ACE_OS::memcpy() method.  Undefining
          # __OPTIMIZE__ prevents this from happening.
          ACE_CPPFLAGS="$ACE_CPPFLAGS -U__OPTIMIZE__"
        fi
        ;;
    esac
    ;;
  *)
    ;;
esac

ACE_FUNC_IOCTL_ARGTYPES

ACE_CHECK_FORMAT_SPECIFIERS
ACE_CHECK_LACKS_PERFECT_MULTICAST_FILTERING

dnl End ACE_SET_PLATFORM_MACROS
])



# ACE_CHECK_FORMAT_SPECIFIERS
#
# Override default *printf format specifiers for size_t, ssize_t, ACE_INT64, 
# and ACE_UINT64
#
# FIXME: Is it possible to write a portable feature test, or is checking
#        the the target OS / target CPU the best we can do?
# 
#---------------------------------------------------------------------------
AC_DEFUN([ACE_CHECK_FORMAT_SPECIFIERS],
[dnl
AH_TEMPLATE([ACE_SIZE_T_FORMAT_SPECIFIER],
[Define to the *printf format specifier  (e.g. "%u") for size_t])dnl
AH_TEMPLATE([ACE_SSIZE_T_FORMAT_SPECIFIER],
[Define to the *printf format specifier  (e.g. "%d") for ssize_t])dnl
AH_TEMPLATE([ACE_INT64_FORMAT_SPECIFIER],
[Define to the *printf format specifier (e.g. "%lld") for the 64 bit signed integer type])dnl
AH_TEMPLATE([ACE_UINT64_FORMAT_SPECIFIER],
[Define to the *printf format specifier (e.g. "%llu") for the 64 bit signed integer type])dnl

case "$host_os" in
darwin*)
  AC_DEFINE([ACE_SIZE_T_FORMAT_SPECIFIER], ["%lu"])
  ;;

linux*)
  case "$host_cpu" in
    alpha|ia64|x86_64)
      AC_DEFINE([ACE_SIZE_T_FORMAT_SPECIFIER], ["%lu"])
      AC_DEFINE([ACE_SSIZE_T_FORMAT_SPECIFIER], ["%ld"])
      ;;
    *)
      ;;
  esac
  ;;

netbsd*)
  case "$host_cpu" in
    x86_64)
      AC_DEFINE([ACE_SIZE_T_FORMAT_SPECIFIER], ["%lu"])
      AC_DEFINE([ACE_SSIZE_T_FORMAT_SPECIFIER], ["%ld"])
      ;;
    *)
      ;;
  esac
  ;;

*)
  ;;
esac])


# ACE_CHECK_PERFECT_MULTICAST_FILTERING
#
# Checks whether platform lacks "perfect" multicast filtering.
#
# FIXME: Is it possible to write a portable feature test, or is checking
#        the the target OS the best we can do?
# 
#---------------------------------------------------------------------------
AC_DEFUN([ACE_CHECK_LACKS_PERFECT_MULTICAST_FILTERING],
[AC_CACHE_CHECK([whether platform lacks perfect multicast filtering],
  [ace_cv_lacks_perfect_multicast_filtering],
  [case "$host_os" in
  darwin* | freebsd* | netbsd* | openbsd* | qnx*)
    ace_cv_lacks_perfect_multicast_filtering=yes ;;
  *)
    ace_cv_lacks_perfect_multicast_filtering=no ;;
  esac])
    
if test $ace_cv_lacks_perfect_multicast_filtering = yes; then
  AC_DEFINE([ACE_LACKS_PERFECT_MULTICAST_FILTERING], 1,
[Define to 1 if platform lacks IGMPv3 "perfect" filtering of multicast 
datagrams at the socket level.  If defined, ACE_SOCK_Dgram_Mcast will bind 
the first joined multicast group to the socket, and all future joins on that
socket will fail with an error.])
fi
])


# ACE_FUNC_IOCTL_ARGTYPES
#
# Determine the correct type to be passed to ioctl's second argument and
# define the types in ACE_IOCTL_TYPE_ARG2.
#
# FIXME: Should we support ioctl's third argument as well...?
# 
# FIXME: Is it possible to write a portable feature test, or is checking
#        the the target OS the best we can do?
# 
#---------------------------------------------------------------------------
AC_DEFUN([ACE_FUNC_IOCTL_ARGTYPES],
[AC_CACHE_CHECK([types of arguments for ioctl()],
  [ace_cv_func_ioctl_arg2],
  [case "$host_os" in
   darwin* | freebsd* | netbsd* | openbsd*)
    ace_cv_func_ioctl_arg2="unsigned long" ;;
   *)
    ace_cv_func_ioctl_arg2="int" ;;
   esac])

AC_DEFINE_UNQUOTED(ACE_IOCTL_TYPE_ARG2, $ace_cv_func_ioctl_arg2,
	           [Define to the type of arg 2 for `ioctl'.])
])
 

# ACE_VAR_TIMEZONE
#
# Checks whether platform has global "timezone" variable.
#
#---------------------------------------------------------------------------
AC_DEFUN([ACE_VAR_TIMEZONE],
[AC_CACHE_CHECK([for timezone variable],
		[ace_cv_var_timezone],
		[AC_TRY_LINK([#include <time.h>],
			     [return (int) timezone(0, 0);],
		             [ace_cv_var_timezone=no],
			     [AC_TRY_LINK([#include <time.h>],
					  [return (int) timezone;],
					  [ace_cv_var_timezone=yes],
			                  [ace_cv_var_timezone=no])])
		])
if test "$ace_cv_var_timezone" = yes; then
  AC_DEFINE([ACE_HAS_TIMEZONE], 1,
	    [Define to 1 if platform has global timezone variable])
fi
])