File: libfmos.m4

package info (click to toggle)
libfshfs 20260130-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 16,968 kB
  • sloc: ansic: 276,743; sh: 6,860; makefile: 1,653; python: 424; cpp: 391; sed: 16
file content (145 lines) | stat: -rw-r--r-- 3,717 bytes parent folder | download | duplicates (2)
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
dnl Checks for libfmos required headers and functions
dnl
dnl Version: 20240520

dnl Function to detect if libfmos is available
dnl ac_libfmos_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l<library> arguments
AC_DEFUN([AX_LIBFMOS_CHECK_LIB],
  [AS_IF(
    [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfmos" = xno],
    [ac_cv_libfmos=no],
    [ac_cv_libfmos=check
    dnl Check if the directory provided as parameter exists
    dnl For both --with-libfmos which returns "yes" and --with-libfmos= which returns ""
    dnl treat them as auto-detection.
    AS_IF(
      [test "x$ac_cv_with_libfmos" != x && test "x$ac_cv_with_libfmos" != xauto-detect && test "x$ac_cv_with_libfmos" != xyes],
      [AX_CHECK_LIB_DIRECTORY_EXISTS([libfmos])],
      [dnl Check for a pkg-config file
      AS_IF(
        [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"],
        [PKG_CHECK_MODULES(
          [libfmos],
          [libfmos >= 20191217],
          [ac_cv_libfmos=yes],
          [ac_cv_libfmos=check])
        ])
      AS_IF(
        [test "x$ac_cv_libfmos" = xyes],
        [ac_cv_libfmos_CPPFLAGS="$pkg_cv_libfmos_CFLAGS"
        ac_cv_libfmos_LIBADD="$pkg_cv_libfmos_LIBS"])
      ])

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

      AS_IF(
        [test "x$ac_cv_header_libfmos_h" = xno],
        [ac_cv_libfmos=no],
        [ac_cv_libfmos=yes

        AX_CHECK_LIB_FUNCTIONS(
          [libfmos],
          [fmos],
          [[libfmos_get_version],
           [libfmos_adc_decompress],
           [libfmos_lzfse_decompress],
           [libfmos_lzvn_decompress]])

        ac_cv_libfmos_LIBADD="-lfmos"])
      ])

    AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libfmos])
    ])

  AS_IF(
    [test "x$ac_cv_libfmos" = xyes],
    [AC_DEFINE(
      [HAVE_LIBFMOS],
      [1],
      [Define to 1 if you have the `fmos' library (-lfmos).])
    ])

  AS_IF(
    [test "x$ac_cv_libfmos" = xyes],
    [AC_SUBST(
      [HAVE_LIBFMOS],
      [1]) ],
    [AC_SUBST(
      [HAVE_LIBFMOS],
      [0])
    ])
  ])

dnl Function to detect if libfmos dependencies are available
AC_DEFUN([AX_LIBFMOS_CHECK_LOCAL],
  [dnl No additional checks.

  ac_cv_libfmos_CPPFLAGS="-I../libfmos -I\$(top_srcdir)/libfmos";
  ac_cv_libfmos_LIBADD="../libfmos/libfmos.la";

  ac_cv_libfmos=local
  ])

dnl Function to detect how to enable libfmos
AC_DEFUN([AX_LIBFMOS_CHECK_ENABLE],
  [AX_COMMON_ARG_WITH(
    [libfmos],
    [libfmos],
    [search for libfmos 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_LIBFMOS_CHECK_LIB

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

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

  AM_CONDITIONAL(
    [HAVE_LOCAL_LIBFMOS],
    [test "x$ac_cv_libfmos" = xlocal])
  AS_IF(
    [test "x$ac_cv_libfmos_CPPFLAGS" != "x"],
    [AC_SUBST(
      [LIBFMOS_CPPFLAGS],
      [$ac_cv_libfmos_CPPFLAGS])
    ])
  AS_IF(
    [test "x$ac_cv_libfmos_LIBADD" != "x"],
    [AC_SUBST(
      [LIBFMOS_LIBADD],
      [$ac_cv_libfmos_LIBADD])
    ])

  AS_IF(
    [test "x$ac_cv_libfmos" = xyes],
    [AC_SUBST(
      [ax_libfmos_pc_libs_private],
      [-lfmos])
    ])

  AS_IF(
    [test "x$ac_cv_libfmos" = xyes],
    [AC_SUBST(
      [ax_libfmos_spec_requires],
      [libfmos])
    AC_SUBST(
      [ax_libfmos_spec_build_requires],
      [libfmos-devel])
    ])
  ])