ext/lbfgsb/extconf.rb in lbfgsb-0.4.1 vs ext/lbfgsb/extconf.rb in lbfgsb-0.5.0
- old
+ new
@@ -1,8 +1,10 @@
require 'mkmf'
require 'numo/narray'
+$defs << '-DUSE_INT64' if with_config('use-int64', false)
+
$LOAD_PATH.each do |lp|
if File.exist?(File.join(lp, 'numo/numo/narray.h'))
$INCFLAGS = "-I#{lp}/numo #{$INCFLAGS}"
break
end
@@ -24,12 +26,19 @@
puts 'libnarray.a not found.'
exit(1)
end
end
-$srcs = Dir.glob("#{$srcdir}/*.c").map { |path| File.basename(path) }
-$srcs.concat(%w[blas.c linpack.c lbfgsb.c])
+$srcs = Dir.glob("#{$srcdir}/**/*.c").map { |path| File.basename(path) }
-$INCFLAGS << " -I$(srcdir)/src"
+blas_dir = with_config('blas-dir')
+$LDFLAGS = "-L#{blas_dir} #{$LDFLAGS}" unless blas_dir.nil?
+
+blas_lib = with_config('blas-lib')
+unless blas_lib.nil?
+ abort "#{blas_lib} not found." unless have_library(blas_lib)
+ $srcs.delete('blas.c')
+end
+
$VPATH << "$(srcdir)/src"
create_makefile('lbfgsb/lbfgsbext')