1 # vala.m4 serial 1 (vala @VERSION@)
2 dnl Autoconf scripts for the Vala compiler
3 dnl Copyright (C) 2007 Mathias Hasselmann
5 dnl This library is free software; you can redistribute it and/or
6 dnl modify it under the terms of the GNU Lesser General Public
7 dnl License as published by the Free Software Foundation; either
8 dnl version 2 of the License, or (at your option) any later version.
10 dnl This library is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 dnl Lesser General Public License for more details.
15 dnl You should have received a copy of the GNU Lesser General Public
16 dnl License along with this library; if not, write to the Free Software
17 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 dnl Mathias Hasselmann <mathias.hasselmann@gmx.de>
21 dnl --------------------------------------------------------------------------
23 dnl VALA_PROG_VALAC([MINIMUM-VERSION])
25 dnl Check whether the Vala compiler exists in `PATH'. If it is found the
26 dnl variable VALAC is set. Optionally a minimum release number of the compiler
28 dnl --------------------------------------------------------------------------
29 AC_DEFUN([VALA_PROG_VALAC],[
30 AC_PATH_PROG([VALAC], [valac], [])
33 if test -z "x${VALAC}"; then
34 AC_MSG_WARN([No Vala compiler found. You will not be able to recompile .vala source files.])
35 elif test -n "x$1"; then
36 AC_REQUIRE([AC_PROG_AWK])
37 AC_MSG_CHECKING([valac is at least version $1])
39 if "${VALAC}" --version | "${AWK}" -v r='$1' 'function vn(s) { if (3 == split(s,v,".")) return (v[1]*1000+v[2])*1000+v[3]; else exit 2; } /^Vala / { exit vn(r) > vn($[2]) }'; then
43 AC_MSG_ERROR([Vala $1 not found.])
49 dnl Make automake/libtool output more friendly to humans
51 dnl Copyright (c) 2009, Damien Lespiau <damien.lespiau@gmail.com>
53 dnl Permission is hereby granted, free of charge, to any person
54 dnl obtaining a copy of this software and associated documentation
55 dnl files (the "Software"), to deal in the Software without
56 dnl restriction, including without limitation the rights to use,
57 dnl copy, modify, merge, publish, distribute, sublicense, and/or sell
58 dnl copies of the Software, and to permit persons to whom the
59 dnl Software is furnished to do so, subject to the following
62 dnl The above copyright notice and this permission notice shall be
63 dnl included in all copies or substantial portions of the Software.
65 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
66 dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
67 dnl OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
68 dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
69 dnl HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
70 dnl WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
71 dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
72 dnl OTHER DEALINGS IN THE SOFTWARE.
74 dnl SHAVE_INIT([shavedir],[default_mode])
76 dnl shavedir: the directory where the shave scripts are, it defaults to
78 dnl default_mode: (enable|disable) default shave mode. This parameter
79 dnl controls shave's behaviour when no option has been
80 dnl given to configure. It defaults to disable.
82 dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
83 dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and
84 dnl LIBTOOL, you don't want the configure tests to have these variables
86 dnl * This macro requires GNU make's -s option.
88 AC_DEFUN([_SHAVE_ARG_ENABLE],
90 AC_ARG_ENABLE([shave],
93 [use shave to make the build pretty [[default=$1]]]),,
98 AC_DEFUN([SHAVE_INIT],
100 dnl you can tweak the default value of enable_shave
101 m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)])
103 if test x"$enable_shave" = xyes; then
104 dnl where can we find the shave scripts?
106 [shavedir="$ac_pwd"],
107 [shavedir="$ac_pwd/$1"])
110 dnl make is now quiet
111 AC_SUBST([MAKEFLAGS], [-s])
112 AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
115 AC_CHECK_PROG(SED,sed,sed,false)
117 dnl substitute libtool
118 SHAVE_SAVED_LIBTOOL=$LIBTOOL
119 LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'"
122 dnl substitute cc/cxx
127 SHAVE_SAVED_OBJC=$OBJC
128 CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
129 CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
130 FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
131 F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
132 OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}"