diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-30 13:09:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-30 13:09:41 +0200 |
commit | 34de252300719b7afe05ef5de6414f0748759ff8 (patch) | |
tree | 42edaee86b23d086f35887c4165a2abfeaaecc69 /m4/sqlite.m4 | |
parent | 3e7e99c8ea5b06971af0b9789f5dfaa4b35955ed (diff) |
Autotools support for SQLite
Diffstat (limited to 'm4/sqlite.m4')
-rw-r--r-- | m4/sqlite.m4 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/m4/sqlite.m4 b/m4/sqlite.m4 new file mode 100644 index 0000000..de5503e --- /dev/null +++ b/m4/sqlite.m4 @@ -0,0 +1,61 @@ +dnl file : m4/sqlite.m4 +dnl author : Boris Kolpackov <boris@codesynthesis.com> +dnl copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +dnl license : GNU GPL v2; see accompanying LICENSE file +dnl +dnl SQLITE +dnl +AC_DEFUN([SQLITE], [ + +# Database file. +# +AC_MSG_CHECKING([for sqlite database file]) +AC_ARG_WITH( + [sqlite-db], + [AC_HELP_STRING([--with-sqlite-db=file], [SQLite database file (odb_test.db by default). Note that all data in this database WILL BE LOST!])], + [case $withval in + yes) + sqlite_db=odb_test.db + sqlite_db_set=yes + ;; + no) + sqlite_db_set=no + ;; + *) + sqlite_db=$withval + sqlite_db_set=yes + ;; + esac], + [sqlite_db=odb_test.db + sqlite_db_set=yes]) + +if test x$sqlite_db_set = xyes; then + + # Make it an absolute path unless it is one of the special values. + # + if test x$sqlite_db != x -a x$sqlite_db != x:memory:; then + AS_SET_CATFILE([abs_sqlite_db], [$ac_pwd], [$sqlite_db]) + sqlite_db=$abs_sqlite_db + fi + + AC_MSG_RESULT(['$sqlite_db']) +else + AC_MSG_RESULT([none]) +fi + +# Create options file. +# +AC_CONFIG_COMMANDS([sqlite.options], + [ + rm -f db.options + + if test x$sqlite_db_set = xyes; then + echo "--database '$sqlite_db'" >>db.options + fi + ], + [ + sqlite_db="$sqlite_db" + sqlite_db_set="$sqlite_db_set" + ]) + +])dnl |