autoconf-archive-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] AX_COMPILER_VENDOR: Make the list of vendors and correspondi


From: Maarten Bosmans
Subject: [PATCH 2/4] AX_COMPILER_VENDOR: Make the list of vendors and corresponding symbols clearer
Date: Sat, 2 Jul 2011 12:06:32 +0200

Also deprecate the macros AX_CHECK_SUNPRO_C and AX_LANG_COMPILER_MS in favor
of the more generic AX_COMPILER_VENDOR.
---
 NEWS                      |    3 +++
 m4/ax_check_sunpro_c.m4   |    9 +++++++++
 m4/ax_compiler_vendor.m4  |   41 +++++++++++++++++++++++++++++++----------
 m4/ax_lang_compiler_ms.m4 |    8 ++++++++
 4 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/NEWS b/NEWS
index b780238..d0b8bae 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+  The macros AX_CHECK_SUNPRO_C and AX_LANG_COMPILER_MS are deprecated in favor
+  of the more generic AX_COMPILER_VENDOR.
+
   Several instance of under-quoted arguments have been fixed in
   AX_CHECK_OPENSSL. See <http://savannah.gnu.org/patch/?7571> for further
   details.
diff --git a/m4/ax_check_sunpro_c.m4 b/m4/ax_check_sunpro_c.m4
index 19c5b93..f68a713 100644
--- a/m4/ax_check_sunpro_c.m4
+++ b/m4/ax_check_sunpro_c.m4
@@ -2,6 +2,15 @@
 #     http://www.gnu.org/software/autoconf-archive/ax_check_sunpro_c.html
 # ===========================================================================
 #
+# OBSOLETE MACRO
+#
+#   Deprecated in favor of AX_COMPILER_VENDOR.
+#   A call to this macro can be replaced by:
+#     AC_LANG_PUSH([C])
+#     AX_COMPILER_VENDOR
+#     AC_LANG_POP
+#     AS_IF([test $ax_cv_c_compiler_vendor = 
sun],[ACTION-IF-YES],[ACTION-IF-NOT])
+#
 # SYNOPSIS
 #
 #   AX_CHECK_SUNPRO_C([ACTION-IF-YES],[ACTION-IF-NOT])
diff --git a/m4/ax_compiler_vendor.m4 b/m4/ax_compiler_vendor.m4
index 3214706..95b53ec 100644
--- a/m4/ax_compiler_vendor.m4
+++ b/m4/ax_compiler_vendor.m4
@@ -47,17 +47,38 @@
 #serial 9
 
 AC_DEFUN([AX_COMPILER_VENDOR],
-[
-AC_CACHE_CHECK([for _AC_LANG compiler vendor], 
ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
- [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
-  # note: don't check for gcc first since some other compilers define __GNUC__
-  for ventest in intel:__ICC,__ECC,__INTEL_COMPILER 
ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ 
clang:__clang__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC 
dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ 
comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ 
sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
-    vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || 
defined(/g'`")"
+[AC_CACHE_CHECK([for _AC_LANG compiler vendor], 
ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
+  [# note: don't check for gcc first since some other compilers define __GNUC__
+  vendors="intel:     __ICC,__ECC,__INTEL_COMPILER
+           ibm:       __xlc__,__xlC__,__IBMC__,__IBMCPP__
+           pathscale: __PATHCC__,__PATHSCALE__
+           clang:     __clang__
+           gnu:       __GNUC__
+           sun:       __SUNPRO_C,__SUNPRO_CC
+           hp:        __HP_cc,__HP_aCC
+           dec:       __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
+           borland:   __BORLANDC__,__TURBOC__
+           comeau:    __COMO__
+           cray:      _CRAYC
+           kai:       __KCC
+           lcc:       __LCC__
+           sgi:       __sgi,sgi
+           microsoft: _MSC_VER
+           metrowerks: __MWERKS__
+           watcom:    __WATCOMC__
+           portland:  __PGI
+           unknown:   UNKNOWN"
+  for ventest in $vendors; do
+    case $ventest in
+      *:) vendor=$ventest; continue ;;
+      *)  vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;;
+    esac
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
-#if !($vencpp)
-      thisisanerror;
-#endif
-])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; 
break])
+      #if !($vencpp)
+        thisisanerror;
+      #endif
+    ])], [break])
   done
+  ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
  ])
 ])
diff --git a/m4/ax_lang_compiler_ms.m4 b/m4/ax_lang_compiler_ms.m4
index 658ca85..8fdd74e 100644
--- a/m4/ax_lang_compiler_ms.m4
+++ b/m4/ax_lang_compiler_ms.m4
@@ -2,6 +2,14 @@
 #    http://www.gnu.org/software/autoconf-archive/ax_lang_compiler_ms.html
 # ===========================================================================
 #
+# OBSOLETE MACRO
+#
+#   Deprecated in favor of AX_COMPILER_VENDOR.
+#   A call to this macro can be replaced by:
+#     AX_COMPILER_VENDOR
+#     AS_IF([test $ax_cv_c_compiler_vendor = microsoft],
+#         [ax_compiler_ms=yes],[ax_compiler_ms=no])
+#
 # SYNOPSIS
 #
 #   AX_LANG_COMPILER_MS
-- 
1.7.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]