]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - aclocal.m4
6f0a9678e5e49b8298cd6c9b685e02613b0a3add
[thirdparty/xfsprogs-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, glibtool,, /usr/bin)
96 fi
97 if test -z "$LIBTOOL"; then
98 AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
99 fi
100 libtool=$LIBTOOL
101 AC_SUBST(libtool)
102 AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
103
104 if test -z "$TAR"; then
105 AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
106 fi
107 tar=$TAR
108 AC_SUBST(tar)
109 if test -z "$ZIP"; then
110 AC_PATH_PROG(ZIP, gzip,, /bin:/usr/local/bin:/usr/freeware/bin:/usr/bin)
111 fi
112
113 zip=$ZIP
114 AC_SUBST(zip)
115
116 if test -z "$MAKEDEPEND"; then
117 AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
118 fi
119 makedepend=$MAKEDEPEND
120 AC_SUBST(makedepend)
121
122 if test -z "$AWK"; then
123 AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
124 fi
125 awk=$AWK
126 AC_SUBST(awk)
127
128 if test -z "$SED"; then
129 AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
130 fi
131 sed=$SED
132 AC_SUBST(sed)
133
134 if test -z "$ECHO"; then
135 AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
136 fi
137 echo=$ECHO
138 AC_SUBST(echo)
139
140 if test -z "$SORT"; then
141 AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
142 fi
143 sort=$SORT
144 AC_SUBST(sort)
145
146 dnl check if symbolic links are supported
147 AC_PROG_LN_S
148
149 if test "$enable_gettext" = yes; then
150 if test -z "$MSGFMT"; then
151 AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/freeware/bin:/usr/local/bin)
152 fi
153 msgfmt=$MSGFMT
154 AC_SUBST(msgfmt)
155 AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
156
157 if test -z "$MSGMERGE"; then
158 AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/freeware/bin:/usr/local/bin)
159 fi
160 msgmerge=$MSGMERGE
161 AC_SUBST(msgmerge)
162 AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
163 fi
164
165 if test -z "$RPM"; then
166 AC_PATH_PROG(RPM, rpm,, /bin:/usr/bin:/usr/freeware/bin)
167 fi
168 rpm=$RPM
169 AC_SUBST(rpm)
170
171 dnl .. and what version is rpm
172 rpm_version=0
173 test -x "$RPM" && rpm_version=`$RPM --version \
174 | awk '{print $NF}' | awk -F. '{V=1; print $V}'`
175 AC_SUBST(rpm_version)
176 dnl At some point in rpm 4.0, rpm can no longer build rpms, and
177 dnl rpmbuild is needed (rpmbuild may go way back; not sure)
178 dnl So, if rpm version >= 4.0, look for rpmbuild. Otherwise build w/ rpm
179 if test $rpm_version -ge 4; then
180 AC_PATH_PROG(RPMBUILD, rpmbuild)
181 rpmbuild=$RPMBUILD
182 else
183 rpmbuild=$RPM
184 fi
185 AC_SUBST(rpmbuild)
186 ])
187
188 AC_DEFUN([AC_PACKAGE_NEED_UUID_H],
189 [ AC_CHECK_HEADERS([uuid.h sys/uuid.h uuid/uuid.h])
190 if test $ac_cv_header_uuid_h = no -a \
191 $ac_cv_header_sys_uuid_h = no -a \
192 $ac_cv_header_uuid_uuid_h = no; then
193 echo
194 echo 'FATAL ERROR: could not find a valid UUID header.'
195 echo 'Install the Universally Unique Identifiers development package.'
196 exit 1
197 fi
198 ])
199
200 AC_DEFUN([AC_PACKAGE_NEED_UUIDCOMPARE],
201 [ AC_CHECK_FUNCS(uuid_compare)
202 if test $ac_cv_func_uuid_compare = yes; then
203 libuuid=""
204 else
205 AC_CHECK_LIB(uuid, uuid_compare,, [
206 echo
207 echo 'FATAL ERROR: could not find a valid UUID library.'
208 echo 'Install the Universally Unique Identifiers library package.'
209 exit 1])
210 libuuid="-luuid"
211 fi
212 AC_SUBST(libuuid)
213 ])
214
215 AC_DEFUN([AC_PACKAGE_NEED_PTHREAD_H],
216 [ AC_CHECK_HEADERS(pthread.h)
217 if test $ac_cv_header_pthread_h = no; then
218 AC_CHECK_HEADERS(pthread.h,, [
219 echo
220 echo 'FATAL ERROR: could not find a valid pthread header.'
221 exit 1])
222 fi
223 ])
224
225 AC_DEFUN([AC_PACKAGE_NEED_PTHREADMUTEXINIT],
226 [ AC_CHECK_LIB(pthread, pthread_mutex_init,, [
227 echo
228 echo 'FATAL ERROR: could not find a valid pthread library.'
229 exit 1
230 ])
231 libpthread=-lpthread
232 AC_SUBST(libpthread)
233 ])
234
235 #
236 # Check if we have a working fadvise system call
237 #
238 AC_DEFUN([AC_HAVE_FADVISE],
239 [ AC_MSG_CHECKING([for fadvise ])
240 AC_TRY_COMPILE([
241 #define _GNU_SOURCE
242 #define _FILE_OFFSET_BITS 64
243 #include <fcntl.h>
244 ], [
245 posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
246 ], have_fadvise=yes
247 AC_MSG_RESULT(yes),
248 AC_MSG_RESULT(no))
249 AC_SUBST(have_fadvise)
250 ])
251
252 #
253 # Check if we have a working madvise system call
254 #
255 AC_DEFUN([AC_HAVE_MADVISE],
256 [ AC_MSG_CHECKING([for madvise ])
257 AC_TRY_COMPILE([
258 #define _GNU_SOURCE
259 #define _FILE_OFFSET_BITS 64
260 #include <sys/mman.h>
261 ], [
262 posix_madvise(0, 0, MADV_NORMAL);
263 ], have_madvise=yes
264 AC_MSG_RESULT(yes),
265 AC_MSG_RESULT(no))
266 AC_SUBST(have_madvise)
267 ])
268
269 #
270 # Check if we have a working mincore system call
271 #
272 AC_DEFUN([AC_HAVE_MINCORE],
273 [ AC_MSG_CHECKING([for mincore ])
274 AC_TRY_COMPILE([
275 #define _GNU_SOURCE
276 #define _FILE_OFFSET_BITS 64
277 #include <sys/mman.h>
278 ], [
279 mincore(0, 0, 0);
280 ], have_mincore=yes
281 AC_MSG_RESULT(yes),
282 AC_MSG_RESULT(no))
283 AC_SUBST(have_mincore)
284 ])
285
286 #
287 # Check if we have a working sendfile system call
288 #
289 AC_DEFUN([AC_HAVE_SENDFILE],
290 [ AC_MSG_CHECKING([for sendfile ])
291 AC_TRY_COMPILE([
292 #define _GNU_SOURCE
293 #define _FILE_OFFSET_BITS 64
294 #include <sys/sendfile.h>
295 ], [
296 sendfile(0, 0, 0, 0);
297 ], have_sendfile=yes
298 AC_MSG_RESULT(yes),
299 AC_MSG_RESULT(no))
300 AC_SUBST(have_sendfile)
301 ])
302
303 #
304 # Check if we have a type for the pointer's size integer (__psint_t)
305 #
306 AC_DEFUN([AC_TYPE_PSINT],
307 [ AC_MSG_CHECKING([for __psint_t ])
308 AC_TRY_COMPILE([
309 #include <sys/types.h>
310 #include <stdlib.h>
311 #include <stddef.h>
312 ], [
313 __psint_t psint;
314 ], AC_DEFINE(HAVE___PSINT_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
315 ])
316
317 #
318 # Check if we have a type for the pointer's size unsigned (__psunsigned_t)
319 #
320 AC_DEFUN([AC_TYPE_PSUNSIGNED],
321 [ AC_MSG_CHECKING([for __psunsigned_t ])
322 AC_TRY_COMPILE([
323 #include <sys/types.h>
324 #include <stdlib.h>
325 #include <stddef.h>
326 ], [
327 __psunsigned_t psuint;
328 ], AC_DEFINE(HAVE___PSUNSIGNED_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
329 ])
330
331 #
332 # Check type sizes
333 #
334 AC_DEFUN([AC_SIZEOF_POINTERS_AND_LONG],
335 [ if test "$cross_compiling" = yes -a -z "$ac_cv_sizeof_long"; then
336 AC_MSG_WARN([Cross compiling; assuming 32bit long and 32bit pointers])
337 fi
338 AC_CHECK_SIZEOF(long, 4)
339 AC_CHECK_SIZEOF(char *, 4)
340 if test $ac_cv_sizeof_long -eq 4 -o $ac_cv_sizeof_long -eq 0; then
341 AC_DEFINE(HAVE_32BIT_LONG)
342 fi
343 if test $ac_cv_sizeof_long -eq 8; then
344 AC_DEFINE(HAVE_64BIT_LONG)
345 fi
346 if test $ac_cv_sizeof_char_p -eq 4 -o $ac_cv_sizeof_char_p -eq 0; then
347 AC_DEFINE(HAVE_32BIT_PTR)
348 fi
349 if test $ac_cv_sizeof_char_p -eq 8; then
350 AC_DEFINE(HAVE_64BIT_PTR)
351 fi
352 ])
353
354 #
355 # Find format of installed man pages.
356 # Always gzipped on Debian, but not Redhat pre-7.0.
357 # We don't deal with bzip2'd man pages, which Mandrake uses,
358 # someone will send us a patch sometime hopefully. :-)
359 #
360 AC_DEFUN([AC_MANUAL_FORMAT],
361 [ have_zipped_manpages=false
362 for d in ${prefix}/share/man ${prefix}/man ; do
363 if test -f $d/man1/man.1.gz
364 then
365 have_zipped_manpages=true
366 break
367 fi
368 done
369 AC_SUBST(have_zipped_manpages)
370 ])
371