66
77RbConfig ::MAKEFILE_CONFIG [ 'CC' ] = ENV [ 'CC' ] if ENV [ 'CC' ]
88
9-
10-
119ldflags = cppflags = nil
1210if RbConfig ::CONFIG [ "host_os" ] =~ /darwin/
1311 begin
14- brew_prefix = `brew --prefix sqlite3` . chomp
15- ldflags = "#{ brew_prefix } /lib"
16- cppflags = "#{ brew_prefix } /include"
17- pkg_conf = "#{ brew_prefix } /lib/pkgconfig"
12+ if with_config ( 'sqlcipher' )
13+ brew_prefix = `brew --prefix sqlcipher` . chomp
14+ ldflags = "#{ brew_prefix } /lib"
15+ cppflags = "#{ brew_prefix } /include/sqlcipher"
16+ pkg_conf = "#{ brew_prefix } /lib/pkgconfig"
17+ else
18+ brew_prefix = `brew --prefix sqlite3` . chomp
19+ ldflags = "#{ brew_prefix } /lib"
20+ cppflags = "#{ brew_prefix } /include"
21+ pkg_conf = "#{ brew_prefix } /lib/pkgconfig"
22+ end
1823
1924 # pkg_config should be less error prone than parsing compiler
2025 # commandline options, but we need to set default ldflags and cpp flags
2429 end
2530end
2631
27- pkg_config ( "sqlite3" )
32+ if with_config ( 'sqlcipher' )
33+ pkg_config ( "sqlcipher" )
34+ else
35+ pkg_config ( "sqlite3" )
36+ end
2837
2938# --with-sqlite3-{dir,include,lib}
30- dir_config ( "sqlite3" , cppflags , ldflags )
39+ if with_config ( 'sqlcipher' )
40+ $CFLAGS << ' -DUSING_SQLCIPHER'
41+ dir_config ( "sqlcipher" , cppflags , ldflags )
42+ else
43+ dir_config ( "sqlite3" , cppflags , ldflags )
44+ end
3145
3246if RbConfig ::CONFIG [ "host_os" ] =~ /mswin/
3347 $CFLAGS << ' -W3'
@@ -49,7 +63,12 @@ def asplode missing
4963
5064asplode ( 'sqlite3.h' ) unless find_header 'sqlite3.h'
5165find_library 'pthread' , 'pthread_create' # 1.8 support. *shrug*
52- asplode ( 'sqlite3' ) unless find_library 'sqlite3' , 'sqlite3_libversion_number'
66+
67+ if with_config ( 'sqlcipher' )
68+ asplode ( 'sqlcipher' ) unless find_library 'sqlcipher' , 'sqlite3_libversion_number'
69+ else
70+ asplode ( 'sqlite3' ) unless find_library 'sqlite3' , 'sqlite3_libversion_number'
71+ end
5372
5473# Functions defined in 1.9 but not 1.8
5574have_func ( 'rb_proc_arity' )
0 commit comments