binary can be disabled
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 15 Jan 2010 06:06:33 +0000 (06:06 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 15 Jan 2010 06:06:33 +0000 (06:06 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/embryo@45169 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
m4/efl_binary.m4 [new file with mode: 0644]
src/bin/Makefile.am

index b7d5d11..cfdfaa2 100644 (file)
@@ -45,6 +45,8 @@ embryoincludedir="${datadir}/include"
 
 ### Additional options to configure
 
+EFL_ENABLE_BIN([embryo-cc])
+
 
 ### Checks for programs
 AC_PROG_CC
@@ -186,6 +188,8 @@ echo "------------------------------------------------------------------------"
 echo
 echo "Configuration Options Summary:"
 echo
+echo "  Build embryo_cc......: $have_embryo_cc"
+echo
 echo "  Documentation........: ${build_doc}"
 echo
 echo "Compilation............: make (or gmake)"
diff --git a/m4/efl_binary.m4 b/m4/efl_binary.m4
new file mode 100644 (file)
index 0000000..0fe85ab
--- /dev/null
@@ -0,0 +1,44 @@
+dnl Copyright (C) 2010 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 a binary is built or not
+
+dnl Usage: EFL_ENABLE_BIN(binary)
+dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being tranformed into _)
+dnl Define have_binary (- is tranformed into _)
+dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being tranformed into _)
+
+AC_DEFUN([EFL_ENABLE_BIN],
+[
+
+m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
+m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl
+
+have_[]m4_defn([DOWN])="yes"
+
+dnl configure option
+
+AC_ARG_ENABLE([$1],
+   [AC_HELP_STRING([--disable-$1], [disable building of ]DOWN)],
+   [
+    if test "x${enableval}" = "xyes" ; then
+       have_[]m4_defn([DOWN])="yes"
+    else
+       have_[]m4_defn([DOWN])="no"
+    fi
+   ])
+
+AC_MSG_CHECKING([whether to build ]DOWN[ binary])
+AC_MSG_RESULT([$have_[]m4_defn([DOWN])])
+
+if test "x$have_[]m4_defn([DOWN])" = "xyes"; then
+   UP[]_PRG=DOWN[${EXEEXT}]
+fi
+
+AC_SUBST(UP[]_PRG)
+
+AM_CONDITIONAL(BUILD_[]UP, test "x$have_[]m4_defn([DOWN])" = "xyes")
+
+AS_IF([test "x$have_[]m4_defn([DOWN])" = "xyes"], [$2], [$3])
+
+])
index d918be5..335b7a5 100644 (file)
@@ -11,7 +11,8 @@ AM_CPPFLAGS = \
 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
 @EVIL_CFLAGS@
 
-bin_PROGRAMS = embryo_cc
+bin_PROGRAMS = @EMBRYO_CC_PRG@
+EXTRA_PROGRAMS = embryo_cc
 
 embryo_cc_SOURCES = \
 embryo_cc_amx.h \