summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorQuentin Glidic <sardemff7+git@sardemff7.net>2016-04-23 12:02:58 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2016-04-25 13:37:10 +0300
commit9992bdcbe6b4071c7d04059955171dec183cacfe (patch)
tree0c62bb3df894473863c97760e59728fb8d807d7b /m4
parent57c83f65348afdc894cec5b08c440539d35d4352 (diff)
build: Add (and use) an AC_SEARCH_LIBS wrapper
AC_SEARCH_LIBS is the recommended macro for these checks, unfortunately, we use AC_CHECK_LIB instead, and even AC_CHECK_FUNC, when only one AC_SEARCH_LIBS would be enough. This wrapper macro is used much like PKG_CHECK_MODULES, as it defines (and AC_SUBST) the PREFIX_LIBS variable itself. It also avoids adding unnecessary stuff to LIBS. Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net> Tested-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'm4')
-rw-r--r--m4/weston.m437
1 files changed, 37 insertions, 0 deletions
diff --git a/m4/weston.m4 b/m4/weston.m4
new file mode 100644
index 00000000..636f9fb0
--- /dev/null
+++ b/m4/weston.m4
@@ -0,0 +1,37 @@
+dnl
+dnl Copyright © 2016 Quentin “Sardem FF7” Glidic
+dnl
+dnl Permission is hereby granted, free of charge, to any person obtaining a
+dnl copy of this software and associated documentation files (the "Software"),
+dnl to deal in the Software without restriction, including without limitation
+dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
+dnl and/or sell copies of the Software, and to permit persons to whom the
+dnl Software is furnished to do so, subject to the following conditions:
+dnl
+dnl The above copyright notice and this permission notice (including the next
+dnl paragraph) shall be included in all copies or substantial portions of the
+dnl Software.
+dnl
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+dnl DEALINGS IN THE SOFTWARE.
+dnl
+
+dnl WESTON_SEARCH_LIBS(PREFIX, search-libs, function, [action-if-found], [action-if-not-found], [other-libraries])
+dnl WESTON_SEARCH_LIBS is a wrapper around AC_SEARCH_LIBS with a little difference:
+dnl action-if-found is called even if no library is required
+AC_DEFUN([WESTON_SEARCH_LIBS], [
+ weston_save_LIBS=${LIBS}
+ AC_SEARCH_LIBS([$3], [$2], [$4], [$5], [$6])
+ AS_CASE([${ac_cv_search_][$3][}],
+ ['none required'], [$4],
+ [no], [],
+ [$1][_LIBS=${ac_cv_search_][$3][}]
+ )
+ AC_SUBST([$1][_LIBS])
+ LIBS=${weston_save_LIBS}
+])