have_cstdint.m4 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # ===========================================================================
  2. # http://tangent.org/
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CXX_CSTDINT()
  8. #
  9. # DESCRIPTION
  10. #
  11. # Example:
  12. #
  13. # LICENSE
  14. #
  15. # Copyright (c) 2012 Brian Aker` <brian@tangent.org>
  16. #
  17. # This program is free software: you can redistribute it and/or modify it
  18. # under the terms of the GNU General Public License as published by the
  19. # Free Software Foundation, either version 3 of the License, or (at your
  20. # option) any later version.
  21. #
  22. # This program is distributed in the hope that it will be useful, but
  23. # WITHOUT ANY WARRANTY; without even the implied warranty of
  24. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  25. # Public License for more details.
  26. #
  27. # You should have received a copy of the GNU General Public License along
  28. # with this program. If not, see <http://www.gnu.org/licenses/>.
  29. #
  30. # As a special exception, the respective Autoconf Macro's copyright owner
  31. # gives unlimited permission to copy, distribute and modify the configure
  32. # scripts that are the output of Autoconf when processing the Macro. You
  33. # need not follow the terms of the GNU General Public License when using
  34. # or distributing such scripts, even though portions of the text of the
  35. # Macro appear in them. The GNU General Public License (GPL) does govern
  36. # all other use of the material that constitutes the Autoconf Macro.
  37. #
  38. # This special exception to the GPL applies to versions of the Autoconf
  39. # Macro released by the Autoconf Archive. When you make and distribute a
  40. # modified version of the Autoconf Macro, you may extend this special
  41. # exception to the GPL to apply to your modified version as well.
  42. #serial 3
  43. AC_DEFUN([AX_CXX_CSTDINT], [
  44. AC_REQUIRE([AC_PROG_CXX])
  45. AC_REQUIRE([AC_PROG_CXXCPP])
  46. AC_CACHE_CHECK([for location of cstdint], [ac_cv_cxx_cstdint], [
  47. AC_LANG_PUSH([C++])
  48. AX_SAVE_FLAGS
  49. CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
  50. AC_COMPILE_IFELSE([
  51. AC_LANG_PROGRAM([#include <cstdint>], [
  52. uint32_t t
  53. ])],
  54. [ac_cxx_cstdint_cstdint="<cstdint>"])
  55. AS_IF([test -z "$ac_cxx_cstdint_cstdint"],[
  56. AC_COMPILE_IFELSE([
  57. AC_LANG_PROGRAM([#include <tr1/cstdint>], [ uint32_t t ])],
  58. [ac_cxx_cstdint_tr1_cstdint="<tr1/cstdint>"])
  59. AS_IF([test -z "$ac_cxx_cstdint_tr1_cstdint"],[
  60. AC_COMPILE_IFELSE([
  61. AC_LANG_PROGRAM([#include <boost/cstdint.hpp>], [ uint32_t t ])],
  62. [ac_cxx_cstdint_boost_cstdint_hpp="<boost/cstdint.hpp>"])
  63. ])
  64. ])
  65. AC_LANG_POP
  66. AX_RESTORE_FLAGS
  67. AS_IF([test -n "$ac_cxx_cstdint_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_cstdint],
  68. [test -n "$ac_cxx_cstdint_tr1_cstdint"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_tr1_cstdint],
  69. [test -n "$ac_cxx_cstdint_boost_cstdint_hpp"], [ac_cv_cxx_cstdint=$ac_cxx_cstdint_boost_cstdint_hpp])
  70. ])
  71. AS_IF([test -n "$ac_cv_cxx_cstdint"], [AC_MSG_RESULT([$ac_cv_cxx_cstdint])], [
  72. ac_cv_cxx_cstdint="<stdint.h>"
  73. AC_MSG_WARN([Could not find a cstdint header.])
  74. AC_MSG_RESULT([$ac_cv_cxx_cstdint])
  75. ])
  76. AC_DEFINE_UNQUOTED([CSTDINT_H],[$ac_cv_cxx_cstdint], [the location of <cstdint>])
  77. ])