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