Description:
"mysql_config.pl --include" reports the wrong include path.
How to repeat:
Download mysql-noinstall-5.1.43-win32.zip and extract it into C:\
Run /c/mysql-5.1.43-win32/scripts/mysql_config.pl --include
It returns "/c/mysql-5.1.43-win32/include/mysql"
The correct path is "/c/mysql-5.1.43-win32/include"
Suggested fix:
This is line 165 of mysql_config.pl:
my $pkgincludedir = fix_path('', "include/mysql", "include");
fix_path() will return the first directory it finds, e.g. if $basedir is "/foo", it will look for "/foo/include/mysql" first, then "/foo/include", and if neither exists, it will return "" (the first argument) instead.
The headers are actually in /foo/include, but /foo/include/mysql exists (it contains only a single header, plugin.h) so fix_path returns that instead of /foo/include.
One possible fix is to have fix_path search for a specific file, e.g.
sub fix_path
{
my $default = shift;
my $file = shift;
my @dirs = @_;
foreach my $dirname ( @dirs )
{
my $path = "$basedir/$dirname";
if ( -f "$path/$file" )
{
return $path;
}
}
return $default;
}
then modify the calls accordingly:
my $pkglibdir = fix_path('', "libmysql.dll", "libmysql/relwithdebinfo",
"libmysql/release","libmysql/debug","lib/mysql","lib");
my $pkgincludedir = fix_path('', "mysql.h", "include/mysql", "include");