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

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

adding --link-libtool option in yat-config

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1#! @SHELL@
2# @configure_input@
3
4# $Id: yat-config.in 1370 2008-07-14 14:35:12Z 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@"
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  --link-libtool    print the libtool inputs for linking to @PACKAGE@
59  --version         print @PACKAGE@'s version
60  --version-major   print @PACKAGE@'s MAJOR version
61  --version-minor   print @PACKAGE@'s MINOR version
62  --version-patch   print @PACKAGE@'s PATCH version
63  --help            print this help
64
65Report bugs to <@PACKAGE_BUGREPORT@>.
66EOF
67
68    exit $1
69}
70
71
72if test $# -eq 0; then
73    usage
74    exit 1
75fi
76
77flags=""
78
79while test $# -gt 0; do
80    case "$1" in
81    --prefix)
82    @ECHO@ $prefix
83    exit 0
84    ;;
85    --bindir)
86    @ECHO@ $bindir
87    exit 0
88    ;;
89    --includedir)
90    @ECHO@ $includedir
91    exit 0
92    ;;
93    --cxx)
94    @ECHO@ $CXX
95    exit 0
96    ;;
97    --cxxcpp)
98    @ECHO@ $CXXCPP
99    exit 0
100    ;;
101    --cppflags)
102    flags="$flags -I$includedir $EXTRA_CPPFLAGS $CPPFLAGS"
103    ;;
104    --cxxflags)
105    flags="$flags $EXTRA_CXXFLAGS $CXXFLAGS"
106    ;;
107    --libs)
108    flags="$flags $LIBS"
109    ;;
110    --ldflags)
111    flags="$flags $EXTRA_LDFLAGS $LDFLAGS"
112    ;;
113    --link-ld)
114    flags="$flags -L$libdir -l${YAT_LIBNAME}"
115    ;;
116    --link-libtool)
117    flags="$flags $libdir/@YAT_LIB@"
118    ;;
119    --version)
120    @ECHO@ @VERSION@
121    exit 0
122    ;;
123    --version-major)
124    @ECHO@ @YAT_MAJOR_VERSION@
125    exit 0
126    ;;
127    --version-minor)
128    @ECHO@ @YAT_MINOR_VERSION@
129    exit 0
130    ;;
131    --version-patch)
132    @ECHO@ @YAT_PATCH_VERSION@
133    exit 0
134    ;;
135    --help)
136    usage
137    exit 0
138    ;;
139    *)
140    usage
141    exit 1
142    ;;
143    esac
144
145    # Next please.
146    shift
147done
148
149# only keep last of replicates
150if test -n "$flags"; then
151   reversed_flags=
152   for opt in $flags; do
153     reversed_flags="$opt $reversed_flags"
154   done
155   unique_flags=
156   for opt in $reversed_flags; do
157     unique=1;       
158     for opt2 in $unique_flags; do
159       if test $opt = $opt2; then
160         unique=0
161       fi
162     done
163     if test $unique -eq 1; then
164       unique_flags="$opt $unique_flags"
165     fi
166   done
167   @ECHO@ $unique_flags
168fi
169
170exit 0
Note: See TracBrowser for help on using the repository browser.