source: branches/0.13-stable/build_support/yat-config.in @ 3418

Last change on this file since 3418 was 3382, checked in by Peter, 7 years ago

add link to yat home page in 'yat-config --help' output

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