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

Last change on this file since 1998 was 1998, checked in by Peter, 12 years ago

Merged patch release 0.5.4 to the trunk. Delta 0.5.4 - 0.5.3

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.6 KB
Line 
1# $Id: yat-config.in 1998 2009-06-13 00:34:19Z 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
27abs_top_builddir="@abs_top_builddir@"
28abs_top_srcdir="@abs_top_srcdir@"
29
30installed=no
31
32CXX="@CXX@"
33CXXCPP="@CXXCPP@"
34CPPFLAGS="@CPPFLAGS@"
35CXXFLAGS="@CXXFLAGS@"
36LDFLAGS="@LDFLAGS@"
37LIBS="@LIBS@"
38YAT_CPPFLAGS="@YAT_CPPFLAGS@"
39YAT_CXXFLAGS="@YAT_CXXFLAGS@"
40YAT_LDFLAGS="@YAT_LDFLAGS@"
41YAT_PRIMARY_LIBS="@YAT_PRIMARY_LIBS@"
42LIBM="@LIBM@"
43
44if test "x$YAT_CBLAS_LIB" = "x"; then
45  YAT_CBLAS_LIB="@YAT_CBLAS_LIB@"
46fi
47
48LA_FILE="$libdir/lib@YAT_LIBNAME@.la"
49if test x$installed = xno; then
50  LA_FILE="@abs_top_builddir@/yat/lib@YAT_LIBNAME@.la"
51fi
52
53usage()
54{
55    cat <<EOF
56Usage: yat-config [OPTION]...
57
58Known values for OPTION are:
59  --prefix                    print prefix
60  --bindir                    print location where binaries are installed
61  --includedir                print location where headers are installed
62  --libdir                    print location where @PACKAGE@ library is installed
63  --cxx                       print C++ compiler name
64  --cxxcpp                    print C++ preprocessor name and required options
65  --cppflags                  print C++ preprocessor flags
66  --cxxflags                  print C++ compiler flags
67  --ldflags                   print linker flags
68  --libs                      print libraries to link against
69  --libs-without-cblas        print libraries to link against except cblas
70  --link-libtool              print the libtool inputs for linking to @PACKAGE@
71  --atleast-version=VERSION   return 0 if @PACKAGE@ is at least version VERSION
72  --version                   print @PACKAGE@'s version
73  --version-major             print @PACKAGE@'s MAJOR version
74  --version-minor             print @PACKAGE@'s MINOR version
75  --version-patch             print @PACKAGE@'s PATCH version
76  --help                      print this help
77
78Report bugs to <@PACKAGE_BUGREPORT@>.
79EOF
80
81    exit $1
82}
83
84
85if test $# -eq 0; then
86    usage 1
87fi
88
89flags=""
90
91while test $# -gt 0; do
92    case "$1" in
93    --prefix)
94    @ECHO@ $prefix
95    exit 0
96    ;;
97    --bindir)
98    @ECHO@ $bindir
99    exit 0
100    ;;
101    --includedir)
102    @ECHO@ $includedir
103    exit 0
104    ;;
105    --libdir)
106    @ECHO@ $libdir
107    exit 0
108    ;;
109    --cxx)
110    @ECHO@ $CXX
111    exit 0
112    ;;
113    --cxxcpp)
114    @ECHO@ $CXXCPP
115    exit 0
116    ;;
117    --cppflags)
118    if test $installed = yes; then
119       if test "x$includedir" = "x/usr/include"; then
120         : # ignore standard include
121       elif (test "$CXX"="g++" &&
122             test "x$includedir"="x/usr/local/include"); then
123         : # ignore /usr/local/include if we use g++
124       else
125         flags="$flags -I$includedir"
126       fi
127    else
128       flags="$flags -I$abs_top_srcdir"
129       # For VPATH build we need to add path to some generated files
130       # The second part is to allow header files in `yat/utility' to
131       # include generated files simply as "generated.h".
132       if test "x$abs_top_builddir" != "x$abs_top_srcdir"; then
133          flags="$flags -I$abs_top_builddir"
134          flags="$flags -I$abs_top_builddir/yat/utility"
135       fi
136    fi
137    flags="$flags $YAT_CPPFLAGS $CPPFLAGS"
138    ;;
139    --cxxflags)
140    flags="$flags $YAT_CXXFLAGS $CXXFLAGS"
141    ;;
142    --libs)
143    flags="$flags -l@YAT_LIBNAME@ $YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM $LIBS"
144    ;;
145    --libs-without-cblas)
146    flags="$flags -l@YAT_LIBNAME@ $YAT_PRIMARY_LIBS $LIBM $LIBS"
147    ;;
148    --ldflags)
149    if test "x$libdir" = "x/usr/lib"; then
150      : # ignore standard '/usr/lib'
151    elif (test "$CXX"="g++" &&
152          test "x$libdir"="x/usr/local/lib"); then
153      : # ignore '/usr/local/lib' if we use g++
154    else
155      flags="$flags -L$libdir"
156    fi
157    flags="$flags $YAT_LDFLAGS $LDFLAGS"
158    ;;
159    --link-libtool)
160    flags="$flags $LA_FILE $YAT_CBLAS_LIB"
161    ;;
162    --atleast-version=*)
163      optarg=`@ECHO@ "$1" | sed 's/--atleast-version=//'`
164      min_major=`@ECHO@ "$optarg" | sed 's/\([0-9]*\).*/\1/'`
165      if test "$optarg" = "$min_major"; then
166         min_minor="0";
167      else
168         min_minor=`@ECHO@ "$optarg" | sed 's/[0-9]*.\([0-9]*\).*/\1/'`
169      fi
170      if test "$optarg" = "$min_major.$min_minor"; then
171         min_patch="0";
172      else
173         min_patch=`@ECHO@ "$optarg" | sed 's/[0-9]*.[0-9]*.\([0-9]*\).*/\1/'`
174      fi
175      if test "$optarg" = "$min_patch"; then
176        echo "yat-config: \`$optarg' is not a valid VERSION"
177        exit 255
178      fi
179      if !(test -n "$min_major" && test -n "$min_minor" \
180           && test -n "$min_patch"); then
181        echo "yat-config: \`$optarg' is not a valid VERSION"
182        exit 255
183      fi
184      if ( test $min_major -gt @YAT_MAJOR_VERSION@ || \
185           ( test $min_major -eq @YAT_MAJOR_VERSION@ && \
186             ( test $min_minor -gt @YAT_MINOR_VERSION@ || \
187         ( test $min_minor -eq @YAT_MINOR_VERSION@ && \
188                 ( test $min_patch -gt @YAT_PATCH_VERSION@ ||
189                   (test $min_patch -eq @YAT_PATCH_VERSION@ &&
190                    test "@YAT_DEV_BUILD@" = "true" )))))) ; then
191   exit 1;
192      fi
193      exit 0
194    ;;
195    --version)
196    @ECHO@ @VERSION@
197    exit 0
198    ;;
199    --version-major)
200    @ECHO@ @YAT_MAJOR_VERSION@
201    exit 0
202    ;;
203    --version-minor)
204    @ECHO@ @YAT_MINOR_VERSION@
205    exit 0
206    ;;
207    --version-patch)
208    @ECHO@ @YAT_PATCH_VERSION@
209    exit 0
210    ;;
211    --help)
212    usage 0
213    ;;
214    *)
215    usage 1
216    ;;
217    esac
218
219    # Next please.
220    shift
221done
222
223# only keep last of replicates
224if test -n "$flags"; then
225   reversed_flags=
226   for opt in $flags; do
227     reversed_flags="$opt $reversed_flags"
228   done
229   unique_flags=
230   for opt in $reversed_flags; do
231     unique=1;       
232     for opt2 in $unique_flags; do
233       if test $opt = $opt2; then
234         unique=0
235       fi
236     done
237     if test $unique -eq 1; then
238       unique_flags="$opt $unique_flags"
239     fi
240   done
241   @ECHO@ $unique_flags
242fi
243
244exit 0
Note: See TracBrowser for help on using the repository browser.