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