]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - aclocal.m4
fix tarball names generated by Makepkgs
[thirdparty/xfsprogs-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 #
15 # Find format of installed man pages.
16 # Always gzipped on Debian, but not Redhat pre-7.0.
17 # We don't deal with bzip2'd man pages, which Mandrake uses,
18 # someone will send us a patch sometime hopefully. :-)
19 #
20 AC_DEFUN([AC_MANUAL_FORMAT],
21 [ have_zipped_manpages=false
22 for d in ${prefix}/share/man ${prefix}/man ; do
23 if test -f $d/man1/man.1.gz
24 then
25 have_zipped_manpages=true
26 break
27 fi
28 done
29 AC_SUBST(have_zipped_manpages)
30 ])
31
32 # The AC_MULTILIB macro was extracted and modified from
33 # gettext-0.15's AC_LIB_PREPARE_MULTILIB macro in the lib-prefix.m4 file
34 # so that the correct paths can be used for 64-bit libraries.
35 #
36 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
37 dnl This file is free software; the Free Software Foundation
38 dnl gives unlimited permission to copy and/or distribute it,
39 dnl with or without modifications, as long as this notice is preserved.
40 dnl From Bruno Haible.
41
42 dnl AC_MULTILIB creates a variable libdirsuffix, containing
43 dnl the suffix of the libdir, either "" or "64".
44 dnl Only do this if the given enable parameter is "yes".
45 AC_DEFUN([AC_MULTILIB],
46 [
47 dnl There is no formal standard regarding lib and lib64. The current
48 dnl practice is that on a system supporting 32-bit and 64-bit instruction
49 dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
50 dnl libraries go under $prefix/lib. We determine the compiler's default
51 dnl mode by looking at the compiler's library search path. If at least
52 dnl of its elements ends in /lib64 or points to a directory whose absolute
53 dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
54 dnl default, namely "lib".
55 enable_lib64="$1"
56 libdirsuffix=""
57 searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
58 if test "$enable_lib64" = "yes" -a -n "$searchpath"; then
59 save_IFS="${IFS= }"; IFS=":"
60 for searchdir in $searchpath; do
61 if test -d "$searchdir"; then
62 case "$searchdir" in
63 */lib64/ | */lib64 ) libdirsuffix=64 ;;
64 *) searchdir=`cd "$searchdir" && pwd`
65 case "$searchdir" in
66 */lib64 ) libdirsuffix=64 ;;
67 esac ;;
68 esac
69 fi
70 done
71 IFS="$save_IFS"
72 fi
73 AC_SUBST(libdirsuffix)
74 ])
75
76 #
77 # Check if we have a libaio.h installed
78 #
79 AC_DEFUN([AC_PACKAGE_WANT_AIO],
80 [ AC_CHECK_HEADERS(libaio.h, [ have_aio=true ], [ have_aio=false ])
81 AC_SUBST(have_aio)
82 ])
83
84 #
85 # Check if we have an aio.h installed
86 #
87 AC_DEFUN([AC_PACKAGE_NEED_AIO_H],
88 [ AC_CHECK_HEADERS(aio.h)
89 if test $ac_cv_header_aio_h = no; then
90 echo
91 echo 'FATAL ERROR: could not find a valid <aio.h> header.'
92 exit 1
93 fi
94 ])
95
96 #
97 # Check if we have the lio_listio routine in either libc/librt
98 #
99 AC_DEFUN([AC_PACKAGE_NEED_LIO_LISTIO],
100 [ AC_CHECK_FUNCS(lio_listio)
101 if test $ac_cv_func_lio_listio = yes; then
102 librt=""
103 else
104 AC_CHECK_LIB(rt, lio_listio,, [
105 echo
106 echo 'FATAL ERROR: could not find a library with lio_listio.'
107 exit 1])
108 librt="-lrt"
109 fi
110 AC_SUBST(librt)
111 ])
112
113
114 #
115 # Generic macro, sets up all of the global packaging variables.
116 # The following environment variables may be set to override defaults:
117 # DEBUG OPTIMIZER MALLOCLIB PLATFORM DISTRIBUTION INSTALL_USER INSTALL_GROUP
118 # BUILD_VERSION
119 #
120 AC_DEFUN([AC_PACKAGE_GLOBALS],
121 [ pkg_name="$1"
122 AC_SUBST(pkg_name)
123
124 . ./VERSION
125 pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
126 AC_SUBST(pkg_version)
127 pkg_release=$PKG_BUILD
128 test -z "$BUILD_VERSION" || pkg_release="$BUILD_VERSION"
129 AC_SUBST(pkg_release)
130
131 DEBUG=${DEBUG:-'-DDEBUG'} dnl -DNDEBUG
132 debug_build="$DEBUG"
133 AC_SUBST(debug_build)
134
135 OPTIMIZER=${OPTIMIZER:-'-g -O2'}
136 opt_build="$OPTIMIZER"
137 AC_SUBST(opt_build)
138
139 MALLOCLIB=${MALLOCLIB:-''} dnl /usr/lib/libefence.a
140 malloc_lib="$MALLOCLIB"
141 AC_SUBST(malloc_lib)
142
143 pkg_user=`id -u -n`
144 test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER"
145 AC_SUBST(pkg_user)
146
147 pkg_group=`id -g -n`
148 test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP"
149 AC_SUBST(pkg_group)
150
151 pkg_distribution=`uname -s`
152 test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
153 AC_SUBST(pkg_distribution)
154
155 pkg_platform=`uname -s | tr 'A-Z' 'a-z' | sed -e 's/irix64/irix/'`
156 test -z "$PLATFORM" || pkg_platform="$PLATFORM"
157 AC_SUBST(pkg_platform)
158 ])
159
160 #
161 # Check if we have a working fadvise system call
162 #
163 AC_DEFUN([AC_HAVE_FADVISE],
164 [ AC_MSG_CHECKING([for fadvise ])
165 AC_TRY_COMPILE([
166 #define _GNU_SOURCE
167 #define _FILE_OFFSET_BITS 64
168 #include <fcntl.h>
169 ], [
170 posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
171 ], have_fadvise=yes
172 AC_MSG_RESULT(yes),
173 AC_MSG_RESULT(no))
174 AC_SUBST(have_fadvise)
175 ])
176
177 #
178 # Check if we have a working madvise system call
179 #
180 AC_DEFUN([AC_HAVE_MADVISE],
181 [ AC_MSG_CHECKING([for madvise ])
182 AC_TRY_COMPILE([
183 #define _GNU_SOURCE
184 #define _FILE_OFFSET_BITS 64
185 #include <sys/mman.h>
186 ], [
187 posix_madvise(0, 0, MADV_NORMAL);
188 ], have_madvise=yes
189 AC_MSG_RESULT(yes),
190 AC_MSG_RESULT(no))
191 AC_SUBST(have_madvise)
192 ])
193
194 #
195 # Check if we have a working mincore system call
196 #
197 AC_DEFUN([AC_HAVE_MINCORE],
198 [ AC_MSG_CHECKING([for mincore ])
199 AC_TRY_COMPILE([
200 #define _GNU_SOURCE
201 #define _FILE_OFFSET_BITS 64
202 #include <sys/mman.h>
203 ], [
204 mincore(0, 0, 0);
205 ], have_mincore=yes
206 AC_MSG_RESULT(yes),
207 AC_MSG_RESULT(no))
208 AC_SUBST(have_mincore)
209 ])
210
211 #
212 # Check if we have a working sendfile system call
213 #
214 AC_DEFUN([AC_HAVE_SENDFILE],
215 [ AC_MSG_CHECKING([for sendfile ])
216 AC_TRY_COMPILE([
217 #define _GNU_SOURCE
218 #define _FILE_OFFSET_BITS 64
219 #include <sys/sendfile.h>
220 ], [
221 sendfile(0, 0, 0, 0);
222 ], have_sendfile=yes
223 AC_MSG_RESULT(yes),
224 AC_MSG_RESULT(no))
225 AC_SUBST(have_sendfile)
226 ])
227
228 #
229 # Check if we have a getmntent libc call (IRIX, Linux)
230 #
231 AC_DEFUN([AC_HAVE_GETMNTENT],
232 [ AC_MSG_CHECKING([for getmntent ])
233 AC_TRY_COMPILE([
234 #include <stdio.h>
235 #include <mntent.h>
236 ], [
237 getmntent(0);
238 ], have_getmntent=yes
239 AC_MSG_RESULT(yes),
240 AC_MSG_RESULT(no))
241 AC_SUBST(have_getmntent)
242 ])
243
244 #
245 # Check if we have a getmntinfo libc call (FreeBSD, Mac OS X)
246 #
247 AC_DEFUN([AC_HAVE_GETMNTINFO],
248 [ AC_MSG_CHECKING([for getmntinfo ])
249 AC_TRY_COMPILE([
250 #include <sys/param.h>
251 #include <sys/ucred.h>
252 #include <sys/mount.h>
253 ], [
254 getmntinfo(0, 0);
255 ], have_getmntinfo=yes
256 AC_MSG_RESULT(yes),
257 AC_MSG_RESULT(no))
258 AC_SUBST(have_getmntinfo)
259 ])
260
261 AC_DEFUN([AC_PACKAGE_NEED_PTHREAD_H],
262 [ AC_CHECK_HEADERS(pthread.h)
263 if test $ac_cv_header_pthread_h = no; then
264 AC_CHECK_HEADERS(pthread.h,, [
265 echo
266 echo 'FATAL ERROR: could not find a valid pthread header.'
267 exit 1])
268 fi
269 ])
270
271 AC_DEFUN([AC_PACKAGE_NEED_PTHREADMUTEXINIT],
272 [ AC_CHECK_LIB(pthread, pthread_mutex_init,, [
273 echo
274 echo 'FATAL ERROR: could not find a valid pthread library.'
275 exit 1
276 ])
277 libpthread=-lpthread
278 AC_SUBST(libpthread)
279 ])
280
281 #
282 # Check if we have a type for the pointer's size integer (__psint_t)
283 #
284 AC_DEFUN([AC_TYPE_PSINT],
285 [ AC_MSG_CHECKING([for __psint_t ])
286 AC_TRY_COMPILE([
287 #include <sys/types.h>
288 #include <stdlib.h>
289 #include <stddef.h>
290 ], [
291 __psint_t psint;
292 ], AC_DEFINE(HAVE___PSINT_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
293 ])
294
295 #
296 # Check if we have a type for the pointer's size unsigned (__psunsigned_t)
297 #
298 AC_DEFUN([AC_TYPE_PSUNSIGNED],
299 [ AC_MSG_CHECKING([for __psunsigned_t ])
300 AC_TRY_COMPILE([
301 #include <sys/types.h>
302 #include <stdlib.h>
303 #include <stddef.h>
304 ], [
305 __psunsigned_t psuint;
306 ], AC_DEFINE(HAVE___PSUNSIGNED_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
307 ])
308
309 #
310 # Check if we have a type for __u32
311 #
312 AC_DEFUN([AC_TYPE_U32],
313 [ AC_MSG_CHECKING([for __u32 ])
314 AC_TRY_COMPILE([
315 #include <asm/types.h>
316 #include <stdlib.h>
317 #include <stddef.h>
318 ], [
319 __u32 u32;
320 ], AC_DEFINE(HAVE___U32) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
321 ])
322
323 #
324 # Check type sizes
325 #
326 AC_DEFUN([AC_SIZEOF_POINTERS_AND_LONG],
327 [ if test "$cross_compiling" = yes -a -z "$ac_cv_sizeof_long"; then
328 AC_MSG_WARN([Cross compiling; assuming 32bit long and 32bit pointers])
329 fi
330 AC_CHECK_SIZEOF(long, 4)
331 AC_CHECK_SIZEOF(char *, 4)
332 if test $ac_cv_sizeof_long -eq 4 -o $ac_cv_sizeof_long -eq 0; then
333 AC_DEFINE(HAVE_32BIT_LONG)
334 fi
335 if test $ac_cv_sizeof_long -eq 8; then
336 AC_DEFINE(HAVE_64BIT_LONG)
337 fi
338 if test $ac_cv_sizeof_char_p -eq 4 -o $ac_cv_sizeof_char_p -eq 0; then
339 AC_DEFINE(HAVE_32BIT_PTR)
340 fi
341 if test $ac_cv_sizeof_char_p -eq 8; then
342 AC_DEFINE(HAVE_64BIT_PTR)
343 fi
344 ])
345
346 #
347 # Check for specified utility (env var) - if unset, fail.
348 #
349 AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
350 [ if test -z "$2"; then
351 echo
352 echo FATAL ERROR: $3 does not seem to be installed.
353 echo $1 cannot be built without a working $4 installation.
354 exit 1
355 fi
356 ])
357
358 #
359 # Generic macro, sets up all of the global build variables.
360 # The following environment variables may be set to override defaults:
361 # CC MAKE LIBTOOL TAR ZIP MAKEDEPEND AWK SED ECHO SORT
362 # MSGFMT MSGMERGE XGETTEXT RPM
363 #
364 AC_DEFUN([AC_PACKAGE_UTILITIES],
365 [ AC_PROG_CC
366 cc="$CC"
367 AC_SUBST(cc)
368 AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
369
370 if test -z "$MAKE"; then
371 AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
372 fi
373 if test -z "$MAKE"; then
374 AC_PATH_PROG(MAKE, make,, /usr/bin)
375 fi
376 make=$MAKE
377 AC_SUBST(make)
378 AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
379
380 if test -z "$LIBTOOL"; then
381 AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
382 fi
383 if test -z "$LIBTOOL"; then
384 AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
385 fi
386 libtool=$LIBTOOL
387 AC_SUBST(libtool)
388 AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
389
390 if test -z "$TAR"; then
391 AC_PATH_PROG(TAR, tar,, /usr/freeware/bin:/bin:/usr/local/bin:/usr/bin)
392 fi
393 tar=$TAR
394 AC_SUBST(tar)
395 if test -z "$ZIP"; then
396 AC_PATH_PROG(ZIP, gzip,, /bin:/usr/bin:/usr/local/bin:/usr/freeware/bin)
397 fi
398
399 zip=$ZIP
400 AC_SUBST(zip)
401
402 if test -z "$MAKEDEPEND"; then
403 AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
404 fi
405 makedepend=$MAKEDEPEND
406 AC_SUBST(makedepend)
407
408 if test -z "$AWK"; then
409 AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
410 fi
411 awk=$AWK
412 AC_SUBST(awk)
413
414 if test -z "$SED"; then
415 AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
416 fi
417 sed=$SED
418 AC_SUBST(sed)
419
420 if test -z "$ECHO"; then
421 AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
422 fi
423 echo=$ECHO
424 AC_SUBST(echo)
425
426 if test -z "$SORT"; then
427 AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
428 fi
429 sort=$SORT
430 AC_SUBST(sort)
431
432 dnl check if symbolic links are supported
433 AC_PROG_LN_S
434
435 if test "$enable_gettext" = yes; then
436 if test -z "$MSGFMT"; then
437 AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
438 fi
439 msgfmt=$MSGFMT
440 AC_SUBST(msgfmt)
441 AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
442
443 if test -z "$MSGMERGE"; then
444 AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
445 fi
446 msgmerge=$MSGMERGE
447 AC_SUBST(msgmerge)
448 AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
449
450 if test -z "$XGETTEXT"; then
451 AC_PATH_PROG(XGETTEXT, xgettext,, /usr/bin:/usr/local/bin:/usr/freeware/bin)
452 fi
453 xgettext=$XGETTEXT
454 AC_SUBST(xgettext)
455 AC_PACKAGE_NEED_UTILITY($1, "$xgettext", xgettext, gettext)
456 fi
457
458 if test -z "$RPM"; then
459 AC_PATH_PROG(RPM, rpm,, /bin:/usr/bin:/usr/freeware/bin)
460 fi
461 rpm=$RPM
462 AC_SUBST(rpm)
463
464 dnl .. and what version is rpm
465 rpm_version=0
466 test -n "$RPM" && test -x "$RPM" && rpm_version=`$RPM --version \
467 | awk '{print $NF}' | awk -F. '{V=1; print $V}'`
468 AC_SUBST(rpm_version)
469 dnl At some point in rpm 4.0, rpm can no longer build rpms, and
470 dnl rpmbuild is needed (rpmbuild may go way back; not sure)
471 dnl So, if rpm version >= 4.0, look for rpmbuild. Otherwise build w/ rpm
472 if test $rpm_version -ge 4; then
473 AC_PATH_PROG(RPMBUILD, rpmbuild)
474 rpmbuild=$RPMBUILD
475 else
476 rpmbuild=$RPM
477 fi
478 AC_SUBST(rpmbuild)
479 ])
480
481 AC_DEFUN([AC_PACKAGE_NEED_UUID_H],
482 [ AC_CHECK_HEADERS([uuid.h sys/uuid.h uuid/uuid.h])
483 if test $ac_cv_header_uuid_h = no -a \
484 $ac_cv_header_sys_uuid_h = no -a \
485 $ac_cv_header_uuid_uuid_h = no; then
486 echo
487 echo 'FATAL ERROR: could not find a valid UUID header.'
488 echo 'Install the Universally Unique Identifiers development package.'
489 exit 1
490 fi
491 ])
492
493 AC_DEFUN([AC_PACKAGE_NEED_UUIDCOMPARE],
494 [ AC_CHECK_FUNCS(uuid_compare)
495 if test $ac_cv_func_uuid_compare = yes; then
496 libuuid=""
497 else
498 AC_CHECK_LIB(uuid, uuid_compare,, [
499 echo
500 echo 'FATAL ERROR: could not find a valid UUID library.'
501 echo 'Install the Universally Unique Identifiers library package.'
502 exit 1])
503 libuuid="-luuid"
504 fi
505 AC_SUBST(libuuid)
506 ])
507