--- Makefile.PL.old	Wed May 10 16:57:54 2000
+++ Makefile.PL	Wed May 10 16:58:03 2000
@@ -73,6 +73,8 @@
 
     my $odbchome= $::opt_o || $ENV{ODBCHOME};
 
+    $odbchome = VMS::Filespec::unixify($odbchome) if $^O eq 'VMS';
+
     # per patches from Teun Burgers
     if (!$odbchome && $ENV{WINDIR} && $^O =~ /^cygwin/) {
 	my $tmp_odbchome = $ENV{WINDIR};
@@ -211,25 +213,39 @@
     elsif ($myodbc eq 'esodbc') {
 	my @ilibs = <$odbchome/*esoobclient.*>;
 	print "Located library @ilibs\n";
-	@ilibs = grep { /\.($Config{so}|$Config{dlext}|a)$/ } @ilibs;
+	# omit . prefix in next grep as some $Config types have . and some don't
+	@ilibs = grep { /($Config{so}|$Config{dlext}|$Config{lib_ext})$/ } @ilibs;
 	die "That's odd, I can't see any esoobclient libs in $odbchome" unless @ilibs;
 	print "We expect to find the sql.h and sqlext.h files (which were\n";
-	print "supplied with esoobclient) in \$ODBCHOME\include directory alongside\n";
+	print "supplied with esoobclient) in \$ODBCHOME/include directory alongside\n";
 	print "the @ilibs library.\n\n";
 	my $ilibpath = $ilibs[0]; # XXX if both .so and .a, pick based on LINKTYPE?
 	my $ilibname = basename($ilibpath);
 	print "Using library $ilibname\n";
-	$opts{DEFINE} = "-I$odbchome/include";
+	$opts{INC} .= " -I$odbchome/include";
+	#
+	# ptrmismatch avoids the char/unsigned problems in DBD
+	# outtypelen is one incorrect fprintf in dbiimp.c(200)
+	# promotmatchw - old prototypes problem
+	#
+	$opts{CCFLAGS} .= "/warnings=informational=(outtypelen,ptrmismatch,promotmatchw)" if ($Config{cc} =~ /DECC/ );
 	if ($ilibname =~ /^esoobclient/) { # no "lib" prefix
 	    $opts{LIBS} = "";
 	    $opts{dynamic_lib} = { OTHERLDFLAGS => "$ilibpath" };
 	}
 	else {
-	    # remove lib prefix and .so suffix so "-l" style link can be used
+	    my $extralibs="";
+	    if (($^O eq 'VMS') && ($ilibname =~ /$Config{lib_ext}$/)) {
+		    $extralibs = " -lcs_share -lsupport -leasyrpc";
+		    print "Adding libraries $extralibs\n";
+	    }
+	    # remove lib prefix and so suffix so "-l" style link can be used
 	    $ilibname =~ s/^lib(esoobclient.*?)\.\w+$/$1/;
-	    $opts{LIBS} = "-L$odbchome -l$ilibname";
-	    warn "Warning: LD_LIBRARY_PATH doesn't include $odbchome\n"
-		unless $ENV{LD_LIBRARY_PATH} =~ /\Q$odbchome/;
+	    $opts{LIBS} = "-L$odbchome -l$ilibname $extralibs";
+	    if ($^O ne "VMS") {
+	 	    warn "Warning: LD_LIBRARY_PATH doesn't include $odbchome\n"
+			    unless $ENV{LD_LIBRARY_PATH} =~ /\Q$odbchome/;
+	    }
 	}
 	print SQLH qq{#define FAR \n#define EXPORT \n#define CALLBACK \n};
 	print SQLH qq{#include <sqlext.h>\n};
