From 0213972e5be47d74a7bac64bf41c8a6cd09edf8f Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Thu, 9 Jun 2011 18:53:38 +0000 Subject: [PATCH] eina: add autotools rules to building and installing examples. SVN revision: 60150 --- legacy/eina/configure.ac | 7 ++++ legacy/eina/m4/efl_examples.m4 | 63 ++++++++++++++++++++++++++++++++++++ legacy/eina/src/Makefile.am | 2 +- legacy/eina/src/examples/Makefile.am | 29 +++++++++++++++++ 4 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 legacy/eina/m4/efl_examples.m4 create mode 100644 legacy/eina/src/examples/Makefile.am diff --git a/legacy/eina/configure.ac b/legacy/eina/configure.ac index ff95b3b..5ba540e 100644 --- a/legacy/eina/configure.ac +++ b/legacy/eina/configure.ac @@ -628,6 +628,10 @@ AM_CONDITIONAL([CITYHASH_BENCH], [test -n "$CXX" && test "x$enable_benchmark" = AC_SUBST(requirement_eina) +### Build and install 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"]) + ### Create the .pc.in file according to the major version #cat > ${srcdir}/eina-${VMAJ}.pc.in << EOF #prefix=@prefix@ @@ -664,6 +668,7 @@ src/modules/mp/fixed_bitmap/Makefile src/modules/mp/buddy/Makefile src/modules/mp/one_big/Makefile src/tests/Makefile +src/examples/Makefile ]) AC_OUTPUT @@ -700,6 +705,8 @@ echo echo " Documentation........: ${build_doc}" echo " Tests................: ${enable_tests}" echo " Coverage.............: ${enable_coverage}" +echo " Examples.............: ${enable_build_examples}" +echo " Examples installed...: ${enable_install_examples}" echo " Benchmark............: ${enable_benchmark}" if test "x${enable_benchmark}" = "xyes" ; then echo " Glib...............: ${enable_benchmark_glib}" diff --git a/legacy/eina/m4/efl_examples.m4 b/legacy/eina/m4/efl_examples.m4 new file mode 100644 index 0000000..2a809ad --- /dev/null +++ b/legacy/eina/m4/efl_examples.m4 @@ -0,0 +1,63 @@ +dnl Copyright (C) 2008 Vincent Torri +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 diff --git a/legacy/eina/src/Makefile.am b/legacy/eina/src/Makefile.am index 0a6b2a3..7ae5ce9 100644 --- a/legacy/eina/src/Makefile.am +++ b/legacy/eina/src/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = lib include modules tests +SUBDIRS = lib include modules tests examples MAINTAINERCLEANFILES = Makefile.in diff --git a/legacy/eina/src/examples/Makefile.am b/legacy/eina/src/examples/Makefile.am new file mode 100644 index 0000000..0167a2c --- /dev/null +++ b/legacy/eina/src/examples/Makefile.am @@ -0,0 +1,29 @@ +MAINTAINERCLEANFILES = Makefile.in + +pkglibdir = $(datadir)/$(PACKAGE)/examples + +AM_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/src/include \ +-I$(top_builddir)/src/include + +LDADD = \ + $(top_builddir)/src/lib/libeina.la + +SRCS = \ + eina_hash_01.c \ + eina_hash_02.c + +pkglib_PROGRAMS = + +if EFL_INSTALL_EXAMPLES +filesdir = $(datadir)/$(PACKAGE)/examples +files_DATA = $(SRCS) +endif + +if EFL_BUILD_EXAMPLES +pkglib_PROGRAMS += \ + eina_hash_01 \ + eina_hash_02 +endif + -- 2.7.4