diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index fc71ebe..6861813 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -22,7 +22,8 @@ sub _new VisualStudioVersion => undef, MinimumVisualStudioVersion => undef, vcver => undef, - platform => undef, }; + platform => undef, + ICUVersion => undef, }; bless($self, $classname); $self->DeterminePlatform(); @@ -76,6 +77,29 @@ sub DeterminePlatform print "Detected hardware platform: $self->{platform}\n"; } +sub DetermineICUVersion{ + + my $self = shift; + + # get the icu version. + my $output = `uconv -V 2>&1`; + $? >> 8 == 0 or die "uconv command not found"; + + if ($output =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)?$/m) + { + $self->{ICUVersion} = $1.$2; + } + elsif ($output =~ /(\d+)\.(\d+)\.(\d+)?$/m) + { + $self->{ICUVersion} = $1; + } + elsif ($output =~ /(\d+)\.(\d+)?$/m) + { + $self->{ICUVersion} = $1; + } + print "Detected icu version : $self->{ICUVersion}\n"; +} + # Return 1 if $oldfile is newer than $newfile, or if $newfile doesn't exist. # Special case - if config.pl has changed, always return 1 sub IsNewer @@ -222,7 +246,9 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c } if ($self->{options}->{icu}) { + $self->DetermineICUVersion(); print $o "#define USE_ICU 1\n"; + print $o "#define HAVE_UCOL_STRCOLLUTF8 1\n" if ($self->{ICUVersion} >= 50); } if (my $port = $self->{options}->{"--with-pgport"}) {