PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/libs/m4/shell.m4.in

#
Autoconf | 63 lines | 58 code | 5 blank | 0 comment | 1 complexity | 2a858c2c394e5146a6c9f2fd151b28dc MD5 | raw file
Possible License(s): GPL-2.0
  1. m4_dnl
  2. m4_dnl Copyright (C) 2008, 2009 Francesco Salvestrini
  3. m4_dnl
  4. m4_dnl This program is free software; you can redistribute it and/or modify
  5. m4_dnl it under the terms of the GNU General Public License as published by
  6. m4_dnl the Free Software Foundation; either version 2 of the License, or
  7. m4_dnl (at your option) any later version.
  8. m4_dnl
  9. m4_dnl This program is distributed in the hope that it will be useful,
  10. m4_dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. m4_dnl GNU General Public License for more details.
  13. m4_dnl
  14. m4_dnl You should have received a copy of the GNU General Public License along
  15. m4_dnl with this program; if not, write to the Free Software Foundation, Inc.,
  16. m4_dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. m4_dnl
  18. m4_dnl
  19. m4_dnl CT_EXIT(EXIT-VALUE)
  20. m4_dnl
  21. m4_define([CT_EXIT],[m4_dnl
  22. exit $1
  23. ])
  24. m4_define([_CT_IF],[
  25. m4_ifval([$2$3],[
  26. elif $1 ; then
  27. m4_default([$2], [:])
  28. m4_ifval([$3], [$0(m4_shiftn(2, $@))])
  29. ],[
  30. m4_ifval([$1],[
  31. else
  32. $1
  33. ])
  34. ])
  35. ])
  36. m4_define([CT_IF],[
  37. m4_ifval([$2$3],[
  38. if $1; then
  39. m4_default([$2], [:])
  40. m4_ifval([$3], [_$0(m4_shiftn(2, $@))])
  41. fi
  42. ])
  43. ])
  44. m4_define([_CT_CASE],[
  45. m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
  46. [$#], 1, [ *) $1 ;;],
  47. [$#], 2, [ $1) m4_default([$2], [:]) ;;],
  48. [ $1) m4_default([$2], [:]) ;;
  49. $0(m4_shiftn(2, $@))
  50. ])
  51. ])
  52. m4_define([CT_CASE],[
  53. m4_ifval([$2$3],[
  54. case $1 in
  55. _CT_CASE(m4_shift($@))
  56. esac
  57. ])
  58. ])