source: branches/0.6-stable/build_support/yat-config.in @ 2271

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

backporting r2266 to stable branch. Use echo instead of variable ECHO provided by libtool because it's broken with 2.2.8

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.7 KB
Line 
1# $Id: yat-config.in 2271 2010-06-14 04:57:06Z peter $
2
3# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
4# Copyright (C) 2009, 2010 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  --yat-la-file               print the path to the .la file
72  --atleast-version=VERSION   return 0 if @PACKAGE@ is at least version VERSION
73  --version                   print @PACKAGE@'s version
74  --version-major             print @PACKAGE@'s MAJOR version
75  --version-minor             print @PACKAGE@'s MINOR version
76  --version-patch             print @PACKAGE@'s PATCH version
77  --help                      print this help
78
79Report bugs to <@PACKAGE_BUGREPORT@>.
80EOF
81
82    exit $1
83}
84
85
86if test $# -eq 0; then
87    usage 1
88fi
89
90flags=""
91
92while test $# -gt 0; do
93    case "$1" in
94    --prefix)
95    echo $prefix
96    exit 0
97    ;;
98    --bindir)
99    echo $bindir
100    exit 0
101    ;;
102    --includedir)
103    echo $includedir
104    exit 0
105    ;;
106    --libdir)
107    echo $libdir
108    exit 0
109    ;;
110    --cxx)
111    echo $CXX
112    exit 0
113    ;;
114    --cxxcpp)
115    echo $CXXCPP
116    exit 0
117    ;;
118    --cppflags)
119    if test $installed = yes; then
120       if test "x$includedir" = "x/usr/include"; then
121         : # ignore standard include
122       elif (test "$CXX" = "g++" &&
123             test "x$includedir" = "x/usr/local/include"); then
124         : # ignore /usr/local/include if we use g++
125       else
126         flags="$flags -I$includedir"
127       fi
128    else
129       flags="$flags -I$abs_top_srcdir"
130       # For VPATH build we need to add path to some generated files
131       # The second part is to allow header files in `yat/utility' to
132       # include generated files simply as "generated.h".
133       if test "x$abs_top_builddir" != "x$abs_top_srcdir"; then
134          flags="$flags -I$abs_top_builddir"
135          flags="$flags -I$abs_top_builddir/yat/utility"
136       fi
137    fi
138    flags="$flags $YAT_CPPFLAGS $CPPFLAGS"
139    ;;
140    --cxxflags)
141    flags="$flags $YAT_CXXFLAGS $CXXFLAGS"
142    ;;
143    --libs)
144    flags="$flags -l@YAT_LIBNAME@ $YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM $LIBS"
145    ;;
146    --libs-without-cblas)
147    flags="$flags -l@YAT_LIBNAME@ $YAT_PRIMARY_LIBS $LIBM $LIBS"
148    ;;
149    --ldflags)
150    if test "x$libdir" = "x/usr/lib"; then
151      : # ignore standard '/usr/lib'
152    elif (test "$CXX" = "g++" &&
153          test "x$libdir" = "x/usr/local/lib"); then
154      : # ignore '/usr/local/lib' if we use g++
155    else
156      flags="$flags -L$libdir"
157    fi
158    flags="$flags $YAT_LDFLAGS $LDFLAGS"
159    ;;
160    --link-libtool)
161    flags="$flags $LA_FILE $YAT_CBLAS_LIB"
162    ;;
163    --yat-la-file)
164    flags="$flags $LA_FILE"
165    ;;
166    --atleast-version=*)
167      optarg=`echo "$1" | sed 's/--atleast-version=//'`
168      min_major=`echo "$optarg" | sed 's/\([0-9]*\).*/\1/'`
169      if test "$optarg" = "$min_major"; then
170         min_minor="0";
171      else
172         min_minor=`echo "$optarg" | sed 's/[0-9]*.\([0-9]*\).*/\1/'`
173      fi
174      if test "$optarg" = "$min_major.$min_minor"; then
175         min_patch="0";
176      else
177         min_patch=`echo "$optarg" | sed 's/[0-9]*.[0-9]*.\([0-9]*\).*/\1/'`
178      fi
179      if test "$optarg" = "$min_patch"; then
180        echo "yat-config: \`$optarg' is not a valid VERSION"
181        exit 255
182      fi
183      if !(test -n "$min_major" && test -n "$min_minor" \
184           && test -n "$min_patch"); then
185        echo "yat-config: \`$optarg' is not a valid VERSION"
186        exit 255
187      fi
188      if ( test $min_major -gt @YAT_MAJOR_VERSION@ || \
189           ( test $min_major -eq @YAT_MAJOR_VERSION@ && \
190             ( test $min_minor -gt @YAT_MINOR_VERSION@ || \
191         ( test $min_minor -eq @YAT_MINOR_VERSION@ && \
192                 ( test $min_patch -gt @YAT_PATCH_VERSION@ ||
193                   (test $min_patch -eq @YAT_PATCH_VERSION@ &&
194                    test "@YAT_DEV_BUILD@" = "true" )))))) ; then
195   exit 1;
196      fi
197      exit 0
198    ;;
199    --version)
200    echo @VERSION@
201    exit 0
202    ;;
203    --version-major)
204    echo @YAT_MAJOR_VERSION@
205    exit 0
206    ;;
207    --version-minor)
208    echo @YAT_MINOR_VERSION@
209    exit 0
210    ;;
211    --version-patch)
212    echo @YAT_PATCH_VERSION@
213    exit 0
214    ;;
215    --help)
216    usage 0
217    ;;
218    *)
219    usage 1
220    ;;
221    esac
222
223    # Next please.
224    shift
225done
226
227# only keep last of replicates
228if test -n "$flags"; then
229   reversed_flags=
230   for opt in $flags; do
231     reversed_flags="$opt $reversed_flags"
232   done
233   unique_flags=
234   for opt in $reversed_flags; do
235     unique=1;       
236     for opt2 in $unique_flags; do
237       if test $opt = $opt2; then
238         unique=0
239       fi
240     done
241     if test $unique -eq 1; then
242       unique_flags="$opt $unique_flags"
243     fi
244   done
245   echo $unique_flags
246fi
247
248exit 0
Note: See TracBrowser for help on using the repository browser.