5cc06cb92919c56ff9af9d11d366019ea0a75fc8
[xfstests-dev.git] / aclocal.m4
1 # generated automatically by aclocal 1.9.6 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005  Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 AC_DEFUN([AC_PACKAGE_NEED_SYS_ACL_H],
15   [ AC_CHECK_HEADERS([sys/acl.h])
16     if test "$ac_cv_header_sys_acl_h" != "yes"; then
17         echo
18         echo 'FATAL ERROR: sys/acl.h does not exist.'
19         echo 'Install the access control lists (acl) development package.'
20         echo 'Alternatively, run "make install-dev" from the acl source.'
21         exit 1
22     fi
23   ])
24
25 AC_DEFUN([AC_PACKAGE_NEED_ACL_LIBACL_H],
26   [ AC_CHECK_HEADERS([acl/libacl.h])
27     if test "$ac_cv_header_acl_libacl_h" != "yes"; then
28         echo
29         echo 'FATAL ERROR: acl/libacl.h does not exist.'
30         echo 'Install the access control lists (acl) development package.'
31         echo 'Alternatively, run "make install-dev" from the acl source.'
32         exit 1
33     fi
34   ])
35
36
37 AC_DEFUN([AC_PACKAGE_NEED_ACLINIT_LIBACL],
38   [ AC_CHECK_LIB(acl, acl_init,, [
39         echo
40         echo 'FATAL ERROR: could not find a valid Access Control List library.'
41         echo 'Install either the libacl (rpm) or the libacl1 (deb) package.'
42         echo 'Alternatively, run "make install-lib" from the acl source.'
43         exit 1
44     ])
45     libacl="-lacl"
46     test -f `pwd`/../acl/libacl/libacl.la && \
47         libacl="`pwd`/../acl/libacl/libacl.la"
48     test -f /usr/lib/libacl.la && libacl="/usr/lib/libacl.la"
49     AC_SUBST(libacl)
50   ])
51
52 AC_DEFUN([AC_PACKAGE_WANT_AIO],
53   [ AC_CHECK_HEADERS(libaio.h, [ have_aio=true ], [ have_aio=false ])
54     AC_SUBST(have_aio)
55   ])
56
57 AC_DEFUN([AC_PACKAGE_NEED_ATTR_XATTR_H],
58   [ AC_CHECK_HEADERS([attr/xattr.h])
59     if test "$ac_cv_header_attr_xattr_h" != "yes"; then
60         echo
61         echo 'FATAL ERROR: attr/xattr.h does not exist.'
62         echo 'Install the extended attributes (attr) development package.'
63         echo 'Alternatively, run "make install-dev" from the attr source.'
64         exit 1
65     fi
66   ])
67
68 AC_DEFUN([AC_PACKAGE_NEED_ATTR_ERROR_H],
69   [ AC_CHECK_HEADERS([attr/error_context.h])
70     if test "$ac_cv_header_attr_error_context_h" != "yes"; then
71         echo
72         echo 'FATAL ERROR: attr/error_context.h does not exist.'
73         echo 'Install the extended attributes (attr) development package.'
74         echo 'Alternatively, run "make install-dev" from the attr source.'
75         exit 1
76     fi
77   ])
78
79 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_H],
80   [ have_attributes_h=false
81     AC_CHECK_HEADERS([attr/attributes.h sys/attributes.h], [have_attributes_h=true], )
82     if test "$have_attributes_h" = "false"; then
83         echo
84         echo 'FATAL ERROR: attributes.h does not exist.'
85         echo 'Install the extended attributes (attr) development package.'
86         echo 'Alternatively, run "make install-dev" from the attr source.'
87         exit 1
88     fi
89   ])
90
91 AC_DEFUN([AC_PACKAGE_WANT_ATTRLIST_LIBATTR],
92   [ AC_CHECK_LIB(attr, attr_list, [have_attr_list=true], [have_attr_list=false])
93     AC_SUBST(have_attr_list)
94   ])
95
96 AC_DEFUN([AC_PACKAGE_NEED_GETXATTR_LIBATTR],
97   [ AC_CHECK_LIB(attr, getxattr,, [
98         echo
99         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
100         echo 'Install the extended attributes (attr) development package.'
101         echo 'Alternatively, run "make install-lib" from the attr source.'
102         exit 1
103     ])
104     libattr="-lattr"
105     test -f `pwd`/../attr/libattr/libattr.la && \
106         libattr="`pwd`/../attr/libattr/libattr.la"
107     test -f /usr/lib/libattr.la && libattr="/usr/lib/libattr.la"
108     AC_SUBST(libattr)
109   ])
110
111 AC_DEFUN([AC_PACKAGE_NEED_ATTRGET_LIBATTR],
112   [ AC_CHECK_LIB(attr, attr_get,, [
113         echo
114         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
115         echo 'Install the extended attributes (attr) development package.'
116         echo 'Alternatively, run "make install-lib" from the attr source.'
117         exit 1
118     ])
119     libattr="-lattr"
120     test -f `pwd`/../attr/libattr/libattr.la && \
121         libattr="`pwd`/../attr/libattr/libattr.la"
122     test -f /usr/lib/libattr.la && libattr="/usr/lib/libattr.la"
123     AC_SUBST(libattr)
124   ])
125
126 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_MACROS],
127   [ AC_MSG_CHECKING([macros in attr/attributes.h])
128     AC_TRY_LINK([
129 #include <sys/types.h>
130 #include <attr/attributes.h>],
131     [ int x = ATTR_SECURE; ], [ echo ok ], [
132         echo
133         echo 'FATAL ERROR: could not find a current attributes header.'
134         echo 'Upgrade the extended attributes (attr) development package.'
135         echo 'Alternatively, run "make install-dev" from the attr source.'
136         exit 1 ])
137   ])
138
139 AC_DEFUN([AC_PACKAGE_WANT_NDBM],
140   [ AC_CHECK_HEADERS(ndbm.h, [ have_db=true ], [ have_db=false ])
141     libgdbm=""
142     AC_SUBST(libgdbm)
143     AC_SUBST(have_db)
144   ])
145
146 AC_DEFUN([AC_PACKAGE_WANT_GDBM],
147   [ AC_CHECK_HEADERS([gdbm/ndbm.h], [ have_db=true ], [ have_db=false ])
148     if test $have_db = true -a -f /usr/lib/libgdbm.a; then
149         libgdbm="/usr/lib/libgdbm.a"
150     fi
151     AC_SUBST(libgdbm)
152     AC_SUBST(have_db)
153   ])
154
155
156 # Generic macro, sets up all of the global packaging variables.
157 # The following environment variables may be set to override defaults:
158 #   DEBUG OPTIMIZER MALLOCLIB PLATFORM DISTRIBUTION INSTALL_USER INSTALL_GROUP
159 #   BUILD_VERSION
160 #
161 AC_DEFUN([AC_PACKAGE_GLOBALS],
162   [ pkg_name="$1"
163     AC_SUBST(pkg_name)
164
165     . ./VERSION
166     pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
167     AC_SUBST(pkg_version)
168     pkg_release=$PKG_BUILD
169     test -z "$BUILD_VERSION" || pkg_release="$BUILD_VERSION"
170     AC_SUBST(pkg_release)
171
172     DEBUG=${DEBUG:-'-DDEBUG'}           dnl  -DNDEBUG
173     debug_build="$DEBUG"
174     AC_SUBST(debug_build)
175
176     OPTIMIZER=${OPTIMIZER:-'-g'}        dnl  -O2
177     opt_build="$OPTIMIZER"
178     AC_SUBST(opt_build)
179
180     MALLOCLIB=${MALLOCLIB:-''}          dnl  /usr/lib/libefence.a
181     malloc_lib="$MALLOCLIB"
182     AC_SUBST(malloc_lib)
183
184     pkg_user=`id -u`
185     test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER"
186     AC_SUBST(pkg_user)
187
188     pkg_group=`id -g`
189     test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP"
190     AC_SUBST(pkg_group)
191
192     pkg_distribution=`uname -s`
193     test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
194     AC_SUBST(pkg_distribution)
195
196     pkg_platform=`uname -s | tr 'A-Z' 'a-z' | sed -e 's/irix64/irix/'`
197     test -z "$PLATFORM" || pkg_platform="$PLATFORM"
198     AC_SUBST(pkg_platform)
199   ])
200
201 #
202 # Check for specified utility (env var) - if unset, fail.
203
204 AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
205   [ if test -z "$2"; then
206         echo
207         echo FATAL ERROR: $3 does not seem to be installed.
208         echo $1 cannot be built without a working $4 installation.
209         exit 1
210     fi
211   ])
212
213 #
214 # Generic macro, sets up all of the global build variables.
215 # The following environment variables may be set to override defaults:
216 #  CC MAKE LIBTOOL TAR ZIP MAKEDEPEND AWK SED ECHO SORT
217 #  MSGFMT MSGMERGE RPM
218 #
219 AC_DEFUN([AC_PACKAGE_UTILITIES],
220   [ AC_PROG_CC
221     cc="$CC"
222     AC_SUBST(cc)
223     AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
224
225     if test -z "$MAKE"; then
226         AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
227     fi
228     if test -z "$MAKE"; then
229         AC_PATH_PROG(MAKE, make,, /usr/bin)
230     fi
231     make=$MAKE
232     AC_SUBST(make)
233     AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
234
235     if test -z "$LIBTOOL"; then
236         AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
237     fi
238     if test -z "$LIBTOOL"; then
239         AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
240     fi
241     libtool=$LIBTOOL
242     AC_SUBST(libtool)
243     AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
244
245     if test -z "$TAR"; then
246         AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
247     fi
248     tar=$TAR
249     AC_SUBST(tar)
250     if test -z "$ZIP"; then
251         AC_PATH_PROG(ZIP, gzip,, /bin:/usr/bin:/usr/local/bin:/usr/freeware/bin)
252     fi
253
254     zip=$ZIP
255     AC_SUBST(zip)
256
257     if test -z "$MAKEDEPEND"; then
258         AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
259     fi
260     makedepend=$MAKEDEPEND
261     AC_SUBST(makedepend)
262
263     if test -z "$AWK"; then
264         AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
265     fi
266     awk=$AWK
267     AC_SUBST(awk)
268
269     if test -z "$SED"; then
270         AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
271     fi
272     sed=$SED
273     AC_SUBST(sed)
274
275     if test -z "$ECHO"; then
276         AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
277     fi
278     echo=$ECHO
279     AC_SUBST(echo)
280
281     if test -z "$SORT"; then
282         AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
283     fi
284     sort=$SORT
285     AC_SUBST(sort)
286
287     dnl check if symbolic links are supported
288     AC_PROG_LN_S
289
290     if test "$enable_gettext" = yes; then
291         if test -z "$MSGFMT"; then
292                 AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
293         fi
294         msgfmt=$MSGFMT
295         AC_SUBST(msgfmt)
296         AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
297
298         if test -z "$MSGMERGE"; then
299                 AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
300         fi
301         msgmerge=$MSGMERGE
302         AC_SUBST(msgmerge)
303         AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
304     fi
305
306     if test -z "$RPM"; then
307         AC_PATH_PROG(RPM, rpm,, /bin:/usr/bin:/usr/freeware/bin)
308     fi
309     rpm=$RPM
310     AC_SUBST(rpm)
311
312     dnl .. and what version is rpm
313     rpm_version=0
314     test -n "$RPM" && test -x "$RPM" && rpm_version=`$RPM --version \
315                         | awk '{print $NF}' | awk -F. '{V=1; print $V}'`
316     AC_SUBST(rpm_version)
317     dnl At some point in rpm 4.0, rpm can no longer build rpms, and
318     dnl rpmbuild is needed (rpmbuild may go way back; not sure)
319     dnl So, if rpm version >= 4.0, look for rpmbuild.  Otherwise build w/ rpm
320     if test $rpm_version -ge 4; then
321         AC_PATH_PROG(RPMBUILD, rpmbuild)
322         rpmbuild=$RPMBUILD
323     else
324         rpmbuild=$RPM
325     fi
326     AC_SUBST(rpmbuild)
327   ])
328
329 AC_DEFUN([AC_PACKAGE_NEED_UUID_H],
330   [ AC_CHECK_HEADERS([uuid.h sys/uuid.h uuid/uuid.h])
331     if test $ac_cv_header_uuid_h = no -a \
332             $ac_cv_header_sys_uuid_h = no -a \
333             $ac_cv_header_uuid_uuid_h = no; then
334         echo
335         echo 'FATAL ERROR: could not find a valid UUID header.'
336         echo 'Install the Universally Unique Identifiers development package.'
337         exit 1
338     fi
339   ])
340
341 AC_DEFUN([AC_PACKAGE_NEED_UUIDCOMPARE],
342   [ AC_CHECK_FUNCS(uuid_compare)
343     if test $ac_cv_func_uuid_compare = yes; then
344         libuuid=""
345     else
346         AC_CHECK_LIB(uuid, uuid_compare,, [
347             echo
348             echo 'FATAL ERROR: could not find a valid UUID library.'
349             echo 'Install the Universally Unique Identifiers library package.'
350             exit 1])
351         libuuid="-luuid"
352     fi
353     AC_SUBST(libuuid)
354   ])
355
356 AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
357   [ AC_CHECK_HEADERS([xfs/libxfs.h])
358     if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
359         echo
360         echo 'FATAL ERROR: cannot find a valid <xfs/libxfs.h> header file.'
361         echo 'Install or upgrade the XFS development package.'
362         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
363         exit 1
364     fi
365   ])
366
367 AC_DEFUN([AC_PACKAGE_NEED_XFS_XQM_H],
368   [ AC_CHECK_HEADERS([xfs/xqm.h])
369     if test "$ac_cv_header_xfs_xqm_h" != "yes"; then
370         echo
371         echo 'FATAL ERROR: cannot find a valid <xfs/xqm.h> header file.'
372         echo 'Install or upgrade the XFS development package.'
373         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
374         exit 1
375     fi
376   ])
377
378 AC_DEFUN([AC_PACKAGE_NEED_XFS_HANDLE_H],
379   [ AC_CHECK_HEADERS([xfs/handle.h])
380     if test "$ac_cv_header_xfs_handle_h" != "yes"; then
381         echo
382         echo 'FATAL ERROR: cannot find a valid <xfs/handle.h> header file.'
383         echo 'Install or upgrade the XFS development package.'
384         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
385         exit 1
386     fi
387   ])
388
389 AC_DEFUN([AC_PACKAGE_NEED_LIBXFSINIT_LIBXFS],
390   [ AC_CHECK_LIB(xfs, libxfs_init,, [
391         echo
392         echo 'FATAL ERROR: could not find a valid XFS base library.'
393         echo 'Install or upgrade the XFS library package.'
394         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
395         exit 1
396     ])
397     libxfs="-lxfs"
398     test -f `pwd`/../xfsprogs/libxfs/libxfs.la && \
399         libxfs="`pwd`/../xfsprogs/libxfs/libxfs.la"
400     test -f /usr/lib/libxfs.la && libxfs="/usr/lib/libxfs.la"
401     AC_SUBST(libxfs)
402   ])
403
404 AC_DEFUN([AC_PACKAGE_NEED_OPEN_BY_FSHANDLE],
405   [ AC_CHECK_LIB(handle, open_by_fshandle,, [
406         echo
407         echo 'FATAL ERROR: could not find a current XFS handle library.'
408         echo 'Install or upgrade the XFS library package.'
409         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
410         exit 1
411     ])
412     libhdl="-lhandle"
413     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
414         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
415     test -f /usr/lib/libhandle.la && libhdl="/usr/lib/libhandle.la"
416     AC_SUBST(libhdl)
417   ])
418
419 AC_DEFUN([AC_PACKAGE_NEED_ATTRLIST_LIBHANDLE],
420   [ AC_CHECK_LIB(handle, attr_list_by_handle,, [
421         echo
422         echo 'FATAL ERROR: could not find a current XFS handle library.'
423         echo 'Install or upgrade the XFS library package.'
424         echo 'Alternatively, run "make install-lib" from the xfsprogs source.'
425         exit 1
426     ])
427     libhdl="-lhandle"
428     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
429         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
430     test -f /usr/lib/libhandle.la && libhdl="/usr/lib/libhandle.la"
431     AC_SUBST(libhdl)
432   ])
433
434 AC_DEFUN([AC_PACKAGE_NEED_IRIX_LIBHANDLE],
435   [ 
436     AC_MSG_CHECKING([libhandle.a for IRIX])
437     libhdl="`pwd`/../irix/libhandle/libhandle.a"
438     if ! test -f $libhdl; then
439         echo 'no'
440         echo 'FATAL ERROR: could not find IRIX XFS handle library.'
441         exit 1
442     fi
443     echo 'yes'
444     AC_SUBST(libhdl)
445   ])
446
447 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO],
448   [ AC_MSG_CHECKING([xfsctl from xfs/libxfs.h])
449     AC_TRY_LINK([#include <xfs/libxfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
450       [ echo ok ],
451       [ echo
452         echo 'FATAL ERROR: cannot find required macros in the XFS headers.'
453         echo 'Upgrade your XFS programs (xfsprogs) development package.'
454         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
455         exit 1
456       ])
457   ])
458