pandora_cstdint.m4 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (C) 2008 Sun Microsystems, Inc.
  2. # This file is free software; Sun Microsystems, Inc.
  3. # gives unlimited permission to copy and/or distribute it,
  4. # with or without modifications, as long as this notice is preserved.
  5. # We check two things: where the include file is for cstdint. We
  6. # include AC_TRY_COMPILE for all the combinations we've seen in the
  7. # wild. We define one of HAVE_CSTDINT or HAVE_TR1_CSTDINT or
  8. # HAVE_BOOST_CSTDINT depending
  9. # on location.
  10. AC_DEFUN([PANDORA_CXX_CSTDINT],
  11. [AC_MSG_CHECKING(the location of cstdint)
  12. AC_LANG_PUSH(C++)
  13. save_CXXFLAGS="${CXXFLAGS}"
  14. CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
  15. ac_cv_cxx_cstdint=""
  16. for location in tr1/cstdint boost/cstdint cstdint; do
  17. if test -z "$ac_cv_cxx_cstdint"; then
  18. AC_TRY_COMPILE([#include <$location>],
  19. [uint32_t t],
  20. [ac_cv_cxx_cstdint="<$location>";])
  21. fi
  22. done
  23. AC_LANG_POP()
  24. CXXFLAGS="${save_CXXFLAGS}"
  25. if test -n "$ac_cv_cxx_cstdint"; then
  26. AC_MSG_RESULT([$ac_cv_cxx_cstdint])
  27. else
  28. AC_DEFINE([__STDC_CONSTANT_MACROS],[1],[Use STDC Constant Macros in C++])
  29. AC_DEFINE([__STDC_FORMAT_MACROS],[1],[Use STDC Format Macros in C++])
  30. ac_cv_cxx_cstdint="<stdint.h>"
  31. AC_MSG_RESULT()
  32. AC_MSG_WARN([Could not find a cstdint header.])
  33. fi
  34. AC_DEFINE_UNQUOTED(CSTDINT_H,$ac_cv_cxx_cstdint,
  35. [the location of <cstdint>])
  36. ])