~ubuntu-branches/ubuntu/utopic/gettext/utopic

« back to all changes in this revision

Viewing changes to gettext-tools/gnulib-m4/stdint.m4

  • Committer: Colin Watson
  • Date: 2010-08-01 21:36:08 UTC
  • mfrom: (2.1.10 sid)
  • Revision ID: cjwatson@canonical.com-20100801213608-yy7vkm8lpatep3ci
merge from Debian 0.18.1.1-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# stdint.m4 serial 29
2
 
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
 
1
# stdint.m4 serial 34
 
2
dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
9
9
 
10
10
AC_DEFUN([gl_STDINT_H],
11
11
[
12
 
  AC_PREREQ(2.59)dnl
 
12
  AC_PREREQ([2.59])dnl
13
13
 
14
14
  dnl Check for long long int and unsigned long long int.
15
15
  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
201
201
  int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
202
202
};
203
203
         ]])],
204
 
         [gl_cv_header_working_stdint_h=yes])])
 
204
         [dnl Determine whether the various *_MIN, *_MAX macros are usable
 
205
          dnl in preprocessor expression. We could do it by compiling a test
 
206
          dnl program for each of these macros. It is faster to run a program
 
207
          dnl that inspects the macro expansion.
 
208
          dnl This detects a bug on HP-UX 11.23/ia64.
 
209
          AC_RUN_IFELSE([
 
210
            AC_LANG_PROGRAM([[
 
211
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
 
212
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
 
213
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 
214
#include <stdint.h>
 
215
]
 
216
gl_STDINT_INCLUDES
 
217
[
 
218
#include <stdio.h>
 
219
#include <string.h>
 
220
#define MVAL(macro) MVAL1(macro)
 
221
#define MVAL1(expression) #expression
 
222
static const char *macro_values[] =
 
223
  {
 
224
#ifdef INT8_MAX
 
225
    MVAL (INT8_MAX),
 
226
#endif
 
227
#ifdef INT16_MAX
 
228
    MVAL (INT16_MAX),
 
229
#endif
 
230
#ifdef INT32_MAX
 
231
    MVAL (INT32_MAX),
 
232
#endif
 
233
#ifdef INT64_MAX
 
234
    MVAL (INT64_MAX),
 
235
#endif
 
236
#ifdef UINT8_MAX
 
237
    MVAL (UINT8_MAX),
 
238
#endif
 
239
#ifdef UINT16_MAX
 
240
    MVAL (UINT16_MAX),
 
241
#endif
 
242
#ifdef UINT32_MAX
 
243
    MVAL (UINT32_MAX),
 
244
#endif
 
245
#ifdef UINT64_MAX
 
246
    MVAL (UINT64_MAX),
 
247
#endif
 
248
    NULL
 
249
  };
 
250
]], [[
 
251
  const char **mv;
 
252
  for (mv = macro_values; *mv != NULL; mv++)
 
253
    {
 
254
      const char *value = *mv;
 
255
      /* Test whether it looks like a cast expression.  */
 
256
      if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
 
257
          || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
 
258
          || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
 
259
          || strncmp (value, "((int)"/*)*/, 6) == 0
 
260
          || strncmp (value, "((signed short)"/*)*/, 15) == 0
 
261
          || strncmp (value, "((signed char)"/*)*/, 14) == 0)
 
262
        return 1;
 
263
    }
 
264
  return 0;
 
265
]])],
 
266
              [gl_cv_header_working_stdint_h=yes],
 
267
              [],
 
268
              [dnl When cross-compiling, assume it works.
 
269
               gl_cv_header_working_stdint_h=yes
 
270
              ])
 
271
         ])
 
272
      ])
205
273
  fi
206
274
  if test "$gl_cv_header_working_stdint_h" = yes; then
207
275
    STDINT_H=
229
297
    gl_STDINT_TYPE_PROPERTIES
230
298
    STDINT_H=stdint.h
231
299
  fi
232
 
  AC_SUBST(STDINT_H)
 
300
  AC_SUBST([STDINT_H])
233
301
])
234
302
 
235
303
dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
240
308
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
241
309
  dnl   config.h.in,
242
310
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
243
 
  AC_FOREACH([gltype], [$1],
 
311
  m4_foreach_w([gltype], [$1],
244
312
    [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
245
313
       [Define to the number of bits in type ']gltype['.])])
