~ubuntu-branches/ubuntu/oneiric/soqt/oneiric

« back to all changes in this revision

Viewing changes to cfg/m4/general.m4

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2004-05-29 02:58:50 UTC
  • Revision ID: james.westby@ubuntu.com-20040529025850-nkh0l2b0mixwkcgh
Tags: 1.0.2-3
Build against coin-2, rather than coin-1.  Closes: #241102.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# SIM_AC_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
2
# --------------------------------------------------------------------------
 
3
# Modified AC_CHECK_HEADER to use AC_TRY_COMPILE instead of AC_TRY_CPP,
 
4
# as we can get false positives and/or false negatives when running under
 
5
# Cygwin, using the Microsoft Visual C++ compiler (the configure script will
 
6
# pick the GCC preprocessor).
 
7
 
 
8
AC_DEFUN([SIM_AS_TR_CPP],
 
9
[m4_ifdef([AS_TR_CPP],[AS_TR_CPP([$1])],[AC_TR_CPP([$1])])])
 
10
 
 
11
AC_DEFUN([SIM_AC_CHECK_HEADER],
 
12
[AC_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])
 
13
AC_ARG_VAR([CPPFLAGS], [C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>])
 
14
AC_CACHE_CHECK(
 
15
  [for $1],
 
16
  ac_Header,
 
17
  [AC_TRY_COMPILE([#include <$1>],
 
18
    [],
 
19
    [AC_VAR_SET([ac_Header], yes)],
 
20
    [AC_VAR_SET([ac_Header], no)])])
 
21
if test AC_VAR_GET(ac_Header) = yes; then
 
22
  ifelse([$2], , :, [$2])
 
23
else
 
24
  ifelse([$3], , :, [$3])
 
25
fi
 
26
AC_VAR_POPDEF([ac_Header])
 
27
])# SIM_AC_CHECK_HEADER
 
28
 
 
29
 
 
30
# SIM_AC_CHECK_HEADERS(HEADER-FILE...
 
31
#                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
32
# ----------------------------------------------------------
 
33
AC_DEFUN([SIM_AC_CHECK_HEADERS],
 
34
[for ac_header in $1
 
35
do
 
36
SIM_AC_CHECK_HEADER(
 
37
  [$ac_header],
 
38
  [AC_DEFINE_UNQUOTED(SIM_AS_TR_CPP(HAVE_$ac_header)) $2],
 
39
  [$3])
 
40
done
 
41
])# SIM_AC_CHECK_HEADERS
 
42
 
 
43
 
 
44
# SIM_AC_CHECK_SIZEOF(TYPE, [INCLUDES])
 
45
# --------------------------------------------
 
46
AC_DEFUN([SIM_AC_CHECK_SIZEOF],
 
47
[
 
48
AC_CHECK_TYPE([$1], [
 
49
  _AC_COMPUTE_INT([sizeof ($1)],
 
50
                  [sim_ac_bytesize],
 
51
                  [AC_INCLUDES_DEFAULT([$2])])
 
52
], [sim_ac_bytesize=0], [$2])
 
53
])# SIM_AC_CHECK_SIZEOF
 
54
 
 
55
 
 
56
# SIM_AC_HAVE_BYTESIZE_TYPES_IFELSE
 
57
# --------------------
 
58
AC_DEFUN([SIM_AC_HAVE_BYTESIZE_TYPES_IFELSE],
 
59
[
 
60
AC_MSG_CHECKING([standard bytesize typedefs])
 
61
AC_TRY_COMPILE([
 
62
#include <stdio.h>
 
63
#ifdef HAVE_INTTYPES_H
 
64
#include <inttypes.h>
 
65
#else /* !HAVE_INTTYPES_H */
 
66
#ifdef HAVE_STDINT_H
 
67
#include <stdint.h>
 
68
#endif /* HAVE_STDINT_H */
 
69
#endif /* !HAVE_INTTYPES_H */
 
70
#ifdef HAVE_SYS_TYPES_H
 
71
#include <sys/types.h>
 
72
#endif /* HAVE_SYS_TYPES_H */
 
73
], [
 
74
  int8_t int8var;
 
75
  uint8_t uint8var;
 
76
  int16_t int16var;
 
77
  uint16_t uint16var;
 
78
  int32_t int32var;
 
79
  uint32_t uint32var;
 
80
  int64_t int64var;
 
81
  uint64_t uint64var;
 
82
],
 
83
[sim_ac_have_have_bytesize_types=true],
 
84
[sim_ac_have_have_bytesize_types=false])
 
85
 
 
86
if $sim_ac_have_have_bytesize_types; then
 
87
  AC_MSG_RESULT([available])
 
88
  AC_DEFINE_UNQUOTED([HAVE_INT8_T], [1], [define this if the type is available on the system])
 
89
  AC_DEFINE_UNQUOTED([COIN_INT8_T], [int8_t], [define this to a type of the indicated bitwidth])
 
90
  AC_DEFINE_UNQUOTED([HAVE_UINT8_T], [1], [define this if the type is available on the system])
 
91
  AC_DEFINE_UNQUOTED([COIN_UINT8_T], [uint8_t], [define this to a type of the indicated bitwidth])
 
92
  AC_DEFINE_UNQUOTED([HAVE_INT16_T], [1], [define this if the type is available on the system])
 
93
  AC_DEFINE_UNQUOTED([COIN_INT16_T], [int16_t], [define this to a type of the indicated bitwidth])
 
94
  AC_DEFINE_UNQUOTED([HAVE_UINT16_T], [1], [define this if the type is available on the system])
 
95
  AC_DEFINE_UNQUOTED([COIN_UINT16_T], [uint16_t], [define this to a type of the indicated bitwidth])
 
96
  AC_DEFINE_UNQUOTED([HAVE_INT32_T], [1], [define this if the type is available on the system])
 
97
  AC_DEFINE_UNQUOTED([COIN_INT32_T], [int32_t], [define this to a type of the indicated bitwidth])
 
98
  AC_DEFINE_UNQUOTED([HAVE_UINT32_T], [1], [define this if the type is available on the system])
 
99
  AC_DEFINE_UNQUOTED([COIN_UINT32_T], [uint32_t], [define this to a type of the indicated bitwidth])
 
100
  AC_DEFINE_UNQUOTED([HAVE_INT64_T], [1], [define this if the type is available on the system])
 
101
  AC_DEFINE_UNQUOTED([COIN_INT64_T], [int64_t], [define this to a type of the indicated bitwidth])
 
102
  AC_DEFINE_UNQUOTED([HAVE_UINT64_T], [1], [define this if the type is available on the system])
 
103
  AC_DEFINE_UNQUOTED([COIN_UINT64_T], [uint64_t], [define this to a type of the indicated bitwidth])
 
104
  $1
 
105
else
 
106
  AC_MSG_RESULT([not available])
 
107
  $2
 
108
fi
 
109
])# SIM_AC_HAVE_BYTESIZE_TYPES_IFELSE
 
