From 7a1637982c05fac7bd262d28d4bd2261e2a41571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nirgal=20Vourg=C3=A8re?= Date: Fri, 28 Jun 2013 20:07:44 +0200 Subject: [PATCH] Fix build if yacc is missing --- configure.ac | 4 +++- src/gmdb2/file.c | 4 ++++ src/gmdb2/sql.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 9a6f5db..e5bc551 100644 --- a/configure.ac +++ b/configure.ac @@ -53,13 +53,15 @@ AC_MSG_RESULT( no - SQL engine disable); sql=false fi -if test "x$YACC" = "x"; then +if ! which $YACC > /dev/null; then sql=false fi if test "x$sql" = "xtrue"; then CFLAGS="$CFLAGS -DSQL" OPTDIRS="$OPTDIRS sql" +else + AC_MSG_WARN([Yacc is not available: SQL disabled.]) fi AM_CONDITIONAL(SQL, test x$sql = xtrue) diff --git a/src/gmdb2/file.c b/src/gmdb2/file.c index 423d36f..4666ba7 100644 --- a/src/gmdb2/file.c +++ b/src/gmdb2/file.c @@ -217,7 +217,9 @@ gmdb_file_open(gchar *file_path) gmdb_file_shuffle_recent(file_path); gmdb_file_add_recent(file_path); +#ifdef SQL sql->mdb = mdb; +#endif mdb_read_catalog(mdb, MDB_ANY); for (i = 0; i < MAX_ICONVIEWS; ++i) { @@ -271,5 +273,7 @@ gmdb_file_close_cb(GtkWidget *button, gpointer data) { gmdb_reset_widgets (gmdbwidgets); gmdb_debug_close_all(); +#if SQL gmdb_sql_close_all(); +#endif } diff --git a/src/gmdb2/sql.c b/src/gmdb2/sql.c index 1a52a1c..383b132 100644 --- a/src/gmdb2/sql.c +++ b/src/gmdb2/sql.c @@ -741,7 +741,7 @@ GtkTreeIter *iter2; void gmdb_sql_new_cb (GtkWidget *w, gpointer data) { - GtkWidget* dlg = gtk_message_dialog_new (gtk_widget_get_toplevel (w), + GtkWidget* dlg = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (w)), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("SQL support was not built.\nRun configure with the --enable-sql option.")); gtk_dialog_run (GTK_DIALOG (dlg));