File perl-DBD-ODBC-1.17-Makefile.diff of Package perl-DBD-ODBC

--- Makefile.PL
+++ Makefile.PL
@@ -36,6 +36,7 @@
 	COMPRESS => 'gzip -v9', SUFFIX => 'gz'
     },
     OBJECT	=> '$(O_FILES)',
+    OPTIMIZE    => "$ENV{RPM_OPT_FLAGS}",
     DEFINE => ''
  );
 my $eumm = $ExtUtils::MakeMaker::VERSION;
@@ -165,6 +166,7 @@
 
     print "Overriding ODBC Directory with command line option: $opt_o\n" if $opt_o ;
     my $odbchome= $opt_o || $ENV{ODBCHOME};
+    my $lib=$ENV{LIB};
 
     $odbchome = VMS::Filespec::unixify($odbchome) if $^O eq 'VMS';
 
@@ -177,7 +179,7 @@
             $tmp_odbchome =~ s/^([A-Za-z]):*$/\/\/$1/;
             $tmp_odbchome =~ s/\\/\//g;
             $odbchome = $tmp_odbchome if (-e "$tmp_odbchome/odbc.ini")
-        } elsif (-f '/opt/sapdb/interfaces/odbc/lib/libsqlod.a') {
+        } elsif (-f '/opt/sapdb/interfaces/odbc/lib/libsqlod.a' || -f '/opt/sapdb/interfaces/odbc/lib/lib64/libsqlod.a') {
             $odbchome = '/opt/sapdb/interfaces/odbc/';
         } elsif ($^O !~ /MSWin/) {
             # unixODBC - would have liked to use odbc_config but it did not
@@ -245,7 +247,7 @@
     # Try to work out which driver manager is being used.
     # Feel free to come up with neat (or un-neat) hacks to get your's to build!
 
-    my $lib_d1 = "$odbchome/lib";
+    my $lib_d1 = "$odbchome/$lib";
     my $lib_d2 = "$odbchome/dlls";
     my $libs   = "odbc";
     $opts{LIBS} = " -L$lib_d1 -R$lib_d1 -L$lib_d2 -R$lib_d2 -l$libs";
@@ -265,35 +267,35 @@
     $arext =~ s/^\.//;
 
     $myodbc = 'unixodbc'
-		if !$myodbc && <$odbchome/lib/libodbc.*>;
+		if !$myodbc && <$odbchome/$lib/libodbc.*>;
 
     $myodbc = 'iodbc'
-		if !$myodbc && (<$odbchome/*iodbc*> || <$odbchome/lib/*iodbc*>);
+		if !$myodbc && (<$odbchome/*iodbc*> || <$odbchome/$lib/*iodbc*>);
 
     $myodbc = 'empress'
-		if !$myodbc && <$odbchome/lib/libempodbc.*>;
+		if !$myodbc && <$odbchome/$lib/libempodbc.*>;
 
     $myodbc = 'intersolve'
 		if !$myodbc && -f "$odbchome/include/qeodbc.h";
 
     $myodbc = 'sapdb'
-		if !$myodbc && -f "$odbchome/lib/libsqlod.$arext";
+		if !$myodbc && -f "$odbchome/$lib/libsqlod.$arext";
 
     $myodbc = 'adabas'
-		if !$myodbc && $ENV{DBROOT} && $odbchome eq $ENV{DBROOT} && -f "$odbchome/lib/odbclib.$arext";
+		if !$myodbc && $ENV{DBROOT} && $odbchome eq $ENV{DBROOT} && -f "$odbchome/$lib/odbclib.$arext";
 
     $myodbc = 'udbc'
-		if !$myodbc && -f "$odbchome/lib/libudbc.$arext";
+		if !$myodbc && -f "$odbchome/$lib/libudbc.$arext";
 
     $myodbc = 'solid'
-		if !$myodbc && -f "$odbchome/lib/libsolcli.$dlext";
+		if !$myodbc && -f "$odbchome/$lib/libsolcli.$dlext";
 
     # JL 2002-12-16: This test is accurate on Unix (Solaris 7) with IBM
     # Informix ClientSDK 2.80.UC1, which includes IBM Informix CLI
     # v3.81.000, an ODBC 3.x driver.
 	# NB: The correct value for $ODBCHOME is $INFORMIXDIR.
     $myodbc = 'informix'
-		if !$myodbc && -f "$odbchome/lib/cli/libifcli.$dlext";
+		if !$myodbc && -f "$odbchome/$lib/cli/libifcli.$dlext";
 
     if (!$myodbc) {
 	local($") = ", ";
@@ -319,7 +321,7 @@
         $opts{dynamic_lib} = {OTHERLDFLAGS => "-lodbc32"};
     }
     elsif ($myodbc eq 'iodbc') {
-	my $ilibdir = "$odbchome/lib";
+	my $ilibdir = "$odbchome/$lib";
 	my @ilibs = <$ilibdir/*iodbc*.*>;
 	@ilibs = grep { /\.($Config{so}|$Config{dlext}|a)$/ } @ilibs;
 	die "That's odd, I can't see any iodbc libs in $ilibdir" unless @ilibs;
@@ -344,7 +346,7 @@
 
 	    # changed /\Q$ilibpath/ to /\Q$ilibdir/ per recommendation
 	    # by Ron Savage
-	    warn "Warning: LD_LIBRARY_PATH doesn't include $odbchome/lib\n"
+	    warn "Warning: LD_LIBRARY_PATH doesn't include $odbchome/$lib\n"
 		unless $ENV{LD_LIBRARY_PATH} =~ /\Q$ilibdir/;
 	}
 	#print SQLH qq{#define FAR \n#define EXPORT \n#define CALLBACK \n};
@@ -383,7 +385,7 @@
                 $opts{DEFINE} .= " $cf";
             }
         }
-	my @ilibs = <$odbchome/lib/libodbc.*>;
+	my @ilibs = <$odbchome/$lib/libodbc.*>;
 	@ilibs = grep { /\.($Config{so}|$Config{dlext}|a)$/ } @ilibs;
 	die "That's odd, I can't see any unixodbc libs in $odbchome" unless @ilibs;
 	print << "EOT";
@@ -403,10 +405,10 @@
 	else {
 	    # remove lib prefix and .so suffix so "-l" style link can be used
 	    $ilibname =~ s/^lib(odbc.*?)\.\w+$/$1/;
-	    $opts{LIBS} = "-L$odbchome/lib -l$ilibname";
+	    $opts{LIBS} = "-L$odbchome/$lib -l$ilibname";
 	    warn "Warning: LD_LIBRARY_PATH doesn't include $odbchome\n"
 		unless (exists($ENV{LD_LIBRARY_PATH}) &&
-                        ($ENV{LD_LIBRARY_PATH} =~ /\Q$odbchome\/lib/));
+                        ($ENV{LD_LIBRARY_PATH} =~ /\Q$odbchome\/$lib/));
 	}
 	print SQLH qq{#include <sql.h>\n};
 	print SQLH qq{#include <sqlucode.h>\n};
@@ -478,7 +480,7 @@
 	#$opts{DEFINE}  .= "";
 	print SQLH qq{#include <odbcsys.h>\n};
 	print SQLH qq{#include <sql.h>\n#include <sqlext.h>\n};
-	$opts{LIBS} = "-L$odbchome/lib -R$odbchome/lib -lempodbc";
+	$opts{LIBS} = "-L$odbchome/$lib -R$odbchome/$lib -lempodbc";
     }
     elsif ($myodbc eq 'sapdb') {
 	print SQLH "#include <WINDOWS.H>\n";
@@ -491,7 +493,11 @@
 	print SQLH qq{#define DBD_ODBC_NO_DATASOURCES\n}; # unless ($^O eq 'MSWin32');
 
 	$opts{INC} .= " -I$odbchome/incl";
-	$opts{LDFROM} = "\$(OBJECT) $odbchome/lib/libsqlod.a";
+        if (-f "$odbchome/lib/libsqlod.a" ) {
+          $opts{LDFROM} = "\$(OBJECT) $odbchome/lib/libsqlod.a";
+        } else {
+          $opts{LDFROM} = "\$(OBJECT) $odbchome/lib/lib64/libsqlod.a";
+        }
     }
     elsif ($myodbc eq 'adabas') {
 	print SQLH "#define FAR \n#define EXPORT \n#define CALLBACK \n";
@@ -499,23 +505,23 @@
 	print SQLH "#include <sql.h>\n";
 	print SQLH "#include <sqlext.h>\n";
 	$opts{INC} .= " -I$odbchome/incl";
-	$opts{LIBS} = "-L$odbchome/lib -lsqlrte -lsqlptc";
-	$opts{LDFROM} = "\$(OBJECT) $odbchome/lib/odbclib.a";
+	$opts{LIBS} = "-L$odbchome/$lib -lsqlrte -lsqlptc";
+	$opts{LDFROM} = "\$(OBJECT) $odbchome/$lib/odbclib.a";
     }
     elsif ($myodbc eq 'udbc') {
         print SQLH qq{#include <libudbc.h>\n};
         $opts{INC} .= " -I$odbchome/include";
         #$opts{DEFINE}  .= "";
-        $opts{LIBS} = "-L$odbchome/lib -R$odbchome/lib -ludbc";
+        $opts{LIBS} = "-L$odbchome/$lib -R$odbchome/$lib -ludbc";
     }
     elsif ($myodbc eq 'easysoft') {
         $opts{INC} .= " -I$odbchome/include";
-        $opts{LIBS} = "-L$odbchome/lib -lesoobclient";
+        $opts{LIBS} = "-L$odbchome/$lib -lesoobclient";
         print SQLH qq{#include <sql.h>\n#include <sqlext.h>\n};
     }
     elsif ($myodbc eq 'solid') {
         $opts{INC} .= " -I$odbchome/include";
-        $opts{LIBS} = "-L$odbchome/lib -lsolcli";
+        $opts{LIBS} = "-L$odbchome/$lib -lsolcli";
 	# Solid does not support DataSources
 	print SQLH qq{#define DBD_ODBC_NO_DATASOURCES\n};
 	# Solid does not support DataSources
@@ -525,7 +531,7 @@
     elsif ($myodbc eq 'informix') {
 		# JL 2002-12-16: See comments above for environment details.
         $opts{INC}  = "-I$odbchome/incl/cli $opts{INC}";
-        $opts{LIBS} = "-L$odbchome/lib/cli -lifcli -lifdmr";
+        $opts{LIBS} = "-L$odbchome/$lib/cli -lifcli -lifdmr";
         $opts{DEFINE} .= " -DNO_WIN32";		# Applies to Unix only, of course
         print SQLH qq{#include <stddef.h>\n};
         print SQLH qq{#include <infxcli.h>\n};