shave.m4 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. dnl Make automake/libtool output more friendly to humans
  2. dnl
  3. dnl SHAVE_INIT([shavedir])
  4. dnl
  5. dnl shavedir: the directory where the shave scripts are, it defaults to
  6. dnl $(top_builddir)
  7. dnl
  8. dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
  9. dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and
  10. dnl LIBTOOL, you don't want the configure tests to have these variables
  11. dnl re-defined.
  12. dnl * This macro requires GNU make's -s option.
  13. AC_DEFUN([SHAVE_INIT],
  14. [
  15. dnl enable/disable shave
  16. AC_ARG_ENABLE([shave],
  17. AS_HELP_STRING([--enable-shave],
  18. [use shave to make the build pretty [[default=no]]]),,
  19. [enable_shave=no])
  20. if test x"$enable_shave" = xyes; then
  21. dnl where can we find the shave scripts?
  22. m4_if([$1],,
  23. [shavedir='$(top_builddir)'],
  24. [shavedir='$(top_builddir)'/$1])
  25. AC_SUBST(shavedir)
  26. dnl make is now quiet
  27. AC_SUBST([MAKEFLAGS], [-s])
  28. AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
  29. dnl we need sed
  30. AC_CHECK_PROG(SED,sed,sed,false)
  31. dnl substitute libtool
  32. SHAVE_SAVED_LIBTOOL=$LIBTOOL
  33. AC_SUBST(SHAVE_SAVED_LIBTOOL)
  34. LIBTOOL="\$(SHELL) \$(shavedir)/shave-libtool '\$(SHAVE_SAVED_LIBTOOL)'"
  35. AC_SUBST(LIBTOOL)
  36. dnl substitute cc/cxx
  37. SHAVE_SAVED_CC=$CC
  38. SHAVE_SAVED_CXX=$CXX
  39. AC_SUBST(SHAVE_SAVED_CC)
  40. AC_SUBST(SHAVE_SAVED_CXX)
  41. CC="\$(SHELL) \$(shavedir)/shave cc '\$(SHAVE_SAVED_CC)'"
  42. CXX="\$(SHELL) \$(shavedir)/shave cxx '\$(SHAVE_SAVED_CXX)'"
  43. AC_SUBST(CC)
  44. AC_SUBST(CXX)
  45. V=@
  46. else
  47. V=1
  48. fi
  49. Q='$(V:1=)'
  50. AC_SUBST(V)
  51. AC_SUBST(Q)
  52. ])