+# for fujitsu
+AC_DEFUN([_AX_COMPILER_VERSION_FUJITSU],[
+ AC_COMPUTE_INT(ax_cv_[]_AC_LANG_ABBREV[]_compiler_version,
+ __FCC_VERSION,,
+ AC_MSG_FAILURE([[[$0]]unknown fujitsu release]))
+ ])
+
+# for GNU
+AC_DEFUN([_AX_COMPILER_VERSION_GNU],[
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ __GNUC__,,
+ AC_MSG_FAILURE([[[$0]] unknown gcc major]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ __GNUC_MINOR__,,
+ AC_MSG_FAILURE([[[$0]] unknown gcc minor]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ [__GNUC_PATCHLEVEL__],,
+ AC_MSG_FAILURE([[[$0]] unknown gcc patch level]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# For sun
+AC_DEFUN([_AX_COMPILER_VERSION_SUN],[
+ m4_define([_AX_COMPILER_VERSION_SUN_NUMBER],
+ [
+ #if defined(__SUNPRO_CC)
+ __SUNPRO_CC
+ #else
+ __SUNPRO_C
+ #endif
+ ])
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_until59,
+ !!(_AX_COMPILER_VERSION_SUN_NUMBER < 0x1000),,
+ AC_MSG_FAILURE([[[$0]] unknown sun release version]))
+ AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_until59" = X1],
+ [dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ _AX_COMPILER_VERSION_SUN_NUMBER % 0x10,,
+ AC_MSG_FAILURE([[[$0]] unknown sun patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ (_AX_COMPILER_VERSION_SUN_NUMBER / 0x10) % 0x10,,
+ AC_MSG_FAILURE([[[$0]] unknown sun minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (_AX_COMPILER_VERSION_SUN_NUMBER / 0x100),,
+ AC_MSG_FAILURE([[[$0]] unknown sun major version]))
+ ],
+ [dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ _AX_COMPILER_VERSION_SUN_NUMBER % 0x10,,
+ AC_MSG_FAILURE([[[$0]] unknown sun patch version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ (_AX_COMPILER_VERSION_SUN_NUMBER / 0x100) % 0x100,,
+ AC_MSG_FAILURE([[[$0]] unknown sun minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (_AX_COMPILER_VERSION_SUN_NUMBER / 0x1000),,
+ AC_MSG_FAILURE([[[$0]] unknown sun major version]))
+ ])
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+])
+
+AC_DEFUN([_AX_COMPILER_VERSION_HP],[
+ m4_define([_AX_COMPILER_VERSION_HP_NUMBER],
+ [
+ #if defined(__HP_cc)
+ __HP_cc
+ #else
+ __HP_aCC
+ #endif
+ ])
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_untilA0121,
+ !!(_AX_COMPILER_VERSION_HP_NUMBER <= 1),,
+ AC_MSG_FAILURE([[[$0]] unknown hp release version]))
+ AS_IF([test "X$_ax_[]_AC_LANG_ABBREV[]_compiler_version_untilA0121" = X1],
+ [dnl By default output last version with this behavior.
+ dnl it is so old
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="01.21.00"
+ ],
+ [dnl
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ (_AX_COMPILER_VERSION_HP_NUMBER % 100),,
+ AC_MSG_FAILURE([[[$0]] unknown hp release version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ ((_AX_COMPILER_VERSION_HP_NUMBER / 100)%100),,
+ AC_MSG_FAILURE([[[$0]] unknown hp minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ ((_AX_COMPILER_VERSION_HP_NUMBER / 10000)%100),,
+ AC_MSG_FAILURE([[[$0]] unknown hp major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+])
+
+AC_DEFUN([_AX_COMPILER_VERSION_DEC],[dnl
+ m4_define([_AX_COMPILER_VERSION_DEC_NUMBER],
+ [
+ #if defined(__DECC_VER)
+ __DECC_VER
+ #else
+ __DECCXX_VER
+ #endif
+ ])
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch,
+ (_AX_COMPILER_VERSION_DEC_NUMBER % 10000),,
+ AC_MSG_FAILURE([[[$0]] unknown dec release version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ ((_AX_COMPILER_VERSION_DEC_NUMBER / 100000UL)%100),,
+ AC_MSG_FAILURE([[[$0]] unknown dec minor version]))
+ AC_COMPUTE_INT(_ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ ((_AX_COMPILER_VERSION_DEC_NUMBER / 10000000UL)%100),,
+ AC_MSG_FAILURE([[[$0]] unknown dec major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_patch"
+ ])
+
+# borland
+AC_DEFUN([_AX_COMPILER_VERSION_BORLAND],[dnl
+ m4_define([_AX_COMPILER_VERSION_TURBOC_NUMBER],
+ [
+ #if defined(__TURBOC__)
+ __TURBOC__
+ #else
+ choke me
+ #endif
+ ])
+ m4_define([_AX_COMPILER_VERSION_BORLANDC_NUMBER],
+ [
+ #if defined(__BORLANDC__)
+ __BORLANDC__
+ #else
+ __CODEGEARC__
+ #endif
+ ])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(,
+ _AX_COMPILER_VERSION_TURBOC_NUMBER)],
+ [dnl TURBOC
+ AC_COMPUTE_INT(
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw,
+ _AX_COMPILER_VERSION_TURBOC_NUMBER,,
+ AC_MSG_FAILURE([[[$0]] unknown turboc version]))
+ AS_IF(
+ [test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw -lt 661 || test $_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw -gt 1023],
+ [dnl compute normal version
+ AC_COMPUTE_INT(
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_minor,
+ _AX_COMPILER_VERSION_TURBOC_NUMBER % 0x100,,
+ AC_MSG_FAILURE([[[$0]] unknown turboc minor version]))
+ AC_COMPUTE_INT(
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_major,
+ (_AX_COMPILER_VERSION_TURBOC_NUMBER/0x100)%0x100,,
+ AC_MSG_FAILURE([[[$0]] unknown turboc major version]))
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:$_ax_[]_AC_LANG_ABBREV[]_compiler_version_major.$_ax_[]_AC_LANG_ABBREV[]_compiler_version_minor"],
+ [dnl special version
+ AS_CASE([$_ax_[]_AC_LANG_ABBREV[]_compiler_version_turboc_raw],
+ [661],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:1.00"],
+ [662],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:1.01"],
+ [663],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="0turboc:2.00"],
+ [
+ AC_MSG_WARN([[[$0]] unknown turboc version between 0x295 and 0x400 please report bug])
+ ax_cv_[]_AC_LANG_ABBREV[]_compiler_version=""
+ ])
+ ])
+ ],
+ # borlandc
+ [
+ AC_COMPUTE_INT(
+ _ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw,
+ _AX_COMPILER_VERSION_BORLANDC_NUMBER,,
+ AC_MSG_FAILURE([[[$0]] unknown borlandc version]))
+ AS_CASE([$_ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw],
+ dnl BORLANDC++ before 5.5
+ [512] ,[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:2.00"],
+ [1024],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.00"],
+ [1024],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.00"],
+ [1040],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:3.1"],
+ [1106],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:4.0"],
+ [1280],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:5.0"],
+ [1312],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="1borlanc:5.02"],
+ dnl C++ Builder era
+ [1328],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="2cppbuilder:3.0"],
+ [1344],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="2cppbuilder:4.0"],
+ dnl BORLANDC++ after 5.5
+ [1360],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.5"],
+ [1361],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.51"],
+ [1378],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="3borlancpp:5.6.4"],
+ dnl C++ Builder with year number
+ [1392],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2006"],
+ [1424],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2007"],
+ [1555],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2009"],
+ [1569],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="4cppbuilder:2010"],
+ dnl XE version
+ [1584],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe"],
+ [1600],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:2"],
+ [1616],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:3"],
+ [1632],[ax_cv_[]_AC_LANG_ABBREV[]_compiler_version="5xe:4"],
+ [
+ AC_MSG_WARN([[[$0]] Unknown borlandc compiler version $_ax_[]_AC_LANG_ABBREV[]_compiler_version_borlandc_raw please report bug])