]> granicus.if.org Git - zfs/blob - config/zfs-meta.m4
Print mount/umount errors
[zfs] / config / zfs-meta.m4
1 dnl #
2 dnl # ZFS_AC_META
3 dnl # Read metadata from the META file.
4 dnl #
5 dnl # AUTHOR:
6 dnl # Chris Dunlap <cdunlap@llnl.gov>
7 dnl #
8 AC_DEFUN([ZFS_AC_META], [
9
10         AH_BOTTOM([
11 #undef PACKAGE
12 #undef PACKAGE_BUGREPORT
13 #undef PACKAGE_NAME
14 #undef PACKAGE_STRING
15 #undef PACKAGE_TARNAME
16 #undef PACKAGE_VERSION
17 #undef STDC_HEADERS
18 #undef VERSION])
19
20         AC_MSG_CHECKING([metadata])
21
22         META="$srcdir/META"
23         _zfs_ac_meta_got_file=no
24         if test -f "$META"; then
25                 _zfs_ac_meta_got_file=yes
26
27                 ZFS_META_NAME=_ZFS_AC_META_GETVAL([(?:NAME|PROJECT|PACKAGE)]);
28                 if test -n "$ZFS_META_NAME"; then
29                         AC_DEFINE_UNQUOTED([ZFS_META_NAME], ["$ZFS_META_NAME"],
30                                 [Define the project name.]
31                         )
32                         AC_SUBST([ZFS_META_NAME])
33                 fi
34
35                 ZFS_META_VERSION=_ZFS_AC_META_GETVAL([VERSION]);
36                 if test -n "$ZFS_META_VERSION"; then
37                         AC_DEFINE_UNQUOTED([ZFS_META_VERSION], ["$ZFS_META_VERSION"],
38                                 [Define the project version.]
39                         )
40                         AC_SUBST([ZFS_META_VERSION])
41                 fi
42
43                 ZFS_META_RELEASE=_ZFS_AC_META_GETVAL([RELEASE]);
44                 if test -n "$ZFS_META_RELEASE"; then
45                         AC_DEFINE_UNQUOTED([ZFS_META_RELEASE], ["$ZFS_META_RELEASE"],
46                                 [Define the project release.]
47                         )
48                         AC_SUBST([ZFS_META_RELEASE])
49                 fi
50
51                 ZFS_META_LICENSE=_ZFS_AC_META_GETVAL([LICENSE]);
52                 if test -n "$ZFS_META_LICENSE"; then
53                         AC_DEFINE_UNQUOTED([ZFS_META_LICENSE], ["$ZFS_META_LICENSE"],
54                                 [Define the project license.]
55                         )
56                         AC_SUBST([ZFS_META_LICENSE])
57                 fi
58
59                 if test -n "$ZFS_META_NAME" -a -n "$ZFS_META_VERSION"; then
60                                 ZFS_META_ALIAS="$ZFS_META_NAME-$ZFS_META_VERSION"
61                                 test -n "$ZFS_META_RELEASE" && 
62                                         ZFS_META_ALIAS="$ZFS_META_ALIAS-$ZFS_META_RELEASE"
63                                 AC_DEFINE_UNQUOTED([ZFS_META_ALIAS],
64                                         ["$ZFS_META_ALIAS"],
65                                         [Define the project alias string.] 
66                                 )
67                                 AC_SUBST([ZFS_META_ALIAS])
68                 fi
69
70                 ZFS_META_DATA=_ZFS_AC_META_GETVAL([DATE]);
71                 if test -n "$ZFS_META_DATA"; then
72                         AC_DEFINE_UNQUOTED([ZFS_META_DATA], ["$ZFS_META_DATA"],
73                                 [Define the project release date.] 
74                         )
75                         AC_SUBST([ZFS_META_DATA])
76                 fi
77
78                 ZFS_META_AUTHOR=_ZFS_AC_META_GETVAL([AUTHOR]);
79                 if test -n "$ZFS_META_AUTHOR"; then
80                         AC_DEFINE_UNQUOTED([ZFS_META_AUTHOR], ["$ZFS_META_AUTHOR"],
81                                 [Define the project author.]
82                         )
83                         AC_SUBST([ZFS_META_AUTHOR])
84                 fi
85
86                 m4_pattern_allow([^LT_(CURRENT|REVISION|AGE)$])
87                 ZFS_META_LT_CURRENT=_ZFS_AC_META_GETVAL([LT_CURRENT]);
88                 ZFS_META_LT_REVISION=_ZFS_AC_META_GETVAL([LT_REVISION]);
89                 ZFS_META_LT_AGE=_ZFS_AC_META_GETVAL([LT_AGE]);
90                 if test -n "$ZFS_META_LT_CURRENT" \
91                                  -o -n "$ZFS_META_LT_REVISION" \
92                                  -o -n "$ZFS_META_LT_AGE"; then
93                         test -n "$ZFS_META_LT_CURRENT" || ZFS_META_LT_CURRENT="0"
94                         test -n "$ZFS_META_LT_REVISION" || ZFS_META_LT_REVISION="0"
95                         test -n "$ZFS_META_LT_AGE" || ZFS_META_LT_AGE="0"
96                         AC_DEFINE_UNQUOTED([ZFS_META_LT_CURRENT],
97                                 ["$ZFS_META_LT_CURRENT"],
98                                 [Define the libtool library 'current'
99                                  version information.]
100                         )
101                         AC_DEFINE_UNQUOTED([ZFS_META_LT_REVISION],
102                                 ["$ZFS_META_LT_REVISION"],
103                                 [Define the libtool library 'revision'
104                                  version information.]
105                         )
106                         AC_DEFINE_UNQUOTED([ZFS_META_LT_AGE], ["$ZFS_META_LT_AGE"],
107                                 [Define the libtool library 'age' 
108                                  version information.]
109                         )
110                         AC_SUBST([ZFS_META_LT_CURRENT])
111                         AC_SUBST([ZFS_META_LT_REVISION])
112                         AC_SUBST([ZFS_META_LT_AGE])
113                 fi
114         fi
115
116         AC_MSG_RESULT([$_zfs_ac_meta_got_file])
117         ]
118 )
119
120 AC_DEFUN([_ZFS_AC_META_GETVAL], 
121         [`perl -n\
122                 -e "BEGIN { \\$key=shift @ARGV; }"\
123                 -e "next unless s/^\s*\\$key@<:@:=@:>@//i;"\
124                 -e "s/^((?:@<:@^'\"#@:>@*(?:(@<:@'\"@:>@)@<:@^\2@:>@*\2)*)*)#.*/\\@S|@1/;"\
125                 -e "s/^\s+//;"\
126                 -e "s/\s+$//;"\
127                 -e "s/^(@<:@'\"@:>@)(.*)\1/\\@S|@2/;"\
128                 -e "\\$val=\\$_;"\
129                 -e "END { print \\$val if defined \\$val; }"\
130                 '$1' $META`]dnl
131 )