aboutsummaryrefslogtreecommitdiffstats
path: root/m4/mpd_with_flags.m4
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-09 20:23:22 +0100
committerMax Kellermann <max@duempel.org>2014-12-09 21:19:09 +0100
commit184557bfed39a84685ea3398f4c5610d2cb4f5bf (patch)
tree7551a18a3290a7d5914e5dba5a718bcd5d45e0da /m4/mpd_with_flags.m4
parentb4253210d2dcbd57873a7785f7aa55155ad3f125 (diff)
downloadmpd-184557bfed39a84685ea3398f4c5610d2cb4f5bf.tar.gz
mpd-184557bfed39a84685ea3398f4c5610d2cb4f5bf.tar.xz
mpd-184557bfed39a84685ea3398f4c5610d2cb4f5bf.zip
m4/mpd_with_flags: add macro MPD_WITH_FLAGS
Diffstat (limited to 'm4/mpd_with_flags.m4')
-rw-r--r--m4/mpd_with_flags.m423
1 files changed, 23 insertions, 0 deletions
diff --git a/m4/mpd_with_flags.m4 b/m4/mpd_with_flags.m4
new file mode 100644
index 000000000..4f82b7973
--- /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])])