configure.ac: pass option name to MPD_OPTIONAL_FUNC()

This commit is contained in:
Max Kellermann 2013-08-07 19:23:00 +02:00
parent 355dd5cb24
commit fdc7d13ad1
2 changed files with 7 additions and 7 deletions

View File

@ -140,8 +140,8 @@ AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl]) AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_CHECK_FUNCS(pipe2 accept4) AC_CHECK_FUNCS(pipe2 accept4)
MPD_OPTIONAL_FUNC(eventfd, USE_EVENTFD) MPD_OPTIONAL_FUNC(eventfd, eventfd, USE_EVENTFD)
MPD_OPTIONAL_FUNC(signalfd, USE_SIGNALFD) MPD_OPTIONAL_FUNC(signalfd, signalfd, USE_SIGNALFD)
AC_SEARCH_LIBS([exp], [m],, AC_SEARCH_LIBS([exp], [m],,
[AC_MSG_ERROR([exp() not found])]) [AC_MSG_ERROR([exp() not found])])

View File

@ -1,12 +1,12 @@
dnl MPD_OPTIONAL_FUNC(func, macro) dnl MPD_OPTIONAL_FUNC(name, func, macro)
dnl dnl
dnl Allow the user to enable or disable the use of a function. If the dnl Allow the user to enable or disable the use of a function. If the
dnl option is not specified, the function is auto-detected. dnl option is not specified, the function is auto-detected.
AC_DEFUN([MPD_OPTIONAL_FUNC], [ AC_DEFUN([MPD_OPTIONAL_FUNC], [
AC_ARG_ENABLE([$1], AC_ARG_ENABLE([$1],
AS_HELP_STRING([--enable-$1], AS_HELP_STRING([--enable-$1],
[use the function "$1()" (default: auto)]), [use the function "$1" (default: auto)]),
[test xenable_$1 = xyes && AC_DEFINE([$2], 1, [Define to use $1()])], [test xenable_$1 = xyes && AC_DEFINE([$3], 1, [Define to use $1])],
[AC_CHECK_FUNC([$1], [AC_CHECK_FUNC([$2],
[AC_DEFINE([$2], 1, [Define to use $1()])],)]) [AC_DEFINE([$3], 1, [Define to use $1])],)])
]) ])