PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/build/m4/shave/shave.m4

http://github.com/hbons/SparkleShare
m4 | 102 lines | 93 code | 9 blank | 0 comment | 0 complexity | d9cb2ab2c81dce28976b7c2a9eb8d5ce MD5 | raw file
  1dnl Make automake/libtool output more friendly to humans
  2dnl
  3dnl Copyright (c) 2009, Damien Lespiau <damien.lespiau@gmail.com>
  4dnl
  5dnl Permission is hereby granted, free of charge, to any person
  6dnl obtaining a copy of this software and associated documentation
  7dnl files (the "Software"), to deal in the Software without
  8dnl restriction, including without limitation the rights to use,
  9dnl copy, modify, merge, publish, distribute, sublicense, and/or sell
 10dnl copies of the Software, and to permit persons to whom the
 11dnl Software is furnished to do so, subject to the following
 12dnl conditions:
 13dnl
 14dnl The above copyright notice and this permission notice shall be
 15dnl included in all copies or substantial portions of the Software.
 16dnl
 17dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 18dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 19dnl OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 20dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 21dnl HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 22dnl WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 23dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 24dnl OTHER DEALINGS IN THE SOFTWARE.
 25dnl
 26dnl SHAVE_INIT([shavedir],[default_mode])
 27dnl
 28dnl shavedir: the directory where the shave scripts are, it defaults to
 29dnl           $(top_builddir)
 30dnl default_mode: (enable|disable) default shave mode.  This parameter
 31dnl               controls shave's behaviour when no option has been
 32dnl               given to configure.  It defaults to disable.
 33dnl
 34dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
 35dnl   before AC_CONFIG_FILE/AC_OUTPUT is perfect.  This macro rewrites CC and
 36dnl   LIBTOOL, you don't want the configure tests to have these variables
 37dnl   re-defined.
 38dnl * This macro requires GNU make's -s option.
 39
 40AC_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
 50AC_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_CC=$CC
 76    SHAVE_SAVED_CXX=$CXX
 77    SHAVE_SAVED_FC=$FC
 78    SHAVE_SAVED_F77=$F77
 79    SHAVE_SAVED_OBJC=$OBJC
 80    SHAVE_SAVED_MCS=$MCS
 81    CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
 82    CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
 83    FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
 84    F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
 85    OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}"
 86    MCS="${SHELL} ${shavedir}/shave mcs ${SHAVE_SAVED_MCS}"
 87    AC_SUBST(CC)
 88    AC_SUBST(CXX)
 89    AC_SUBST(FC)
 90    AC_SUBST(F77)
 91    AC_SUBST(OBJC)
 92    AC_SUBST(MCS)
 93
 94    V=@
 95  else
 96    V=1
 97  fi
 98  Q='$(V:1=)'
 99  AC_SUBST(V)
100  AC_SUBST(Q)
101])
102