Report on whether XFS was built debug or not for XFS benchmark runs
[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   [ if test -z "$CC"; then
80         AC_PROG_CC
81     fi
82     cc="$CC"
83     AC_SUBST(cc)
84     AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
85
86     if test -z "$MAKE"; then
87         AC_PATH_PROG(MAKE, make, /usr/bin/make)
88     fi
89     make=$MAKE
90     AC_SUBST(make)
91     AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
92
93     if test -z "$LIBTOOL"; then
94         AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin:/usr/local/bin)
95     fi
96     libtool=$LIBTOOL
97     AC_SUBST(libtool)
98     AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
99
100     if test -z "$TAR"; then
101         AC_PATH_PROG(TAR, tar)
102     fi
103     tar=$TAR
104     AC_SUBST(tar)
105     if test -z "$ZIP"; then
106         AC_PATH_PROG(ZIP, gzip, /bin/gzip)
107     fi
108     zip=$ZIP
109     AC_SUBST(zip)
110     if test -z "$MAKEDEPEND"; then
111         AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
112     fi
113     makedepend=$MAKEDEPEND
114     AC_SUBST(makedepend)
115     if test -z "$AWK"; then
116         AC_PATH_PROG(AWK, awk, /bin/awk)
117     fi
118     awk=$AWK
119     AC_SUBST(awk)
120     if test -z "$SED"; then
121         AC_PATH_PROG(SED, sed, /bin/sed)
122     fi
123     sed=$SED
124     AC_SUBST(sed)
125     if test -z "$ECHO"; then
126         AC_PATH_PROG(ECHO, echo, /bin/echo)
127     fi
128     echo=$ECHO
129     AC_SUBST(echo)
130     if test -z "$SORT"; then
131         AC_PATH_PROG(SORT, sort, /bin/sort)
132     fi
133     sort=$SORT
134     AC_SUBST(sort)
135
136     dnl check if symbolic links are supported
137     AC_PROG_LN_S
138
139     if test "$enable_gettext" = yes; then
140         if test -z "$MSGFMT"; then
141                 AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
142         fi
143         msgfmt=$MSGFMT
144         AC_SUBST(msgfmt)
145         AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
146         if test -z "$MSGMERGE"; then
147                 AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge)
148         fi
149         msgmerge=$MSGMERGE
150         AC_SUBST(msgmerge)
151         AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
152     fi
153
154     if test -z "$RPM"; then
155         AC_PATH_PROG(RPM, rpm, /bin/rpm)
156     fi
157     rpm=$RPM
158     AC_SUBST(rpm)
159     dnl .. and what version is rpm
160     rpm_version=0
161     test -x $RPM && rpm_version=`$RPM --version \
162                         | awk '{print $NF}' | awk -F. '{V=1; print $V}'`
163     AC_SUBST(rpm_version)
164     dnl At some point in rpm 4.0, rpm can no longer build rpms, and
165     dnl rpmbuild is needed (rpmbuild may go way back; not sure)
166     dnl So, if rpm version >= 4.0, look for rpmbuild.  Otherwise build w/ rpm
167     if test $rpm_version -ge 4; then
168         AC_PATH_PROG(RPMBUILD, rpmbuild)
169         rpmbuild=$RPMBUILD
170     else
171         rpmbuild=$RPM
172     fi
173     AC_SUBST(rpmbuild)
174   ])
175
176 AC_DEFUN([AC_PACKAGE_NEED_UUID_H],
177   [ AC_CHECK_HEADERS(uuid.h)
178     if test $ac_cv_header_uuid_h = no; then
179         AC_CHECK_HEADERS(uuid/uuid.h,, [
180         echo
181         echo 'FATAL ERROR: could not find a valid UUID header.'
182         echo 'Install the Universally Unique Identifiers development package.'
183         exit 1])
184     fi
185   ])
186
187 AC_DEFUN([AC_PACKAGE_NEED_UUIDCOMPARE],
188   [ AC_CHECK_FUNCS(uuid_compare)
189     if test $ac_cv_func_uuid_compare = no; then
190         AC_CHECK_LIB(uuid, uuid_compare, [libuuid=/usr/lib/libuuid.a], [
191         echo
192         echo 'FATAL ERROR: could not find a valid UUID library.'
193         echo 'Install the Universally Unique Identifiers library package.'
194         exit 1])
195     fi
196     AC_SUBST(libuuid)
197   ])
198
199 AC_DEFUN([AC_PACKAGE_CHECK_LIBUUID],
200   [ test $pkg_platform = freebsd && libuuid=""
201   ])
202
203 AC_DEFUN([AC_PACKAGE_NEED_XFS_LIBXFS_H],
204   [ AC_CHECK_HEADERS([xfs/libxfs.h])
205     if test "$ac_cv_header_xfs_libxfs_h" != "yes"; then
206         echo
207         echo 'FATAL ERROR: cannot find a valid <xfs/libxfs.h> header file.'
208         echo 'Install or upgrade the XFS development package.'
209         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
210         exit 1
211     fi
212   ])
213
214 AC_DEFUN([AC_PACKAGE_NEED_XFS_HANDLE_H],
215   [ AC_CHECK_HEADERS([xfs/handle.h])
216     if test "$ac_cv_header_xfs_handle_h" != "yes"; then
217         echo
218         echo 'FATAL ERROR: cannot find a valid <xfs/handle.h> header file.'
219         echo 'Install or upgrade the XFS development package.'
220         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
221         exit 1
222     fi
223   ])
224
225 AC_DEFUN([AC_PACKAGE_NEED_LIBXFSINIT_LIBXFS],
226   [ AC_CHECK_LIB(xfs, libxfs_init,, [
227         echo
228         echo 'FATAL ERROR: could not find a valid XFS base library.'
229         echo 'Install or upgrade the XFS library package.'
230         echo 'Alternatively, run "make install-lib" from the xfsprogs source.'
231         exit 1
232     ])
233     libxfs="-lxfs"
234     test -f `pwd`/../xfsprogs/libxfs/libxfs.la && \
235         libxfs="`pwd`/../xfsprogs/libxfs/libxfs.la"
236     test -f /usr/lib/libxfs.la && libxfs="/usr/lib/libxfs.la"
237     AC_SUBST(libxfs)
238   ])
239
240 AC_DEFUN([AC_PACKAGE_NEED_ATTRLIST_LIBHANDLE],
241   [ AC_CHECK_LIB(handle, attr_list_by_handle,, [
242         echo
243         echo 'FATAL ERROR: could not find a current XFS handle library.'
244         echo 'Install or upgrade the XFS library package.'
245         echo 'Alternatively, run "make install-lib" from the xfsprogs source.'
246         exit 1
247     ])
248     libhdl="-lhandle"
249     test -f `pwd`/../xfsprogs/libhandle/libhandle.la && \
250         libhdl="`pwd`/../xfsprogs/libhandle/libhandle.la"
251     test -f /usr/lib/libhandle.la && libhdl="/usr/lib/libhandle.la"
252     AC_SUBST(libhdl)
253   ])
254
255 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO],
256   [ AC_MSG_CHECKING([xfsctl from xfs/libxfs.h])
257     AC_TRY_LINK([#include <xfs/libxfs.h>], [ int x = xfsctl(0, 0, 0, 0); ],
258       [ echo ok ],
259       [ echo
260         echo 'FATAL ERROR: cannot find required macros in the XFS headers.'
261         echo 'Upgrade your XFS programs (xfsprogs) development package.'
262         echo 'Alternatively, run "make install-dev" from the xfsprogs source.'
263         exit 1
264       ])
265   ])
266
267 AC_DEFUN([AC_PACKAGE_NEED_ATTR_XATTR_H],
268   [ AC_CHECK_HEADERS([attr/xattr.h])
269     if test "$ac_cv_header_attr_xattr_h" != "yes"; then
270         echo
271         echo 'FATAL ERROR: attr/xattr.h does not exist.'
272         echo 'Install the extended attributes (attr) development package.'
273         echo 'Alternatively, run "make install-lib" from the attr source.'
274         exit 1
275     fi
276   ])
277
278 AC_DEFUN([AC_PACKAGE_NEED_ATTR_ERROR_H],
279   [ AC_CHECK_HEADERS([attr/error_context.h])
280     if test "$ac_cv_header_attr_error_context_h" != "yes"; then
281         echo
282         echo 'FATAL ERROR: attr/error_context.h does not exist.'
283         echo 'Install the extended attributes (attr) development package.'
284         echo 'Alternatively, run "make install-lib" from the attr source.'
285         exit 1
286     fi
287   ])
288
289 AC_DEFUN([AC_PACKAGE_NEED_ATTR_ATTRIBUTES_H],
290   [ AC_CHECK_HEADERS([attr/attributes.h])
291     if test "$ac_cv_header_attr_attributes_h" != "yes"; then
292         echo
293         echo 'FATAL ERROR: attr/attributes.h does not exist.'
294         echo 'Install the extended attributes (attr) development package.'
295         echo 'Alternatively, run "make install-lib" from the attr source.'
296         exit 1
297     fi
298   ])
299
300 AC_DEFUN([AC_PACKAGE_NEED_GETXATTR_LIBATTR],
301   [ AC_CHECK_LIB(attr, getxattr,, [
302         echo
303         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
304         echo 'Install the extended attributes (attr) development package.'
305         echo 'Alternatively, run "make install-lib" from the attr source.'
306         exit 1
307     ])
308     libattr="-lattr"
309     test -f `pwd`/../attr/libattr/libattr.la && \
310         libattr="`pwd`/../attr/libattr/libattr.la"
311     test -f /usr/lib/libattr.la && libattr="/usr/lib/libattr.la"
312     AC_SUBST(libattr)
313   ])
314
315 AC_DEFUN([AC_PACKAGE_NEED_ATTRGET_LIBATTR],
316   [ AC_CHECK_LIB(attr, attr_get,, [
317         echo
318         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
319         echo 'Install the extended attributes (attr) development package.'
320         echo 'Alternatively, run "make install-lib" from the attr source.'
321         exit 1
322     ])
323     libattr="-lattr"
324     test -f `pwd`/../attr/libattr/libattr.la && \
325         libattr="`pwd`/../attr/libattr/libattr.la"
326     test -f /usr/lib/libattr.la && libattr="/usr/lib/libattr.la"
327     AC_SUBST(libattr)
328   ])
329
330 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_MACROS],
331   [ AC_MSG_CHECKING([macros in attr/attributes.h])
332     AC_TRY_LINK([
333 #include <sys/types.h>
334 #include <attr/attributes.h>],
335     [ int x = ATTR_SHIFT; ], [
336         echo
337         echo 'FATAL ERROR: incorrect macros exist in attributes.h header file.'
338         echo 'Upgrade the extended attributes (attr) development package.'
339         echo 'Alternatively, run "make install-dev" from the attr source.'
340         exit 1 ],
341     [ echo ok ])
342   ])
343
344 AC_DEFUN([AC_PACKAGE_NEED_SYS_ACL_H],
345   [ AC_CHECK_HEADERS([sys/acl.h])
346     if test "$ac_cv_header_sys_acl_h" != "yes"; then
347         echo
348         echo 'FATAL ERROR: sys/acl.h does not exist.'
349         echo 'Install the access control lists (acl) development package.'
350         echo 'Alternatively, run "make install-lib" from the acl source.'
351         exit 1
352     fi
353   ])
354
355 AC_DEFUN([AC_PACKAGE_NEED_ACL_LIBACL_H],
356   [ AC_CHECK_HEADERS([acl/libacl.h])
357     if test "$ac_cv_header_acl_libacl_h" != "yes"; then
358         echo
359         echo 'FATAL ERROR: acl/libacl.h does not exist.'
360         echo 'Install the access control lists (acl) development package.'
361         echo 'Alternatively, run "make install-lib" from the acl source.'
362         exit 1
363     fi
364   ])
365
366
367 AC_DEFUN([AC_PACKAGE_NEED_ACLINIT_LIBACL],
368   [ AC_CHECK_LIB(acl, acl_init,, [
369         echo
370         echo 'FATAL ERROR: could not find a valid Access Control List library.'
371         echo 'Install either the libacl (rpm) or the libacl1 (deb) package.'
372         echo 'Alternatively, run "make install-lib" from the acl source.'
373         exit 1
374     ])
375     libacl="-lacl"
376     test -f `pwd`/../acl/libacl/libacl.la && \
377         libacl="`pwd`/../acl/libacl/libacl.la"
378     test -f /usr/lib/libacl.la && libacl="/usr/lib/libacl.la"
379     AC_SUBST(libacl)
380   ])
381
382 AC_DEFUN([AC_PACKAGE_WANT_LIBGDBM],
383   [ AC_CHECK_HEADER([gdbm/ndbm.h], [have_db=true ], [ have_db=false ])
384     if test $have_db = true -a -f /usr/lib/libgdbm.a; then
385         libgdbm="/usr/lib/libgdbm.a"
386     fi
387     AC_SUBST(libgdbm)
388     AC_SUBST(have_db)
389   ])
390