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

Last change on this file since 2842 was 2842, checked in by Peter, 11 years ago

remove todo doxygen tags

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.7 KB
Line 
1# $Id: yat-config.in 2842 2012-09-17 04:52:20Z peter $
2
3# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
4# Copyright (C) 2009, 2010, 2011, 2012 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/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
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       # 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       flags="$flags -I$abs_top_srcdir"
137    fi
138    flags="$flags $YAT_CPPFLAGS $CPPFLAGS"
139    ;;
140    --cxxflags)
141    flags="$flags $YAT_CXXFLAGS $CXXFLAGS"
142    ;;
143    --libs)
144    flags="$flags -lyat $YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM $LIBS"
145    ;;
146    --libs-without-cblas)
147    flags="$flags -lyat $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    echo "yat-config: unrecognized option '$1'" >&2
220    echo "Try \`yat-config --help' for more information." >&2
221    exit 1
222    ;;
223    esac
224
225    # Next please.
226    shift
227done
228
229# only keep last of replicates
230if test -n "$flags"; then
231   reversed_flags=
232   for opt in $flags; do
233     reversed_flags="$opt $reversed_flags"
234   done
235   unique_flags=
236   for opt in $reversed_flags; do
237     unique=1;
238     for opt2 in $unique_flags; do
239       if test $opt = $opt2; then
240         unique=0
241       fi
242     done
243     if test $unique -eq 1; then
244       unique_flags="$opt $unique_flags"
245     fi
246   done
247   echo $unique_flags
248fi
249
250exit 0
Note: See TracBrowser for help on using the repository browser.