edbus: Do not build examples by default
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Fri, 21 Sep 2012 22:44:05 +0000 (22:44 +0000)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Fri, 21 Sep 2012 22:44:05 +0000 (22:44 +0000)
It's weird to enable/disable the examples at configure time rather than
having a rule "make examples", but this appears to be how it's done in
EFL.

SVN revision: 77005

Makefile.am
configure.ac
m4/efl_examples.m4 [new file with mode: 0644]

index 6fe4f0a..30d2608 100644 (file)
@@ -78,6 +78,7 @@ libedbus2_la_SOURCES = \
        src/lib/edbus_service.c \
        src/lib/edbus_signal_handler.c
 
+if EFL_BUILD_EXAMPLES
 noinst_PROGRAMS = \
        src/examples/connman-list-services \
        src/examples/ofono-dial \
@@ -110,6 +111,7 @@ src_examples_server_LDADD = $(EXAMPLES_LIBS)
 
 src_examples_client_SOURCES = src/examples/client.c
 src_examples_client_LDADD = $(EXAMPLES_LIBS)
+endif
 
 .PHONY: doc
 
index e203746..3fde424 100644 (file)
@@ -79,6 +79,9 @@ PKG_CHECK_MODULES([EINA], [eina >= 1.7.0])
 PKG_CHECK_MODULES([ECORE], [ecore])
 PKG_CHECK_MODULES([DBUS], [dbus-1])
 
+### Build and install examples
+EFL_CHECK_BUILD_EXAMPLES([enable_build_examples="yes"], [enable_build_examples="no"])
+
 with_max_log_level="EINA_LOG_LEVEL_DBG"
 AC_ARG_WITH(maximum-log-level,
    [AC_HELP_STRING([--with-maximum-log-level=NUMBER],
diff --git a/m4/efl_examples.m4 b/m4/efl_examples.m4
new file mode 100644 (file)
index 0000000..2a809ad
--- /dev/null
@@ -0,0 +1,63 @@
+dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
+dnl That code is public domain and can be freely used or copied.
+
+dnl Macro that check if building examples is wanted.
+
+dnl Usage: EFL_CHECK_BUILD_EXAMPLES([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Defines the automake conditionnal EFL_ENABLE_BUILD_EXAMPLES
+
+AC_DEFUN([EFL_CHECK_BUILD_EXAMPLES],
+[
+
+dnl configure option
+
+AC_ARG_ENABLE([build-examples],
+   [AC_HELP_STRING([--enable-build-examples], [enable building examples @<:@default=disabled@:>@])],
+   [
+    if test "x${enableval}" = "xyes" ; then
+       _efl_enable_build_examples="yes"
+    else
+       _efl_enable_build_examples="no"
+    fi
+   ],
+   [_efl_enable_build_examples="no"])
+
+AC_MSG_CHECKING([whether examples are built])
+AC_MSG_RESULT([${_efl_enable_build_examples}])
+
+AM_CONDITIONAL(EFL_BUILD_EXAMPLES, test "x${_efl_enable_build_examples}" = "xyes")
+
+AS_IF([test "x$_efl_enable_build_examples" = "xyes"], [$1], [$2])
+])
+
+
+dnl Macro that check if installing examples is wanted.
+
+dnl Usage: EFL_CHECK_INSTALL_EXAMPLES([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Defines the automake conditionnal EFL_ENABLE_INSTALL_EXAMPLES
+
+AC_DEFUN([EFL_CHECK_INSTALL_EXAMPLES],
+[
+
+dnl configure option
+
+AC_ARG_ENABLE([install-examples],
+   [AC_HELP_STRING([--enable-install-examples], [enable installing example source files @<:@default=disabled@:>@])],
+   [
+    if test "x${enableval}" = "xyes" ; then
+       _efl_enable_install_examples="yes"
+    else
+       _efl_enable_install_examples="no"
+    fi
+   ],
+   [_efl_enable_install_examples="no"])
+
+AC_MSG_CHECKING([whether examples are installed])
+AC_MSG_RESULT([${_efl_enable_install_examples}])
+
+AM_CONDITIONAL(EFL_INSTALL_EXAMPLES, test "x${_efl_enable_install_examples}" = "xyes")
+
+AS_IF([test "x$_efl_enable_install_examples" = "xyes"], [$1], [$2])
+])
+
+dnl End of efl_examples.m4