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.

95 lines
2.9KB

  1. # ============================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_caolan_check_package.html
  3. # ============================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_caolan_CHECK_PACKAGE(PACKAGE, FUNCTION, LIBRARY , HEADERFILE [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Provides --with-PACKAGE, --with-PACKAGE-include and
  12. # --with-PACKAGE-libdir options to configure. Supports the now standard
  13. # --with-PACKAGE=DIR approach where the package's include dir and lib dir
  14. # are underneath DIR, but also allows the include and lib directories to
  15. # be specified separately
  16. #
  17. # adds the extra -Ipath to CFLAGS if needed adds extra -Lpath to LD_FLAGS
  18. # if needed searches for the FUNCTION in the LIBRARY with AC_CHECK_LIBRARY
  19. # and thus adds the lib to LIBS
  20. #
  21. # defines HAVE_PKG_PACKAGE if it is found, (where PACKAGE in the
  22. # HAVE_PKG_PACKAGE is replaced with the actual first parameter passed)
  23. # note that autoheader will complain of not having the HAVE_PKG_PACKAGE
  24. # and you will have to add it to acconfig.h manually
  25. #
  26. # LICENSE
  27. #
  28. # Copyright (c) 2008 Caolan McNamara <caolan@skynet.ie>
  29. # Copyright (c) 2008 Alexandre Duret-Lutz <adl@gnu.org>
  30. # Copyright (c) 2008 Matthew Mueller <donut@azstarnet.com>
  31. #
  32. # Copying and distribution of this file, with or without modification, are
  33. # permitted in any medium without royalty provided the copyright notice
  34. # and this notice are preserved. This file is offered as-is, without any
  35. # warranty.
  36. #serial 8
  37. AC_DEFUN([AX_caolan_CHECK_PACKAGE],
  38. [
  39. AC_ARG_WITH($1,
  40. [ --with-$1[=DIR] root directory of $1 installation],
  41. with_$1=$withval
  42. if test "${with_$1}" != yes; then
  43. $1_include="$withval/include"
  44. $1_libdir="$withval/lib"
  45. fi
  46. )
  47. AC_ARG_WITH($1-include,
  48. [ --with-$1-include=DIR specify exact include dir for $1 headers],
  49. $1_include="$withval")
  50. AC_ARG_WITH($1-libdir,
  51. [ --with-$1-libdir=DIR specify exact library dir for $1 library
  52. --without-$1 disables $1 usage completely],
  53. $1_libdir="$withval")
  54. if test "${with_$1}" != no ; then
  55. OLD_LIBS=$LIBS
  56. OLD_LDFLAGS=$LDFLAGS
  57. OLD_CFLAGS=$CFLAGS
  58. OLD_CPPFLAGS=$CPPFLAGS
  59. if test "${$1_libdir}" ; then
  60. LDFLAGS="$LDFLAGS -L${$1_libdir}"
  61. fi
  62. if test "${$1_include}" ; then
  63. CPPFLAGS="$CPPFLAGS -I${$1_include}"
  64. CFLAGS="$CFLAGS -I${$1_include}"
  65. fi
  66. no_good=no
  67. AC_CHECK_LIB($3,$2,,no_good=yes)
  68. AC_CHECK_HEADER($4,,no_good=yes)
  69. if test "$no_good" = yes; then
  70. dnl broken
  71. ifelse([$6], , , [$6])
  72. LIBS=$OLD_LIBS
  73. LDFLAGS=$OLD_LDFLAGS
  74. CPPFLAGS=$OLD_CPPFLAGS
  75. CFLAGS=$OLD_CFLAGS
  76. else
  77. dnl fixed
  78. ifelse([$5], , , [$5])
  79. AC_DEFINE(HAVE_PKG_$1)
  80. fi
  81. fi
  82. ])