~drizzle-trunk/libdrizzle/jenkins-Libdrizzle-6

« back to all changes in this revision

Viewing changes to m4/have_cinttypes.m4

  • Committer: Andrew Hutchings
  • Date: 2012-12-17 12:03:43 UTC
  • mfrom: (44.1.1 libdrizzle)
  • Revision ID: andrew@linuxjedi.co.uk-20121217120343-tgde4ngz85yc6rsq
Merge in Brian's autoconf work

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ===========================================================================
 
2
#     http://tangent.org/
 
3
# ===========================================================================
 
4
#
 
5
# SYNOPSIS
 
6
#
 
7
#   AX_CXX_CINTTYPES()
 
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
 
 
43
#serial 2
 
44
 
 
45
AC_DEFUN([AX_CXX_CINTTYPES], [
 
46
    AC_REQUIRE([AC_PROG_CXX])
 
47
    AC_REQUIRE([AC_PROG_CXXCPP])
 
48
    AC_REQUIRE([AX_CXX_CSTDINT])
 
49
 
 
50
    AC_CACHE_CHECK([for location of cinttypes], [ac_cv_cxx_cinttypes], [
 
51
      AX_SAVE_FLAGS
 
52
      CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
 
53
      AC_LANG_PUSH([C++])
 
54
 
 
55
      AC_COMPILE_IFELSE([
 
56
        AC_LANG_PROGRAM([#include <cinttypes>], [
 
57
          uint32_t foo= UINT32_C(1); 
 
58
          ])],
 
59
        [ac_cxx_cinttypes_cinttypes="<cinttypes>"])
 
60
 
 
61
# Look for tr1/cinttypes
 
62
      AC_COMPILE_IFELSE([
 
63
        AC_LANG_PROGRAM([#include <tr1/cinttypes>], [
 
64
          uint32_t foo= UINT32_C(1);
 
65
          ])],
 
66
        [ac_cxx_cinttypes_tr1_cinttypes="<tr1/cinttypes>"])
 
67
 
 
68
# Look for boost/cinttypes.hpp
 
69
      AC_COMPILE_IFELSE([
 
70
        AC_LANG_PROGRAM([#include <boost/cinttypes.hpp>], [
 
71
          uint32_t foo= UINT32_C(1); 
 
72
          ])],
 
73
        [ac_cxx_cinttypes_boost_cinttypes_hpp="<boost/cinttypes.hpp>"])
 
74
 
 
75
      AC_LANG_POP
 
76
      AX_RESTORE_FLAGS
 
77
 
 
78
      AS_IF([test -n "$ac_cxx_cinttypes_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_cinttypes],
 
79
          [test -n "$ac_cxx_cinttypes_tr1_cinttypes"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_tr1_cinttypes],
 
80
          [test -n "$ac_cxx_cinttypes_boost_cinttypes_hpp"], [ac_cv_cxx_cinttypes=$ac_cxx_cinttypes_boost_cinttypes_hpp])
 
81
  ])
 
82
 
 
83
  AS_IF([ test -n "$ac_cv_cxx_cinttypes"], [
 
84
      AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
 
85
      ],[
 
86
      ac_cv_cxx_cinttypes="<inttypes.h>"
 
87
      AC_MSG_WARN([Could not find a cinttypes header.])
 
88
      AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
 
89
      ])
 
90
 
 
91
  AC_DEFINE([__STDC_LIMIT_MACROS],[1],[Use STDC Limit Macros in C++])
 
92
  AC_DEFINE_UNQUOTED([CINTTYPES_H],[$ac_cv_cxx_cinttypes],[the location of <cinttypes>])
 
93
  ])