@@ -560,15 +560,6 @@ class Configure
560560 return false
561561 end
562562
563- if setup_config
564- check_llvm_flags
565- return true
566- end
567-
568- failure "ABORT: unable to set up LLVM"
569- end
570-
571- def setup_config
572563 @log . print " Checking for 'llvm-config': "
573564
574565 config = @llvm_configure
@@ -595,36 +586,38 @@ class Configure
595586 # Ruby 1.9 raises this error
596587 failed = true
597588 end
598- if failed
599- @log . write "Executing #{ config_cmd . inspect } failed"
600- return false
601- end
602589
603- parts = version . sub ( /svn$/ , "" ) . split ( "." ) . map { |i | i . to_i }
604- api_version = ( "%d%02d" % parts [ 0 ..1 ] ) . to_i
605- if api_version < 300 or api_version > 305
606- @log . write "only LLVM 3.0-3.5 is supported"
607- else
608- @log . write "found! (version #{ version } - api: #{ api_version } )"
609- @llvm = :config
610- @llvm_configure = config_cmd
611- @llvm_version = version
612- @llvm_api_version = api_version
613-
614- if @llvm_shared
615- setup_config_shared
616- end
590+ unless failed
591+ parts = version . sub ( /svn$/ , "" ) . split ( "." ) . map { |i | i . to_i }
592+ api_version = ( "%d%02d" % parts [ 0 ..1 ] ) . to_i
593+ if api_version < 300 or api_version > 305
594+ @log . write "only LLVM 3.0-3.5 is supported"
595+ else
596+ @log . write "found! (version #{ version } - api: #{ api_version } )"
597+ @llvm = :config
598+ @llvm_configure = config_cmd
599+ @llvm_version = version
600+ @llvm_api_version = api_version
617601
618- return true
602+ check_llvm_flags
603+
604+ if @llvm_shared
605+ setup_llvm_shared
606+ end
607+
608+ return true
609+ end
610+ else
611+ @log . write "executing #{ config_cmd . inspect } failed"
619612 end
620613 else
621614 @log . write "not found"
622615 end
623616
624- false
617+ failure "ABORT: unable to set up LLVM"
625618 end
626619
627- def setup_config_shared
620+ def setup_llvm_shared
628621 @log . print " Checking for LLVM shared libs: "
629622
630623 src = <<-EOP
@@ -633,7 +626,7 @@ using namespace llvm;
633626int main() { LLVMContext &Context = getGlobalContext(); }
634627 EOP
635628
636- common_args = `#{ @llvm_configure } --cppflags --ldflags` . strip . split ( /\s +/ )
629+ common_args = " `#{ @llvm_configure } --cppflags` #{ @llvm_cxxflags } #{ @llvm_ldflags } " . strip . split ( /\s +/ )
637630 shared_configs = {
638631 "libLLVM-#{ @llvm_version } " => [ "-lLLVM-#{ @llvm_version } " ] ,
639632 "#{ @llvm_configure } --libs" => `#{ @llvm_configure } --libs` . strip . split ( /\s +/ )
0 commit comments