upload tizen1.0 source
[framework/multimedia/gstreamer0.10-ffmpeg.git] / common / 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=`pwd`],
36       [shavedir=`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     SHAVE_SAVED_OBJC=$OBJC
57     CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
58     CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
59     FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
60     F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
61     OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}"
62     AC_SUBST(CC)
63     AC_SUBST(CXX)
64     AC_SUBST(FC)
65     AC_SUBST(F77)
66     AC_SUBST(OBJC)
67
68     V=@
69   else
70     V=1
71   fi
72   Q='$(V:1=)'
73   AC_SUBST(V)
74   AC_SUBST(Q)
75 ])
76