4 if [ "$1" = "install" ]; then
5 PREFIX
=`cat bin/prefix`
12 INCPATH
="$PREFIX/include/odk"
19 mkdir
-p $ETCPATH/odkda2
22 echo "Installing: Libraries"
25 cp bin
/odkda-config
$PREFIX/bin
27 echo "Installing: Development Headers"
28 mkdir
-p $INCPATH/odkda
29 cp include
/odkda
/*.h
$INCPATH/odkda
/
30 cp include
/*.h
$INCPATH/
32 cp bin
/odkda.conf
$ETCPATH/odkda2
33 cp bin
/*.xml
$ETCPATH/odkda2
49 INCPATH
="$PREFIX/include/odk"
51 CONFFILE
="$ETCPATH/odkda.conf"
57 export CFLAGS
="-fPIC -g -Wall"
59 echo "Autoconfiguring (best guess)"
77 if (mysql_config
--libs 2>&1 >/dev
/null
); then
78 if (gcc mysqltest.c
`mysql_config --libs --cflags` -o mysqltest
2>/dev
/null
>/dev
/null
); then
79 echo " [Detected MySQL]"
81 DEFS
="$DEFS -D_USE_MYSQL"
108 if (gcc tdstest.c
-o tdstest
2>/dev
/null
>/dev
/null
); then
109 echo " [Detected FreeTDS]"
111 DEFS
="$DEFS -D_USE_TDS"
120 if (pkg-config
--silence-errors --libs sqlite
2>/dev
/null
>/dev
/null
); then
121 echo " [Detected SQLite]"
123 DEFS
="$DEFS -D_USE_SQLITE"
129 if (pkg-config
--silence-errors --libs sqlite3
2>/dev
/null
>/dev
/null
); then
130 echo " [Detected SQLite3]"
132 DEFS
="$DEFS -D_USE_SQLITE3"
137 #Test from PostgreSQL
138 if (pg_config
--libdir 2>/dev
/null
>/dev
/null
); then
139 echo " [Detected PostgreSQL]"
141 DEFS
="$DEFS -D_USE_POSTGRES"
146 if ( ls $ORACLE_HOME/rdbms
/public
/oci.h
2>/dev
/null
>/dev
/null
); then
147 echo " [Detected Oracle]"
149 DEFS
="$DEFS -D_USE_ORACLE"
154 echo $PREFIX > bin
/prefix
155 echo $ETCPATH > bin
/etc
156 echo "char *configs[2] = {\"$ETCPATH/odkda.conf\", \"odkda.conf\"};" >> config.h
157 echo "static char* PREFIX = \"$PREFIX\";" >> config.h
158 echo "static char* VERSION = \"$VERSION\";" >> config.h
159 echo "static char* INCPATH = \"$INCPATH\";" >> config.h
160 echo "static char* LIBPATH = \"$LIBPATH\";" >> config.h
161 echo "static char* ETCPATH = \"$ETCPATH\";" >> config.h
162 echo "static char* CONFFILE = \"$ETCPATH/odkda2/odkda.conf\";" >> config.h
165 export CFLAGS
="-fPIC -g"
166 export DIRS
='-I./include '
170 echo "Compiling ODKDA2"
172 echo " Compiling Sources"
173 gcc src
/provider.c
-I.
/include
-I.
/ -D_HAVE_CONFIG_ $CFLAGS `odkutils-config --cflags` -c -o bin
/provider.o
174 gcc src
/connection.c
-I.
/include
$CFLAGS `odkutils-config --cflags` -c -o bin
/connection.o
175 gcc src
/column.c
-I.
/include
$CFLAGS `odkutils-config --cflags` -c -o bin
/column.o
176 gcc src
/value.c
-I.
/include
$CFLAGS `odkutils-config --cflags` -c -o bin
/value.o
177 gcc src
/command.c
-I.
/include
$CFLAGS `odkutils-config --cflags` -c -o bin
/command.o
178 gcc src
/sqlcommand.c
-I.
/include
$CFLAGS `odkutils-config --cflags` -c -o bin
/sqlcommand.o
179 gcc src
/schema.c
-I.
/include
$CFLAGS `odkutils-config --cflags` -c -o bin
/schema.o
180 gcc src
/exts.c
-I.
/include
$CFLAGS `odkutils-config --cflags` -c -o bin
/exts.o
182 echo " Creating Library"
183 gcc bin
/provider.o bin
/connection.o bin
/column.o bin
/value.o bin
/command.o bin
/sqlcommand.o bin
/schema.o bin
/exts.o
`odkutils-config --libs --cflags` -shared -Wl,-soname,libodkda2.so
$CFLAGS -o bin
/libodkda2.so
185 echo " Compiling Plugins"
187 if [ $WITHMYSQL == "Yes" ]; then
189 gcc src
/plugins
/mysql.c
-I.
/include
-L.
/bin
-lodkda2 $CFLAGS -shared -Wl,-soname,libodkda2-mysql.so
`odkutils-config --libs --cflags` `mysql_config --libs --cflags` -o bin
/libodkda2-mysql.so
190 cp src
/plugins
/mysql.xml bin
/
193 if [ $WITHTDS == "Yes" ]; then
194 echo " * FreeTDS (MS SQL, Sybase)"
195 gcc src
/plugins
/tds.c
-I.
/include
-L.
/bin
-lodkda2 $CFLAGS -shared -Wl,-soname,libodkda2-tds.so
`odkutils-config --libs --cflags` -o bin
/libodkda2-tds.so
196 cp src
/plugins
/tds.xml bin
/
199 if [ $WITHPOSTGRES == "Yes" ]; then
201 gcc src
/plugins
/pgsql.c
-I.
/include
-L.
/bin
-lodkda2 -lpq $CFLAGS -shared -Wl,-soname,libodkda2-pgsql.so
`odkutils-config --libs --cflags` -I`pg_config --includedir` -L`pg_config --libdir` -o bin
/libodkda2-pgsql.so
202 cp src
/plugins
/pgsql.xml bin
/
205 if [ $WITHSQLITE3 == "Yes" ]; then
207 gcc src
/plugins
/sqlite3.c
-I.
/include
-L.
/bin
-lodkda2 $CFLAGS -shared -Wl,-soname,libodkda2-sqlite3.so
`odkutils-config --libs --cflags` `pkg-config --libs --cflags sqlite3` -o bin
/libodkda2-sqlite3.so
208 cp src
/plugins
/sqlite3.xml bin
/
211 echo " Creating odkda-config Script"
212 gcc src
/config.c
-fPIC -I.
/ -D_HAVE_CONFIG_ `odkutils-config --static --libs --cflags` -o bin
/odkda-config
216 .
/odkda-config
--rlocal $f