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

Last change on this file since 3715 was 3715, checked in by Peter, 5 years ago

Introduce variables 'YAT_CONFIG_CPPFLAGS', 'YAT_CONFIG_CXXFLAGS' and
'YAT_CONFIG_LDFLAGS' which are propagated to yat-config. These can be
used to tailor 'yat-config' return values as wanted without affecting
the actual build of the library.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1# $Id: yat-config.in 3715 2017-11-10 03:00:22Z peter $
2
3# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
4# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2015, 2016 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# let user override these four variables
45: ${YAT_CONFIG_CPPFLAGS="@YAT_CONFIG_CPPFLAGS@"}
46: ${YAT_CONFIG_CXXFLAGS="@YAT_CONFIG_CXXFLAGS@"}
47: ${YAT_CONFIG_LDFLAGS="@YAT_CONFIG_LDFLAGS@"}
48: ${YAT_CBLAS_LIB="@YAT_CBLAS_LIB@"}
49
50LA_FILE="$libdir/libyat.la"
51if test x$installed = xno; then
52  LA_FILE="@abs_top_builddir@/yat/libyat.la"
53fi
54
55usage()
56{
57    cat <<EOF
58Usage: yat-config [OPTION]...
59
60Known values for OPTION are:
61  --prefix                    print prefix
62  --bindir                    print location where binaries are installed
63  --includedir                print location where headers are installed
64  --libdir                    print location where @PACKAGE@ library is installed
65  --cxx                       print C++ compiler name
66  --cxxcpp                    print C++ preprocessor name and required options
67  --cppflags                  print C++ preprocessor flags
68  --cxxflags                  print C++ compiler flags
69  --ldflags                   print linker flags
70  --libs                      print libraries to link against
71  --libs-without-cblas        print libraries to link against except cblas
72  --link-libtool              print the libtool inputs for linking to @PACKAGE@
73  --yat-la-file               print the path to the .la file
74  --atleast-version=VERSION   return 0 if @PACKAGE@ is at least version VERSION
75  --version                   print @PACKAGE@'s version
76  --version-major             print @PACKAGE@'s MAJOR version
77  --version-minor             print @PACKAGE@'s MINOR version
78  --version-patch             print @PACKAGE@'s PATCH version
79  --help                      print this help and exit
80
81An alternative CBLAS library can be specified using the YAT_CBLAS_LIB
82environment variable. The CBLAS library detected during configuration
83is used by default (@YAT_CBLAS_LIB@).
84
85Report bugs to <@PACKAGE_BUGREPORT@>.
86yat home page: <@PACKAGE_URL@>
87EOF
88
89    exit $1
90}
91
92
93if test $# -eq 0; then
94    usage 1
95fi
96
97flags=""
98
99while test $# -gt 0; do
100    case "$1" in
101    --prefix)
102    echo $prefix
103    exit 0
104    ;;
105    --bindir)
106    echo $bindir
107    exit 0
108    ;;
109    --includedir)
110    echo $includedir
111    exit 0
112    ;;
113    --libdir)
114    echo $libdir
115    exit 0
116    ;;
117    --cxx)
118    echo $CXX
119    exit 0
120    ;;
121    --cxxcpp)
122    echo $CXXCPP
123    exit 0
124    ;;
125    --cppflags)
126    if test $installed = yes; then
127       if test "x$includedir" = "x/usr/include"; then
128         : # ignore standard include
129       elif (test "$CXX" = "g++" &&
130             test "x$includedir" = "x/usr/local/include"); then
131         : # ignore /usr/local/include if we use g++
132       else
133         flags="$flags -I$includedir"
134       fi
135    else
136       # For VPATH build we need to add path to some generated files
137       # The second part is to allow header files in `yat/utility' to
138       # include generated files simply as "generated.h".
139       if test "x$abs_top_builddir" != "x$abs_top_srcdir"; then
140          flags="$flags -I$abs_top_builddir"
141          flags="$flags -I$abs_top_builddir/yat/utility"
142       fi
143       flags="$flags -I$abs_top_srcdir"
144    fi
145    flags="$flags $YAT_CPPFLAGS $CPPFLAGS $YAT_CONFIG_CPPFLAGS"
146    ;;
147    --cxxflags)
148    flags="$flags $YAT_CXXFLAGS $CXXFLAGS $YAT_CONFIG_CXXFLAGS"
149    ;;
150    --libs)
151    flags="$flags -lyat $YAT_STATIC_LIBS $YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM $LIBS"
152    ;;
153    --libs-without-cblas)
154    flags="$flags -lyat $YAT_STATIC_LIBS $YAT_PRIMARY_LIBS $LIBM $LIBS"
155    ;;
156    --ldflags)
157    if test "x$libdir" = "x/usr/lib"; then
158      : # ignore standard '/usr/lib'
159    elif (test "$CXX" = "g++" &&
160          test "x$libdir" = "x/usr/local/lib"); then
161      : # ignore '/usr/local/lib' if we use g++
162    else
163      flags="$flags -L$libdir"
164    fi
165    flags="$flags $YAT_LDFLAGS $LDFLAGS $YAT_CONFIG_LDFLAGS"
166    ;;
167    --link-libtool)
168    flags="$flags $LA_FILE $YAT_STATIC_LIBS $YAT_CBLAS_LIB"
169    ;;
170    --yat-la-file)
171    flags="$flags $LA_FILE"
172    ;;
173    --atleast-version=*)
174      optarg=`echo "$1" | sed 's/--atleast-version=//'`
175      min_major=`echo "$optarg" | sed 's/\([0-9]*\).*/\1/'`
176      if test "$optarg" = "$min_major"; then
177         min_minor="0";
178      else
179         min_minor=`echo "$optarg" | sed 's/[0-9]*.\([0-9]*\).*/\1/'`
180      fi
181      if test "$optarg" = "$min_major.$min_minor"; then
182         min_patch="0";
183      else
184         min_patch=`echo "$optarg" | sed 's/[0-9]*.[0-9]*.\([0-9]*\).*/\1/'`
185      fi
186      if test "$optarg" = "$min_patch"; then
187        echo "yat-config: \`$optarg' is not a valid VERSION"
188        exit 255
189      fi
190      if !(test -n "$min_major" && test -n "$min_minor" \
191           && test -n "$min_patch"); then
192        echo "yat-config: \`$optarg' is not a valid VERSION"
193        exit 255
194      fi
195      if ( test $min_major -gt @YAT_MAJOR_VERSION@ || \
196           ( test $min_major -eq @YAT_MAJOR_VERSION@ && \
197             ( test $min_minor -gt @YAT_MINOR_VERSION@ || \
198               ( test $min_minor -eq @YAT_MINOR_VERSION@ && \
199                 ( test $min_patch -gt @YAT_PATCH_VERSION@ ||
200                   (test $min_patch -eq @YAT_PATCH_VERSION@ &&
201                    test "@YAT_DEV_BUILD@" = "true" )))))) ; then
202      exit 1;
203      fi
204      exit 0
205    ;;
206    --version)
207    echo @VERSION@
208    exit 0
209    ;;
210    --version-major)
211    echo @YAT_MAJOR_VERSION@
212    exit 0
213    ;;
214    --version-minor)
215    echo @YAT_MINOR_VERSION@
216    exit 0
217    ;;
218    --version-patch)
219    echo @YAT_PATCH_VERSION@
220    exit 0
221    ;;
222    --help)
223    usage 0
224    ;;
225    *)
226    echo "yat-config: unrecognized option '$1'" >&2
227    echo "Try \`yat-config --help' for more information." >&2
228    exit 1
229    ;;
230    esac
231
232    # Next please.
233    shift
234done
235
236echo $flags
237exit 0
Note: See TracBrowser for help on using the repository browser.