1 dnl Make automake/libtool output more friendly to humans
3 dnl Copyright (c) 2009, Damien Lespiau <damien.lespiau@gmail.com>
5 dnl Permission is hereby granted, free of charge, to any person
6 dnl obtaining a copy of this software and associated documentation
7 dnl files (the "Software"), to deal in the Software without
8 dnl restriction, including without limitation the rights to use,
9 dnl copy, modify, merge, publish, distribute, sublicense, and/or sell
10 dnl copies of the Software, and to permit persons to whom the
11 dnl Software is furnished to do so, subject to the following
14 dnl The above copyright notice and this permission notice shall be
15 dnl included in all copies or substantial portions of the Software.
17 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 dnl OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 dnl HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 dnl WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 dnl OTHER DEALINGS IN THE SOFTWARE.
26 dnl SHAVE_INIT([shavedir],[default_mode])
28 dnl shavedir: the directory where the shave scripts are, it defaults to
30 dnl default_mode: (enable|disable) default shave mode. This parameter
31 dnl controls shave's behaviour when no option has been
32 dnl given to configure. It defaults to disable.
34 dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
35 dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and
36 dnl LIBTOOL, you don't want the configure tests to have these variables
38 dnl * This macro requires GNU make's -s option.
40 AC_DEFUN([_SHAVE_ARG_ENABLE],
42 AC_ARG_ENABLE([shave],
45 [use shave to make the build pretty [[default=$1]]]),,
50 AC_DEFUN([SHAVE_INIT],
52 dnl you can tweak the default value of enable_shave
53 m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)])
55 if test x"$enable_shave" = xyes; then
56 dnl where can we find the shave scripts?
59 [shavedir="$ac_pwd/$1"])
63 AC_SUBST([MAKEFLAGS], [-s])
64 AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
67 AC_CHECK_PROG(SED,sed,sed,false)
69 dnl substitute libtool
70 SHAVE_SAVED_LIBTOOL=$LIBTOOL
71 LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'"
75 SHAVE_SAVED_CCAS=$CCAS
80 SHAVE_SAVED_OBJC=$OBJC
82 CCAS="${SHELL} ${shavedir}/shave ccas ${SHAVE_SAVED_CCAS}"
83 CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
84 CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
85 FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
86 F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
87 OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}"
88 MCS="${SHELL} ${shavedir}/shave mcs ${SHAVE_SAVED_MCS}"