source: trunk/build_support/yat-config.in @ 1487

Last change on this file since 1487 was 1487, checked in by Jari Häkkinen, 15 years ago

Addresses #436. GPL license copy reference should also be updated.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1#! @SHELL@
2# @configure_input@
3
4# $Id: yat-config.in 1487 2008-09-10 08:41:36Z jari $
5
6# Copyright (C) 2008 Peter Johansson
7#
8# This file is part of the yat library, http://dev.thep.lu.se/yat
9#
10# The yat library is free software; you can redistribute it and/or
11# modify it under the terms of the GNU General Public License as
12# published by the Free Software Foundation; either version 3 of the
13# License, or (at your option) any later version.
14#
15# The yat library is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with yat. If not, see <http://www.gnu.org/licenses/>.
22
23prefix="@prefix@"
24exec_prefix="@exec_prefix@"
25bindir="@bindir@"
26libdir="@libdir@"
27includedir="@includedir@"
28
29CXX="@CXX@"
30CXXCPP="@CXXCPP@"
31CPPFLAGS="@CPPFLAGS@"
32CXXFLAGS="@CXXFLAGS@"
33LDFLAGS="@LDFLAGS@"
34LIBS="@LIBS@"
35EXTRA_CPPFLAGS="@EXTRA_CPPFLAGS@"
36EXTRA_CXXFLAGS="@EXTRA_CXXFLAGS@"
37EXTRA_LDFLAGS="@EXTRA_LDFLAGS@"
38
39LA_FILE="$libdir/lib@YAT_LIBNAME@.la"
40
41usage()
42{
43    cat <<EOF
44Usage: yat-config [OPTION]...
45
46Known values for OPTION are:
47  --prefix                    print prefix
48  --bindir                    print location where binaries are installed
49  --includedir                print location where headers are installed
50  --libdir                    print location where @PACKAGE@ library is installed
51  --cxx                       print C++ compiler name
52  --cxxcpp                    print C++ preprocessor name and required options
53  --cppflags                  print C++ preprocessor flags
54  --cxxflags                  print C++ compiler flags
55  --ldflags                   print linker flags
56  --libs                      print libraries to link against
57  --link-libtool              print the libtool inputs for linking to @PACKAGE@
58  --atleast-version=VERSION   return 0 if @PACKAGE@ is at least version VERSION
59  --version                   print @PACKAGE@'s version
60  --version-major             print @PACKAGE@'s MAJOR version
61  --version-minor             print @PACKAGE@'s MINOR version
62  --version-patch             print @PACKAGE@'s PATCH version
63  --help                      print this help
64
65Report bugs to <@PACKAGE_BUGREPORT@>.
66EOF
67
68    exit $1
69}
70
71
72if test $# -eq 0; then
73    usage
74    exit 1
75fi
76
77flags=""
78
79while test $# -gt 0; do
80    case "$1" in
81    --prefix)
82    @ECHO@ $prefix
83    exit 0
84    ;;
85    --bindir)
86    @ECHO@ $bindir
87    exit 0
88    ;;
89    --includedir)
90    @ECHO@ $includedir
91    exit 0
92    ;;
93    --libdir)
94    @ECHO@ $libdir
95    exit 0
96    ;;
97    --cxx)
98    @ECHO@ $CXX
99    exit 0
100    ;;
101    --cxxcpp)
102    @ECHO@ $CXXCPP
103    exit 0
104    ;;
105    --cppflags)
106    flags="$flags -I$includedir $EXTRA_CPPFLAGS $CPPFLAGS"
107    ;;
108    --cxxflags)
109    flags="$flags $EXTRA_CXXFLAGS $CXXFLAGS"
110    ;;
111    --libs)
112    flags="$flags -l@YAT_LIBNAME@ $LIBS"
113    ;;
114    --ldflags)
115    flags="$flags -L$libdir $EXTRA_LDFLAGS $LDFLAGS"
116    ;;
117    --link-libtool)
118    flags="$flags $LA_FILE"
119    ;;
120    --atleast-version=*)
121      optarg=`@ECHO@ "$1" | sed 's/--atleast-version=//'`
122      min_major=`@ECHO@ "$optarg" | sed 's/\([0-9]*\).*/\1/'`
123      if test "$optarg" = "$min_major"; then
124         min_minor="0";
125      else
126         min_minor=`@ECHO@ "$optarg" | sed 's/[0-9]*.\([0-9]*\).*/\1/'`
127      fi
128      if test "$optarg" = "$min_major.$min_minor"; then
129         min_patch="0";
130      else
131         min_patch=`@ECHO@ "$optarg" | sed 's/[0-9]*.[0-9]*.\([0-9]*\).*/\1/'`
132      fi
133      if test "$optarg" = "$min_patch"; then
134        echo "yat-config: \`$optarg' is not a valid VERSION"
135        exit 255
136      fi
137      if !(test -n "$min_major" && test -n "$min_minor" \
138           && test -n "$min_patch"); then
139        echo "yat-config: \`$optarg' is not a valid VERSION"
140        exit 255
141      fi
142      if ( test $min_major -gt @YAT_MAJOR_VERSION@ || \
143           ( test $min_major -eq @YAT_MAJOR_VERSION@ && \
144             ( test $min_minor -gt @YAT_MINOR_VERSION@ || \
145         ( test $min_minor -eq @YAT_MINOR_VERSION@ && \
146                 ( test $min_patch -gt @YAT_PATCH_VERSION@ ||
147                   (test $min_patch -eq @YAT_PATCH_VERSION@ &&
148                    test "@YAT_DEV_BUILD@" = "true" )))))) ; then
149   exit 1;
150      fi
151      exit 0
152    ;;
153    --version)
154    @ECHO@ @VERSION@
155    exit 0
156    ;;
157    --version-major)
158    @ECHO@ @YAT_MAJOR_VERSION@
159    exit 0
160    ;;
161    --version-minor)
162    @ECHO@ @YAT_MINOR_VERSION@
163    exit 0
164    ;;
165    --version-patch)
166    @ECHO@ @YAT_PATCH_VERSION@
167    exit 0
168    ;;
169    --help)
170    usage
171    exit 0
172    ;;
173    *)
174    usage
175    exit 1
176    ;;
177    esac
178
179    # Next please.
180    shift
181done
182
183# only keep last of replicates
184if test -n "$flags"; then
185   reversed_flags=
186   for opt in $flags; do
187     reversed_flags="$opt $reversed_flags"
188   done
189   unique_flags=
190   for opt in $reversed_flags; do
191     unique=1;       
192     for opt2 in $unique_flags; do
193       if test $opt = $opt2; then
194         unique=0
195       fi
196     done
197     if test $unique -eq 1; then
198       unique_flags="$opt $unique_flags"
199     fi
200   done
201   @ECHO@ $unique_flags
202fi
203
204exit 0
Note: See TracBrowser for help on using the repository browser.