| 1 | #! /bin/sh |
| 2 | # |
| 3 | # $Id: lib-config.in,v 1.2 2001/01/20 12:01:09 mdw Exp $ |
| 4 | # |
| 5 | # Provide configuration information for library clients |
| 6 | # |
| 7 | # (c) 1999 Straylight/Edgeware |
| 8 | # |
| 9 | |
| 10 | #----- Licensing notice ----------------------------------------------------- |
| 11 | # |
| 12 | # This file is part of the Common Files Distribution (`common'). |
| 13 | # |
| 14 | # `Common' is free software; you can redistribute it and/or modify |
| 15 | # it under the terms of the GNU General Public License as published by |
| 16 | # the Free Software Foundation; either version 2 of the License, or |
| 17 | # (at your option) any later version. |
| 18 | # |
| 19 | # `Common' is distributed in the hope that it will be useful, |
| 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | # GNU General Public License for more details. |
| 23 | # |
| 24 | # You should have received a copy of the GNU General Public License |
| 25 | # along with `common'; if not, write to the Free Software Foundation, |
| 26 | # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 27 | |
| 28 | #----- Revision history ----------------------------------------------------- |
| 29 | # |
| 30 | # $Log: lib-config.in,v $ |
| 31 | # Revision 1.2 2001/01/20 12:01:09 mdw |
| 32 | # Cosmetic indentation fix. |
| 33 | # |
| 34 | # Revision 1.1 2000/08/15 21:37:06 mdw |
| 35 | # New common library configuration skeleton, filled in by configure.in. |
| 36 | # Replaces mLib-config etc. |
| 37 | # |
| 38 | |
| 39 | #----- Configuration -------------------------------------------------------- |
| 40 | |
| 41 | prefix=@prefix@ |
| 42 | exec_prefix=@exec_prefix@ |
| 43 | libdir=@libdir@ |
| 44 | includedir=@includedir@ |
| 45 | archincludedir=${libdir}/@LIBRARY@/include |
| 46 | |
| 47 | VERSION=@VERSION@ |
| 48 | |
| 49 | #----- Command-line parsing and output -------------------------------------- |
| 50 | |
| 51 | ego=`echo "$0" | sed 's:.*/::'` |
| 52 | |
| 53 | if [ -z "${1+x}" ]; then |
| 54 | echo >&2 "Usage: $ego OPTION" |
| 55 | echo >&2 "Run \`$ego --help' for more information." |
| 56 | exit 1 |
| 57 | fi |
| 58 | |
| 59 | case "$1" in |
| 60 | --help) |
| 61 | cat <<EOF |
| 62 | @LIBNAME@, version $VERSION |
| 63 | |
| 64 | Usage: $ego OPTION |
| 65 | |
| 66 | Provides configuration parameters for @LIBNAME@ client programs. Options |
| 67 | are: |
| 68 | |
| 69 | --help Display this help text. |
| 70 | --version Display @LIBNAME@ version number. |
| 71 | --check VERSION Verifies that the given version number is supported. |
| 72 | --cflags Display appropriate compiler flags. |
| 73 | --libs Display appropriate linker flags and library names. |
| 74 | EOF |
| 75 | ;; |
| 76 | --version) |
| 77 | echo $VERSION |
| 78 | ;; |
| 79 | --check) |
| 80 | version=${2-1.0.0pre0} |
| 81 | set `echo $VERSION | sed 's/[^0-9][^0-9]*/ /g'` |
| 82 | MAJOR=${1-1} MINOR=${2-0} PATCH=${3-0} PRE=$4 |
| 83 | set `echo $version | sed 's/[^0-9][^0-9]*/ /g'` |
| 84 | major=${1-1} minor=${2-0} patch=${3-0} pre=$4 |
| 85 | [ $major -gt $MAJOR ] && exit 1 |
| 86 | [ $major -lt $MAJOR ] && exit 0 |
| 87 | [ $minor -gt $MINOR ] && exit 1 |
| 88 | [ $minor -lt $MINOR ] && exit 0 |
| 89 | [ $patch -gt $PATCH ] && exit 1 |
| 90 | [ $patch -lt $PATCH ] && exit 0 |
| 91 | if [ "$PRE" ]; then |
| 92 | [ -z "$pre" ] && exit 1 |
| 93 | [ $pre -gt $PRE ] && exit 1 |
| 94 | [ $pre -lt $PRE ] && exit 0 |
| 95 | fi |
| 96 | exit 0 |
| 97 | ;; |
| 98 | --cflags) |
| 99 | echo "-I${includedir} -I${archincludedir}" |
| 100 | ;; |
| 101 | --libs) |
| 102 | echo "-L${libdir} -l@LIBRARY@" |
| 103 | ;; |
| 104 | *) |
| 105 | echo >&2 "$ego: unrecognized option \`$1'" |
| 106 | exit 1 |
| 107 | esac |
| 108 | |
| 109 | #----- That's all, folks ---------------------------------------------------- |