Check for xlog_assign_lsn in xfs headers
[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 # The AC_MULTILIB macro was extracted and modified from 
15 # gettext-0.15's AC_LIB_PREPARE_MULTILIB macro in the lib-prefix.m4 file
16 # so that the correct paths can be used for 64-bit libraries.
17 #
18 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
19 dnl This file is free software; the Free Software Foundation
20 dnl gives unlimited permission to copy and/or distribute it,
21 dnl with or without modifications, as long as this notice is preserved.
22 dnl From Bruno Haible.
23
24 dnl AC_MULTILIB creates a variable libdirsuffix, containing
25 dnl the suffix of the libdir, either "" or "64".
26 dnl Only do this if the given enable parameter is "yes".
27 AC_DEFUN([AC_MULTILIB],
28 [
29   dnl There is no formal standard regarding lib and lib64. The current
30   dnl practice is that on a system supporting 32-bit and 64-bit instruction
31   dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
32   dnl libraries go under $prefix/lib. We determine the compiler's default
33   dnl mode by looking at the compiler's library search path. If at least
34   dnl of its elements ends in /lib64 or points to a directory whose absolute
35   dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
36   dnl default, namely "lib".
37   enable_lib64="$1"
38   libdirsuffix=""
39   searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
40   if test "$enable_lib64" = "yes" -a -n "$searchpath"; then
41     save_IFS="${IFS=    }"; IFS=":"
42     for searchdir in $searchpath; do
43       if test -d "$searchdir"; then
44         case "$searchdir" in
45           */lib64/ | */lib64 ) libdirsuffix=64 ;;
46           *) searchdir=`cd "$searchdir" && pwd`
47              case "$searchdir" in
48                */lib64 ) libdirsuffix=64 ;;
49              esac ;;
50         esac
51       fi
52     done
53     IFS="$save_IFS"
54   fi
55   AC_SUBST(libdirsuffix)
56 ])
57
58 AC_DEFUN([AC_PACKAGE_NEED_SYS_ACL_H],
59   [ AC_CHECK_HEADERS([sys/acl.h])
60     if test "$ac_cv_header_sys_acl_h" != "yes"; then
61         echo
62         echo 'FATAL ERROR: sys/acl.h does not exist.'
63         echo 'Install the access control lists (acl) development package.'
64         echo 'Alternatively, run "make install-dev" from the acl source.'
65         exit 1
66     fi
67   ])
68
69 AC_DEFUN([AC_PACKAGE_NEED_ACL_LIBACL_H],
70   [ AC_CHECK_HEADERS([acl/libacl.h])
71     if test "$ac_cv_header_acl_libacl_h" != "yes"; then
72         echo
73         echo 'FATAL ERROR: acl/libacl.h does not exist.'
74         echo 'Install the access control lists (acl) development package.'
75         echo 'Alternatively, run "make install-dev" from the acl source.'
76         exit 1
77     fi
78   ])
79
80
81 AC_DEFUN([AC_PACKAGE_NEED_ACLINIT_LIBACL],
82   [ AC_CHECK_LIB(acl, acl_init,, [
83         echo
84         echo 'FATAL ERROR: could not find a valid Access Control List library.'
85         echo 'Install either the libacl (rpm) or the libacl1 (deb) package.'
86         echo 'Alternatively, run "make install-lib" from the acl source.'
87         exit 1
88     ])
89     libacl="-lacl"
90     test -f `pwd`/../acl/libacl/libacl.la && \
91         libacl="`pwd`/../acl/libacl/libacl.la"
92     test -f ${libexecdir}${libdirsuffix}/libacl.la && \
93         libacl="${libexecdir}${libdirsuffix}/libacl.la"
94     AC_SUBST(libacl)
95   ])
96
97 AC_DEFUN([AC_PACKAGE_WANT_AIO],
98   [ AC_CHECK_HEADERS(libaio.h, [ have_aio=true ], [ have_aio=false ])
99     AC_SUBST(have_aio)
100   ])
101
102 AC_DEFUN([AC_PACKAGE_WANT_DMAPI],
103   [ AC_CHECK_HEADERS(sys/dmapi/dmapi.h, [ have_dmapi=true ], [ have_dmapi=false ])
104     AC_SUBST(have_dmapi)
105   ])
106
107 AC_DEFUN([AC_PACKAGE_NEED_ATTR_XATTR_H],
108   [ AC_CHECK_HEADERS([attr/xattr.h])
109     if test "$ac_cv_header_attr_xattr_h" != "yes"; then
110         echo
111         echo 'FATAL ERROR: attr/xattr.h does not exist.'
112         echo 'Install the extended attributes (attr) development package.'
113         echo 'Alternatively, run "make install-dev" from the attr source.'
114         exit 1
115     fi
116   ])
117
118 AC_DEFUN([AC_PACKAGE_NEED_ATTR_ERROR_H],
119   [ AC_CHECK_HEADERS([attr/error_context.h])
120     if test "$ac_cv_header_attr_error_context_h" != "yes"; then
121         echo
122         echo 'FATAL ERROR: attr/error_context.h does not exist.'
123         echo 'Install the extended attributes (attr) development package.'
124         echo 'Alternatively, run "make install-dev" from the attr source.'
125         exit 1
126     fi
127   ])
128
129 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_H],
130   [ have_attributes_h=false
131     AC_CHECK_HEADERS([attr/attributes.h sys/attributes.h], [have_attributes_h=true], )
132     if test "$have_attributes_h" = "false"; then
133         echo
134         echo 'FATAL ERROR: attributes.h does not exist.'
135         echo 'Install the extended attributes (attr) development package.'
136         echo 'Alternatively, run "make install-dev" from the attr source.'
137         exit 1
138     fi
139   ])
140
141 AC_DEFUN([AC_PACKAGE_WANT_ATTRLIST_LIBATTR],
142   [ AC_CHECK_LIB(attr, attr_list, [have_attr_list=true], [have_attr_list=false])
143     AC_SUBST(have_attr_list)
144   ])
145
146 AC_DEFUN([AC_PACKAGE_NEED_GETXATTR_LIBATTR],
147   [ AC_CHECK_LIB(attr, getxattr,, [
148         echo
149         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
150         echo 'Install the extended attributes (attr) development package.'
151         echo 'Alternatively, run "make install-lib" from the attr source.'
152         exit 1
153     ])
154     libattr="-lattr"
155     test -f `pwd`/../attr/libattr/libattr.la && \
156         libattr="`pwd`/../attr/libattr/libattr.la"
157     test -f ${libexecdir}${libdirsuffix}/libattr.la && \
158         libattr="${libexecdir}${libdirsuffix}/libattr.la"
159     AC_SUBST(libattr)
160   ])
161
162 AC_DEFUN([AC_PACKAGE_NEED_ATTRGET_LIBATTR],
163   [ AC_CHECK_LIB(attr, attr_get,, [
164         echo
165         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
166         echo 'Install the extended attributes (attr) development package.'
167         echo 'Alternatively, run "make install-lib" from the attr source.'
168         exit 1
169     ])
170     libattr="-lattr"
171     test -f `pwd`/../attr/libattr/libattr.la && \
172         libattr="`pwd`/../attr/libattr/libattr.la"
173     test -f ${libexecdir}${libdirsuffix}/libattr.la && \
174         libattr="${libexecdir}${libdirsuffix}/libattr.la"
175     AC_SUBST(libattr)
176   ])
177
178 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_MACROS],
179   [ AC_MSG_CHECKING([macros in attr/attributes.h])
180     AC_TRY_LINK([
181 #include <sys/types.h>
182 #include <attr/attributes.h>],
183     [ int x = ATTR_SECURE; ], [ echo ok ], [
184         echo
185         echo 'FATAL ERROR: could not find a current attributes header.'
186         echo 'Upgrade the extended attributes (attr) development package.'
187         echo 'Alternatively, run "make install-dev" from the attr source.'
188         exit 1 ])
189   ])
190
191 AC_DEFUN([AC_PACKAGE_WANT_NDBM],
192   [ AC_CHECK_HEADERS(ndbm.h, [ have_db=true ], [ have_db=false ])
193     libgdbm=""
194     AC_SUBST(libgdbm)
195     AC_SUBST(have_db)
196   ])
197
198 AC_DEFUN([AC_PACKAGE_WANT_GDBM],
199   [ AC_CHECK_HEADERS([gdbm/ndbm.h], [ have_db=true ], [ have_db=false ])
200     if test $have_db = true; then
201         libgdbm="-lgdbm"
202     fi
203     AC_SUBST(libgdbm)
204     AC_SUBST(have_db)
205   ])
206
207 #
208 # Generic macro, sets up all of the global packaging variables.
209 # The following environment variables may be set to override defaults:
210 #   DEBUG OPTIMIZER MALLOCLIB PLATFORM DISTRIBUTION INSTALL_USER INSTALL_GROUP
211 #   BUILD_VERSION
212 #
213 AC_DEFUN([AC_PACKAGE_GLOBALS],
214   [ pkg_name="$1"
215     AC_SUBST(pkg_name)
216
217     . ./VERSION
218     pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
219     AC_SUBST(pkg_version)
220     pkg_release=$PKG_BUILD
221     test -z "$BUILD_VERSION" || pkg_release="$BUILD_VERSION"
222     AC_SUBST(pkg_release)
223
224     DEBUG=${DEBUG:-'-DDEBUG'}           dnl  -DNDEBUG
225     debug_build="$DEBUG"
226     AC_SUBST(debug_build)
227
228     OPTIMIZER=${OPTIMIZER:-'-g -O2'}
229     opt_build="$OPTIMIZER"
230     AC_SUBST(opt_build)
231
232     MALLOCLIB=${MALLOCLIB:-''}          dnl  /usr/lib/libefence.a
233     malloc_lib="$MALLOCLIB"
234     AC_SUBST(malloc_lib)
235
236     pkg_user=`id -u -n`
237     test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER"
238     AC_SUBST(pkg_user)
239
240     pkg_group=`id -g -n`
241     test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP"
242     AC_SUBST(pkg_group)
243
244     pkg_distribution=`uname -s`
245     test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
246     AC_SUBST(pkg_distribution)
247
248     pkg_platform=`uname -s | tr 'A-Z' 'a-z' | sed -e 's/irix64/irix/'`
249     test -z "$PLATFORM" || pkg_platform="$PLATFORM"
250     AC_SUBST(pkg_platform)
251   ])
252
253 #
254 # Check for specified utility (env var) - if unset, fail.
255
256 AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
257   [ if test -z "$2"; then
258         echo
259         echo FATAL ERROR: $3 does not seem to be installed.
260         echo $1 cannot be built without a working $4 installation.
261         exit 1
262     fi
263   ])
264
265 #
266 # Generic macro, sets up all of the global build variables.
267 # The following environment variables may be set to override defaults:
268 #  CC MAKE LIBTOOL TAR ZIP MAKEDEPEND AWK SED ECHO SORT
269 #  MSGFMT MSGMERGE RPM
270 #
271 AC_DEFUN([AC_PACKAGE_UTILITIES],
272   [ AC_PROG_CC
273     cc="$CC"
274     AC_SUBST(cc)
275     AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
276
277     if test -z "$MAKE"; then
278         AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
279     fi
280     if test -z "$MAKE"; then
281         AC_PATH_PROG(MAKE, make,, /usr/bin)
282     fi
283     make=$MAKE
284     AC_SUBST(make)
285     AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
286
287     if test -z "$LIBTOOL"; then
288         AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
289     fi
290     if test -z "$LIBTOOL"; then
291         AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
292     fi
293     libtool=$LIBTOOL
294     AC_SUBST(libtool)
295     AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
296
297     if test -z "$TAR"; then
298         AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
299     fi
300     tar=$TAR
301     AC_SUBST(tar)
302     if test -z "$ZIP"; then
303         AC_PATH_PROG(ZIP, gzip,, /bin:/usr/bin:/usr/local/bin:/usr/freeware/bin)
304     fi
305
306     zip=$ZIP
307     AC_SUBST(zip)
308
309     if test -z "$MAKEDEPEND"; then
310         AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
311     fi
312     makedepend=$MAKEDEPEND
313     AC_SUBST(makedepend)
314
315     if test -z "$AWK"; then
316         AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
317     fi
318     awk=$AWK
319     AC_SUBST(awk)
320
321     if test -z "$SED"; then
322         AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
323     fi
324     sed=$SED
325     AC_SUBST(sed)
326
327     if test -z "$ECHO"; then
328         AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
329     fi
330     echo=$ECHO
331     AC_SUBST(echo)
332
333     if test -z "$SORT"; then
334         AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
335     fi
336     sort=$SORT
337     AC_SUBST(sort)
338
339     dnl check if symbolic links are supported
340     AC_PROG_LN_S
341
342     if test "$enable_gettext" = yes; then
343         if test -z "$MSGFMT"; then
344                 AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
345         fi
346         msgfmt=$MSGFMT
347         AC_SUBST(msgfmt)
348         AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
349
350         if test -z "$MSGMERGE"; then
351                 AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
352         fi
353         msgmerge=$MSGMERGE
354         AC_SUBST(msgmerge)
355         AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
356     fi
357
358     if test -z "$RPM"; then
359         AC_PATH_PROG(RPM, rpm,, /bin:/usr/bin:/usr/freeware/bin)
360     fi
361     rpm=$RPM
362     AC_SUBST(rpm)
363
364     dnl .. and what version is rpm
365     rpm_version=0
366     test -n "$RPM" && test -x "$RPM" && rpm_version=`$RPM --version \
367                         | awk '{print $NF}' | awk -F. '{V=1; print $V}'`
368     AC_SUBST(rpm_version)
369     dnl At some point in rpm 4.0, rpm can no longer build rpms, and
370     dnl rpmbuild is needed (rpmbuild may go way back; not sure)
371     dnl So, if rpm version >= 4.0, look for rpmbuild.  Otherwise build w/ rpm
372     if test $rpm_version -ge 4; then
373         AC_PATH_PROG(RPMBUILD, rpmbuild)
374         rpmbuild=$RPMBUILD
375     else
376         rpmbuild=$RPM
377     fi
378     AC_SUBST(rpmbuild)
379   ])
380
381 AC_DEFUN([AC_PACKAGE_NEED_UUID_H],
382   [ AC_CHECK_HEADERS([uuid.h sys/uuid.h uuid/uuid.h])
383     if test $ac_cv_header_uuid_h = no -a \
384             $ac_cv_header_sys_uuid_h = no -a \
385             $ac_cv_header_uuid_uuid_h = no; then
386         echo
387         echo 'FATAL ERROR: could not find a valid UUID header.'
388         echo 'Install the Universally Unique Identifiers development package.'
389         exit 1
390     fi
391   ])
392
393 AC_DEFUN([AC_PACKAGE_NEED_UUIDCOMPARE],
394   [ AC_CHECK_FUNCS(uuid_compare)
395     if test $ac_cv_func_uuid_compare = yes; then
396         libuuid=""
397     else
398         AC_CHECK_LIB(uuid, uuid_compare,, [
399             echo
400             echo 'FATAL ERROR: could not find a valid UUID library.'
401             echo 'Install the Universally Unique Identifiers library package.'
402             exit 1])
403         libuuid="-luuid"
404     fi
405     AC_SUBST(libuuid)
406   ])
407
408 AC_DEFUN([AC_PACKAGE_NEED_XFS_XFS_H],
409   [ AC_CHECK_HEADERS([xfs/xfs.h])
410     if test "$ac_cv_header_xfs_xfs_h" != "yes"; then
411         echo
412         echo 'FATAL ERROR: cannot find a valid <xfs/xfs.h> header file.'
413         echo 'Install or upgrade the XFS development package.'
414         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
415         exit 1
416     fi
417   ])
418
419 AC_DEFUN([AC_PACKAGE_WANT_XFS_LIBXFS_H],
420   [ AC_CHECK_HEADERS([xfs/libxfs.h], [ have_libxfs=true ], [ have_libxfs=false ])
421     AC_SUBST(have_libxfs)
422   ])
423
424 AC_DEFUN([AC_PACKAGE_WANT_XLOG_ASSIGN_LSN],
425   [
426     AC_CHECK_DECL(xlog_assign_lsn,
427       [ have_xlog_assign_lsn=true ], [ have_xlog_assign_lsn=false ],
428       [[#include <xfs/libxfs.h>]])
429   ])
430
431 AC_DEFUN([AC_PACKAGE_NEED_XFS_XQM_H],
432   [ AC_CHECK_HEADERS([xfs/xqm.h])
433     if test "$ac_cv_header_xfs_xqm_h" != "yes"; then
434         echo
435         echo 'FATAL ERROR: cannot find a valid <xfs/xqm.h> header file.'
436         echo 'Install or upgrade the XFS development package.'
437         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
438         exit 1
439     fi
440   ])
441
442 AC_DEFUN([AC_PACKAGE_NEED_XFS_HANDLE_H],
443   [ AC_CHECK_HEADERS([xfs/handle.h])
444     if test "$ac_cv_header_xfs_handle_h" != "yes"; then
445         echo
446         echo 'FATAL ERROR: cannot find a valid <xfs/handle.h> header file.'
447         echo 'Install or upgrade the XFS development package.'
448         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
449         exit 1
450     fi
451   ])
452
453 AC_DEFUN([AC_PACKAGE_NEED_LIBXFSINIT_LIBXFS],
454   [ AC_CHECK_LIB(xfs, libxfs_init,, [
455         echo
456         echo 'FATAL ERROR: could not find a valid XFS base library.'
457         echo 'Install or upgrade the XFS library package.'
458         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
459         exit 1
460     ])
461     libxfs="-lxfs"
462     test -f `pwd`/../xfsprogs/libxfs/libxfs.la && \
463         libxfs="`pwd`/../xfsprogs/libxfs/libxfs.la"
464     test -f ${libexecdir}${libdirsuffix}/libxfs.la && \
465         libxfs="${libexecdir}${libdirsuffix}/libxfs.la"
466     AC_SUBST(libxfs)
467   ])
468
469 AC_DEFUN([AC_PACKAGE_NEED_OPEN_BY_FSHANDLE],
470   [ AC_CHECK_LIB(handle, open_by_fshandle,, [
471         echo
472         echo 'FATAL ERROR: could not find a current XFS handle library.'
473         echo 'Install or upgrade the XFS library package.'
474         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
475         exit 1
476     ])
477     libhdl="-lhandle"
478     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
479         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
480     test -f ${libexecdir}${libdirsuffix}/libhandle.la && \
481         libhdl="${libexecdir}${libdirsuffix}/libhandle.la"
482     AC_SUBST(libhdl)
483   ])
484
485 AC_DEFUN([AC_PACKAGE_NEED_ATTRLIST_LIBHANDLE],
486   [ AC_CHECK_LIB(handle, attr_list_by_handle,, [
487         echo
488         echo 'FATAL ERROR: could not find a current XFS handle library.'
489         echo 'Install or upgrade the XFS library package.'
490         echo 'Alternatively, run "make install-lib" from the xfsprogs source.'
491         exit 1
492     ])
493     libhdl="-lhandle"
494     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
495         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
496     test -f ${libexecdir}${libdirsuffix}/libhandle.la && \
497         libhdl="${libexecdir}${libdirsuffix}/libhandle.la"
498     AC_SUBST(libhdl)
499   ])
500
501 AC_DEFUN([AC_PACKAGE_NEED_IRIX_LIBHANDLE],
502   [ 
503     AC_MSG_CHECKING([libhandle.a for IRIX])
504     libhdl="`pwd`/../irix/libhandle/libhandle.a"
505     if ! test -f $libhdl; then
506         echo 'no'
507         echo 'FATAL ERROR: could not find IRIX XFS handle library.'
508         exit 1
509     fi
510     echo 'yes'
511     AC_SUBST(libhdl)
512   ])
513
514 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO],
515   [ AC_MSG_CHECKING([xfsctl from xfs/xfs.h])
516     AC_TRY_LINK([#include <xfs/xfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
517       [ echo ok ],
518       [ echo
519         echo 'FATAL ERROR: cannot find required macros in the XFS headers.'
520         echo 'Upgrade your XFS programs (xfsprogs) development package.'
521         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
522         exit 1
523       ])
524   ])
525