[go: up one dir, main page]

File: libfwps.m4

package info (click to toggle)
libfwsi 20181227-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 9,912 kB
  • sloc: ansic: 124,133; sh: 5,880; makefile: 1,190; python: 349; sed: 16
file content (186 lines) | stat: -rw-r--r-- 4,790 bytes parent folder | download | duplicates (7)
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
174
175
176
177
178
179
180
181
182
183
184
185
186
dnl Checks for libfwps required headers and functions
dnl
dnl Version: 20181117

dnl Function to detect if libfwps is available
dnl ac_libfwps_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l<library> arguments
AC_DEFUN([AX_LIBFWPS_CHECK_LIB],
  [AS_IF(
    [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfwps" = xno],
    [ac_cv_libfwps=no],
    [dnl Check if the directory provided as parameter exists
    AS_IF(
      [test "x$ac_cv_with_libfwps" != x && test "x$ac_cv_with_libfwps" != xauto-detect],
      [AS_IF(
        [test -d "$ac_cv_with_libfwps"],
        [CFLAGS="$CFLAGS -I${ac_cv_with_libfwps}/include"
        LDFLAGS="$LDFLAGS -L${ac_cv_with_libfwps}/lib"],
        [AC_MSG_FAILURE(
          [no such directory: $ac_cv_with_libfwps],
          [1])
        ])
        ac_cv_libfwps=check],
      [dnl Check for a pkg-config file
      AS_IF(
        [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"],
        [PKG_CHECK_MODULES(
          [libfwps],
          [libfwps >= 20140622],
          [ac_cv_libfwps=yes],
          [ac_cv_libfwps=check])
        ])
      AS_IF(
        [test "x$ac_cv_libfwps" = xyes],
        [ac_cv_libfwps_CPPFLAGS="$pkg_cv_libfwps_CFLAGS"
        ac_cv_libfwps_LIBADD="$pkg_cv_libfwps_LIBS"])
      ])

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

      AS_IF(
        [test "x$ac_cv_header_libfwps_h" = xno],
        [ac_cv_libfwps=no],
        [dnl Check for the individual functions
        ac_cv_libfwps=yes

        AC_CHECK_LIB(
          fwps,
          libfwps_get_version,
          [ac_cv_libfwps_dummy=yes],
          [ac_cv_libfwps=no])

        dnl Store functions
        AC_CHECK_LIB(
          fwps,
          libfwps_store_initialize,
          [ac_cv_libfwps_dummy=yes],
          [ac_cv_libfwps=no])
        AC_CHECK_LIB(
          fwps,
          libfwps_store_free,
          [ac_cv_libfwps_dummy=yes],
          [ac_cv_libfwps=no])
        AC_CHECK_LIB(
          fwps,
          libfwps_store_copy_from_byte_stream,
          [ac_cv_libfwps_dummy=yes],
          [ac_cv_libfwps=no])

        ac_cv_libfwps_LIBADD="-lfwps"])
      ])
    AS_IF(
      [test "x$ac_cv_with_libfwps" != x && test "x$ac_cv_with_libfwps" != xauto-detect && test "x$ac_cv_libfwps" != xyes],
      [AC_MSG_FAILURE(
        [unable to find supported libfwps in directory: $ac_cv_with_libfwps],
        [1])
      ])
    ])

  dnl Check for debug functions
  AS_IF(
    [test "x$ac_cv_libfwps" = xyes && test "x$ac_cv_enable_debug_output" != xno],
    [AC_CHECK_LIB(
      fwps,
      libfwps_property_identifier_get_description,
      [ac_cv_libfwps_dummy=yes],
      [ac_cv_libfwps=no])

    AC_CHECK_LIB(
      fwps,
      libfwps_property_identifier_get_identifier,
      [ac_cv_libfwps_dummy=yes],
      [ac_cv_libfwps=no])
    ])

  AS_IF(
    [test "x$ac_cv_libfwps" = xyes],
    [AC_DEFINE(
      [HAVE_LIBFWPS],
      [1],
      [Define to 1 if you have the `fwps' library (-lfwps).])
    ])

  AS_IF(
    [test "x$ac_cv_libfwps" = xyes],
    [AC_SUBST(
      [HAVE_LIBFWPS],
      [1]) ],
    [AC_SUBST(
      [HAVE_LIBFWPS],
      [0])
    ])
  ])

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

  ac_cv_libfwps_CPPFLAGS="-I../libfwps";
  ac_cv_libfwps_LIBADD="../libfwps/libfwps.la";

  ac_cv_libfwps=local
  ])

dnl Function to detect how to enable libfwps
AC_DEFUN([AX_LIBFWPS_CHECK_ENABLE],
  [AX_COMMON_ARG_WITH(
    [libfwps],
    [libfwps],
    [search for libfwps 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_LIBFWPS_CHECK_LIB

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

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

  AM_CONDITIONAL(
    [HAVE_LOCAL_LIBFWPS],
    [test "x$ac_cv_libfwps" = xlocal])
  AS_IF(
    [test "x$ac_cv_libfwps_CPPFLAGS" != "x"],
    [AC_SUBST(
      [LIBFWPS_CPPFLAGS],
      [$ac_cv_libfwps_CPPFLAGS])
    ])
  AS_IF(
    [test "x$ac_cv_libfwps_LIBADD" != "x"],
    [AC_SUBST(
      [LIBFWPS_LIBADD],
      [$ac_cv_libfwps_LIBADD])
    ])

  AS_IF(
    [test "x$ac_cv_libfwps" = xyes],
    [AC_SUBST(
      [ax_libfwps_pc_libs_private],
      [-lfwps])
    ])

  AS_IF(
    [test "x$ac_cv_libfwps" = xyes],
    [AC_SUBST(
      [ax_libfwps_spec_requires],
      [libfwps])
    AC_SUBST(
      [ax_libfwps_spec_build_requires],
      [libfwps-devel])
    ])
  ])