Determine mysql config (from original branch)

This commit is contained in:
Jeremy Suriel 2010-07-03 23:01:44 -04:00
parent 13bec8bd19
commit 6651972045

View File

@ -31,19 +31,33 @@ else
puts "Trying to detect MySQL configuration with mysql_config command..." puts "Trying to detect MySQL configuration with mysql_config command..."
begin begin
cflags = libs = nil cflags = libs = nil
for prefix in ["", "/usr/local/mysql/bin/", "/opt/local/mysql/bin/"]
begin dirs = ENV['PATH'].split(':') + %w[
cflags = exec_command("#{prefix}mysql_config --cflags", true) /opt
libs = exec_command("#{prefix}mysql_config --libs", true) /opt/local
break /opt/local/mysql
rescue RuntimeError, Errno::ENOENT => ex /opt/local/lib/mysql5
cflags = libs = nil /usr
end /usr/local
end /usr/local/mysql
if cflags && libs /usr/local/mysql-*
puts "Succeeded to detect MySQL configuration with #{prefix}mysql_config command." /usr/local/lib/mysql5
$CPPFLAGS << " #{cflags.strip}" ].map{|dir| "#{dir}/bin" }
$libs = "#{libs.strip} #{$libs}"
GLOB = "{#{dirs.join(',')}}/{mysql_config,mysql_config5}"
if /mswin32/ =~ RUBY_PLATFORM
inc, lib = dir_config('mysql')
exit 1 unless have_library("libmysql")
elsif mc = (with_config('mysql-config') || Dir[GLOB].first) then
mc = Dir[GLOB].first if mc == true
puts "Succeeded to detect MySQL configuration: #{mc}"
cflags = `#{mc} --cflags`.chomp
exit 1 if $? != 0
libs = `#{mc} --libs`.chomp
exit 1 if $? != 0
$CPPFLAGS += ' ' + cflags
$libs = libs + " " + $libs
else else
puts "Failed to detect MySQL configuration with mysql_config command." puts "Failed to detect MySQL configuration with mysql_config command."
puts "Trying to detect MySQL client library..." puts "Trying to detect MySQL client library..."
@ -55,6 +69,7 @@ else
have_library(libs.shift) have_library(libs.shift)
end end
end end
end end
end end