File: libaal.m4

package info (click to toggle)
libaal 1.0.7-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 1,768 kB
  • sloc: sh: 4,118; ansic: 2,461; makefile: 52
file content (95 lines) | stat: -rw-r--r-- 2,563 bytes parent folder | download | duplicates (7)
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
95
# This file is a part of libaal package
# Copyright (C) 2001, 2002, 2003 by Hans Reiser, licensing governed by
# libaal/COPYING.

dnl Usage:
dnl AC_CHECK_LIBAAL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl
dnl Example:
dnl AC_CHECK_LIBAAL(0.3.0, , [AC_MSG_ERROR([libaal >= 0.3.0 not installed - please install first])])
dnl
dnl Adds the required libraries to $AAL_LIBS and does an
dnl AC_SUBST(AAL_LIBS)

AC_DEFUN([AC_CHECK_LIBAAL],
[

dnl save LIBS
saved_LIBS="$LIBS"

dnl Check for headers and library
AC_CHECK_HEADER(aal/libaal.h, ,
    [AC_MSG_ERROR([<aal/libaal.h> not found; install libaal])] 
$3)

AC_CHECK_LIB(aal, aal_device_open, ,
    [AC_MSG_ERROR([libaal not found; install libaal available at \
http://www.namesys.com/snapshots/])]
$3)

AC_MSG_CHECKING(for libaal version >= $1)

AC_TRY_LINK_FUNC(libaal_version,,
    AC_MSG_RESULT(failed)
    AC_MSG_ERROR([libaal can't execute test]))

dnl Get major, minor, and micro version from arg MINIMUM-VERSION
libaal_config_major_version=`echo $1 | \
    sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
libaal_config_minor_version=`echo $1 | \
    sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
libaal_config_micro_version=`echo $1 | \
    sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`

dnl Compare MINIMUM-VERSION with libaal version
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <aal/libaal.h>

int main() {
    const char *version;    
    int major, minor, micro;
	
    if (!(version = libaal_version()))
	exit(1);
		
    if (sscanf(version, "%d.%d.%d", &major, &minor, &micro) != 3) {
	printf("%s, bad version string\n", version);
	exit(1);
    }
	
    if ((major >= $libaal_config_major_version) &&
	((major == $libaal_config_major_version) && 
	(minor >= $libaal_config_minor_version)) &&
	((major == $libaal_config_major_version) && 
	(minor == $libaal_config_minor_version) && 
	(micro >= $libaal_config_micro_version))) 
    {
	return 0;
    } else {
	printf("\nAn old version of libaal (%s) was found.\n",
	    version);
	printf("You need a version of libaal newer than or "
            "equal to %d.%d.%d.\n", $libaal_config_major_version, 
	    $libaal_config_minor_version, $libaal_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 @AAL_LIBS@
AAL_LIBS="$LIBS"
LIBS="$saved_LIBS"
AC_SUBST(AAL_LIBS)

dnl Execute ACTION-IF-FOUND
$2

])