Skip to content

Commit

Permalink
Improved configuration script
Browse files Browse the repository at this point in the history
  • Loading branch information
wedesoft committed Oct 8, 2010
1 parent 61a8fe5 commit 807f993
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,25 @@ def check_program
end
end

file 'ext/config.h' do |t|
s = "/* config.h. Generated from Rakefile by rake. */\n"
libswscale_incdir = check_program do |c|
def check_c_header( name )
check_program do |c|
c.puts <<EOS
extern "C" {
#include <libswscale/swscale.h>
#include <#{name}>
}
int main(void) { return 0; }
EOS
end
if libswscale_incdir
end

file 'ext/config.h' do |t|
s = "/* config.h. Generated from Rakefile by rake. */\n"
if check_c_header 'libswscale/swscale.h'
s << "#define HAVE_LIBSWSCALE_INCDIR 1\n"
else
unless check_c_header 'ffmpeg/swscale.h'
raise 'Cannot find swscale.h header file'
end
s << "#undef HAVE_LIBSWSCALE_INCDIR\n"
end
File.open( t.name, 'w' ) { |f| f.puts s }
Expand Down

0 comments on commit 807f993

Please sign in to comment.