fix null string comparison in notrun case
[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_NEED_ATTR_XATTR_H],
103   [ AC_CHECK_HEADERS([attr/xattr.h])
104     if test "$ac_cv_header_attr_xattr_h" != "yes"; then
105         echo
106         echo 'FATAL ERROR: attr/xattr.h does not exist.'
107         echo 'Install the extended attributes (attr) development package.'
108         echo 'Alternatively, run "make install-dev" from the attr source.'
109         exit 1
110     fi
111   ])
112
113 AC_DEFUN([AC_PACKAGE_NEED_ATTR_ERROR_H],
114   [ AC_CHECK_HEADERS([attr/error_context.h])
115     if test "$ac_cv_header_attr_error_context_h" != "yes"; then
116         echo
117         echo 'FATAL ERROR: attr/error_context.h does not exist.'
118         echo 'Install the extended attributes (attr) development package.'
119         echo 'Alternatively, run "make install-dev" from the attr source.'
120         exit 1
121     fi
122   ])
123
124 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_H],
125   [ have_attributes_h=false
126     AC_CHECK_HEADERS([attr/attributes.h sys/attributes.h], [have_attributes_h=true], )
127     if test "$have_attributes_h" = "false"; then
128         echo
129         echo 'FATAL ERROR: attributes.h does not exist.'
130         echo 'Install the extended attributes (attr) development package.'
131         echo 'Alternatively, run "make install-dev" from the attr source.'
132         exit 1
133     fi
134   ])
135
136 AC_DEFUN([AC_PACKAGE_WANT_ATTRLIST_LIBATTR],
137   [ AC_CHECK_LIB(attr, attr_list, [have_attr_list=true], [have_attr_list=false])
138     AC_SUBST(have_attr_list)
139   ])
140
141 AC_DEFUN([AC_PACKAGE_NEED_GETXATTR_LIBATTR],
142   [ AC_CHECK_LIB(attr, getxattr,, [
143         echo
144         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
145         echo 'Install the extended attributes (attr) development package.'
146         echo 'Alternatively, run "make install-lib" from the attr source.'
147         exit 1
148     ])
149     libattr="-lattr"
150     test -f `pwd`/../attr/libattr/libattr.la && \
151         libattr="`pwd`/../attr/libattr/libattr.la"
152     test -f ${libexecdir}${libdirsuffix}/libattr.la && \
153         libattr="${libexecdir}${libdirsuffix}/libattr.la"
154     AC_SUBST(libattr)
155   ])
156
157 AC_DEFUN([AC_PACKAGE_NEED_ATTRGET_LIBATTR],
158   [ AC_CHECK_LIB(attr, attr_get,, [
159         echo
160         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
161         echo 'Install the extended attributes (attr) development package.'
162         echo 'Alternatively, run "make install-lib" from the attr source.'
163         exit 1
164     ])
165     libattr="-lattr"
166     test -f `pwd`/../attr/libattr/libattr.la && \
167         libattr="`pwd`/../attr/libattr/libattr.la"
168     test -f ${libexecdir}${libdirsuffix}/libattr.la && \
169         libattr="${libexecdir}${libdirsuffix}/libattr.la"
170     AC_SUBST(libattr)
171   ])
172
173 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_MACROS],
174   [ AC_MSG_CHECKING([macros in attr/attributes.h])
175     AC_TRY_LINK([
176 #include <sys/types.h>
177 #include <attr/attributes.h>],
178     [ int x = ATTR_SECURE; ], [ echo ok ], [
179         echo
180         echo 'FATAL ERROR: could not find a current attributes header.'
181         echo 'Upgrade the extended attributes (attr) development package.'
182         echo 'Alternatively, run "make install-dev" from the attr source.'
183         exit 1 ])
184   ])
185
186 AC_DEFUN([AC_PACKAGE_WANT_NDBM],
187   [ AC_CHECK_HEADERS(ndbm.h, [ have_db=true ], [ have_db=false ])
188     libgdbm=""
189     AC_SUBST(libgdbm)
190     AC_SUBST(have_db)
191   ])
192
193 AC_DEFUN([AC_PACKAGE_WANT_GDBM],
194   [ AC_CHECK_HEADERS([gdbm/ndbm.h], [ have_db=true ], [ have_db=false ])
195     if test $have_db = true -a -f ${libexecdir}${libdirsuffix}/libgdbm.a; then
196         libgdbm="${libexecdir}${libdirsuffix}/libgdbm.a"
197     fi
198     AC_SUBST(libgdbm)
199     AC_SUBST(have_db)
200   ])
201
202 #
203 # Generic macro, sets up all of the global packaging variables.
204 # The following environment variables may be set to override defaults:
205 #   DEBUG OPTIMIZER MALLOCLIB PLATFORM DISTRIBUTION INSTALL_USER INSTALL_GROUP
206 #   BUILD_VERSION
207 #
208 AC_DEFUN([AC_PACKAGE_GLOBALS],
209   [ pkg_name="$1"
210     AC_SUBST(pkg_name)
211
212     . ./VERSION
213     pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
214     AC_SUBST(pkg_version)
215     pkg_release=$PKG_BUILD
216     test -z "$BUILD_VERSION" || pkg_release="$BUILD_VERSION"
217     AC_SUBST(pkg_release)
218
219     DEBUG=${DEBUG:-'-DDEBUG'}           dnl  -DNDEBUG
220     debug_build="$DEBUG"
221     AC_SUBST(debug_build)
222
223     OPTIMIZER=${OPTIMIZER:-'-g -O2'}
224     opt_build="$OPTIMIZER"
225     AC_SUBST(opt_build)
226
227     MALLOCLIB=${MALLOCLIB:-''}          dnl  /usr/lib/libefence.a
228     malloc_lib="$MALLOCLIB"
229     AC_SUBST(malloc_lib)
230
231     pkg_user=`id -u -n`
232     test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER"
233     AC_SUBST(pkg_user)
234
235     pkg_group=`id -g -n`
236     test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP"
237     AC_SUBST(pkg_group)
238
239     pkg_distribution=`uname -s`
240     test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
241     AC_SUBST(pkg_distribution)
242
243     pkg_platform=`uname -s | tr 'A-Z' 'a-z' | sed -e 's/irix64/irix/'`
244     test -z "$PLATFORM" || pkg_platform="$PLATFORM"
245     AC_SUBST(pkg_platform)
246   ])
247
248 #
249 # Check for specified utility (env var) - if unset, fail.
250
251 AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
252   [ if test -z "$2"; then
253         echo
254         echo FATAL ERROR: $3 does not seem to be installed.
255         echo $1 cannot be built without a working $4 installation.
256         exit 1
257     fi
258   ])
259
260 #
261 # Generic macro, sets up all of the global build variables.
262 # The following environment variables may be set to override defaults:
263 #  CC MAKE LIBTOOL TAR ZIP MAKEDEPEND AWK SED ECHO SORT
264 #  MSGFMT MSGMERGE RPM
265 #
266 AC_DEFUN([AC_PACKAGE_UTILITIES],
267   [ AC_PROG_CC
268     cc="$CC"
269     AC_SUBST(cc)
270     AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
271
272     if test -z "$MAKE"; then
273         AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
274     fi
275     if test -z "$MAKE"; then
276         AC_PATH_PROG(MAKE, make,, /usr/bin)
277     fi
278     make=$MAKE
279     AC_SUBST(make)
280     AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
281
282     if test -z "$LIBTOOL"; then
283         AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
284     fi
285     if test -z "$LIBTOOL"; then
286         AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
287     fi
288     libtool=$LIBTOOL
289     AC_SUBST(libtool)
290     AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
291
292     if test -z "$TAR"; then
293         AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
294     fi
295     tar=$TAR
296     AC_SUBST(tar)
297     if test -z "$ZIP"; then
298         AC_PATH_PROG(ZIP, gzip,, /bin:/usr/bin:/usr/local/bin:/usr/freeware/bin)
299     fi
300
301     zip=$ZIP
302     AC_SUBST(zip)
303
304     if test -z "$MAKEDEPEND"; then
305         AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
306     fi
307     makedepend=$MAKEDEPEND
308     AC_SUBST(makedepend)
309
310     if test -z "$AWK"; then
311         AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
312     fi
313     awk=$AWK
314     AC_SUBST(awk)
315
316     if test -z "$SED"; then
317         AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
318     fi
319     sed=$SED
320     AC_SUBST(sed)
321
322     if test -z "$ECHO"; then
323         AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
324     fi
325     echo=$ECHO
326     AC_SUBST(echo)
327
328     if test -z "$SORT"; then
329         AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
330     fi
331     sort=$SORT
332     AC_SUBST(sort)
333
334     dnl check if symbolic links are supported
335     AC_PROG_LN_S
336
337     if test "$enable_gettext" = yes; then
338         if test -z "$MSGFMT"; then
339                 AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
340         fi
341         msgfmt=$MSGFMT
342         AC_SUBST(msgfmt)
343         AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
344
345         if test -z "$MSGMERGE"; then
346                 AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
347         fi
348         msgmerge=$MSGMERGE
349         AC_SUBST(msgmerge)
350         AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
351     fi
352
353     if test -z "$RPM"; then
354         AC_PATH_PROG(RPM, rpm,, /bin:/usr/bin:/usr/freeware/bin)
355     fi
356     rpm=$RPM
357     AC_SUBST(rpm)
358
359     dnl .. and what version is rpm
360     rpm_version=0
361     test -n "$RPM" && test -x "$RPM" && rpm_version=`$RPM --version \
362                         | awk '{print $NF}' | awk -F. '{V=1; print $V}'`
363     AC_SUBST(rpm_version)
364     dnl At some point in rpm 4.0, rpm can no longer build rpms, and
365     dnl rpmbuild is needed (rpmbuild may go way back; not sure)
366     dnl So, if rpm version >= 4.0, look for rpmbuild.  Otherwise build w/ rpm
367     if test $rpm_version -ge 4; then
368         AC_PATH_PROG(RPMBUILD, rpmbuild)
369         rpmbuild=$RPMBUILD
370     else
371         rpmbuild=$RPM
372     fi
373     AC_SUBST(rpmbuild)
374   ])
375
376 AC_DEFUN([AC_PACKAGE_NEED_UUID_H],
377   [ AC_CHECK_HEADERS([uuid.h sys/uuid.h uuid/uuid.h])
378     if test $ac_cv_header_uuid_h = no -a \
379             $ac_cv_header_sys_uuid_h = no -a \
380             $ac_cv_header_uuid_uuid_h = no; then
381         echo
382         echo 'FATAL ERROR: could not find a valid UUID header.'
383         echo 'Install the Universally Unique Identifiers development package.'
384         exit 1
385     fi
386   ])
387
388 AC_DEFUN([AC_PACKAGE_NEED_UUIDCOMPARE],
389   [ AC_CHECK_FUNCS(uuid_compare)
390     if test $ac_cv_func_uuid_compare = yes; then
391         libuuid=""
392     else
393         AC_CHECK_LIB(uuid, uuid_compare,, [
394             echo
395             echo 'FATAL ERROR: could not find a valid UUID library.'
396             echo 'Install the Universally Unique Identifiers library package.'
397             exit 1])
398         libuuid="-luuid"
399     fi
400     AC_SUBST(libuuid)
401   ])
402
403 AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
404   [ AC_CHECK_HEADERS([xfs/libxfs.h])
405     if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
406         echo
407         echo 'FATAL ERROR: cannot find a valid <xfs/libxfs.h> header file.'
408         echo 'Install or upgrade the XFS development package.'
409         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
410         exit 1
411     fi
412   ])
413
414 AC_DEFUN([AC_PACKAGE_NEED_XFS_XQM_H],
415   [ AC_CHECK_HEADERS([xfs/xqm.h])
416     if test "$ac_cv_header_xfs_xqm_h" != "yes"; then
417         echo
418         echo 'FATAL ERROR: cannot find a valid <xfs/xqm.h> header file.'
419         echo 'Install or upgrade the XFS development package.'
420         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
421         exit 1
422     fi
423   ])
424
425 AC_DEFUN([AC_PACKAGE_NEED_XFS_HANDLE_H],
426   [ AC_CHECK_HEADERS([xfs/handle.h])
427     if test "$ac_cv_header_xfs_handle_h" != "yes"; then
428         echo
429         echo 'FATAL ERROR: cannot find a valid <xfs/handle.h> header file.'
430         echo 'Install or upgrade the XFS development package.'
431         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
432         exit 1
433     fi
434   ])
435
436 AC_DEFUN([AC_PACKAGE_NEED_LIBXFSINIT_LIBXFS],
437   [ AC_CHECK_LIB(xfs, libxfs_init,, [
438         echo
439         echo 'FATAL ERROR: could not find a valid XFS base library.'
440         echo 'Install or upgrade the XFS library package.'
441         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
442         exit 1
443     ])
444     libxfs="-lxfs"
445     test -f `pwd`/../xfsprogs/libxfs/libxfs.la && \
446         libxfs="`pwd`/../xfsprogs/libxfs/libxfs.la"
447     test -f ${libexecdir}${libdirsuffix}/libxfs.la && \
448         libxfs="${libexecdir}${libdirsuffix}/libxfs.la"
449     AC_SUBST(libxfs)
450   ])
451
452 AC_DEFUN([AC_PACKAGE_NEED_OPEN_BY_FSHANDLE],
453   [ AC_CHECK_LIB(handle, open_by_fshandle,, [
454         echo
455         echo 'FATAL ERROR: could not find a current XFS handle library.'
456         echo 'Install or upgrade the XFS library package.'
457         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
458         exit 1
459     ])
460     libhdl="-lhandle"
461     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
462         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
463     test -f ${libexecdir}${libdirsuffix}/libhandle.la && \
464         libhdl="${libexecdir}${libdirsuffix}/libhandle.la"
465     AC_SUBST(libhdl)
466   ])
467
468 AC_DEFUN([AC_PACKAGE_NEED_ATTRLIST_LIBHANDLE],
469   [ AC_CHECK_LIB(handle, attr_list_by_handle,, [
470         echo
471         echo 'FATAL ERROR: could not find a current XFS handle library.'
472         echo 'Install or upgrade the XFS library package.'
473         echo 'Alternatively, run "make install-lib" from the xfsprogs source.'
474         exit 1
475     ])
476     libhdl="-lhandle"
477     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
478         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
479     test -f ${libexecdir}${libdirsuffix}/libhandle.la && \
480         libhdl="${libexecdir}${libdirsuffix}/libhandle.la"
481     AC_SUBST(libhdl)
482   ])
483
484 AC_DEFUN([AC_PACKAGE_NEED_IRIX_LIBHANDLE],
485   [ 
486     AC_MSG_CHECKING([libhandle.a for IRIX])
487     libhdl="`pwd`/../irix/libhandle/libhandle.a"
488     if ! test -f $libhdl; then
489         echo 'no'
490         echo 'FATAL ERROR: could not find IRIX XFS handle library.'
491         exit 1
492     fi
493     echo 'yes'
494     AC_SUBST(libhdl)
495   ])
496
497 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO],
498   [ AC_MSG_CHECKING([xfsctl from xfs/libxfs.h])
499     AC_TRY_LINK([#include <xfs/libxfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
500       [ echo ok ],
501       [ echo
502         echo 'FATAL ERROR: cannot find required macros in the XFS headers.'
503         echo 'Upgrade your XFS programs (xfsprogs) development package.'
504         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
505         exit 1
506       ])
507   ])
508