+
+# -----------------------------------------------------------
+# Error flags
+# -----------------------------------------------------------
+AS_COMPILER_FLAG(-Wall, ERROR_CFLAGS="-Wall", ERROR_CFLAGS="")
+AS_COMPILER_FLAG(-Werror, werror=yes, werror=no)
+
+AC_ARG_ENABLE(Werror,
+ AC_HELP_STRING([--disable-Werror],[compile without -Werror (normally enabled in development builds)]),
+ werror=$enableval, :)
+
+AS_COMPILER_FLAG(-Wextra, wextra=yes, wextra=no)
+AS_COMPILER_FLAG(-Wno-missing-field-initializers,
+ wno_missing_field_initializers=yes,
+ wno_missing_field_initializers=no)
+AS_COMPILER_FLAG(-Wno-unused-parameter,
+ wno_unused_parameter=yes,
+ wno_unused_parameter=no)
+
+ifelse(empathy_released, 1, [],
+ [
+ if test x$werror = xyes; then
+ ERROR_CFLAGS="$ERROR_CFLAGS -Werror"
+ fi
+ if test x$wextra = xyes -a \
+ x$wno_missing_field_initializers = xyes -a \
+ x$wno_unused_parameter = xyes; then
+ ERROR_CFLAGS="$ERROR_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter"
+ fi
+ ])
+
+AS_COMPILER_FLAG(-Wdeclaration-after-statement, ERROR_CFLAGS="$ERROR_CFLAGS -Wdeclaration-after-statement")
+AS_COMPILER_FLAG(-Wshadow, ERROR_CFLAGS="$ERROR_CFLAGS -Wshadow")
+AS_COMPILER_FLAG(-Wmissing-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-prototypes")
+AS_COMPILER_FLAG(-Wmissing-declarations, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-declarations")
+# Disabled because some GTK+ headers (like gtkitemfactory.h) are bugged :(
+#AS_COMPILER_FLAG(-Wstrict-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wstrict-prototypes")
+
+AC_SUBST(ERROR_CFLAGS)
+
+# -----------------------------------------------------------
+# Enable TPL
+# -----------------------------------------------------------
+
+# It needs to be defined before PKG_CHECK_MODULES calls
+AC_ARG_ENABLE(tpl,
+ AC_HELP_STRING([--enable-tpl],[enable telepathy-logger code and disable the
+ empathy logger]), enable_tpl=$enableval, enable_tpl=no )
+AM_CONDITIONAL(ENABLE_TPL, test "x$enable_tpl" = "xyes")
+
+if test x${enable_tpl} = xyes; then
+ AC_DEFINE(ENABLE_TPL, [], [Enable TPL code])
+fi
+
+if test "x$enable_tpl" = "xyes"; then
+ PKG_CHECK_MODULES(TPL,
+ [
+ telepathy-logger = $TELEPATHY_LOGGER
+ ])
+ AC_SUBST(TPL_CFLAGS)
+ AC_SUBST(TPL_LIBS)
+fi
+
+