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

Last change on this file since 2960 was 2960, checked in by Peter, 10 years ago

merge patch release 0.10.1 into trunk

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