Add a flag to enable Dbus support (turn off by default)
[lxde/lxappearance.git] / configure.ac
index 015939b..1b90bc1 100644 (file)
@@ -4,16 +4,16 @@
 prog_name = lxappearance
 
 AC_PREREQ([2.63])
-AC_INIT([lxappearance], [0.5.0], [http://lxde.org/])
+AC_INIT([lxappearance], [0.5.1], [http://lxde.org/])
 AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
-AM_MAINTAINER_MODE
-
-AC_CONFIG_HEADERS([config.h])
-
 # Support silent build rules. Disable by either passing --disable-silent-rules
 # to configure or passing V=1 to make
 AM_SILENT_RULES([yes])
 
+AM_MAINTAINER_MODE
+
+AC_CONFIG_HEADERS([config.h])
+
 # Checks for programs.
 AC_PROG_CC
 # AM_PROG_LIBTOOL
@@ -31,21 +31,60 @@ AC_HEADER_STDC
 IT_PROG_INTLTOOL([0.40.0])
 
 AC_ARG_ENABLE(man,
-       [AC_HELP_STRING([--enable-man],
-               [regenerate roff man pages from Docbook @<:@default=no@:>@])],
-       [enable_man="${enableval}"],
-       [enable_man=no]
+AS_HELP_STRING([--enable-man],[regenerate roff man pages from Docbook @<:@default=yes@:>@]),
+[case "${enableval}" in
+  yes)  enable_man=yes ;;
+  no)   enable_man=no ;;
+  *) AC_MSG_ERROR([bad value "${enableval}" for --enable-man, use "yes" (default) or "no".]) ;;
+esac],[])
+
+AC_ARG_ENABLE(more_warnings,
+       [AS_HELP_STRING([--enable-more-warnings],
+               [Add more warnings @<:@default=no@:>@])],
+       [enable_more_warnings="${enableval}"],
+       [enable_more_warnings=no]
 )
 
+AC_ARG_ENABLE(gtk3,
+AS_HELP_STRING([--enable-gtk3],[enable to use gtk-3.0 instead of gtk-2.0]),
+[case "${enableval}" in
+  yes)  enable_gtk3=yes ;;
+  no)   enable_gtk3=no ;;
+  *) AC_MSG_ERROR([bad value "${enableval}" for --enable-gtk3, use "yes" (default) or "no".]) ;;
+esac],[])
+
 PKG_CHECK_MODULES(XLIB, "x11")
 AC_SUBST(XLIB_CFLAGS)
 AC_SUBST(XLIB_LIBS)
 
-gtk_modules="gtk+-2.0 >= 2.12.0 gthread-2.0"
+if test "x$enable_gtk3" = "xyes" ; then
+  CFLAGS="$CFLAGS -DENABLE_GTK3"
+  gtk_modules="gtk+-3.0 >= 3.0.0"
+else
+  gtk_modules="gtk+-2.0 >= 2.12.0 gthread-2.0"
+fi
+
 PKG_CHECK_MODULES(GTK, [$gtk_modules])
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
+AC_ARG_ENABLE(dbus,
+       [AS_HELP_STRING([--enable-dbus],
+               [Use Dbus support (usefull for lxsession > 0.4.9) @<:@default=no@:>@])],
+       [enable_dbus="${enableval}"],
+       [enable_dbus=no]
+)
+
+
+if test x"$enable_dbus" = x"yes"; then
+       PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.95 dbus-glib-1 >= 0.70])
+       CFLAGS="$CFLAGS -DENABLE_DBUS"
+fi
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
+
+
+
 gmodule_modules="gmodule-export-2.0"
 PKG_CHECK_MODULES(GMODULE, [$gmodule_modules])
 AC_SUBST(GMODULE_CFLAGS)
@@ -61,14 +100,13 @@ AC_SUBST(GMODULE_LIBS)
 # AC_SUBST(MENU_CACHE_CFLAGS)
 # AC_SUBST(MENU_CACHE_LIBS)
 
-# Pass --enable-maintainer-mode to enable more CFLAGS
-if test "$USE_MAINTAINER_MODE" = "yes"; then
+if test x"$enable_more_warnings" = x"yes"; then
   ADDITIONAL_FLAGS="-Wall -Werror=all -Werror=format -Werror=implicit-function-declaration -Werror=implicit-int -Werror=missing-braces -Werror=parentheses -Werror=return-type -Werror=strict-aliasing -Werror=switch -Wuninitialized -Werror=unused-label -Werror=unused-value -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Werror=missing-declarations -Wredundant-decls -Wmissing-noreturn -Wpointer-arith -Wcast-align -Wwrite-strings -Werror=inline -Werror=format-nonliteral -Wformat-nonliteral -Werror=format-security -Wformat-security -Winit-self -Werror=missing-include-dirs -Werror=undef -Werror=aggregate-return -Wmissing-format-attribute -Werror=nested-externs -fno-strict-aliasing -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
 fi
 AC_SUBST(ADDITIONAL_FLAGS)
 
 AC_ARG_ENABLE(man,
-       [AC_HELP_STRING([--enable-man],
+       [AS_HELP_STRING([--enable-man],
                [regenerate roff man pages from Docbook @<:@default=no@:>@])],
        [enable_man="${enableval}"],
        [enable_man=no]
@@ -110,7 +148,7 @@ if test x"$enable_man" = x"yes"; then
                [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
 fi
 
-AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
+AM_CONDITIONAL(ENABLE_MAN, test "x$enable_man" != "xno")
 
 AC_CONFIG_FILES([
     Makefile
@@ -138,6 +176,7 @@ else
     echo lxappearance....................... : Version $VERSION
     echo
     echo Enable debug....................: "$enable_debug"
+    echo Enable Dbus support.............: "$enable_dbus"
     echo Prefix..........................: $prefix
     echo
     echo The binary will be installed in $prefix/bin