Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.3KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_lib_upnp.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_LIB_UPNP([ACTION-IF-TRUE], [ACTION-IF-FALSE])
  8. #
  9. # DESCRIPTION
  10. #
  11. # This macro will check for the existence of libupnp
  12. # (http://upnp.sourceforge.net/). It does this by checking for the header
  13. # file upnp.h and the upnp library object file. A --with-libupnp option is
  14. # supported as well. The following output variables are set with AC_SUBST:
  15. #
  16. # UPNP_CPPFLAGS
  17. # UPNP_LDFLAGS
  18. # UPNP_LIBS
  19. #
  20. # You can use them like this in Makefile.am:
  21. #
  22. # AM_CPPFLAGS = $(UPNP_CPPFLAGS)
  23. # AM_LDFLAGS = $(UPNP_LDFLAGS)
  24. # program_LDADD = $(UPNP_LIBS)
  25. #
  26. # Additionally, the C preprocessor symbol HAVE_LIBUPNP will be defined
  27. # with AC_DEFINE if libupnp is available.
  28. #
  29. # LICENSE
  30. #
  31. # Copyright (c) 2009 Oskar Liljeblad <oskar@osk.mine.nu>
  32. #
  33. # Copying and distribution of this file, with or without modification, are
  34. # permitted in any medium without royalty provided the copyright notice
  35. # and this notice are preserved. This file is offered as-is, without any
  36. # warranty.
  37. #serial 6
  38. AU_ALIAS([AC_LIB_UPNP], [AX_LIB_UPNP])
  39. AC_DEFUN([AX_LIB_UPNP], [
  40. AH_TEMPLATE([HAVE_LIBUPNP], [Define if libupnp is available])
  41. AC_ARG_WITH(libupnp, [ --with-libupnp=DIR prefix for upnp library files and headers], [
  42. if test "$withval" = "no"; then
  43. ac_upnp_path=
  44. $2
  45. elif test "$withval" = "yes"; then
  46. ac_upnp_path=/usr
  47. else
  48. ac_upnp_path="$withval"
  49. fi
  50. ],[ac_upnp_path=/usr])
  51. if test "$ac_upnp_path" != ""; then
  52. saved_CPPFLAGS="$CPPFLAGS"
  53. CPPFLAGS="$CPPFLAGS -I$ac_upnp_path/include/upnp"
  54. AC_CHECK_HEADER([upnp.h], [
  55. saved_LDFLAGS="$LDFLAGS"
  56. LDFLAGS="$LDFLAGS -L$ac_upnp_path/lib"
  57. AC_CHECK_LIB(upnp, UpnpInit, [
  58. AC_SUBST(UPNP_CPPFLAGS, [-I$ac_upnp_path/include/upnp])
  59. AC_SUBST(UPNP_LDFLAGS, [-L$ac_upnp_path/lib])
  60. AC_SUBST(UPNP_LIBS, [-lupnp])
  61. AC_DEFINE([HAVE_LIBUPNP])
  62. $1
  63. ], [
  64. :
  65. $2
  66. ])
  67. LDFLAGS="$saved_LDFLAGS"
  68. ], [
  69. AC_MSG_RESULT([not found])
  70. $2
  71. ])
  72. CPPFLAGS="$saved_CPPFLAGS"
  73. fi
  74. ])