Update all config.h usage.
[awesomized/libmemcached] / m4 / ax_compiler_version.m4
1 # ===========================================================================
2 # https://github.com/BrianAker/ddm4/
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_C_COMPILER_VERSION()
8 # AX_CXX_COMPILER_VERSION()
9 #
10 # DESCRIPTION
11 #
12 # Capture version of C/C++ compiler
13 #
14 # LICENSE
15 #
16 # Copyright (C) 2012 Brian Aker
17 # All rights reserved.
18 #
19 # Redistribution and use in source and binary forms, with or without
20 # modification, are permitted provided that the following conditions are
21 # met:
22 #
23 # * Redistributions of source code must retain the above copyright
24 # notice, this list of conditions and the following disclaimer.
25 #
26 # * Redistributions in binary form must reproduce the above
27 # copyright notice, this list of conditions and the following disclaimer
28 # in the documentation and/or other materials provided with the
29 # distribution.
30 #
31 # * The names of its contributors may not be used to endorse or
32 # promote products derived from this software without specific prior
33 # written permission.
34 #
35 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
47 #serial 4
48
49 AC_DEFUN([AX_C_COMPILER_VERSION],[
50 AC_REQUIRE([AX_COMPILER_VENDOR])
51 AC_MSG_CHECKING([C Compiler version])
52
53 ax_cv_c_compiler_version_vendor="$ax_cv_c_compiler_vendor"
54
55 AC_CHECK_DECL([__GNUC_PATCHLEVEL__],[
56 GNUCC=yes
57 ],[GNUCC=no])
58 AC_MSG_CHECKING([GNUCC])
59 AC_MSG_RESULT([$GNUCC])
60
61 AC_CHECK_DECL([__SUNPRO_C],[SUNCC=yes],[SUNCC=no])
62 AC_MSG_CHECKING([SUNCC])
63 AC_MSG_RESULT([$SUNCC])
64
65 AC_CHECK_DECL([__ICC],[INTELCC=yes],[INTELCC=no])
66 AC_MSG_CHECKING([INTELCC])
67 AC_MSG_RESULT([$INTELCC])
68
69 AC_CHECK_DECL([__clang__],[CLANG=yes],[CLANG=no])
70 AC_MSG_CHECKING([CLANG])
71 AC_MSG_RESULT([$CLANG])
72
73 AC_CHECK_DECL([__MINGW32__],[
74 MINGW=yes
75 ax_cv_c_compiler_version_vendor=mingw
76 ],[MINGW=no])
77 AC_MSG_CHECKING([MINGW])
78 AC_MSG_RESULT([$MINGW])
79
80 AS_CASE(["$ax_cv_c_compiler_version_vendor"],[
81 sun],[ax_c_compiler_version=`$CC -V 2>&1 | sed 1q`],[
82 intel],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],[
83 clang],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],[
84 gnu],[ax_c_compiler_version=`$CC --version | sed 1q`],[
85 mingw],[ax_c_compiler_version=`$CC --version | sed 1q`],[
86 ax_c_compiler_version=unknown])
87
88 AC_MSG_RESULT(["$ax_c_compiler_version"])
89 AC_SUBST([CC_VERSION_VENDOR],["$ax_cv_c_compiler_version_vendor"])
90 AC_SUBST([CC_VERSION],["$ax_c_compiler_version"])
91 ])
92
93 AC_DEFUN([AX_CXX_COMPILER_VERSION],[
94 AC_REQUIRE([AX_C_COMPILER_VERSION])
95 AC_MSG_CHECKING([C++ Compiler version])
96
97 AS_CASE(["$ax_cv_c_compiler_version_vendor"],[
98 sun],[ax_cxx_compiler_version=`$CC -V 2>&1 | sed 1q`],[
99 intel],[ax_cxx_compiler_version=`$CC --version 2>&1 | sed 1q`],[
100 clang],[ax_cxx_compiler_version=`$CC --version 2>&1 | sed 1q`],[
101 gnu],[ax_cxx_compiler_version=`$CC --version | sed 1q`],[
102 mingw],[ax_cxx_compiler_version=`$CC --version | sed 1q`],[
103 ax_cxx_compiler_version=unknown])
104
105 AC_MSG_RESULT(["$ax_cxx_compiler_version"])
106 AC_SUBST([CXX_VERSION_VENDOR],["$ax_cv_c_compiler_version_vendor"])
107 AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"])
108 ])