From cdc945d53d6f3050b502dd28196ecb1e8501b0d8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 20 Mar 2017 10:51:25 +0100 Subject: [PATCH] configure.ac: repair the getmouse() check Was broken by commit b73fd31ce0dc27d8 --- configure.ac | 7 +++---- m4/mpd_with_flags.m4 | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 m4/mpd_with_flags.m4 diff --git a/configure.ac b/configure.ac index 2a78958..6273a09 100644 --- a/configure.ac +++ b/configure.ac @@ -227,11 +227,10 @@ AM_CONDITIONAL(ENABLE_HELP_SCREEN, test x$enable_help_screen = xyes) 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 new file mode 100644 index 0000000..4f82b79 --- /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])]) -- 2.30.2