3 dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
4 dnl the losing memcmp on some x86 Next systems.
5 AC_DEFUN(jm_AC_FUNC_MEMCMP,
6 [AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
12 /* Some versions of memcmp are not 8-bit clean. */
13 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
14 if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
17 /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
18 or more and with at least one buffer not starting on a 4-byte boundary.
19 William Lewis provided this test program. */
24 for (i = 0; i < 4; i++)
28 strcpy (a, "--------01111111");
29 strcpy (b, "--------10000000");
30 if (memcmp (a, b, 16) >= 0)
38 jm_cv_func_memcmp_working=yes,
39 jm_cv_func_memcmp_working=no,
40 jm_cv_func_memcmp_working=no)])
41 test $jm_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.o"
45 dnl If you use this macro in a package, you should
46 dnl add the following two lines to acconfig.h:
47 dnl /* Define to rpl_memcmp if the replacement function should be used. */
50 AC_DEFUN(jm_FUNC_MEMCMP,
51 [AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
52 if test $jm_cv_func_memcmp_working = no; then
53 AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp)