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
3.6KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_check_func_in.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CHECK_FUNC_IN(HEADER, FUNCTION [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Checking for library functions in a given header file.
  12. #
  13. # LICENSE
  14. #
  15. # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
  16. #
  17. # This program is free software; you can redistribute it and/or modify it
  18. # under the terms of the GNU General Public License as published by the
  19. # Free Software Foundation; either version 3 of the License, or (at your
  20. # option) any later version.
  21. #
  22. # This program is distributed in the hope that it will be useful, but
  23. # WITHOUT ANY WARRANTY; without even the implied warranty of
  24. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  25. # Public License for more details.
  26. #
  27. # You should have received a copy of the GNU General Public License along
  28. # with this program. If not, see <https://www.gnu.org/licenses/>.
  29. #
  30. # As a special exception, the respective Autoconf Macro's copyright owner
  31. # gives unlimited permission to copy, distribute and modify the configure
  32. # scripts that are the output of Autoconf when processing the Macro. You
  33. # need not follow the terms of the GNU General Public License when using
  34. # or distributing such scripts, even though portions of the text of the
  35. # Macro appear in them. The GNU General Public License (GPL) does govern
  36. # all other use of the material that constitutes the Autoconf Macro.
  37. #
  38. # This special exception to the GPL applies to versions of the Autoconf
  39. # Macro released by the Autoconf Archive. When you make and distribute a
  40. # modified version of the Autoconf Macro, you may extend this special
  41. # exception to the GPL to apply to your modified version as well.
  42. #serial 7
  43. dnl AX_CHECK_FUNC_IN(HEADER, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  44. AU_ALIAS([AC_CHECK_FUNC_IN], [AX_CHECK_FUNC_IN])
  45. AC_DEFUN([AX_CHECK_FUNC_IN],
  46. [AC_MSG_CHECKING([for $2 in $1])
  47. AC_CACHE_VAL(ac_cv_func_$2,
  48. [AC_TRY_LINK(
  49. dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
  50. dnl which includes <sys/select.h> which contains a prototype for
  51. dnl select. Similarly for bzero.
  52. [/* System header to define __stub macros and hopefully few prototypes,
  53. which can conflict with char $2(); below. */
  54. #include <assert.h>
  55. #include <$1>
  56. /* Override any gcc2 internal prototype to avoid an error. */
  57. ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
  58. extern "C"
  59. #endif
  60. ])dnl
  61. [/* We use char because int might match the return type of a gcc2
  62. builtin and then its argument prototype would still apply. */
  63. char $2();
  64. ], [
  65. /* The GNU C library defines this for functions which it implements
  66. to always fail with ENOSYS. Some functions are actually named
  67. something starting with __ and the normal name is an alias. */
  68. #if defined (__stub_$2) || defined (__stub___$2)
  69. choke me
  70. #else
  71. $2();
  72. #endif
  73. ], eval "ac_cv_func_$2=yes", eval "ac_cv_func_$2=no")])
  74. if eval "test \"`echo '$ac_cv_func_'$2`\" = yes"; then
  75. AC_MSG_RESULT(yes)
  76. ifelse([$3], , :, [$3])
  77. else
  78. AC_MSG_RESULT(no)
  79. ifelse([$4], , , [$4
  80. ])dnl
  81. fi
  82. ])
  83. dnl AC_CHECK_FUNCS_IN(HEADER, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  84. AC_DEFUN([AC_CHECK_FUNCS_IN],
  85. [for ac_func in $2
  86. do
  87. AX_CHECK_FUNC_IN($1, $ac_func,
  88. ac_tr_func=HAVE_`echo $ac_func | sed -e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:' -e 's:[[^A-Z0-9]]:_:g'`
  89. AC_DEFINE_UNQUOTED($ac_tr_func) $3], $4)dnl
  90. done
  91. ])