diff options
author | Vincent Torri <vincent.torri@gmail.com> | 2012-09-17 16:35:38 +0000 |
---|---|---|
committer | Vincent Torri <vincent.torri@gmail.com> | 2012-09-17 16:35:38 +0000 |
commit | 8abaff3bdf53ecc7e605b82b12e385b8c0a02327 (patch) | |
tree | 4c828ae7083f724fd0214cf3624b20a7cf9448d2 /m4 | |
parent | 12732ab7ebcacad66352d3d48306e9945a4a584f (diff) |
merge: add eet
SVN revision: 76768
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ac_path_generic.m4 | 137 | ||||
-rw-r--r-- | m4/efl_binary.m4 | 79 | ||||
-rw-r--r-- | m4/efl_check_libs.m4 | 119 | ||||
-rw-r--r-- | m4/efl_compiler.m4 | 2 |
4 files changed, 336 insertions, 1 deletions
diff --git a/m4/ac_path_generic.m4 b/m4/ac_path_generic.m4 new file mode 100644 index 0000000000..d42724115f --- /dev/null +++ b/m4/ac_path_generic.m4 | |||
@@ -0,0 +1,137 @@ | |||
1 | dnl @synopsis AC_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | ||
2 | dnl | ||
3 | dnl Runs a LIBRARY-config script and defines LIBRARY_CFLAGS and LIBRARY_LIBS | ||
4 | dnl | ||
5 | dnl The script must support `--cflags' and `--libs' args. | ||
6 | dnl If MINIMUM-VERSION is specified, the script must also support the | ||
7 | dnl `--version' arg. | ||
8 | dnl If the `--with-library-[exec-]prefix' arguments to ./configure are given, | ||
9 | dnl it must also support `--prefix' and `--exec-prefix'. | ||
10 | dnl (In other words, it must be like gtk-config.) | ||
11 | dnl | ||
12 | dnl For example: | ||
13 | dnl | ||
14 | dnl AC_PATH_GENERIC(Foo, 1.0.0) | ||
15 | dnl | ||
16 | dnl would run `foo-config --version' and check that it is at least 1.0.0 | ||
17 | dnl | ||
18 | dnl If so, the following would then be defined: | ||
19 | dnl | ||
20 | dnl FOO_CFLAGS to `foo-config --cflags` | ||
21 | dnl FOO_LIBS to `foo-config --libs` | ||
22 | dnl | ||
23 | dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK) | ||
24 | dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount) | ||
25 | dnl | ||
26 | dnl @author Angus Lees <gusl@cse.unsw.edu.au> | ||
27 | |||
28 | AC_DEFUN([AC_PATH_GENERIC], | ||
29 | [dnl | ||
30 | dnl we're going to need uppercase, lowercase and user-friendly versions of the | ||
31 | dnl string `LIBRARY' | ||
32 | pushdef([UP], translit([$1], [a-z], [A-Z]))dnl | ||
33 | pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl | ||
34 | |||
35 | dnl | ||
36 | dnl Get the cflags and libraries from the LIBRARY-config script | ||
37 | dnl | ||
38 | AC_ARG_WITH(DOWN-prefix, | ||
39 | [ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)], | ||
40 | DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="") | ||
41 | AC_ARG_WITH(DOWN-exec-prefix, | ||
42 | [ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)], | ||
43 | DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="") | ||
44 | |||
45 | if test x$DOWN[]_config_exec_prefix != x ; then | ||
46 | DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix" | ||
47 | if test x${UP[]_CONFIG+set} != xset ; then | ||
48 | UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config | ||
49 | fi | ||
50 | fi | ||
51 | if test x$DOWN[]_config_prefix != x ; then | ||
52 | DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix" | ||
53 | if test x${UP[]_CONFIG+set} != xset ; then | ||
54 | UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config | ||
55 | fi | ||
56 | fi | ||
57 | |||
58 | AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no) | ||
59 | ifelse([$2], , | ||
60 | AC_MSG_CHECKING(for $1), | ||
61 | AC_MSG_CHECKING(for $1 - version >= $2) | ||
62 | ) | ||
63 | no_[]DOWN="" | ||
64 | if test "$UP[]_CONFIG" = "no" ; then | ||
65 | no_[]DOWN=yes | ||
66 | else | ||
67 | UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`" | ||
68 | UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`" | ||
69 | ifelse([$2], , ,[ | ||
70 | DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \ | ||
71 | --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'` | ||
72 | DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \ | ||
73 | --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'` | ||
74 | DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \ | ||
75 | --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'` | ||
76 | DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])" | ||
77 | DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])" | ||
78 | DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])" | ||
79 | |||
80 | # Compare wanted version to what config script returned. | ||
81 | # If I knew what library was being run, i'd probably also compile | ||
82 | # a test program at this point (which also extracted and tested | ||
83 | # the version in some library-specific way) | ||
84 | if test "$DOWN[]_config_major_version" -lt \ | ||
85 | "$DOWN[]_wanted_major_version" \ | ||
86 | -o \( "$DOWN[]_config_major_version" -eq \ | ||
87 | "$DOWN[]_wanted_major_version" \ | ||
88 | -a "$DOWN[]_config_minor_version" -lt \ | ||
89 | "$DOWN[]_wanted_minor_version" \) \ | ||
90 | -o \( "$DOWN[]_config_major_version" -eq \ | ||
91 | "$DOWN[]_wanted_major_version" \ | ||
92 | -a "$DOWN[]_config_minor_version" -eq \ | ||
93 | "$DOWN[]_wanted_minor_version" \ | ||
94 | -a "$DOWN[]_config_micro_version" -lt \ | ||
95 | "$DOWN[]_wanted_micro_version" \) ; then | ||
96 | # older version found | ||
97 | no_[]DOWN=yes | ||
98 | echo -n "*** An old version of $1 " | ||
99 | echo -n "($DOWN[]_config_major_version" | ||
100 | echo -n ".$DOWN[]_config_minor_version" | ||
101 | echo ".$DOWN[]_config_micro_version) was found." | ||
102 | echo -n "*** You need a version of $1 newer than " | ||
103 | echo -n "$DOWN[]_wanted_major_version" | ||
104 | echo -n ".$DOWN[]_wanted_minor_version" | ||
105 | echo ".$DOWN[]_wanted_micro_version." | ||
106 | echo "***" | ||
107 | echo "*** If you have already installed a sufficiently new version, this error" | ||
108 | echo "*** probably means that the wrong copy of the DOWN-config shell script is" | ||
109 | echo "*** being found. The easiest way to fix this is to remove the old version" | ||
110 | echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the" | ||
111 | echo "*** correct copy of DOWN-config. (In this case, you will have to" | ||
112 | echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf" | ||
113 | echo "*** so that the correct libraries are found at run-time)" | ||
114 | fi | ||
115 | ]) | ||
116 | fi | ||
117 | if test "x$no_[]DOWN" = x ; then | ||
118 | AC_MSG_RESULT(yes) | ||
119 | ifelse([$3], , :, [$3]) | ||
120 | else | ||
121 | AC_MSG_RESULT(no) | ||
122 | if test "$UP[]_CONFIG" = "no" ; then | ||
123 | echo "*** The DOWN-config script installed by $1 could not be found" | ||
124 | echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in" | ||
125 | echo "*** your path, or set the UP[]_CONFIG environment variable to the" | ||
126 | echo "*** full path to DOWN-config." | ||
127 | fi | ||
128 | UP[]_CFLAGS="" | ||
129 | UP[]_LIBS="" | ||
130 | ifelse([$4], , :, [$4]) | ||
131 | fi | ||
132 | AC_SUBST(UP[]_CFLAGS) | ||
133 | AC_SUBST(UP[]_LIBS) | ||
134 | |||
135 | popdef([UP]) | ||
136 | popdef([DOWN]) | ||
137 | ]) | ||
diff --git a/m4/efl_binary.m4 b/m4/efl_binary.m4 new file mode 100644 index 0000000000..fc2f200509 --- /dev/null +++ b/m4/efl_binary.m4 | |||
@@ -0,0 +1,79 @@ | |||
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. | ||
3 | |||
4 | dnl Macro that checks if a binary is built or not | ||
5 | |||
6 | dnl Usage: EFL_ENABLE_BIN(binary) | ||
7 | dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being transformed into _) | ||
8 | dnl Define have_binary (- is transformed into _) | ||
9 | dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being transformed into _) | ||
10 | |||
11 | AC_DEFUN([EFL_ENABLE_BIN], | ||
12 | [ | ||
13 | |||
14 | m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl | ||
15 | m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl | ||
16 | |||
17 | have_[]m4_defn([DOWN])="yes" | ||
18 | |||
19 | dnl configure option | ||
20 | |||
21 | AC_ARG_ENABLE([$1], | ||
22 | [AC_HELP_STRING([--disable-$1], [disable building of ]DOWN)], | ||
23 | [ | ||
24 | if test "x${enableval}" = "xyes" ; then | ||
25 | have_[]m4_defn([DOWN])="yes" | ||
26 | else | ||
27 | have_[]m4_defn([DOWN])="no" | ||
28 | fi | ||
29 | ]) | ||
30 | |||
31 | AC_MSG_CHECKING([whether to build ]DOWN[ binary]) | ||
32 | AC_MSG_RESULT([$have_[]m4_defn([DOWN])]) | ||
33 | |||
34 | if test "x$have_[]m4_defn([DOWN])" = "xyes"; then | ||
35 | UP[]_PRG=DOWN[${EXEEXT}] | ||
36 | fi | ||
37 | |||
38 | AC_SUBST(UP[]_PRG) | ||
39 | |||
40 | AM_CONDITIONAL(BUILD_[]UP, test "x$have_[]m4_defn([DOWN])" = "xyes") | ||
41 | |||
42 | AS_IF([test "x$have_[]m4_defn([DOWN])" = "xyes"], [$2], [$3]) | ||
43 | |||
44 | ]) | ||
45 | |||
46 | dnl Macro that specifies the binary to be used | ||
47 | |||
48 | dnl Usage: EFL_WITH_BIN(binary, package, msg) | ||
49 | dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being transformed into _) | ||
50 | dnl Define with_binary (- is transformed into _) | ||
51 | dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being transformed into _) | ||
52 | |||
53 | AC_DEFUN([EFL_WITH_BIN], | ||
54 | [ | ||
55 | |||
56 | m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl | ||
57 | m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl | ||
58 | |||
59 | AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | ||
60 | AC_MSG_NOTICE([$PKG_CONFIG]) | ||
61 | |||
62 | with_[]m4_defn([DOWN])=m4_esyscmd($PKG_CONFIG --variable=prefix $2)/bin/m4_defn([DOWN]) | ||
63 | |||
64 | dnl configure option | ||
65 | |||
66 | AC_ARG_WITH([$1], | ||
67 | [AC_HELP_STRING([--with-$1-bin=PATH], [specify a specific path to ]DOWN)], | ||
68 | [ | ||
69 | with_[]m4_defn([DOWN])=$withval | ||
70 | _efl_msg="( explicitely set)" | ||
71 | ]) | ||
72 | |||
73 | AC_MSG_NOTICE([$msg: ]m4_defn([DOWN])[$_efl_msg]) | ||
74 | |||
75 | AC_SUBST(with_[]m4_defn([DOWN])) | ||
76 | |||
77 | AS_IF([test "x$have_[]m4_defn([DOWN])" = "xyes"], [$4], [$5]) | ||
78 | |||
79 | ]) | ||
diff --git a/m4/efl_check_libs.m4 b/m4/efl_check_libs.m4 new file mode 100644 index 0000000000..b1c37894b6 --- /dev/null +++ b/m4/efl_check_libs.m4 | |||
@@ -0,0 +1,119 @@ | |||
1 | dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com> | ||
2 | dnl This code is public domain and can be freely used or copied. | ||
3 | |||
4 | dnl Macro that check dependencies libraries for the EFL: | ||
5 | |||
6 | dnl libjpeg | ||
7 | dnl zlib | ||
8 | |||
9 | dnl _EFL_CHECK_LIB_LIBJPEG is for internal use | ||
10 | dnl _EFL_CHECK_LIB_LIBJPEG(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) | ||
11 | |||
12 | AC_DEFUN([_EFL_CHECK_LIB_LIBJPEG], | ||
13 | [ | ||
14 | m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl | ||
15 | m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl | ||
16 | |||
17 | AC_CHECK_HEADER([jpeglib.h], | ||
18 | [have_dep="yes"], | ||
19 | [ | ||
20 | AC_MSG_ERROR(["Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file"]) | ||
21 | have_dep="no" | ||
22 | ]) | ||
23 | |||
24 | if test "x${have_dep}" = "xyes" ; then | ||
25 | AC_CHECK_LIB([jpeg], [jpeg_std_error], | ||
26 | [ | ||
27 | have_dep="yes" | ||
28 | requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ljpeg" | ||
29 | ], | ||
30 | [ | ||
31 | AC_MSG_ERROR("Cannot find libjpeg library. Make sure your LDFLAGS environment variable contains include lines for the location of this file") | ||
32 | have_dep="no" | ||
33 | ]) | ||
34 | fi | ||
35 | |||
36 | AS_IF([test "x${have_dep}" = "xyes"], [$2], [$3]) | ||
37 | |||
38 | m4_popdef([DOWNEFL]) | ||
39 | m4_popdef([UPEFL]) | ||
40 | ]) | ||
41 | |||
42 | dnl _EFL_CHECK_LIB_ZLIB is for internal use | ||
43 | dnl _EFL_CHECK_LIB_ZLIB(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) | ||
44 | |||
45 | AC_DEFUN([_EFL_CHECK_LIB_ZLIB], | ||
46 | [ | ||
47 | m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl | ||
48 | m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl | ||
49 | |||
50 | PKG_CHECK_EXISTS([zlib], | ||
51 | [ | ||
52 | _efl_have_lib="yes" | ||
53 | requirements_pc_[]m4_defn([DOWNEFL])="${requirements_pc_[]m4_defn([DOWNEFL])} zlib" | ||
54 | ], | ||
55 | [ | ||
56 | _efl_have_lib="no" | ||
57 | ]) | ||
58 | |||
59 | if test "x${_efl_have_lib}" = "xno" ; then | ||
60 | AC_CHECK_HEADER([zlib.h], | ||
61 | [_efl_have_lib="yes"], | ||
62 | [ | ||
63 | AC_MSG_ERROR(["Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file"]) | ||
64 | _efl_have_lib="no" | ||
65 | ]) | ||
66 | |||
67 | if test "x${_efl_have_lib}" = "xyes" ; then | ||
68 | AC_CHECK_LIB([z], [zlibVersion], | ||
69 | [ | ||
70 | _efl_have_lib="yes" | ||
71 | requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -lz" | ||
72 | ], | ||
73 | [ | ||
74 | AC_MSG_ERROR(["Cannot find libjpeg library. Make sure your LDFLAGS environment variable contains include lines for the location of this file"]) | ||
75 | _efl_have_lib="no" | ||
76 | ]) | ||
77 | fi | ||
78 | fi | ||
79 | |||
80 | AS_IF([test "x${_efl_have_lib}" = "xyes"], [$2], [$3]) | ||
81 | |||
82 | m4_popdef([DOWNEFL]) | ||
83 | m4_popdef([UPEFL]) | ||
84 | ]) | ||
85 | |||
86 | dnl Macro that checks for a library | ||
87 | dnl | ||
88 | dnl EFL_CHECK_LIB(EFL, LIBRARY) | ||
89 | dnl AC_DEFINE : EFL_HAVE_LIBRARY (LIBRARY being replaced by its value) | ||
90 | |||
91 | AC_DEFUN([EFL_CHECK_LIB], | ||
92 | [ | ||
93 | m4_pushdef([UP], m4_translit([$2], [-a-z], [_A-Z]))dnl | ||
94 | m4_pushdef([DOWN], m4_translit([$2], [-A-Z], [_a-z]))dnl | ||
95 | |||
96 | m4_default([_EFL_CHECK_LIB_]m4_defn([UP]))($1, [have_lib="yes"], [have_lib="no"]) | ||
97 | |||
98 | AC_MSG_CHECKING([for ]m4_defn([DOWN])) | ||
99 | AC_MSG_RESULT([${have_lib}]) | ||
100 | |||
101 | if test "x${have_lib}" = "xyes" ; then | ||
102 | AC_DEFINE([HAVE_]m4_defn([UP]), [1], [Define to 1 if the `]m4_defn([DOWN])[' library is installed.]) | ||
103 | fi | ||
104 | |||
105 | efl_lib_[]m4_defn([DOWN])="${have_lib}" | ||
106 | |||
107 | m4_popdef([DOWN]) | ||
108 | m4_popdef([UP]) | ||
109 | ]) | ||
110 | |||
111 | dnl Macro that iterates over a sequence of white separated libraries | ||
112 | dnl and that calls EFL_CHECK_LIB() for each of these libraries | ||
113 | dnl | ||
114 | dnl EFL_CHECK_LIBS(EFL, LIBRARIES) | ||
115 | |||
116 | AC_DEFUN([EFL_CHECK_LIBS], | ||
117 | [ | ||
118 | m4_foreach_w([lib], [$2], [EFL_CHECK_LIB($1, m4_defn([lib]))]) | ||
119 | ]) | ||
diff --git a/m4/efl_compiler.m4 b/m4/efl_compiler.m4 index be6a753e07..ca30759d82 100644 --- a/m4/efl_compiler.m4 +++ b/m4/efl_compiler.m4 | |||
@@ -65,7 +65,7 @@ dnl AM_CONDITIONAL : EFL_HAVE_FLAG (FLAG being replaced by its value) | |||
65 | AC_DEFUN([EFL_CHECK_LINKER_FLAG], | 65 | AC_DEFUN([EFL_CHECK_LINKER_FLAG], |
66 | [ | 66 | [ |
67 | m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z])) | 67 | m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z])) |
68 | m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z])) | 68 | m4_pushdef([UP], m4_translit([[$2]], [,-a-z], [__A-Z])) |
69 | 69 | ||
70 | LDFLAGS_save="${LDFLAGS}" | 70 | LDFLAGS_save="${LDFLAGS}" |
71 | LDFLAGS="${LDFLAGS} $2" | 71 | LDFLAGS="${LDFLAGS} $2" |