fptools.m4 966 B

123456789101112131415161718192021222324252627282930
  1. dnl Macros stolen from the fptools package.
  2. dnl FP_COMPARE_VERSIONS(VERSION1, TEST, VERSION2, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
  3. dnl ----------------------------------------------------------------------------------
  4. dnl Compare dotted version numbers VERSION1 and VERSION2 lexicographically according
  5. dnl to TEST (one of -eq, -ne, -lt, -le, -gt, or -ge).
  6. AC_DEFUN([FP_COMPARE_VERSIONS],
  7. [fp_version1=$1; fp_version2=$3
  8. fp_save_IFS=$IFS; IFS='.'
  9. while test x"$fp_version1" != x || test x"$fp_version2" != x
  10. do
  11. set dummy $fp_version1; shift
  12. fp_num1=""
  13. test $[@%:@] = 0 || { fp_num1="[$]1"; shift; }
  14. test x"$fp_num1" = x && fp_num1="0"
  15. fp_version1="[$]*"
  16. set dummy $fp_version2; shift
  17. fp_num2=""
  18. test $[@%:@] = 0 || { fp_num2="[$]1"; shift; }
  19. test x"$fp_num2" = x && fp_num2="0"
  20. fp_version2="[$]*"
  21. test "$fp_num1" = "$fp_num2" || break;
  22. done
  23. IFS=$fp_save_IFS
  24. AS_IF([test "$fp_num1" $2 "$fp_num2"], [$4], [$5])[]dnl
  25. ])dnl FP_COMPARE_VERSIONS