PageRenderTime 13ms CodeModel.GetById 7ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/config/ac_meta.m4

https://code.google.com/
m4 | 110 lines | 87 code | 11 blank | 12 comment | 0 complexity | 960fc829646162a4dc7994e65364730f MD5 | raw file
  1##*****************************************************************************
  2## $Id$
  3##*****************************************************************************
  4#  AUTHOR:
  5#    Chris Dunlap <cdunlap@llnl.gov>
  6#
  7#  SYNOPSIS:
  8#    X_AC_META
  9#
 10#  DESCRIPTION:
 11#    Read metadata from the META file.
 12##*****************************************************************************
 13
 14AC_DEFUN([X_AC_META], [
 15  AC_MSG_CHECKING([metadata])
 16
 17  META="$srcdir/META"
 18  _x_ac_meta_got_file=no
 19  if test -f "$META"; then
 20    _x_ac_meta_got_file=yes
 21
 22    META_NAME=_X_AC_META_GETVAL([(?:NAME|PROJECT|PACKAGE)]);
 23    if test -n "$META_NAME"; then
 24      AC_DEFINE_UNQUOTED([META_NAME], ["$META_NAME"],
 25        [Define the project name.]
 26      )
 27      AC_SUBST([META_NAME])
 28    fi
 29
 30    META_VERSION=_X_AC_META_GETVAL([VERSION]);
 31    if test -n "$META_VERSION"; then
 32      AC_DEFINE_UNQUOTED([META_VERSION], ["$META_VERSION"],
 33        [Define the project version.]
 34      )
 35      AC_SUBST([META_VERSION])
 36    fi
 37
 38    META_RELEASE=_X_AC_META_GETVAL([RELEASE]);
 39    if test -n "$META_RELEASE"; then
 40      AC_DEFINE_UNQUOTED([META_RELEASE], ["$META_RELEASE"],
 41        [Define the project release.]
 42      )
 43      AC_SUBST([META_RELEASE])
 44    fi
 45
 46    if test -n "$META_NAME" -a -n "$META_VERSION"; then
 47        META_ALIAS="$META_NAME-$META_VERSION"
 48        test -n "$META_RELEASE" && META_ALIAS="$META_ALIAS-$META_RELEASE"
 49        AC_DEFINE_UNQUOTED([META_ALIAS], ["$META_ALIAS"],
 50          [Define the project alias string (name-ver or name-ver-rel).]
 51        )
 52        AC_SUBST([META_ALIAS])
 53    fi
 54
 55    META_DATE=_X_AC_META_GETVAL([DATE]);
 56    if test -n "$META_DATE"; then
 57      AC_DEFINE_UNQUOTED([META_DATE], ["$META_DATE"],
 58        [Define the project release date.] 
 59      )
 60      AC_SUBST([META_DATE])
 61    fi
 62
 63    META_AUTHOR=_X_AC_META_GETVAL([AUTHOR]);
 64    if test -n "$META_AUTHOR"; then
 65      AC_DEFINE_UNQUOTED([META_AUTHOR], ["$META_AUTHOR"],
 66        [Define the project author.]
 67      )
 68      AC_SUBST([META_AUTHOR])
 69    fi
 70
 71    META_LT_CURRENT=_X_AC_META_GETVAL([LT_CURRENT]);
 72    META_LT_REVISION=_X_AC_META_GETVAL([LT_REVISION]);
 73    META_LT_AGE=_X_AC_META_GETVAL([LT_AGE]);
 74    if test -n "$META_LT_CURRENT" \
 75         -o -n "$META_LT_REVISION" \
 76         -o -n "$META_LT_AGE"; then
 77      test -n "$META_LT_CURRENT" || META_LT_CURRENT="0"
 78      test -n "$META_LT_REVISION" || META_LT_REVISION="0"
 79      test -n "$META_LT_AGE" || META_LT_AGE="0"
 80      AC_DEFINE_UNQUOTED([META_LT_CURRENT], ["$META_LT_CURRENT"],
 81        [Define the libtool library 'current' version information.]
 82      )
 83      AC_DEFINE_UNQUOTED([META_LT_REVISION], ["$META_LT_REVISION"],
 84        [Define the libtool library 'revision' version information.]
 85      )
 86      AC_DEFINE_UNQUOTED([META_LT_AGE], ["$META_LT_AGE"],
 87        [Define the libtool library 'age' version information.]
 88      )
 89      AC_SUBST([META_LT_CURRENT])
 90      AC_SUBST([META_LT_REVISION])
 91      AC_SUBST([META_LT_AGE])
 92    fi
 93  fi
 94
 95  AC_MSG_RESULT([$_x_ac_meta_got_file])
 96  ]
 97)
 98
 99AC_DEFUN([_X_AC_META_GETVAL], 
100  [`perl -n\
101    -e "BEGIN { \\$key=shift @ARGV; }"\
102    -e "next unless s/^\s*\\$key@<:@:=@:>@//i;"\
103    -e "s/^((?:@<:@^'\"#@:>@*(?:(@<:@'\"@:>@)@<:@^\2@:>@*\2)*)*)#.*/\\@S|@1/;"\
104    -e "s/^\s+//;"\
105    -e "s/\s+$//;"\
106    -e "s/^(@<:@'\"@:>@)(.*)\1/\\@S|@2/;"\
107    -e "\\$val=\\$_;"\
108    -e "END { print \\$val if defined \\$val; }"\
109    '$1' $META`]dnl
110)