```ruby
require 'mkmf'

if RUBY_VERSION < "2.0"
  STDERR.print("Ruby version is too old\n")
  exit(1)
end

$CFLAGS = '-Wall -Werror'
$CFLAGS += ' -g3' if ENV['debug']

dir_config("ruby")
create_makefile("byebug")
```

Check for GCC before adding GCC-specific flags
user
```ruby
require 'mkmf'

RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']

if RUBY_VERSION < "2.0"
  STDERR.print("Ruby version is too old\n")
  exit(1)
end

if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
  $CFLAGS = '-Wall -Werror'
  $CFLAGS += ' -g3' if ENV['debug']
end

dir_config("ruby")
create_makefile("byebug")
```
assistant