File: libfcache.m4

package info (click to toggle)
libfsext 20260201-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,552 kB
  • sloc: ansic: 215,542; sh: 6,929; makefile: 1,554; python: 469; cpp: 427; sed: 16
file content (173 lines) | stat: -rw-r--r-- 4,955 bytes parent folder | download | duplicates (8)
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
dnl Checks for libfcache required headers and functions
dnl
dnl Version: 20240514

dnl Function to detect if libfcache is available
dnl ac_libfcache_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l<library> arguments
AC_DEFUN([AX_LIBFCACHE_CHECK_LIB],
  [AS_IF(
    [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfcache" = xno],
    [ac_cv_libfcache=no],
    [ac_cv_libfcache=check
    dnl Check if the directory provided as parameter exists
    dnl For both --with-libfcache which returns "yes" and --with-libfcache= which returns ""
    dnl treat them as auto-detection.
    AS_IF(
      [test "x$ac_cv_with_libfcache" != x && test "x$ac_cv_with_libfcache" != xauto-detect && test "x$ac_cv_with_libfcache" != xyes],
      [AX_CHECK_LIB_DIRECTORY_EXISTS([libfcache])],
      [dnl Check for a pkg-config file
      AS_IF(
        [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"],
        [PKG_CHECK_MODULES(
          [libfcache],
          [libfcache >= 20191109],
          [ac_cv_libfcache=yes],
          [ac_cv_libfcache=check])
        ])
      AS_IF(
        [test "x$ac_cv_libfcache" = xyes],
        [ac_cv_libfcache_CPPFLAGS="$pkg_cv_libfcache_CFLAGS"
        ac_cv_libfcache_LIBADD="$pkg_cv_libfcache_LIBS"])
      ])

    AS_IF(
      [test "x$ac_cv_libfcache" = xcheck],
      [dnl Check for headers
      AC_CHECK_HEADERS([libfcache.h])

      AS_IF(
        [test "x$ac_cv_header_libfcache_h" = xno],
        [ac_cv_libfcache=no],
        [ac_cv_libfcache=yes

        AX_CHECK_LIB_FUNCTIONS(
          [libfcache],
          [fcache],
          [[libfcache_get_version],
           [libfcache_cache_initialize],
           [libfcache_cache_free],
           [libfcache_cache_clone],
           [libfcache_cache_clear],
           [libfcache_cache_get_number_of_entries],
           [libfcache_cache_get_number_of_cache_values],
           [libfcache_cache_clear_value_by_index],
           [libfcache_cache_get_value_by_identifier],
           [libfcache_cache_get_value_by_index],
           [libfcache_cache_set_value_by_identifier],
           [libfcache_cache_set_value_by_index],
           [libfcache_cache_value_free],
           [libfcache_cache_value_clear],
           [libfcache_cache_value_get_identifier],
           [libfcache_cache_value_set_identifier],
           [libfcache_cache_value_get_value],
           [libfcache_cache_value_set_value],
           [libfcache_date_time_get_timestamp]])

        ac_cv_libfcache_LIBADD="-lfcache"])
      ])

    AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libfcache])
    ])

  AS_IF(
    [test "x$ac_cv_libfcache" = xyes],
    [AC_DEFINE(
      [HAVE_LIBFCACHE],
      [1],
      [Define to 1 if you have the `fcache' library (-lfcache).])
    ])

  AS_IF(
    [test "x$ac_cv_libfcache" = xyes],
    [AC_SUBST(
      [HAVE_LIBFCACHE],
      [1]) ],
    [AC_SUBST(
      [HAVE_LIBFCACHE],
      [0])
    ])
  ])

dnl Function to detect if libfcache dependencies are available
AC_DEFUN([AX_LIBFCACHE_CHECK_LOCAL],
  [dnl Types used in libfcache/libfcache_date_time.h
  AC_STRUCT_TM

  dnl Headers included in libfcache/libfcache_date_time.h
  AC_CHECK_HEADERS([sys/time.h])

  dnl Date and time functions used in libfcache/libfcache_date_time.h
  AC_CHECK_FUNCS([clock_gettime time])

  AS_IF(
    [test "x$ac_cv_func_time" != xyes],
    [AC_MSG_FAILURE(
      [Missing function: time],
      [1])
    ])

  ac_cv_libfcache_CPPFLAGS="-I../libfcache -I\$(top_srcdir)/libfcache";
  ac_cv_libfcache_LIBADD="../libfcache/libfcache.la";

  ac_cv_libfcache=local
  ])

dnl Function to detect how to enable libfcache
AC_DEFUN([AX_LIBFCACHE_CHECK_ENABLE],
  [AX_COMMON_ARG_WITH(
    [libfcache],
    [libfcache],
    [search for libfcache in includedir and libdir or in the specified DIR, or no if to use local version],
    [auto-detect],
    [DIR])

  dnl Check for a shared library version
  AX_LIBFCACHE_CHECK_LIB

  dnl Check if the dependencies for the local library version
  AS_IF(
    [test "x$ac_cv_libfcache" != xyes],
    [AX_LIBFCACHE_CHECK_LOCAL

    AC_DEFINE(
      [HAVE_LOCAL_LIBFCACHE],
      [1],
      [Define to 1 if the local version of libfcache is used.])
    AC_SUBST(
      [HAVE_LOCAL_LIBFCACHE],
      [1])
    ])

  AM_CONDITIONAL(
    [HAVE_LOCAL_LIBFCACHE],
    [test "x$ac_cv_libfcache" = xlocal])
  AS_IF(
    [test "x$ac_cv_libfcache_CPPFLAGS" != "x"],
    [AC_SUBST(
      [LIBFCACHE_CPPFLAGS],
      [$ac_cv_libfcache_CPPFLAGS])
    ])
  AS_IF(
    [test "x$ac_cv_libfcache_LIBADD" != "x"],
    [AC_SUBST(
      [LIBFCACHE_LIBADD],
      [$ac_cv_libfcache_LIBADD])
    ])

  AS_IF(
    [test "x$ac_cv_libfcache" = xyes],
    [AC_SUBST(
      [ax_libfcache_pc_libs_private],
      [-lfcache])
    ])

  AS_IF(
    [test "x$ac_cv_libfcache" = xyes],
    [AC_SUBST(
      [ax_libfcache_spec_requires],
      [libfcache])
    AC_SUBST(
      [ax_libfcache_spec_build_requires],
      [libfcache-devel])
    ])
  ])