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.

58 lines
1.9KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_check_strcspn.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CHECK_STRCSPN
  8. #
  9. # DESCRIPTION
  10. #
  11. # Not all systems have strcspn(3). See if we need to substitute. To make
  12. # this work, you have to do horrible things. In one of your Makefile.am
  13. # files, you must make an explicit rule to make this object. It should
  14. # look like this:
  15. #
  16. # strcspn.lo : $(top_srcdir)/compat/strcspn.c
  17. # $(LTCOMPILE) -o $@ -c $(top_srcdir)/compat/strcspn.c
  18. #
  19. # and you must include ``@COMPATOBJ@'' in a LIBADD somewhere and, finally,
  20. # you must add another artificial dependency, something like:
  21. #
  22. # makeshell.lo : genshell.c @COMPATOBJ@
  23. #
  24. # It is all pretty horrific, but I have found nothing else that works.
  25. #
  26. # LICENSE
  27. #
  28. # Copyright (c) 2008 Bruce Korb <bkorb@gnu.org>
  29. #
  30. # Copying and distribution of this file, with or without modification, are
  31. # permitted in any medium without royalty provided the copyright notice
  32. # and this notice are preserved. This file is offered as-is, without any
  33. # warranty.
  34. #serial 6
  35. AU_ALIAS([AG_CHECK_STRCSPN], [AX_CHECK_STRCSPN])
  36. AC_DEFUN([AX_CHECK_STRCSPN],[
  37. AC_MSG_CHECKING([whether strcspn matches prototype and works])
  38. AC_CACHE_VAL([ax_cv_strcspn],[
  39. AC_TRY_RUN([#include <string.h>
  40. int main (int argc, char** argv) {
  41. char zRej[] = "reject";
  42. char zAcc[] = "a-ok-eject";
  43. return strcspn( zAcc, zRej ) - 5;
  44. }],[ax_cv_strcspn=yes],[ax_cv_strcspn=no],[ax_cv_strcspn=no]
  45. ) # end of TRY_RUN]) # end of CACHE_VAL
  46. AC_MSG_RESULT([$ax_cv_strcspn])
  47. if test x$ax_cv_strcspn = xyes
  48. then
  49. AC_DEFINE(HAVE_STRCSPN, 1,
  50. [Define this if strcspn matches prototype and works])
  51. else
  52. COMPATOBJ="$COMPATOBJ strcspn.lo"
  53. fi
  54. ]) # end of AC_DEFUN of AX_CHECK_STRCSPN