Top Level Namespace

Constant Summary collapse

GLOB =
"{#{dirs.join(',')}}/{mysql_config,mysql_config5,mariadb_config}".freeze

Instance Method Summary collapse

Instance Method Details

#add_ssl_defines(header) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'ext/mysql2/extconf.rb', line 14

def add_ssl_defines(header)
  all_modes_found = %w[SSL_MODE_DISABLED SSL_MODE_PREFERRED SSL_MODE_REQUIRED SSL_MODE_VERIFY_CA SSL_MODE_VERIFY_IDENTITY].inject(true) do |m, ssl_mode|
    m && have_const(ssl_mode, header)
  end
  $CFLAGS << ' -DFULL_SSL_MODE_SUPPORT' if all_modes_found
  # if we only have ssl toggle (--ssl,--disable-ssl) from 5.7.3 to 5.7.10
  has_no_support = all_modes_found ? false : !have_const('MYSQL_OPT_SSL_ENFORCE', header)
  $CFLAGS << ' -DNO_SSL_MODE_SUPPORT' if has_no_support
end

#asplode(lib) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'ext/mysql2/extconf.rb', line 4

def asplode(lib)
  if RUBY_PLATFORM =~ /mingw|mswin/
    abort "-----\n#{lib} is missing. Check your installation of MySQL or Connector/C, and try again.\n-----"
  elsif RUBY_PLATFORM =~ /darwin/
    abort "-----\n#{lib} is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.\n-----"
  else
    abort "-----\n#{lib} is missing. You may need to 'sudo apt-get install libmariadb-dev', 'sudo apt-get install libmysqlclient-dev' or 'sudo yum install mysql-devel', and try again.\n-----"
  end
end