110
 
 
111
# SIM_AC_BYTESIZE_TYPE(TYPEDEFTYPE, BYTESIZE, ALTERNATE_TYPELIST,
 
112
#                     [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
113
# ----------------------------------------------------------
 
114
 
115
# FIXME: pretty ugly code with several quick hacks. 20010324 mortene.
 
116
AC_DEFUN([SIM_AC_BYTESIZE_TYPE],
 
117
[sim_ac_searching=true
 
118
for sim_ac_type in $1 $3
 
119
do
 
120
  if $sim_ac_searching; then
 
121
    SIM_AC_CHECK_SIZEOF($sim_ac_type, [
 
122
#include <stdio.h>
 
123
#ifdef HAVE_INTTYPES_H
 
124
#include <inttypes.h>
 
125
#else /* !HAVE_INTTYPES_H */
 
126
#ifdef HAVE_STDINT_H
 
127
#include <stdint.h>
 
128
#endif /* HAVE_STDINT_H */
 
129
#endif /* !HAVE_INTTYPES_H */
 
130
#ifdef HAVE_SYS_TYPES_H
 
131
#include <sys/types.h>
 
132
#endif /* HAVE_SYS_TYPES_H */
 
133
])
 
134
    if test "$sim_ac_bytesize" = "$2"; then
 
135
      sim_ac_searching=false
 
136
      if test "$sim_ac_type" = "$1"; then
 
137
        AC_DEFINE_UNQUOTED(SIM_AS_TR_CPP(have_$1), 1, [define this if the type is available on the system])
 
138
      fi
 
139
      AC_DEFINE_UNQUOTED(SIM_AS_TR_CPP(coin_$1), $sim_ac_type, [define this to a type of the indicated bitwidth])
 
140
    fi
 
141
  fi
 
142
done
 
143
 
 
144
if $sim_ac_searching; then
 
145
  ifelse([$5], , :, [$5])
 
146
else
 
147
  ifelse([$4], , :, [$4])
 
148
fi
 
149
])# SIM_AC_BYTESIZE_TYPE
 
150
 
 
151
# SIM_AC_DEFINE_BYTESIZE_TYPES
 
152
# ----------------------------------------------------------
 
153
 
154
AC_DEFUN([SIM_AC_DEFINE_BYTESIZE_TYPES],
 
155
[
 
156
SIM_AC_HAVE_BYTESIZE_TYPES_IFELSE([], [
 
157
SIM_AC_BYTESIZE_TYPE(int8_t, 1, [char], [], AC_MSG_ERROR([could not find 8-bit type]))
 
158
SIM_AC_BYTESIZE_TYPE(uint8_t, 1, [u_int8_t "unsigned char"], [], AC_MSG_ERROR([could not find unsigned 8-bit type]))
 
159
 
 
160
SIM_AC_BYTESIZE_TYPE(int16_t, 2, [short int], [], AC_MSG_ERROR([could not find 16-bit type]))
 
161
SIM_AC_BYTESIZE_TYPE(uint16_t, 2, [u_int16_t "unsigned short" "unsigned int"], [], AC_MSG_ERROR([could not find unsigned 16-bit type]))
 
162
 
 
163
SIM_AC_BYTESIZE_TYPE(int32_t, 4, [int long], [], AC_MSG_ERROR([could not find 32-bit type]))
 
164
SIM_AC_BYTESIZE_TYPE(uint32_t, 4, [u_int32_t "unsigned int" "unsigned long"], [], AC_MSG_ERROR([could not find unsigned 32-bit type]))
 
165
 
 
166
SIM_AC_BYTESIZE_TYPE(int64_t, 8, [long int "long long" __int64], [], AC_MSG_WARN([could not find 64-bit type]))
 
167
SIM_AC_BYTESIZE_TYPE(uint64_t, 8, [u_int64_t "unsigned long" "unsigned int" "unsigned long long" "unsigned __int64"], [], AC_MSG_WARN([could not find unsigned 64-bit type]))
 
168
])
 
169
])# SIM_AC_DEFINE_BYTESIZE_TYPES