@@ -552,6 +552,66 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
552552# Sed expression to map a string onto a valid variable name.
553553as_tr_sh=" eval sed 'y%*+%pp%;s%[^_$as_cr_alnum ]%_%g'"
554554
555+ as_awk_strverscmp='
556+ # Use only awk features that work with 7th edition Unix awk (1978).
557+ # My, what an old awk you have, Mr. Solaris!
558+ END {
559+ while (length(v1) && length(v2)) {
560+ # Set d1 to be the next thing to compare from v1, and likewise for d2.
561+ # Normally this is a single character, but if v1 and v2 contain digits,
562+ # compare them as integers and fractions as strverscmp does.
563+ if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
564+ # Split v1 and v2 into their leading digit string components d1 and d2,
565+ # and advance v1 and v2 past the leading digit strings.
566+ for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
567+ for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
568+ d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
569+ d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
570+ if (d1 ~ /^0/) {
571+ if (d2 ~ /^0/) {
572+ # Compare two fractions.
573+ while (d1 ~ /^0/ && d2 ~ /^0/) {
574+ d1 = substr(d1, 2); len1--
575+ d2 = substr(d2, 2); len2--
576+ }
577+ if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
578+ # The two components differ in length, and the common prefix
579+ # contains only leading zeros. Consider the longer to be less.
580+ d1 = -len1
581+ d2 = -len2
582+ } else {
583+ # Otherwise, compare as strings.
584+ d1 = "x" d1
585+ d2 = "x" d2
586+ }
587+ } else {
588+ # A fraction is less than an integer.
589+ exit 1
590+ }
591+ } else {
592+ if (d2 ~ /^0/) {
593+ # An integer is greater than a fraction.
594+ exit 2
595+ } else {
596+ # Compare two integers.
597+ d1 += 0
598+ d2 += 0
599+ }
600+ }
601+ } else {
602+ # The normal case, without worrying about digits.
603+ d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
604+ d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
605+ }
606+ if (d1 < d2) exit 1
607+ if (d1 > d2) exit 2
608+ }
609+ # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
610+ # which mishandles some comparisons of empty strings to integers.
611+ if (length(v2)) exit 1
612+ if (length(v1)) exit 2
613+ }
614+ '
555615
556616test -n " $DJDIR " || exec 7< & 0 < /dev/null
557617exec 6>&1
@@ -1669,12 +1729,19 @@ if test -z "${R_HOME}"; then
16691729fi
16701730
16711731R_VERSION=` " ${R_HOME} /bin/R" --vanilla --slave -e " cat(as.character(getRversion()))" `
1672- if test " ${R_VERSION} " \< " 3.4.0" ; then
1673- R_CXX11_PREFIX=" CXX1X"
1674- else
1675- R_CXX11_PREFIX=" CXX11"
1676- fi
1677-
1732+ as_arg_v1=" ${R_VERSION} "
1733+ as_arg_v2=" 3.4.0"
1734+ awk " $as_awk_strverscmp " v1=" $as_arg_v1 " v2=" $as_arg_v2 " /dev/null
1735+ case $? in # (
1736+ 1) :
1737+ R_CXX11_PREFIX=" CXX1X" ;; # (
1738+ 0) :
1739+ R_CXX11_PREFIX=" CXX11" ;; # (
1740+ 2) :
1741+ R_CXX11_PREFIX=" CXX11" ;; # (
1742+ * ) :
1743+ ;;
1744+ esac
16781745
16791746ac_config_files=" $ac_config_files src/Makevars"
16801747
0 commit comments