Blame view

mu/mailutils-config 2.87 KB
1 2
#! /bin/sh
# A deprecated interface to GNU Mailutils configuration facilities.
3
# Copyright (C) 2010-2012, 2014-2016 Free Software Foundation, Inc.
4 5 6 7 8 9 10 11 12 13 14 15 16 17
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.

18 19 20 21 22
# Despite being deprecated, this script is retained as an intermediate
# layer between mu and the AM_GNU_MAILUTILS macro.  This is important,
# because some distros prefer to rename mu when installing.  Using this 
# script allows AM_GNU_MAILUTILS to find mu even if it was renamed.

23 24 25
mode=
file=
dir=`expr "$0" : '\(.*\)/.*'`
Sergey Poznyakoff authored
26
muname=mailutils
27 28 29 30 31 32 33 34 35 36 37

test -n "$dir" && PATH=$PATH:$dir

usage() {
    cat <<EOT
This is a deprecated interface to GNU Mailutils configuration facilities.
It will be removed in future versions.  Please, consider using these
alternatives instead:

       Traditional usage          |   Use instead
    ------------------------------+-------------------
Sergey Poznyakoff authored
38 39 40 41 42
    mailutils-config --compile    | $muname cflags
    mailutils-config --link       | $muname ldflags
    mailutils-config --info       | $muname info
    mailutils-config --query      | $muname query
    mailutils-config --query=FILE | $muname query -f FILE
43

Sergey Poznyakoff authored
44
For more information, try \`$muname --help'.
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 96

EOT
    exit 0
}

while test $# -ne 0
do
  arg=$1
  shift
  case $arg in
  -c|--c|--co|--com|--comp|--compil|--compile)
    mode=cflags
    break
    ;;
  -i|--i|--in|--inf|--info)
    mode=info
    break
    ;;
  -l|--l|--li|--lin|--link)
    mode=ldflags
    break
    ;;
  --)
    break
    ;;
  -q*=*|--q*=*)
    opt=`expr "$arg" : '\(.*\)='`
    arg=`expr "$arg" : '.*=\(.*\)'`
    case $opt in
    -q|--q|--qu|--que|--quer|--query)
      mode=query
      file=arg
      break
      ;;
    *)
      echo >&2 "$0: invalid option: $1"
      exit 1
    esac
    ;;
  -q|--q|--qu|--que|--quer|--query)
    mode=query
    break
    ;;
  -q*)
    mode=query
    file=`expr "$arg" : '-q\(.*\)'`
    break
    ;;
  --usage|--u|--us|--usa|--usag|--help|--hel|--he|--h)
    usage
    ;;
  -V|--version|--versio|--versi|--vers|--ver|--ve|--v)
Sergey Poznyakoff authored
97
    $muname --version | sed -n '1{s/^mailutils/mailutils-config/;s/(\(GNU Mailutils\)) \([0-9][0-9.]*\).*/(\1 \2)/;p}'
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
    exit 0
    ;;
  *)
    echo >&2 "$0: unexpected argument; try \`$0 --usage' for help"
    exit 1
    ;;
  esac
done

if test -z "$mode"; then
  usage
fi

if test -n "$file"; then
  set -- -f"$file" $*
fi

Sergey Poznyakoff authored
115
$muname $mode $*