246
314
  for gltype in $1 ; do
265
333
    AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
266
334
    eval BITSIZEOF_${GLTYPE}=\$result
267
335
  done
268
 
  AC_FOREACH([gltype], [$1],
 
336
  m4_foreach_w([gltype], [$1],
269
337
    [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
270
338
])
271
339
 
278
346
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
279
347
  dnl   config.h.in,
280
348
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
281
 
  AC_FOREACH([gltype], [$1],
 
349
  m4_foreach_w([gltype], [$1],
282
350
    [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
283
351
       [Define to 1 if ']gltype[' is a signed integer type.])])
284
352
  for gltype in $1 ; do
292
360
    eval result=\$gl_cv_type_${gltype}_signed
293
361
    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
294
362
    if test "$result" = yes; then
295
 
      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1)
 
363
      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
296
364
      eval HAVE_SIGNED_${GLTYPE}=1
297
365
    else
298
366
      eval HAVE_SIGNED_${GLTYPE}=0
299
367
    fi
300
368
  done
301
 
  AC_FOREACH([gltype], [$1],
 
369
  m4_foreach_w([gltype], [$1],
302
370
    [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
303
371
])
304
372
 
311
379
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
312
380
  dnl   config.h.in,
313
381
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
314
 
  AC_FOREACH([gltype], [$1],
 
382
  m4_foreach_w([gltype], [$1],
315
383
    [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
316
384
       [Define to l, ll, u, ul, ull, etc., as suitable for
317
385
        constants of type ']gltype['.])])
328
396
       for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
329
397
         case $glsuf in
330
398
           '')  gltype1='int';;
331
 
           l)   gltype1='long int';;
332
 
           ll)  gltype1='long long int';;
333
 
           i64) gltype1='__int64';;
334
 
           u)   gltype1='unsigned int';;
335
 
           ul)  gltype1='unsigned long int';;
336
 
           ull) gltype1='unsigned long long int';;
 
399
           l)   gltype1='long int';;
 
400
           ll)  gltype1='long long int';;
 
401
           i64) gltype1='__int64';;
 
402
           u)   gltype1='unsigned int';;
 
403
           ul)  gltype1='unsigned long int';;
 
404
           ull) gltype1='unsigned long long int';;
337
405
           ui64)gltype1='unsigned __int64';;
338
406
         esac
339
407
         AC_COMPILE_IFELSE(
340
 
           [AC_LANG_PROGRAM([$2
 
408
           [AC_LANG_PROGRAM([$2[
341
409
              extern $gltype foo;
342
 
              extern $gltype1 foo;])],
 
410
              extern $gltype1 foo;]])],
343
411
           [eval gl_cv_type_${gltype}_suffix=\$glsuf])
344
412
         eval result=\$gl_cv_type_${gltype}_suffix
345
413
         test "$result" != no && break
348
416
    eval result=\$gl_cv_type_${gltype}_suffix
349
417
    test "$result" = no && result=
350
418
    eval ${GLTYPE}_SUFFIX=\$result
351
 
    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
 
419
    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
352
420
  done
353
 
  AC_FOREACH([gltype], [$1],
 
421
  m4_foreach_w([gltype], [$1],
354
422
    [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
355
423
])
356
424
 
373
441
dnl of interest to stdint.in.h.
374
442
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
375
443
[
376
 
  gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
 
444
  AC_REQUIRE([gl_MULTIARCH])
 
445
  if test $APPLE_UNIVERSAL_BUILD = 0; then
 
446
    gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
 
447
      [gl_STDINT_INCLUDES])
 
448
  fi
 
449
  gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
377
450
    [gl_STDINT_INCLUDES])
378
451
  gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
379
452
    [gl_STDINT_INCLUDES])
380
453
  gl_cv_type_ptrdiff_t_signed=yes
381
454
  gl_cv_type_size_t_signed=no
382
 
  gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
 
455
  if test $APPLE_UNIVERSAL_BUILD = 0; then
 
456
    gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
 
457
      [gl_STDINT_INCLUDES])
 
458
  fi
 
459
  gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
383
460
    [gl_STDINT_INCLUDES])
384
461
])
385
462