memmove.m4 828 B

123456789101112131415161718192021222324252627
  1. AC_DEFUN([AC_FUNC_MEMMOVE],
  2. [AC_CHECK_FUNCS(memmove)
  3. AC_MSG_CHECKING(for working memmove)
  4. AC_CACHE_VAL(ac_cv_have_working_memmove,
  5. [AC_TRY_RUN(
  6. [#include <stdio.h>
  7. int main(void)
  8. {
  9. char buf[10];
  10. strcpy (buf, "01234567");
  11. memmove (buf, buf + 2, 3);
  12. if (strcmp (buf, "23434567"))
  13. exit (1);
  14. strcpy (buf, "01234567");
  15. memmove (buf + 2, buf, 3);
  16. if (strcmp (buf, "01012567"))
  17. exit (1);
  18. exit (0);
  19. }], ac_cv_have_working_memmove=yes, ac_cv_have_working_memmove=no, ac_cv_have_working_memmove=cross)])
  20. AC_MSG_RESULT([$ac_cv_have_working_memmove])
  21. if test x$ac_cv_have_working_memmove != "xyes"; then
  22. AC_LIBOBJ(memmove)
  23. AC_MSG_WARN([Replacing missing/broken memmove.])
  24. AC_DEFINE(PREFER_PORTABLE_MEMMOVE, 1, "enable replacement memmove if system memmove is broken or missing")
  25. fi])