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

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

updating copyright statements

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