File: obstack.m4

package info (click to toggle)
coreutils 9.7-3
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 67,780 kB
  • sloc: ansic: 243,477; sh: 29,063; perl: 7,908; yacc: 1,858; makefile: 196; python: 47; sed: 16
file content (72 lines) | stat: -rw-r--r-- 2,306 bytes parent folder | download | duplicates (5)
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
# obstack.m4
# serial 1
dnl Copyright 1996-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.

# See if we need to provide obstacks.

dnl Autoconf's AC_FUNC_OBSTACK is marked obsolete since version 2.70.
dnl We provide our own macro here.

AC_DEFUN([gl_FUNC_OBSTACK],
[
  AC_CHECK_HEADERS_ONCE([obstack.h])
  if test $ac_cv_header_obstack_h = yes; then
    HAVE_OBSTACK=1
    AC_CACHE_CHECK([for obstacks that work with any size object],
      [gl_cv_func_obstack],
      [AC_LINK_IFELSE(
         [AC_LANG_PROGRAM(
            [[#include "obstack.h"
              void *obstack_chunk_alloc (size_t n) { return 0; }
              void obstack_chunk_free (void *p) { }
              /* Check that an internal function returns size_t, not int.  */
              size_t _obstack_memory_used (struct obstack *);
             ]],
            [[struct obstack mem;
              obstack_init (&mem);
              obstack_free (&mem, 0);
            ]])],
         [gl_cv_func_obstack=yes],
         [gl_cv_func_obstack=no])
      ])
    if test $gl_cv_func_obstack = yes; then
      REPLACE_OBSTACK=0
    else
      REPLACE_OBSTACK=1
    fi
  else
    HAVE_OBSTACK=0
    REPLACE_OBSTACK=0
  fi
  if test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1; then
    GL_GENERATE_OBSTACK_H=true
  else
    GL_GENERATE_OBSTACK_H=false
  fi
  AC_SUBST([REPLACE_OBSTACK])

  dnl Test whether a 'ptrdiff_t' has at least as many bits as a pointer.
  AC_CACHE_CHECK([whether ptrdiff_t is at least as large as a pointer],
    [gl_cv_ptrdiff_t_wide_enough],
    [AC_COMPILE_IFELSE(
       [AC_LANG_PROGRAM(
          [[#include <stddef.h>
            typedef int check[2 * (sizeof (ptrdiff_t) >= sizeof (void *)) - 1];
           ]],
          [[]])],
       [gl_cv_ptrdiff_t_wide_enough=yes],
       [gl_cv_ptrdiff_t_wide_enough=no])
    ])
  if test $gl_cv_ptrdiff_t_wide_enough = yes; then
    SMALL_PTRDIFF_T=0
  else
    SMALL_PTRDIFF_T=1
  fi
  dnl SMALL_PTRDIFF_T is expected to be 1 only on old / exotic platforms
  dnl such as Windows 3.1 and AS/400.
  AC_SUBST([SMALL_PTRDIFF_T])
])