Rudy Lippan wrote:
>Hello everyone,
>
>DBD::mysql 2.9005_3 should now be up on CPAN.
>
Attached is a patch which removes the use (or, rather, attempted use!)
of mysql_config on Win32, since that program doesn't exist on Win32.
The patch isn't as big as it looks at first -- it's just that I've
inserted a couple of "if ($^O !~ /mswin32/i)" lines and indented the
sections of code within them.
It also omits "-g" from the cflags (the VC++ compiler uses different
flags to enable debugging, and in fact Perl on Win32 uses some debugging
flags by default anyway) and omits "-lz -lm -lcrypt -lnsl" from libs
(since these libraries don't exist and aren't required on Win32).
Btw, This release passes all tests on Win32 using perl-5.8.5 and
mysql-4.1.3.
- Steve
PS. I'm still longing for some Unicode support. What are the current
plans on this? Are we waiting for a "stable" mysql-4.1.x and/or DBI v2,
or will something be done sooner?
------------------------------------------------
This email has been scanned for viruses and content by the Radan Computational
Webshield Appliances.
--- Makefile.PL.orig 2004-10-28 02:34:16.000000000 +0100
+++ Makefile.PL 2004-11-02 09:58:48.150097100 +0000
@@ -48,36 +48,39 @@
my $source = {};
-#Check for mysql_config first
-$source->{'mysql_config'}="guessed";
-if ($opt->{'mysql_config'})
-{
- if (-f $opt->{'mysql_config'})
- {
- $source->{'mysql_config'} = "Users choice";
- }
- else
- {
- print <<"MSG";
+#Check for mysql_config first (except on Win32)
+if ($^O !~ /mswin32/i)
+{
+ $source->{'mysql_config'}="guessed";
+ if ($opt->{'mysql_config'})
+ {
+ if (-f $opt->{'mysql_config'})
+ {
+ $source->{'mysql_config'} = "Users choice";
+ }
+ else
+ {
+ print <<"MSG";
Specified mysql configuration script '$opt->{'mysql_config'}' doesn't exist.
Please check path/permissions. Will try to use default mysql_config
script found through PATH.
MSG
- $opt->{'mysql_config'}= "mysql_config";
+ $opt->{'mysql_config'}= "mysql_config";
+ }
}
-}
-else
-{
- if (! `mysql_config`)
+ else
{
- print <<MSG;
+ if (! `mysql_config`)
+ {
+ print <<MSG;
Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!
MSG
+ }
+ $opt->{'mysql_config'} = "mysql_config";
}
- $opt->{'mysql_config'} = "mysql_config";
}
foreach my $key (qw/testdb testhost testuser testpassword testsocket
@@ -139,7 +142,7 @@
my $cflags = "-I\$(DBI_INSTARCH_DIR) $opt->{'cflags'}";
$cflags .= " -DDBD_MYSQL_WITH_SSL" if $opt->{'ssl'};
$cflags .= " -DDBD_NO_CLIENT_FOUND_ROWS" if $opt->{'nofoundrows'};
-$cflags .= " -g ";
+$cflags .= " -g " unless $^O =~ /mswin32/i;
my %o = ( 'NAME' => 'DBD::mysql',
'INC' => $cflags,
'dist' => { 'SUFFIX' => ".gz",
@@ -239,40 +242,43 @@
return;
}
- # First try to get options values from mysql_config
- my $command = $opt->{'mysql_config'} . " --$param";
- eval
- {
- open(PIPE, "$command |") or die "Can't find mysql_config.";
- };
-
- if (!$@)
+ # First try to get options values from mysql_config (except on Win32)
+ if ($^O !~ /mswin32/i)
{
- my $str = "";
- while (defined(my $line = <PIPE>))
+ my $command = $opt->{'mysql_config'} . " --$param";
+ eval
{
- $str .= $line;
+ open(PIPE, "$command |") or die "Can't find mysql_config.";
+ };
+
+ if (!$@)
+ {
+ my $str = "";
+ while (defined(my $line = <PIPE>))
+ {
+ $str .= $line;
+ }
+ if ($str ne "" && $str !~ /Options:/)
+ {
+ $str =~ s/\s+$//s;
+ $str =~ s/^\s+//s;
+
+ # Unfortunately ExtUtils::MakeMaker doesn't deal very well
+ # with -L'...'
+ $str =~ s/\-L\'(.*?)\'/-L$1/sg;
+ $str =~ s/\-L\"(.*?)\"/-L$1/sg;
+
+ $opt->{$param} = $str;
+ $source->{$param} = "mysql_config";
+ return;
+ }
}
- if ($str ne "" && $str !~ /Options:/)
+ else
{
- $str =~ s/\s+$//s;
- $str =~ s/^\s+//s;
-
- # Unfortunately ExtUtils::MakeMaker doesn't deal very well
- # with -L'...'
- $str =~ s/\-L\'(.*?)\'/-L$1/sg;
- $str =~ s/\-L\"(.*?)\"/-L$1/sg;
-
- $opt->{$param} = $str;
- $source->{$param} = "mysql_config";
- return;
+ # need to do something here...
+ #print "Can't find mysql_config. Use --mysql_config option to specify where
mysql_config is located\n";
}
}
- else
- {
- # need to do something here...
- #print "Can't find mysql_config. Use --mysql_config option to specify where
mysql_config is located\n";
- }
# Ok, mysql_config doesn't work. We need to do our best
if ($param eq "nocatchstderr" || $param eq "nofoundrows")
@@ -316,7 +322,8 @@
$source->{$param} = "guessed";
my @files=();
- my $default_libs= "-lmysqlclient -lz -lm -lcrypt -lnsl";
+ my $default_libs = ($^O =~ /mswin32/i) ? "-lmysqlclient" :
+ "-lmysqlclient -lz -lm -lcrypt -lnsl";
@files = ($^O =~ /mswin32/i) ? qw(mysqlclient.lib) :
qw(libmysqlclient.a libmysqlclient.so);