Commit 13367fc4 authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Carlos Garnacho

Add macro to enable compile warnings. call it. Add WARN_CFLAGS to

2008-12-16  Carlos Garnacho  <carlos@imendio.com>

        * acinclude.m4: Add macro to enable compile warnings.
        * configure.ac: call it.
        * src/*/Makefile.am: Add WARN_CFLAGS to INCLUDES.

svn path=/trunk/; revision=2718
parent 46446e70
2008-12-16 Carlos Garnacho <carlos@imendio.com>
* acinclude.m4: Add macro to enable compile warnings.
* configure.ac: call it.
* src/*/Makefile.am: Add WARN_CFLAGS to INCLUDES.
2008-12-16 Martyn Russell <martyn@imendio.com>
* src/trackerd/tracker-monitor.c: Fixed a compiler warning and
......
......@@ -90,3 +90,68 @@ x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
m4_ifvaln([$5],[else $5])dnl
fi
]) dnl AX_COMPARE_VERSION
dnl #########################################################################
dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
AC_DEFUN([IDT_COMPILE_WARNINGS],[
if test -f $srcdir/autogen.sh; then
default_compile_warnings="error"
else
default_compile_warnings="no"
fi
AC_ARG_WITH(compile-warnings,
AS_HELP_STRING([--with-compile-warnings=@<:@no/yes/error@:>@],
[Compiler warnings]),
[enable_compile_warnings="$withval"],
[enable_compile_warnings="$default_compile_warnings"])
warnCFLAGS=
if test "x$GCC" != xyes; then
enable_compile_warnings=no
fi
warning_flags=
realsave_CFLAGS="$CFLAGS"
case "$enable_compile_warnings" in
no)
warning_flags=
;;
yes)
warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
;;
maximum|error)
warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
CFLAGS="$warning_flags $CFLAGS"
for option in -Wno-sign-compare -Wno-pointer-sign; do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
has_option=no,)
CFLAGS="$SAVE_CFLAGS"
AC_MSG_RESULT($has_option)
if test $has_option = yes; then
warning_flags="$warning_flags $option"
fi
unset has_option
unset SAVE_CFLAGS
done
unset option
if test "$enable_compile_warnings" = "error" ; then
warning_flags="$warning_flags -Werror"
fi
;;
*)
AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
;;
esac
CFLAGS="$realsave_CFLAGS"
AC_MSG_CHECKING(what warning flags to pass to the C compiler)
AC_MSG_RESULT($warning_flags)
WARN_CFLAGS="$warning_flags"
AC_SUBST(WARN_CFLAGS)
]) dnl IDT_COMPILE_WARNINGS
......@@ -40,6 +40,8 @@ AC_CONFIG_SRCDIR([src/trackerd/tracker-main.c])
AM_INIT_AUTOMAKE(no-define)
AM_CONFIG_HEADER(config.h)
IDT_COMPILE_WARNINGS
TRACKER_MAJOR_VERSION=tracker_major_version
TRACKER_MINOR_VERSION=tracker_minor_version
TRACKER_MICRO_VERSION=tracker_micro_version
......
......@@ -5,6 +5,7 @@ INCLUDES = \
-DG_LOG_DOMAIN=\"Tracker\" \
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(HAL_CFLAGS) \
$(DBUS_CFLAGS) \
$(UNAC_CFLAGS) \
......
......@@ -5,6 +5,7 @@ INCLUDES = \
-DG_LOG_DOMAIN=\"Tracker\" \
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(DBUS_CFLAGS) \
$(RAPTOR_CFLAGS) \
$(GLIB2_CFLAGS)
......
......@@ -5,6 +5,7 @@ INCLUDES = \
-DG_LOG_DOMAIN=\"Tracker\" \
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(QDBM_CFLAGS) \
$(DBUS_CFLAGS) \
......
......@@ -4,6 +4,7 @@ INCLUDES = \
-DLOCALEDIR=\""$(localedir)"\" \
-DG_LOG_DOMAIN=\"Tracker\" \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(GLIB2_CFLAGS) \
$(DBUS_CFLAGS)
......
......@@ -5,6 +5,7 @@ INCLUDES = \
-DLOCALEDIR=\""$(localedir)"\" \
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(TRACKER_APPLET_CFLAGS) \
$(LIBGLADE_CFLAGS)
......
......@@ -4,7 +4,6 @@ module_flags = -module -avoid-version -no-undefined
indexer_modulesdir = $(libdir)/tracker/indexer-modules
INCLUDES = \
-Wall \
-DSHAREDIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DLOCALEDIR=\""$(localedir)"\" \
......@@ -13,6 +12,7 @@ INCLUDES = \
-D_GNU_SOURCE \
-DTRACKER_COMPILATION \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(GMODULE_CFLAGS) \
$(GIO_CFLAGS) \
$(GLIB2_CFLAGS) \
......
......@@ -330,11 +330,8 @@ set_metadata (const gchar *key, const gchar *value, gpointer user_data)
g_free (statement);
}
#endif
/* TODO URI branch: path -> uri */
#ifdef HAVE_RAPTOR
static void
foreach_in_metadata_set_metadata (TrackerField *field,
gpointer value,
......@@ -354,7 +351,7 @@ foreach_in_metadata_set_metadata (TrackerField *field,
}
}
#endif
#endif /* HAVE_RAPTOR */
void
tracker_removable_device_add_metadata (TrackerIndexer *indexer,
......
......@@ -15,6 +15,7 @@ INCLUDES = \
-DTRACKER_BINDIR=\""$(bindir)"\" \
-DTRACKER_LIBEXECDIR=\""$(libexecdir)"\" \
-DTRACKER_COMPILATION \
$(WARN_CFLAGS) \
$(LIBGLADE_CFLAGS) \
$(GTK2_CFLAGS) \
$(DBUS_CFLAGS) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment