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

Last change on this file since 1685 was 1685, checked in by Peter, 14 years ago

remove string: 'generated by make...' from yat-config.in and let make include the string into yat-config. REmoved some make verbosity.

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