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

Last change on this file since 1408 was 1408, checked in by Peter, 15 years ago

just to consistent

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.9 KB
Line 
1#! @SHELL@
2# @configure_input@
3
4# $Id: yat-config.in 1408 2008-08-13 17:59:30Z peter $
5
6# Copyright (C) 2008 Peter Johansson
7#
8# This file is part of the yat library, http://trac.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    --cxx)
96    @ECHO@ $CXX
97    exit 0
98    ;;
99    --cxxcpp)
100    @ECHO@ $CXXCPP
101    exit 0
102    ;;
103    --cppflags)
104    flags="$flags -I$includedir $EXTRA_CPPFLAGS $CPPFLAGS"
105    ;;
106    --cxxflags)
107    flags="$flags $EXTRA_CXXFLAGS $CXXFLAGS"
108    ;;
109    --libs)
110    flags="$flags -l@YAT_LIBNAME@ $LIBS"
111    ;;
112    --ldflags)
113    flags="$flags -L$libdir $EXTRA_LDFLAGS $LDFLAGS"
114    ;;
115    --link-libtool)
116    flags="$flags $LA_FILE"
117    ;;
118    --atleast-version=*)
119      min_major=`@ECHO@ "$optarg" | sed 's/\([0-9]*\).*/\1/'`
120      if test "$optarg" = "$min_major"; then
121         min_minor="0";
122      else
123         min_minor=`@ECHO@ "$optarg" | sed 's/[0-9]*.\([0-9]*\).*/\1/'`
124      fi
125      if test "$optarg" = "$min_major.$min_minor"; then
126         min_patch="0";
127      else
128         min_patch=`@ECHO@ "$optarg" | sed 's/[0-9]*.[0-9]*.\([0-9]*\).*/\1/'`
129      fi
130      if test "$optarg" = "$min_patch"; then
131        exit 255
132      fi
133      if !(test -n "$min_major" && test -n "$min_minor" \
134           && test -n "$min_patch"); then
135        exit 255
136      fi
137      if ( test $min_major -gt @YAT_MAJOR_VERSION@ || \
138           ( test $min_major -eq @YAT_MAJOR_VERSION@ && \
139             ( test $min_minor -gt @YAT_MINOR_VERSION@ || \
140         ( test $min_minor -eq @YAT_MINOR_VERSION@ && \
141                 ( test $min_patch -gt @YAT_PATCH_VERSION@ ||
142                   (test $min_patch -eq @YAT_PATCH_VERSION@ &&
143                    test "@YAT_DEV_BUILD@" = "true" )))))) ; then
144   exit 1;
145      fi
146      exit 0
147    ;;
148    --version)
149    @ECHO@ @VERSION@
150    exit 0
151    ;;
152    --version-major)
153    @ECHO@ @YAT_MAJOR_VERSION@
154    exit 0
155    ;;
156    --version-minor)
157    @ECHO@ @YAT_MINOR_VERSION@
158    exit 0
159    ;;
160    --version-patch)
161    @ECHO@ @YAT_PATCH_VERSION@
162    exit 0
163    ;;
164    --help)
165    usage
166    exit 0
167    ;;
168    *)
169    usage
170    exit 1
171    ;;
172    esac
173
174    # Next please.
175    shift
176done
177
178# only keep last of replicates
179if test -n "$flags"; then
180   reversed_flags=
181   for opt in $flags; do
182     reversed_flags="$opt $reversed_flags"
183   done
184   unique_flags=
185   for opt in $reversed_flags; do
186     unique=1;       
187     for opt2 in $unique_flags; do
188       if test $opt = $opt2; then
189         unique=0
190       fi
191     done
192     if test $unique -eq 1; then
193       unique_flags="$opt $unique_flags"
194     fi
195   done
196   @ECHO@ $unique_flags
197fi
198
199exit 0
Note: See TracBrowser for help on using the repository browser.