ecore/examples - Add support for building and installing examples.
authorantognolli <antognolli@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 21 Jun 2011 17:14:19 +0000 (17:14 +0000)
committerantognolli <antognolli@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 21 Jun 2011 17:14:19 +0000 (17:14 +0000)
Also move them from ecore/examples to ecore/src/examples, to match the other
libraries organization.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@60556 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

12 files changed:
Makefile.am
configure.ac
doc/Doxyfile.in
m4/efl_examples.m4 [new file with mode: 0644]
src/Makefile.am
src/examples/Makefile.am [new file with mode: 0644]
src/examples/client_bench.c [moved from examples/client_bench.c with 100% similarity]
src/examples/ecore_con_client_example.c [moved from examples/ecore_con_client_example.c with 100% similarity]
src/examples/ecore_con_server_example.c [moved from examples/ecore_con_server_example.c with 100% similarity]
src/examples/ecore_fd_handler_example.c [moved from examples/ecore_fd_handler_example.c with 100% similarity]
src/examples/ecore_file_download_example.c [moved from examples/ecore_file_download_example.c with 100% similarity]
src/examples/server_bench.c [moved from examples/server_bench.c with 100% similarity]

index d05ddcf..236341e 100644 (file)
@@ -93,8 +93,6 @@ ecore-input.pc.in \
 ecore-wince.pc.in \
 ecore.spec.in \
 ecore.spec \
-examples/ecore_con_server_example.c \
-examples/ecore_con_client_example.c \
 m4/ac_abstract_socket.m4 \
 m4/ac_attribute.m4 \
 m4/check_x_extension.m4 \
index 74dc0ec..853bdad 100644 (file)
@@ -1378,6 +1378,11 @@ ECORE_EVAS_CHECK_MODULE([software-16-wince],
    [${have_ecore_wince}],
    [requirements_ecore_evas="ecore-wince >= 1.0.0 ${requirements_ecore_evas}"])
 
+### install and build examples
+
+EFL_CHECK_BUILD_EXAMPLES([enable_build_examples="yes"], [enable_build_examples="no"])
+EFL_CHECK_INSTALL_EXAMPLES([enable_install_examples="yes"], [enable_install_examples="no"])
+
 ### requirements
 
 AC_SUBST(requirements_ecore)
@@ -1442,6 +1447,7 @@ src/lib/ecore_wince/Makefile
 src/lib/ecore_x/Makefile
 src/lib/ecore_x/xlib/Makefile
 src/lib/ecore_x/xcb/Makefile
+src/examples/Makefile
 src/tests/Makefile
 README
 ecore.spec
index 79d731a..800c4bb 100644 (file)
@@ -82,7 +82,7 @@ EXCLUDE                = @top_srcdir@/src/lib/ecore_config/* @top_srcdir@/src/li
 EXCLUDE_SYMLINKS       = NO
 EXCLUDE_PATTERNS       = ecore_config* Ecore_Config*
 EXCLUDE_SYMBOLS        = Ecore_Config*
-EXAMPLE_PATH           = @top_srcdir@/examples/
+EXAMPLE_PATH           = @top_srcdir@/src/examples/
 EXAMPLE_PATTERNS       =
 EXAMPLE_RECURSIVE      = YES
 IMAGE_PATH             = img
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
index a6fc38f..d98d3b6 100644 (file)
@@ -1,3 +1,3 @@
 MAINTAINERCLEANFILES = Makefile.in
 
-SUBDIRS = lib bin tests
+SUBDIRS = lib bin tests examples
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
new file mode 100644 (file)
index 0000000..ea1964e
--- /dev/null
@@ -0,0 +1,34 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+pkglibdir = $(datadir)/$(PACKAGE)/examples
+
+AM_CPPFLAGS = \
+-I. \
+-I$(top_srcdir)/src/lib/ecore \
+@GLIB_CFLAGS@ @EVIL_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@
+
+LDADD = \
+       $(top_builddir)/src/lib/ecore/libecore.la \
+       @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm
+
+SRCS = \
+       client_bench.c \
+       server_bench.c \
+       ecore_con_client_example.c \
+       ecore_con_server_example.c \
+       ecore_fd_handler_example.c \
+       ecore_file_download_example.c
+
+EXTRA_DIST = $(SRCS)
+
+pkglib_PROGRAMS =
+
+if EFL_INSTALL_EXAMPLES
+filesdir = $(datadir)/$(PACKAGE)/examples
+files_DATA = $(SRCS)
+endif
+
+if EFL_BUILD_EXAMPLES
+pkglib_PROGRAMS +=
+endif
+