3 dnl # Read metadata from the META file.
6 dnl # Chris Dunlap <cdunlap@llnl.gov>
8 AC_DEFUN([ZFS_AC_META], [
12 #undef PACKAGE_BUGREPORT
15 #undef PACKAGE_TARNAME
16 #undef PACKAGE_VERSION
20 AC_MSG_CHECKING([metadata])
23 _zfs_ac_meta_got_file=no
24 if test -f "$META"; then
25 _zfs_ac_meta_got_file=yes
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.]
32 AC_SUBST([ZFS_META_NAME])
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.]
40 AC_SUBST([ZFS_META_VERSION])
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.]
48 AC_SUBST([ZFS_META_RELEASE])
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.]
56 AC_SUBST([ZFS_META_LICENSE])
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],
65 [Define the project alias string.]
67 AC_SUBST([ZFS_META_ALIAS])
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.]
75 AC_SUBST([ZFS_META_DATA])
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.]
83 AC_SUBST([ZFS_META_AUTHOR])
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'
101 AC_DEFINE_UNQUOTED([ZFS_META_LT_REVISION],
102 ["$ZFS_META_LT_REVISION"],
103 [Define the libtool library 'revision'
104 version information.]
106 AC_DEFINE_UNQUOTED([ZFS_META_LT_AGE], ["$ZFS_META_LT_AGE"],
107 [Define the libtool library 'age'
108 version information.]
110 AC_SUBST([ZFS_META_LT_CURRENT])
111 AC_SUBST([ZFS_META_LT_REVISION])
112 AC_SUBST([ZFS_META_LT_AGE])
116 AC_MSG_RESULT([$_zfs_ac_meta_got_file])
120 AC_DEFUN([_ZFS_AC_META_GETVAL],
122 -e "BEGIN { \\$key=shift @ARGV; }"\
123 -e "next unless s/^\s*\\$key@<:@:=@:>@//i;"\
124 -e "s/^((?:@<:@^'\"#@:>@*(?:(@<:@'\"@:>@)@<:@^\2@:>@*\2)*)*)#.*/\\@S|@1/;"\
127 -e "s/^(@<:@'\"@:>@)(.*)\1/\\@S|@2/;"\
129 -e "END { print \\$val if defined \\$val; }"\