-
Notifications
You must be signed in to change notification settings - Fork 0
/
libreiser4.m4
94 lines (77 loc) · 2.67 KB
/
libreiser4.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This file is a part of reiser4progs package
# Copyright (C) 2001, 2002, 2003 by Hans Reiser, licensing governed by
# reiser4progs/COPYING.
dnl Usage:
dnl AC_CHECK_LIBREISER4([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl
dnl Example:
dnl AC_CHECK_LIBREISER4(0.3.0, , [AC_MSG_ERROR([libreiser4 >= 0.3.0 not installed - please install first])])
dnl
dnl Adds the required libraries to $REISER4_LIBS and does an
dnl AC_SUBST(REISER4_LIBS)
AC_DEFUN([AC_CHECK_LIBREISER4],
[
dnl save LIBS
saved_LIBS="$LIBS"
dnl Check for headers and library
AC_CHECK_HEADER(reiser4/libreiser4.h, ,
[AC_MSG_ERROR([<reiser4/libreiser4.h> not found; install reiser4progs])]
$3)
AC_CHECK_LIB(reiser4, reiser4_fs_open, ,
[AC_MSG_ERROR([libreiser4 not found; install reiser4progs available at \
http://www.namesys.com/snapshots])]
$3)
AC_MSG_CHECKING(for libreiser4 version >= $1)
AC_TRY_LINK_FUNC(libreiser4_version,,
AC_MSG_RESULT(failed)
AC_MSG_ERROR([libreiser4 can't execute test]))
dnl Get major, minor, and micro version from arg MINIMUM-VERSION
libreiser4_config_major_version=`echo $1 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
libreiser4_config_minor_version=`echo $1 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
libreiser4_config_micro_version=`echo $1 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
dnl Compare MINIMUM-VERSION with libreiser4 version
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <reiser4/libreiser4.h>
int main() {
int major, minor, micro;
const char *version;
if ( !(version = libreiser4_version()) )
exit(1);
if (sscanf(version, "%d.%d.%d", &major, &minor, µ) != 3) {
printf("%s, bad version string\n", version);
exit(1);
}
if ((major >= $libreiser4_config_major_version) &&
((major == $libreiser4_config_major_version) &&
(minor >= $libreiser4_config_minor_version)) &&
((major == $libreiser4_config_major_version) &&
(minor == $libreiser4_config_minor_version) &&
(micro >= $libreiser4_config_micro_version)))
{
return 0;
} else {
printf("\nAn old version of libreiser4 (%s) was found.\n",
version);
printf("You need a version of libreiser4 newer than or "
"equal to %d.%d.%d.\n", $libreiser4_config_major_version,
$libreiser4_config_minor_version, $libreiser4_config_micro_version);
printf("You can get it at http://www.namesys.com/snapshots\n");
return 1;
}
}
],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) ; $3,
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
dnl restore orignial LIBS and set @REISER4_LIBS@
REISER4_LIBS="$LIBS"
LIBS="$saved_LIBS"
AC_SUBST(REISER4_LIBS)
dnl Execute ACTION-IF-FOUND
$2
])