summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ed117e)
raw | patch | inline | side by side (parent: 0ed117e)
author | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 09:51:25 +0000 (10:51 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 09:51:25 +0000 (10:51 +0100) |
configure.ac | patch | blob | history | |
m4/mpd_with_flags.m4 | [new file with mode: 0644] | patch | blob |
diff --git a/configure.ac b/configure.ac
index 2a78958598272c5e0c1dac6d9c585c647768b07a..6273a09ed0a6b0ab52d39e75d9226996ddd83b28 100644 (file)
--- a/configure.ac
+++ b/configure.ac
dnl Optional - curses getmouse support
-dnl AC_CHECK_LIB depends on being able to prepend a '-l', remove the '-l' from CURSES_LIB first
-AC_CHECK_LIB([$(expr substr $CURSES_LIB 3 99)],
- [getmouse],
+MPD_WITH_LIBRARY([CURSES],
+ [AC_CHECK_FUNC([getmouse],
[ax_cv_curses_mouse=yes],
- [ax_cv_curses_mouse=no])
+ [ax_cv_curses_mouse=no])])
AC_ARG_ENABLE([mouse],
AS_HELP_STRING([--enable-mouse],
diff --git a/m4/mpd_with_flags.m4 b/m4/mpd_with_flags.m4
--- /dev/null
+++ b/m4/mpd_with_flags.m4
@@ -0,0 +1,23 @@
+dnl Run code with the specified CFLAGS/CXXFLAGS and LIBS appended.
+dnl Restores the old values afterwards.
+dnl
+dnl Parameters: cflags, libs, code
+AC_DEFUN([MPD_WITH_FLAGS], [
+ ac_save_CFLAGS="$[]CFLAGS"
+ ac_save_CXXFLAGS="$[]CXXFLAGS"
+ ac_save_LIBS="$[]LIBS"
+ CFLAGS="$[]CFLAGS $1"
+ CXXFLAGS="$[]CXXFLAGS $1"
+ LIBS="$[]LIBS $2"
+ $3
+ CFLAGS="$[]ac_save_CFLAGS"
+ CXXFLAGS="$[]ac_save_CXXFLAGS"
+ LIBS="$[]ac_save_LIBS"
+])
+
+dnl Run code with the specified library's CFLAGS/CXXFLAGS and LIBS
+dnl appended. Restores the old values afterwards.
+dnl
+dnl Parameters: libname, code
+AC_DEFUN([MPD_WITH_LIBRARY],
+ [MPD_WITH_FLAGS([$[]$1_CFLAGS], [$[]$1_LIBS], [$2])])