| 1 |
dnl Make automake/libtool output more friendly to humans |
|---|
| 2 |
dnl |
|---|
| 3 |
dnl Copyright (c) 2009, Damien Lespiau <damien.lespiau@gmail.com> |
|---|
| 4 |
dnl |
|---|
| 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 |
|---|
| 12 |
dnl conditions: |
|---|
| 13 |
dnl |
|---|
| 14 |
dnl The above copyright notice and this permission notice shall be |
|---|
| 15 |
dnl included in all copies or substantial portions of the Software. |
|---|
| 16 |
dnl |
|---|
| 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. |
|---|
| 25 |
dnl |
|---|
| 26 |
dnl SHAVE_INIT([shavedir],[default_mode]) |
|---|
| 27 |
dnl |
|---|
| 28 |
dnl shavedir: the directory where the shave scripts are, it defaults to |
|---|
| 29 |
dnl $(top_builddir) |
|---|
| 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. |
|---|
| 33 |
dnl |
|---|
| 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 |
|---|
| 37 |
dnl re-defined. |
|---|
| 38 |
dnl * This macro requires GNU make's -s option. |
|---|
| 39 |
|
|---|
| 40 |
AC_DEFUN([_SHAVE_ARG_ENABLE], |
|---|
| 41 |
[ |
|---|
| 42 |
AC_ARG_ENABLE([shave], |
|---|
| 43 |
AS_HELP_STRING( |
|---|
| 44 |
[--enable-shave], |
|---|
| 45 |
[use shave to make the build pretty [[default=$1]]]),, |
|---|
| 46 |
[enable_shave=$1] |
|---|
| 47 |
) |
|---|
| 48 |
]) |
|---|
| 49 |
|
|---|
| 50 |
AC_DEFUN([SHAVE_INIT], |
|---|
| 51 |
[ |
|---|
| 52 |
dnl you can tweak the default value of enable_shave |
|---|
| 53 |
m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)]) |
|---|
| 54 |
|
|---|
| 55 |
if test x"$enable_shave" = xyes; then |
|---|
| 56 |
dnl where can we find the shave scripts? |
|---|
| 57 |
m4_if([$1],, |
|---|
| 58 |
[shavedir="$ac_pwd"], |
|---|
| 59 |
[shavedir="$ac_pwd/$1"]) |
|---|
| 60 |
AC_SUBST(shavedir) |
|---|
| 61 |
|
|---|
| 62 |
dnl make is now quiet |
|---|
| 63 |
AC_SUBST([MAKEFLAGS], [-s]) |
|---|
| 64 |
AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`']) |
|---|
| 65 |
|
|---|
| 66 |
dnl we need sed |
|---|
| 67 |
AC_CHECK_PROG(SED,sed,sed,false) |
|---|
| 68 |
|
|---|
| 69 |
dnl substitute libtool |
|---|
| 70 |
SHAVE_SAVED_LIBTOOL=$LIBTOOL |
|---|
| 71 |
LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'" |
|---|
| 72 |
AC_SUBST(LIBTOOL) |
|---|
| 73 |
|
|---|
| 74 |
dnl substitute cc/cxx |
|---|
| 75 |
SHAVE_SAVED_CCAS=$CCAS |
|---|
| 76 |
SHAVE_SAVED_CC=$CC |
|---|
| 77 |
SHAVE_SAVED_CXX=$CXX |
|---|
| 78 |
SHAVE_SAVED_FC=$FC |
|---|
| 79 |
SHAVE_SAVED_F77=$F77 |
|---|
| 80 |
SHAVE_SAVED_OBJC=$OBJC |
|---|
| 81 |
SHAVE_SAVED_MCS=$MCS |
|---|
| 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}" |
|---|
| 89 |
AC_SUBST(CCAS) |
|---|
| 90 |
AC_SUBST(CC) |
|---|
| 91 |
AC_SUBST(CXX) |
|---|
| 92 |
AC_SUBST(FC) |
|---|
| 93 |
AC_SUBST(F77) |
|---|
| 94 |
AC_SUBST(OBJC) |
|---|
| 95 |
AC_SUBST(MCS) |
|---|
| 96 |
|
|---|
| 97 |
V=@ |
|---|
| 98 |
else |
|---|
| 99 |
V=1 |
|---|
| 100 |
fi |
|---|
| 101 |
Q='$(V:1=)' |
|---|
| 102 |
AC_SUBST(V) |
|---|
| 103 |
AC_SUBST(Q) |
|---|
| 104 |
]) |
|---|
| 105 |
|
|---|