1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#!/bin/sh
set -e
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR " 0 INT QUIT ABRT PIPE TERM
cd "$WORKDIR"
cat <<EOF > soci_test.cpp
#include <soci/soci.h>
#include <soci/mysql/soci-mysql.h>
#include <soci/postgresql/soci-postgresql.h>
#include <soci/sqlite3/soci-sqlite3.h>
#include <soci/firebird/soci-firebird.h>
#include <soci/odbc/soci-odbc.h>
#include <iostream>
using namespace soci;
backend_factory const &backend_mysql = *soci::factory_mysql();
backend_factory const &backend_pgsql = *soci::factory_postgresql();
backend_factory const &backend_sqlite3 = *soci::factory_sqlite3();
backend_factory const &backend_firebird = *soci::factory_firebird();
backend_factory const &backend_odbc = *soci::factory_odbc();
int main(int argc, char* argv[]) {
try {
soci::session sql_mysql(backend_mysql, "host=test.soci.invalid");
soci::session sql_pgsql(backend_pgsql, "host=test.soci.invalid");
soci::session sql_sqlite3(backend_sqlite3, "host=test.soci.invalid");
soci::session sql_firebird(backend_firebird, "host=test.soci.invalid");
soci::session sql_odbc(backend_odbc, "host=test.soci.invalid");
}
catch (soci_error const &e)
{
/* ignore errors, since if we get this far, we know we can compile
and link OK */
}
return 0;
}
EOF
CPPFLAGS="-I/usr/include/soci -I/usr/include/mysql -I/usr/include/postgresql \
-I/usr/include/firebird"
#CXXFLAGS="-std=c++98"
LIBS="-lsoci_core -lsoci_mysql -lsoci_postgresql -lsoci_sqlite3 \
-lsoci_firebird -lsoci_odbc"
g++ ${CPPFLAGS} ${CXXFLAGS} -o soci_test soci_test.cpp ${LIBS}
echo "build: OK"
[ -x soci_test ]
./soci_test
echo "run: OK"
|