]> code.delx.au - pulseaudio/blob - m4/shave.m4
run make update-shave
[pulseaudio] / m4 / shave.m4
1 dnl Make automake/libtool output more friendly to humans
2 dnl
3 dnl SHAVE_INIT([shavedir],[default_mode])
4 dnl
5 dnl shavedir: the directory where the shave scripts are, it defaults to
6 dnl $(top_builddir)
7 dnl default_mode: (enable|disable) default shave mode. This parameter
8 dnl controls shave's behaviour when no option has been
9 dnl given to configure. It defaults to disable.
10 dnl
11 dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
12 dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and
13 dnl LIBTOOL, you don't want the configure tests to have these variables
14 dnl re-defined.
15 dnl * This macro requires GNU make's -s option.
16
17 AC_DEFUN([_SHAVE_ARG_ENABLE],
18 [
19 AC_ARG_ENABLE([shave],
20 AS_HELP_STRING(
21 [--enable-shave],
22 [use shave to make the build pretty [[default=$1]]]),,
23 [enable_shave=$1]
24 )
25 ])
26
27 AC_DEFUN([SHAVE_INIT],
28 [
29 dnl you can tweak the default value of enable_shave
30 m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)])
31
32 if test x"$enable_shave" = xyes; then
33 dnl where can we find the shave scripts?
34 m4_if([$1],,
35 [shavedir="$ac_pwd"],
36 [shavedir="$ac_pwd/$1"])
37 AC_SUBST(shavedir)
38
39 dnl make is now quiet
40 AC_SUBST([MAKEFLAGS], [-s])
41 AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
42
43 dnl we need sed
44 AC_CHECK_PROG(SED,sed,sed,false)
45
46 dnl substitute libtool
47 SHAVE_SAVED_LIBTOOL=$LIBTOOL
48 LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'"
49 AC_SUBST(LIBTOOL)
50
51 dnl substitute cc/cxx
52 SHAVE_SAVED_CC=$CC
53 SHAVE_SAVED_CXX=$CXX
54 SHAVE_SAVED_FC=$FC
55 SHAVE_SAVED_F77=$F77
56 CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
57 CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
58 FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
59 F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
60 AC_SUBST(CC)
61 AC_SUBST(CXX)
62 AC_SUBST(FC)
63 AC_SUBST(F77)
64
65 V=@
66 else
67 V=1
68 fi
69 Q='$(V:1=)'
70 AC_SUBST(V)
71 AC_SUBST(Q)
72 ])
73