1 dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
2 dnl That code is public domain and can be freely used or copied.
4 dnl Macro that check if a binary is built or not
6 dnl Usage: EFL_ENABLE_BIN(binary)
7 dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being tranformed into _)
8 dnl Define have_binary (- is tranformed into _)
9 dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being tranformed into _)
11 AC_DEFUN([EFL_ENABLE_BIN],
14 m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
15 m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl
17 have_[]m4_defn([DOWN])="yes"
22 [AC_HELP_STRING([--disable-$1], [disable building of ]DOWN)],
24 if test "x${enableval}" = "xyes" ; then
25 have_[]m4_defn([DOWN])="yes"
27 have_[]m4_defn([DOWN])="no"
31 AC_MSG_CHECKING([whether to build ]DOWN[ binary])
32 AC_MSG_RESULT([$have_[]m4_defn([DOWN])])
34 if test "x$have_[]m4_defn([DOWN])" = "xyes"; then
35 UP[]_PRG=DOWN[${EXEEXT}]
40 AM_CONDITIONAL(BUILD_[]UP, test "x$have_[]m4_defn([DOWN])" = "xyes")
42 AS_IF([test "x$have_[]m4_defn([DOWN])" = "xyes"], [$2], [$3])
47 dnl Macro that check if a binary is built or not
49 dnl Usage: EFL_WITH_BIN(package, binary, default_value)
50 dnl Call AC_SUBST(_binary) (_binary is the lowercase of binary, - being tranformed into _ by default, or the value set by the user)
52 AC_DEFUN([EFL_WITH_BIN],
55 m4_pushdef([DOWN], m4_translit([[$2]], [-A-Z], [_a-z]))dnl
60 [AC_HELP_STRING([--with-$2=PATH], [specify a specific path to ]DOWN[ @<:@default=$3@:>@])],
61 [_efl_with_binary=${withval}],
62 [_efl_with_binary=$(pkg-config --variable=prefix $1)/bin/$3])
64 DOWN=${_efl_with_binary}
65 AC_MSG_NOTICE(DOWN[ set to ${_efl_with_binary}])
67 with_binary_[]m4_defn([DOWN])=${_efl_with_binary}