0a38e1b62644e6b31069c82afc6236bc9474c3df
[xfstests-dev.git] / m4 / package_xfslibs.m4
1 AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
2   [ AC_CHECK_HEADERS([xfs/libxfs.h])
3     if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
4         echo
5         echo 'FATAL ERROR: cannot find a valid <xfs/libxfs.h> header file.'
6         echo 'Install or upgrade the XFS development package.'
7         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
8         exit 1
9     fi
10   ])
11
12 AC_DEFUN([AC_PACKAGE_NEED_XFS_XQM_H],
13   [ AC_CHECK_HEADERS([xfs/xqm.h])
14     if test "$ac_cv_header_xfs_xqm_h" != "yes"; then
15         echo
16         echo 'FATAL ERROR: cannot find a valid <xfs/xqm.h> header file.'
17         echo 'Install or upgrade the XFS development package.'
18         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
19         exit 1
20     fi
21   ])
22
23 AC_DEFUN([AC_PACKAGE_NEED_XFS_HANDLE_H],
24   [ AC_CHECK_HEADERS([xfs/handle.h])
25     if test "$ac_cv_header_xfs_handle_h" != "yes"; then
26         echo
27         echo 'FATAL ERROR: cannot find a valid <xfs/handle.h> header file.'
28         echo 'Install or upgrade the XFS development package.'
29         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
30         exit 1
31     fi
32   ])
33
34 AC_DEFUN([AC_PACKAGE_NEED_LIBXFSINIT_LIBXFS],
35   [ AC_CHECK_LIB(xfs, libxfs_init,, [
36         echo
37         echo 'FATAL ERROR: could not find a valid XFS base library.'
38         echo 'Install or upgrade the XFS library package.'
39         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
40         exit 1
41     ])
42     libxfs="-lxfs"
43     test -f `pwd`/../xfsprogs/libxfs/libxfs.la && \
44         libxfs="`pwd`/../xfsprogs/libxfs/libxfs.la"
45     test -f ${libexecdir}${libdirsuffix}/libxfs.la && \
46         libxfs="${libexecdir}${libdirsuffix}/libxfs.la"
47     AC_SUBST(libxfs)
48   ])
49
50 AC_DEFUN([AC_PACKAGE_NEED_OPEN_BY_FSHANDLE],
51   [ AC_CHECK_LIB(handle, open_by_fshandle,, [
52         echo
53         echo 'FATAL ERROR: could not find a current XFS handle library.'
54         echo 'Install or upgrade the XFS library package.'
55         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
56         exit 1
57     ])
58     libhdl="-lhandle"
59     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
60         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
61     test -f ${libexecdir}${libdirsuffix}/libhandle.la && \
62         libhdl="${libexecdir}${libdirsuffix}/libhandle.la"
63     AC_SUBST(libhdl)
64   ])
65
66 AC_DEFUN([AC_PACKAGE_NEED_ATTRLIST_LIBHANDLE],
67   [ AC_CHECK_LIB(handle, attr_list_by_handle,, [
68         echo
69         echo 'FATAL ERROR: could not find a current XFS handle library.'
70         echo 'Install or upgrade the XFS library package.'
71         echo 'Alternatively, run "make install-lib" from the xfsprogs source.'
72         exit 1
73     ])
74     libhdl="-lhandle"
75     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
76         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
77     test -f ${libexecdir}${libdirsuffix}/libhandle.la && \
78         libhdl="${libexecdir}${libdirsuffix}/libhandle.la"
79     AC_SUBST(libhdl)
80   ])
81
82 AC_DEFUN([AC_PACKAGE_NEED_IRIX_LIBHANDLE],
83   [ 
84     AC_MSG_CHECKING([libhandle.a for IRIX])
85     libhdl="`pwd`/../irix/libhandle/libhandle.a"
86     if ! test -f $libhdl; then
87         echo 'no'
88         echo 'FATAL ERROR: could not find IRIX XFS handle library.'
89         exit 1
90     fi
91     echo 'yes'
92     AC_SUBST(libhdl)
93   ])
94
95 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO],
96   [ AC_MSG_CHECKING([xfsctl from xfs/libxfs.h])
97     AC_TRY_LINK([#include <xfs/libxfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
98       [ echo ok ],
99       [ echo
100         echo 'FATAL ERROR: cannot find required macros in the XFS headers.'
101         echo 'Upgrade your XFS programs (xfsprogs) development package.'
102         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
103         exit 1
104       ])
105   ])