2
0

ax_vcs_checkout.m4 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # ===========================================================================
  2. # http://
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_VCS_CHECKOUT
  8. #
  9. # DESCRIPTION
  10. #
  11. # Discover whether or not we are operating with a tree which
  12. # has been checked out of a version control system.
  13. #
  14. #
  15. # LICENSE
  16. #
  17. # Copyright (C) 2012 Brian Aker
  18. # All rights reserved.
  19. #
  20. # Redistribution and use in source and binary forms, with or without
  21. # modification, are permitted provided that the following conditions are
  22. # met:
  23. #
  24. # * Redistributions of source code must retain the above copyright
  25. # notice, this list of conditions and the following disclaimer.
  26. #
  27. # * Redistributions in binary form must reproduce the above
  28. # copyright notice, this list of conditions and the following disclaimer
  29. # in the documentation and/or other materials provided with the
  30. # distribution.
  31. #
  32. # * The names of its contributors may not be used to endorse or
  33. # promote products derived from this software without specific prior
  34. # written permission.
  35. #
  36. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  37. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  38. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  39. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  40. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  43. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  44. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  45. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  46. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  47. #serial 6.1
  48. #
  49. # Added tweak for git. The base repo's .git is a directory. Any worktree's
  50. # .git is a file. Use -e to check for either dir or file.
  51. AC_DEFUN([AX_VCS_SYSTEM],
  52. [AC_PREREQ([2.63])dnl
  53. AC_CACHE_CHECK([for vcs system], [ac_cv_vcs_system],
  54. [ac_cv_vcs_system="none"
  55. AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"])
  56. AS_IF([test -d ".svn"],[ac_cv_vcs_system="svn"])
  57. AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"])
  58. AS_IF([test -e ".git"],[ac_cv_vcs_system="git"])
  59. ])
  60. AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system])
  61. ])
  62. AC_DEFUN([AX_VCS_CHECKOUT],
  63. [AC_PREREQ([2.63])dnl
  64. AC_REQUIRE([AX_VCS_SYSTEM])
  65. AC_CACHE_CHECK([for vcs checkout],[ac_cv_vcs_checkout],
  66. [AS_IF([test "x$ac_cv_vcs_system" != "xnone"],
  67. [ac_cv_vcs_checkout=yes],
  68. [ac_cv_vcs_checkout=no])
  69. ])
  70. AM_CONDITIONAL([IS_VCS_CHECKOUT],[test "x$ac_cv_vcs_checkout" = "xyes"])
  71. AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],
  72. [AC_DEFINE([VCS_CHECKOUT],[1],[Define if the code was built from VCS.])],
  73. [AC_DEFINE([VCS_CHECKOUT],[0],[Define if the code was built from VCS.])])
  74. ])