summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-18 13:48:14 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-18 13:48:14 +0000
commitdb38bdd6de782b880ab03c1c4217823d30d5eae0 (patch)
tree1df90ff44139e1f1528f8d9af4ad8dc48cfddec1 /m4
parentac4df627f71e4dfc331ef48027fc48b52227a6f1 (diff)
cosmetic: simplify and colorize features.
EFL_ADD_FEATURE(PKG, NAME, [VALUE]) will do an amazing work to produce colored output in a standard way. if value == yes, it's green and shows "+name" if value == no, it's red and shows "-name" else it shows cyan and shows "name=value" if not provided, will use ${have_name:-${want_name}} SVN revision: 82976
Diffstat (limited to 'm4')
-rw-r--r--m4/ecore_check_module.m460
-rw-r--r--m4/efl.m469
-rw-r--r--m4/evas_check_engine.m419
-rw-r--r--m4/evas_check_loader.m418
4 files changed, 90 insertions, 76 deletions
diff --git a/m4/ecore_check_module.m4 b/m4/ecore_check_module.m4
index 2aa38c3589..784b523e89 100644
--- a/m4/ecore_check_module.m4
+++ b/m4/ecore_check_module.m4
@@ -1,56 +1,6 @@
1dnl use: ECORE_CHECK_MODULE(Foo, default-enabled, description[, dependency[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
2AC_DEFUN([ECORE_CHECK_MODULE],
3[
4m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
5m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl
6
7have_ecore_[]m4_defn([DOWN])=no
8ecore_[]m4_defn([DOWN])[]_cflags=
9ecore_[]m4_defn([DOWN])[]_libs=
10want_module=$2
11
12AC_ARG_ENABLE(ecore-$1,
13 [AC_HELP_STRING(
14 [--enable-ecore-$1],
15 [enable the ecore_]m4_defn([DOWN])[ module])],
16 [
17 if test "x${enableval}" = "xyes" ; then
18 want_module="yes"
19 else
20 want_module="no"
21 fi
22 ],
23 [])
24
25AC_MSG_CHECKING([whether Ecore_$3 module is to be built])
26
27if test "x${want_module}" = "xyes" ; then
28 if test "x$4" = "x" || test "x$4" = "xyes" ; then
29 AC_DEFINE([BUILD_ECORE_]m4_defn([UP]), [1], [Build Ecore_$3 Module])
30 have_ecore_[]m4_defn([DOWN])="yes"
31 ecore_[]m4_defn([DOWN])[]_libs="-lecore_[]m4_defn([DOWN])"
32 AC_MSG_RESULT([yes])
33 else
34 AC_MSG_RESULT([no (dependency failed)])
35 fi
36else
37 AC_MSG_RESULT([no])
38fi
39
40AM_CONDITIONAL([BUILD_ECORE_]UP, [test "x$have_ecore_]DOWN[" = "xyes"])
41
42AS_IF([test "x$have_ecore_[]m4_defn([DOWN])" = "xyes"], [$5], [$6])
43
44AC_SUBST(ecore_[]m4_defn([DOWN])[]_cflags)
45AC_SUBST(ecore_[]m4_defn([DOWN])[]_libs)
46
47m4_popdef([UP])
48m4_popdef([DOWN])
49])
50
51dnl use: ECORE_EVAS_MODULE(name, want, [DEPENDENCY-CHECK-CODE]) 1dnl use: ECORE_EVAS_MODULE(name, want, [DEPENDENCY-CHECK-CODE])
52AC_DEFUN([ECORE_EVAS_MODULE], 2AC_DEFUN([ECORE_EVAS_MODULE],
53[ 3[dnl
54m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl 4m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
55m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl 5m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl
56 6
@@ -66,8 +16,8 @@ if test "x$have_ecore_evas" = "xyes"; then
66 fi 16 fi
67fi 17fi
68 18
69AM_CONDITIONAL([BUILD_ECORE_EVAS_]UP, [test "x$have_ecore_evas_]m4_defn([DOWN])[" = "xyes"]) 19EFL_ADD_FEATURE([ECORE_EVAS], [$1], [${want_module}])dnl
70 20AM_CONDITIONAL([BUILD_ECORE_EVAS_]UP, [test "x$have_ecore_evas_]m4_defn([DOWN])[" = "xyes"])dnl
71m4_popdef([UP]) 21m4_popdef([UP])dnl
72m4_popdef([DOWN]) 22m4_popdef([DOWN])dnl
73]) 23])
diff --git a/m4/efl.m4 b/m4/efl.m4
index 896eac3862..8db34ba042 100644
--- a/m4/efl.m4
+++ b/m4/efl.m4
@@ -33,6 +33,43 @@ m4_define([def_build_profile], m4_if($4, dev, [dev], [release]))dnl
33m4_define([efl_version], m4_if($4, dev, [v_maj.v_min.v_mic.v_rev], [v_maj.v_min.v_mic]))dnl 33m4_define([efl_version], m4_if($4, dev, [v_maj.v_min.v_mic.v_rev], [v_maj.v_min.v_mic]))dnl
34]) 34])
35 35
36dnl EFL_COLOR
37dnl will check if terminal supports color and if color is wanted by user.
38dnl
39dnl Used Variables:
40dnl WANT_COLOR: if no, forces no color output.
41dnl TERM: used to check if color should be enabled.
42dnl
43dnl Defined Variables:
44dnl COLOR_YES: to be used in positive/yes conditions
45dnl COLOR_NO: to be used in negative/no conditions
46dnl COLOR_OTHER: to be used to highlight some other condition
47dnl COLOR_RESET: to reset color
48dnl want_color: yes or no
49AC_DEFUN([EFL_COLOR],
50[dnl
51case "$TERM" in
52 xterm|xterm-color|Eterm|aterm|kterm|rxvt*|screen|gnome|interix)
53 want_color="${WANT_COLOR:-yes}"
54 ;;
55 *)
56 want_color="no"
57 ;;
58esac
59
60if test "${want_color}" = "yes"; then
61 COLOR_YES=`echo -e "\033@<:@1;32m"`
62 COLOR_NO=`echo -e "\033@<:@1;31m"`
63 COLOR_OTHER=`echo -e "\033@<:@1;36m"`
64 COLOR_RESET=`echo -e "\033@<:@0m"`
65else
66 COLOR_YES=""
67 COLOR_NO=""
68 COLOR_OTHER=""
69 COLOR_RESET=""
70fi
71])
72
36dnl EFL_INIT() 73dnl EFL_INIT()
37dnl Will AC_DEFINE() the following: 74dnl Will AC_DEFINE() the following:
38dnl VMAJ = v_maj 75dnl VMAJ = v_maj
@@ -51,6 +88,7 @@ dnl lt_rev = libtool 'revision' field of libtool's -version-info
51dnl lt_age = libtool 'age' field of libtool's -version-info 88dnl lt_age = libtool 'age' field of libtool's -version-info
52AC_DEFUN([EFL_INIT], 89AC_DEFUN([EFL_INIT],
53[dnl 90[dnl
91AC_REQUIRE([EFL_COLOR])dnl
54AC_DEFINE_UNQUOTED([VMAJ], [v_maj], [Major version])dnl 92AC_DEFINE_UNQUOTED([VMAJ], [v_maj], [Major version])dnl
55AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])dnl 93AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])dnl
56AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])dnl 94AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])dnl
@@ -378,3 +416,34 @@ AM_CONDITIONAL([HAVE_]m4_defn([UP]), [test "$efl_lib_optional_[]m4_defn([DOWN])"
378m4_popdef([UP])dnl 416m4_popdef([UP])dnl
379m4_popdef([DOWN])dnl 417m4_popdef([DOWN])dnl
380]) 418])
419
420dnl EFL_ADD_FEATURE(PKG, NAME, [VALUE])
421dnl if VALUE is not specified, will use ${have_name} instead.
422dnl
423dnl Defined Variables:
424dnl features_pkg
425AC_DEFUN([EFL_ADD_FEATURE],
426[dnl
427m4_pushdef([DOWNPKG], m4_translit([$1], [-A-Z], [_a-z]))dnl
428m4_pushdef([DOWNNAME], m4_translit([$2], [-A-Z], [_a-z]))dnl
429
430value="m4_if($3, , [${have_]m4_defn([DOWNNAME])[:-${want_]m4_defn([DOWNNAME])[}}], [$3])"
431case "${value}" in
432 yes)
433 tmp="${COLOR_YES}+$2${COLOR_RESET}"
434 ;;
435 no)
436 tmp="${COLOR_NO}-$2${COLOR_RESET}"
437 ;;
438 *)
439 tmp="${COLOR_OTHER}$2=${value}${COLOR_RESET}"
440 ;;
441esac
442if test -z "${features_[]m4_defn([DOWNPKG])}"; then
443 features_[]m4_defn([DOWNPKG])="${tmp}"
444else
445 features_[]m4_defn([DOWNPKG])="${features_[]m4_defn([DOWNPKG])} ${tmp}"
446fi
447m4_popdef([DOWNNAME])dnl
448m4_popdef([DOWNPKG])dnl
449])
diff --git a/m4/evas_check_engine.m4 b/m4/evas_check_engine.m4
index 90d4b528c4..c37e550ac6 100644
--- a/m4/evas_check_engine.m4
+++ b/m4/evas_check_engine.m4
@@ -560,7 +560,7 @@ dnl will call DEPENDENCY-CHECK-CODE if it should be built,
560dnl if some dependency fail just call AC_MSG_ERROR() to abort. 560dnl if some dependency fail just call AC_MSG_ERROR() to abort.
561 561
562AC_DEFUN([EVAS_ENGINE], 562AC_DEFUN([EVAS_ENGINE],
563[ 563[dnl
564m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl 564m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
565m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl 565m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
566 566
@@ -595,16 +595,16 @@ AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "${want_static_engine}" = "yes"])
595AC_SUBST([evas_engine_]m4_defn([DOWN])[_cflags]) 595AC_SUBST([evas_engine_]m4_defn([DOWN])[_cflags])
596AC_SUBST([evas_engine_]m4_defn([DOWN])[_libs]) 596AC_SUBST([evas_engine_]m4_defn([DOWN])[_libs])
597 597
598m4_popdef([UP]) 598EFL_ADD_FEATURE([EVAS_ENGINE], [$1], [${have_evas_engine_]DOWN[}])dnl
599m4_popdef([DOWN]) 599m4_popdef([UP])dnl
600m4_popdef([DOWN])dnl
600]) 601])
601 602
602 603
603 604
604dnl use: EVAS_CHECK_ENGINE(engine, want_engine, simple, description) 605dnl use: EVAS_CHECK_ENGINE(engine, want_engine, simple, description)
605AC_DEFUN([EVAS_CHECK_ENGINE], 606AC_DEFUN([EVAS_CHECK_ENGINE],
606[ 607[dnl
607
608m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl 608m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
609m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl 609m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
610 610
@@ -647,9 +647,8 @@ if test "x${want_static_engine}" = "xyes" ; then
647 have_static_module="yes" 647 have_static_module="yes"
648fi 648fi
649 649
650AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "x${want_static_engine}" = "xyes"]) 650EFL_ADD_FEATURE([EVAS_ENGINE], [$1], [${have_evas_engine_]DOWN[}])
651 651AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "x${want_static_engine}" = "xyes"])dnl
652m4_popdef([UP]) 652m4_popdef([UP])dnl
653m4_popdef([DOWN]) 653m4_popdef([DOWN])dnl
654
655]) 654])
diff --git a/m4/evas_check_loader.m4 b/m4/evas_check_loader.m4
index 54d0eac281..31d64e9695 100644
--- a/m4/evas_check_loader.m4
+++ b/m4/evas_check_loader.m4
@@ -422,13 +422,10 @@ AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4])
422]) 422])
423 423
424dnl use: EVAS_CHECK_IMAGE_LOADER(loader, want_loader, macro) 424dnl use: EVAS_CHECK_IMAGE_LOADER(loader, want_loader, macro)
425
426
427AC_DEFUN([EVAS_CHECK_IMAGE_LOADER], 425AC_DEFUN([EVAS_CHECK_IMAGE_LOADER],
428[ 426[dnl
429 427m4_pushdef([UP], m4_toupper([$1]))dnl
430m4_pushdef([UP], m4_toupper([$1])) 428m4_pushdef([DOWN], m4_tolower([$1]))dnl
431m4_pushdef([DOWN], m4_tolower([$1]))
432 429
433want_loader="$2" 430want_loader="$2"
434want_static_loader="no" 431want_static_loader="no"
@@ -469,9 +466,8 @@ if test "x${want_static_loader}" = "xyes" ; then
469 have_static_module="yes" 466 have_static_module="yes"
470fi 467fi
471 468
472AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "x${want_static_loader}" = "xyes"]) 469EFL_ADD_FEATURE([EVAS_LOADER], DOWN, [${have_evas_image_loader_]DOWN[}])dnl
473 470AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "x${want_static_loader}" = "xyes"])dnl
474m4_popdef([UP]) 471m4_popdef([UP])dnl
475m4_popdef([DOWN]) 472m4_popdef([DOWN])dnl
476
477]) 473])