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

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

using @PACKAGE@ and adding line 'Report bugs to...' in yat-config

File size: 3.6 KB
Line 
1#! @SHELL@
2# @configure_input@
3
4# $Id$
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@"
40YAT_LIBNAME="@YAT_LIBNAME@"
41
42usage()
43{
44    cat <<EOF
45Usage: yat-config [OPTION]...
46
47Known values for OPTION are:
48  --prefix          print @PACKAGE@ installation prefix
49  --bindir          print location where binaries are installed
50  --includedir      print location where headers are installed
51  --cxx             print C++ compiler name
52  --cxxcpp          print C++ preprocessor name and any required options
53  --cppflags        print C++ preprocessor flags
54  --cxxflags        print C++ compiler flags
55  --ldflags         print linker flags
56  --libs            print additional libraries to link against
57  --link-ld         print link switch(es) for linking to @PACKAGE@
58  --version         print @PACKAGE@'s version
59  --version-major   print @PACKAGE@'s MAJOR version
60  --version-minor   print @PACKAGE@'s MINOR version
61  --version-patch   print @PACKAGE@'s PATCH version
62  --help            print this help
63
64Report bugs to <@PACKAGE_BUGREPORT@>.
65EOF
66
67    exit $1
68}
69
70
71if test $# -eq 0; then
72    usage
73    exit 1
74fi
75
76flags=""
77
78while test $# -gt 0; do
79    case "$1" in
80    --prefix)
81    @ECHO@ $prefix
82    exit 0
83    ;;
84    --bindir)
85    @ECHO@ $bindir
86    exit 0
87    ;;
88    --includedir)
89    @ECHO@ $includedir
90    exit 0
91    ;;
92    --cxx)
93    @ECHO@ $CXX
94    exit 0
95    ;;
96    --cxxcpp)
97    @ECHO@ $CXXCPP
98    exit 0
99    ;;
100    --cppflags)
101    flags="$flags -I$includedir $EXTRA_CPPFLAGS $CPPFLAGS"
102    ;;
103    --cxxflags)
104    flags="$flags $EXTRA_CXXFLAGS $CXXFLAGS"
105    ;;
106    --libs)
107    flags="$flags $LIBS"
108    ;;
109    --ldflags)
110    flags="$flags $EXTRA_LDFLAGS $LDFLAGS"
111    ;;
112    --link-ld)
113    flags="$flags -L$libdir -l${YAT_LIBNAME}"
114    ;;
115    --version)
116    @ECHO@ @VERSION@
117    exit 0
118    ;;
119    --version-major)
120    @ECHO@ @YAT_MAJOR_VERSION@
121    exit 0
122    ;;
123    --version-minor)
124    @ECHO@ @YAT_MINOR_VERSION@
125    exit 0
126    ;;
127    --version-patch)
128    @ECHO@ @YAT_PATCH_VERSION@
129    exit 0
130    ;;
131    --help)
132    usage
133    exit 0
134    ;;
135    *)
136    usage
137    exit 1
138    ;;
139    esac
140
141    # Next please.
142    shift
143done
144
145# only keep last of replicates
146if test -n "$flags"; then
147   reversed_flags=
148   for opt in $flags; do
149     reversed_flags="$opt $reversed_flags"
150   done
151   unique_flags=
152   for opt in $reversed_flags; do
153     unique=1;       
154     for opt2 in $unique_flags; do
155       if test $opt = $opt2; then
156         unique=0
157       fi
158     done
159     if test $unique -eq 1; then
160       unique_flags="$opt $unique_flags"
161     fi
162   done
163   @ECHO@ $unique_flags
164fi
165
166exit 0
Note: See TracBrowser for help on using the repository browser.