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

Last change on this file since 1469 was 1469, checked in by Peter, 13 years ago

stray trac.thep

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1#! @SHELL@
2# @configure_input@
3
4# $Id: yat-config.in 1469 2008-09-02 17:21:00Z peter $
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 2 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 this program; if not, write to the Free Software
22# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23# 02111-1307, USA.
24
25prefix="@prefix@"
26exec_prefix="@exec_prefix@"
27bindir="@bindir@"
28libdir="@libdir@"
29includedir="@includedir@"
30
31CXX="@CXX@"
32CXXCPP="@CXXCPP@"
33CPPFLAGS="@CPPFLAGS@"
34CXXFLAGS="@CXXFLAGS@"
35LDFLAGS="@LDFLAGS@"
36LIBS="@LIBS@"
37EXTRA_CPPFLAGS="@EXTRA_CPPFLAGS@"
38EXTRA_CXXFLAGS="@EXTRA_CXXFLAGS@"
39EXTRA_LDFLAGS="@EXTRA_LDFLAGS@"
40
41LA_FILE="$libdir/lib@YAT_LIBNAME@.la"
42
43usage()
44{
45    cat <<EOF
46Usage: yat-config [OPTION]...
47
48Known values for OPTION are:
49  --prefix                    print prefix
50  --bindir                    print location where binaries are installed
51  --includedir                print location where headers are installed
52  --libdir                    print location where @PACKAGE@ library is installed
53  --cxx                       print C++ compiler name
54  --cxxcpp                    print C++ preprocessor name and required options
55  --cppflags                  print C++ preprocessor flags
56  --cxxflags                  print C++ compiler flags
57  --ldflags                   print linker flags
58  --libs                      print libraries to link against
59  --link-libtool              print the libtool inputs for linking to @PACKAGE@
60  --atleast-version=VERSION   return 0 if @PACKAGE@ is at least version VERSION
61  --version                   print @PACKAGE@'s version
62  --version-major             print @PACKAGE@'s MAJOR version
63  --version-minor             print @PACKAGE@'s MINOR version
64  --version-patch             print @PACKAGE@'s PATCH version
65  --help                      print this help
66
67Report bugs to <@PACKAGE_BUGREPORT@>.
68EOF
69
70    exit $1
71}
72
73
74if test $# -eq 0; then
75    usage
76    exit 1
77fi
78
79flags=""
80
81while test $# -gt 0; do
82    case "$1" in
83    --prefix)
84    @ECHO@ $prefix
85    exit 0
86    ;;
87    --bindir)
88    @ECHO@ $bindir
89    exit 0
90    ;;
91    --includedir)
92    @ECHO@ $includedir
93    exit 0
94    ;;
95    --libdir)
96    @ECHO@ $libdir
97    exit 0
98    ;;
99    --cxx)
100    @ECHO@ $CXX
101    exit 0
102    ;;
103    --cxxcpp)
104    @ECHO@ $CXXCPP
105    exit 0
106    ;;
107    --cppflags)
108    flags="$flags -I$includedir $EXTRA_CPPFLAGS $CPPFLAGS"
109    ;;
110    --cxxflags)
111    flags="$flags $EXTRA_CXXFLAGS $CXXFLAGS"
112    ;;
113    --libs)
114    flags="$flags -l@YAT_LIBNAME@ $LIBS"
115    ;;
116    --ldflags)
117    flags="$flags -L$libdir $EXTRA_LDFLAGS $LDFLAGS"
118    ;;
119    --link-libtool)
120    flags="$flags $LA_FILE"
121    ;;
122    --atleast-version=*)
123      optarg=`@ECHO@ "$1" | sed 's/--atleast-version=//'`
124      min_major=`@ECHO@ "$optarg" | sed 's/\([0-9]*\).*/\1/'`
125      if test "$optarg" = "$min_major"; then
126         min_minor="0";
127      else
128         min_minor=`@ECHO@ "$optarg" | sed 's/[0-9]*.\([0-9]*\).*/\1/'`
129      fi
130      if test "$optarg" = "$min_major.$min_minor"; then
131         min_patch="0";
132      else
133         min_patch=`@ECHO@ "$optarg" | sed 's/[0-9]*.[0-9]*.\([0-9]*\).*/\1/'`
134      fi
135      if test "$optarg" = "$min_patch"; then
136        echo "yat-config: \`$optarg' is not a valid VERSION"
137        exit 255
138      fi
139      if !(test -n "$min_major" && test -n "$min_minor" \
140           && test -n "$min_patch"); then
141        echo "yat-config: \`$optarg' is not a valid VERSION"
142        exit 255
143      fi
144      if ( test $min_major -gt @YAT_MAJOR_VERSION@ || \
145           ( test $min_major -eq @YAT_MAJOR_VERSION@ && \
146             ( test $min_minor -gt @YAT_MINOR_VERSION@ || \
147         ( test $min_minor -eq @YAT_MINOR_VERSION@ && \
148                 ( test $min_patch -gt @YAT_PATCH_VERSION@ ||
149                   (test $min_patch -eq @YAT_PATCH_VERSION@ &&
150                    test "@YAT_DEV_BUILD@" = "true" )))))) ; then
151   exit 1;
152      fi
153      exit 0
154    ;;
155    --version)
156    @ECHO@ @VERSION@
157    exit 0
158    ;;
159    --version-major)
160    @ECHO@ @YAT_MAJOR_VERSION@
161    exit 0
162    ;;
163    --version-minor)
164    @ECHO@ @YAT_MINOR_VERSION@
165    exit 0
166    ;;
167    --version-patch)
168    @ECHO@ @YAT_PATCH_VERSION@
169    exit 0
170    ;;
171    --help)
172    usage
173    exit 0
174    ;;
175    *)
176    usage
177    exit 1
178    ;;
179    esac
180
181    # Next please.
182    shift
183done
184
185# only keep last of replicates
186if test -n "$flags"; then
187   reversed_flags=
188   for opt in $flags; do
189     reversed_flags="$opt $reversed_flags"
190   done
191   unique_flags=
192   for opt in $reversed_flags; do
193     unique=1;       
194     for opt2 in $unique_flags; do
195       if test $opt = $opt2; then
196         unique=0
197       fi
198     done
199     if test $unique -eq 1; then
200       unique_flags="$opt $unique_flags"
201     fi
202   done
203   @ECHO@ $unique_flags
204fi
205
206exit 0
Note: See TracBrowser for help on using the repository browser.