/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

  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. AC_DEFUN([_SHAVE_ARG_ENABLE],
  40. [
  41. AC_ARG_ENABLE([shave],
  42. AS_HELP_STRING(
  43. [--enable-shave],
  44. [use shave to make the build pretty [[default=$1]]]),,
  45. [enable_shave=$1]
  46. )
  47. ])
  48. AC_DEFUN([SHAVE_INIT],
  49. [
  50. dnl you can tweak the default value of enable_shave
  51. m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)])
  52. if test x"$enable_shave" = xyes; then
  53. dnl where can we find the shave scripts?
  54. m4_if([$1],,
  55. [shavedir="$ac_pwd"],
  56. [shavedir="$ac_pwd/$1"])
  57. AC_SUBST(shavedir)
  58. dnl make is now quiet
  59. AC_SUBST([MAKEFLAGS], [-s])
  60. AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
  61. dnl we need sed
  62. AC_CHECK_PROG(SED,sed,sed,false)
  63. dnl substitute libtool
  64. SHAVE_SAVED_LIBTOOL=$LIBTOOL
  65. LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'"
  66. AC_SUBST(LIBTOOL)
  67. dnl substitute cc/cxx
  68. SHAVE_SAVED_CC=$CC
  69. SHAVE_SAVED_CXX=$CXX
  70. SHAVE_SAVED_FC=$FC
  71. SHAVE_SAVED_F77=$F77
  72. SHAVE_SAVED_OBJC=$OBJC
  73. SHAVE_SAVED_MCS=$MCS
  74. CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
  75. CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
  76. FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
  77. F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
  78. OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}"
  79. MCS="${SHELL} ${shavedir}/shave mcs ${SHAVE_SAVED_MCS}"
  80. AC_SUBST(CC)
  81. AC_SUBST(CXX)
  82. AC_SUBST(FC)
  83. AC_SUBST(F77)
  84. AC_SUBST(OBJC)
  85. AC_SUBST(MCS)
  86. V=@
  87. else
  88. V=1
  89. fi
  90. Q='$(V:1=)'
  91. AC_SUBST(V)
  92. AC_SUBST(Q)
  93. ])