building
[libdbcli.git] / Jamrules.configure
blobd8ac943c062da45b4d4c00894b65f294c186c7ea
1 -configure-enable-disable-vars- +=
2     "postgres"  USE_PGSQL       "auto"  "use PostgreSQL"
3     "mysql"     USE_MYSQL       "auto"  "use MySQL"
4     "monetdb"   USE_MONETDB     "auto"  "use MonetDB"
5     "firebird"  USE_FBSQL       "auto"  "use Firebird"
8 rule -custom-pkg-find- {
9     local r ;
10     local cmd = [ Command "whereis -b $(2) | awk '{print $2}'" : parse-output ] ;
11     Echo 'checking for' $(1) '... ' : -n ;
12     if $(cmd) {
13         r = [ Command $(2) --version : exit-code no-output ] ;
14     }
15     if $(r) {
16         Echo 'found' ;
17         return 1 ;
18     }
19     Echo 'not found' ;
20     return 0 ;
23 rule -pkg-find- {
24     local r ;
25     Echo 'checking for' $(1) '... ' : -n ;
26     if [ Command pkg-config --exists $(1) : exit-code no-output ] == 0 {
27         Echo 'found' ;
28         return 1 ;
29     }
30     Echo ' not found' ;
31     return 0 ;
34 rule -configure-test-gmp- {
35     return [
36         -configure-test-compile-cc- "libgmp" :
37         "#include <gmp.h>"
38         "int main () {"
39         "mpz_t x;"
40         "mpz_init_set_str(x, "1234567", 10);"
41         "return 0;"
42         "}"
43         : : "-lgmp"
44     ] ;
47 rule -configure- {
48     if ! $(PREFIX) {
49         PREFIX = /usr/local ;
50     }
51     local pp = [ Command "echo $(PREFIX) | sed \"s/\\//\\\\\\\\\\\//g\"" : dummy ] ;
52     Command "sed -e \"s/@prefix/\\$(pp)/\" ./src/libdbcli.pc.in > ./src/libdbcli.pc" ;
53     -configure-pkg-config-necessary-
54         "libex"         "libex"
55         "uuid"          "uuid"
56     ;
57     HAVE_PGSQL = 'no' ;
58     PGSQL_VER = 'no' ;
59     if $(USE_PGSQL) {
60         if [ -custom-pkg-find- postgres : pg_config ] == 1 {
61             pg_include_dir = [ Command pg_config --includedir : parse-output no-space-break no-tab-break no-cr-break ] ;
62             -configure-add-line- "CFLAGS.all += -I$(pg_include_dir) ;" ;
63             pg_lib_dir = [ Command pg_config --libdir : parse-output no-space-break no-tab-break no-cr-break ] ;
64             -configure-add-line- "LINKLIBS.all += -L$(pg_lib_dir) -lpq -lpgtypes ;" ;
65             -configure-add-line- "SubInclude TOP src pg ;" ;
66             -configure-add-line- "SubInclude TOP include pg ;" ;
67             if [ -configure-test-gmp- ] == 1 {
68                 -configure-add-line- "LINKLIBS.all += -lgmp -lm ;" ;
69                 HAVE_PGSQL = 'yes' ;
70                 PGSQL_VER = [ Command pg_config --version : parse-output no-space-break no-tab-break no-cr-break ] ;
71                 if $(debug) {
72                     -configure-add-line- "SubInclude TOP test pg ;" ;
73                 }
74             } else {
75                 Exit "libgmp not found" ;
76             }
77         }
78     }
80     HAVE_MYSQL = 'no' ;
81     MYSQL_VER = 'no' ;
82     if $(USE_MYSQL) {
83         if [ -custom-pkg-find- mysql : mysql_config ] == 1 {
84             mysql_include_dir = [ Command mysql_config --include :  parse-output no-space-break no-tab-break no-cr-break ] ;
85             -configure-add-line- "CFLAGS.all += $(mysql_include_dir) ;" ;
86             mysql_libs = [ Command mysql_config --libs :  parse-output no-space-break no-tab-break no-cr-break ] ;
87             -configure-add-line- "LINKLIBS.all += $(mysql_libs) ;" ;
88             -configure-add-line- "SubInclude TOP src mysql ;" ;
89             -configure-add-line- "SubInclude TOP include mysql ;" ;
90             HAVE_MYSQL = 'yes' ;
91             MYSQL_VER = [ Command mysql_config --version :  parse-output no-space-break no-tab-break no-cr-break ] ;
92         }
93     }
94     
95     HAVE_MONETDB = 'no' ;
96     MONETDB_VER = 'no' ;
97     if $(USE_MONETDB) {
98         if [ -pkg-find- monetdb-mapi ] == 1 {
99             mdb_include = [ Command pkg-config --cflags monetdb-mapi : parse-output no-space-break no-tab-break no-cr-break ] ;
100             mdb_libs = [ Command pkg-config --libs monetdb-mapi : parse-output no-space-break no-tab-break no-cr-break ] ;
101             -configure-add-line- "CFLAGS.all += $(mdb_include) ;" ;
102             -configure-add-line- "LINKLIBS.all += $(mdb_libs) ;" ;
103             -configure-add-line- "SubInclude TOP src mdb ;" ;
104             -configure-add-line- "SubInclude TOP include mdb ;" ;
105             HAVE_MONETDB = 'yes' ;
106             MONETDB_VER = [ Command pkg-config --modversion monetdb-mapi : parse-output no-space-break no-tab-break no-cr-break ] ;
107             if $(debug) {
108                 -configure-add-line- "SubInclude TOP test mdb ;" ;
109             }
110         }
111     }
112     
113     HAVE_FBSQL = 'no' ;
114     FBSQL_VER = 'no' ;
115     if $(USE_FBSQL) {
116         if [ -custom-pkg-find- firebird : fb_config ] == 1 {
117             fbsql_cflags = [ Command fb_config --cflags :  parse-output no-space-break no-tab-break no-cr-break ] ;
118             fbsql_libs = [ Command fb_config --libs :  parse-output no-space-break no-tab-break no-cr-break ] ;
119             -configure-add-line- "CFLAGS.all += $(fbsql_cflags) ;" ;
120             -configure-add-line- "LINKLIBS.all += $(fbsql_libs) ;" ;
121             -configure-add-line- "SubInclude TOP src gds ;" ;
122             -configure-add-line- "SubInclude TOP include gds ;" ;
123             HAVE_FBSQL = 'yes' ;
124             FBSQL_VER = [ Command fb_config --version :  parse-output no-space-break no-tab-break no-cr-break ] ;
125             if $(debug) {
126                 -configure-add-line- "SubInclude TOP test gds ;" ;
127             }
128         }
129     }
131     if $(debug) {
132         -configure-add-line- "CFLAGS.all += -O0 -g3 ;" ;
133     } else {
134         -configure-add-line- "set-profile ;" ;
135     }
137     Command "$(TOP)/config.sh $(TOP) $(PREFIX) $(HAVE_PGSQL) $(HAVE_MYSQL) $(HAVE_MONETDB) $(HAVE_FBSQL)" ;
138     Echo ;
139     Echo 'Database interfaces:' ;
140     Echo '  PostgreSql    ' $(PGSQL_VER) ;
141     Echo '  MySql         ' $(MYSQL_VER) ;
142     Echo '  MonetDB       ' $(MONETDB_VER) ;
143     Echo '  Firebird      ' $(FBSQL_VER) ;
146 configure ;