diff options
author | Simon Josefsson <simon@josefsson.org> | 2008-01-14 15:35:48 +0100 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2008-01-14 15:35:48 +0100 |
commit | 4dc80d0fcd34b7b36a64a007a8a6b81b1b9c136e (patch) | |
tree | 7e265478c7cccfb94b6cc626f13cb69f2c71e64e /lgl/m4 | |
parent | a033a9d515ccdcdb3a60a757d916059b9c8bb6a0 (diff) | |
download | gnutls-4dc80d0fcd34b7b36a64a007a8a6b81b1b9c136e.tar.gz |
Use gnulib's memmem-simple instead.
Diffstat (limited to 'lgl/m4')
-rw-r--r-- | lgl/m4/alloca.m4 | 8 | ||||
-rw-r--r-- | lgl/m4/gnulib-cache.m4 | 4 | ||||
-rw-r--r-- | lgl/m4/gnulib-comp.m4 | 2 | ||||
-rw-r--r-- | lgl/m4/memmem.m4 | 24 |
4 files changed, 22 insertions, 16 deletions
diff --git a/lgl/m4/alloca.m4 b/lgl/m4/alloca.m4 index eb62e0e7a5..95f54a6d48 100644 --- a/lgl/m4/alloca.m4 +++ b/lgl/m4/alloca.m4 @@ -1,5 +1,5 @@ -# alloca.m4 serial 7 -dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc. +# alloca.m4 serial 8 +dnl Copyright (C) 2002-2004, 2006, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -39,10 +39,6 @@ AC_DEFUN([gl_FUNC_ALLOCA], ALLOCA_H=alloca.h fi AC_SUBST([ALLOCA_H]) - - AC_DEFINE(HAVE_ALLOCA_H, 1, - [Define HAVE_ALLOCA_H for backward compatibility with older code - that includes <alloca.h> only if HAVE_ALLOCA_H is defined.]) ]) # Prerequisites of lib/alloca.c. diff --git a/lgl/m4/gnulib-cache.m4 b/lgl/m4/gnulib-cache.m4 index 8bfc9736e7..d181fda0c9 100644 --- a/lgl/m4/gnulib-cache.m4 +++ b/lgl/m4/gnulib-cache.m4 @@ -15,11 +15,11 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=liblgnu --source-base=lgl --m4-base=lgl/m4 --doc-base=doc --aux-dir=build-aux --lgpl=2 --libtool --macro-prefix=lgl crypto/gc crypto/gc-arcfour crypto/gc-arctwo crypto/gc-camellia crypto/gc-des crypto/gc-hmac-md5 crypto/gc-md2 crypto/gc-md4 crypto/gc-md5 crypto/gc-pbkdf2-sha1 crypto/gc-random crypto/gc-rijndael crypto/gc-sha1 gettext memmem memmove minmax read-file snprintf socklen stdint strverscmp sys_socket sys_stat time_r unistd vasprintf +# gnulib-tool --import --dir=. --lib=liblgnu --source-base=lgl --m4-base=lgl/m4 --doc-base=doc --aux-dir=build-aux --lgpl=2 --libtool --macro-prefix=lgl crypto/gc crypto/gc-arcfour crypto/gc-arctwo crypto/gc-camellia crypto/gc-des crypto/gc-hmac-md5 crypto/gc-md2 crypto/gc-md4 crypto/gc-md5 crypto/gc-pbkdf2-sha1 crypto/gc-random crypto/gc-rijndael crypto/gc-sha1 gettext memmem-simple memmove minmax read-file snprintf socklen stdint strverscmp sys_socket sys_stat time_r unistd vasprintf # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) -gl_MODULES([crypto/gc crypto/gc-arcfour crypto/gc-arctwo crypto/gc-camellia crypto/gc-des crypto/gc-hmac-md5 crypto/gc-md2 crypto/gc-md4 crypto/gc-md5 crypto/gc-pbkdf2-sha1 crypto/gc-random crypto/gc-rijndael crypto/gc-sha1 gettext memmem memmove minmax read-file snprintf socklen stdint strverscmp sys_socket sys_stat time_r unistd vasprintf]) +gl_MODULES([crypto/gc crypto/gc-arcfour crypto/gc-arctwo crypto/gc-camellia crypto/gc-des crypto/gc-hmac-md5 crypto/gc-md2 crypto/gc-md4 crypto/gc-md5 crypto/gc-pbkdf2-sha1 crypto/gc-random crypto/gc-rijndael crypto/gc-sha1 gettext memmem-simple memmove minmax read-file snprintf socklen stdint strverscmp sys_socket sys_stat time_r unistd vasprintf]) gl_AVOID([]) gl_SOURCE_BASE([lgl]) gl_M4_BASE([lgl/m4]) diff --git a/lgl/m4/gnulib-comp.m4 b/lgl/m4/gnulib-comp.m4 index 273922a4e2..5b51020aa1 100644 --- a/lgl/m4/gnulib-comp.m4 +++ b/lgl/m4/gnulib-comp.m4 @@ -78,7 +78,7 @@ AC_DEFUN([lgl_INIT], AC_SUBST([LTLIBINTL]) gl_FUNC_MEMCHR gl_FUNC_MEMCMP - gl_FUNC_MEMMEM + gl_FUNC_MEMMEM_SIMPLE gl_STRING_MODULE_INDICATOR([memmem]) gl_FUNC_MEMMOVE gl_MINMAX diff --git a/lgl/m4/memmem.m4 b/lgl/m4/memmem.m4 index 9767354ad2..7f3aa3c70f 100644 --- a/lgl/m4/memmem.m4 +++ b/lgl/m4/memmem.m4 @@ -1,10 +1,11 @@ -# memmem.m4 serial 7 +# memmem.m4 serial 9 dnl Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_FUNC_MEMMEM], +dnl Check that memmem is present. +AC_DEFUN([gl_FUNC_MEMMEM_SIMPLE], [ dnl Persuade glibc <string.h> to declare memmem(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) @@ -14,7 +15,15 @@ AC_DEFUN([gl_FUNC_MEMMEM], AC_CHECK_DECLS_ONCE(memmem) if test $ac_cv_have_decl_memmem = no; then HAVE_DECL_MEMMEM=0 - else + fi + gl_PREREQ_MEMMEM +]) # gl_FUNC_MEMMEM_SIMPLE + +dnl Additionally, check that memmem is efficient and handles empty needles. +AC_DEFUN([gl_FUNC_MEMMEM], +[ + AC_REQUIRE([gl_FUNC_MEMMEM_SIMPLE]) + if test $ac_cv_have_decl_memmem = yes; then AC_CACHE_CHECK([whether memmem works in linear time], [gl_cv_func_memmem_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([ @@ -28,6 +37,7 @@ AC_DEFUN([gl_FUNC_MEMMEM], /* Failure to compile this test due to missing alarm is okay, since all such platforms (mingw) also lack memmem. */ alarm (5); + /* Check for quadratic performance. */ if (haystack && needle) { memset (haystack, 'A', 2 * m); @@ -36,18 +46,18 @@ AC_DEFUN([gl_FUNC_MEMMEM], needle[m] = 'B'; result = memmem (haystack, 2 * m + 1, needle, m + 1); } + /* Check for empty needle behavior. */ return !result || !memmem ("a", 1, 0, 0);]])], [gl_cv_func_memmem_works=yes], [gl_cv_func_memmem_works=no], [dnl pessimistically assume the worst, since even glibc 2.6.1 dnl has quadratic complexity in its memmem - gl_cv_func_memmem_works=no])]) - if test $gl_cv_func_memmem_works = no; then + gl_cv_func_memmem_works="guessing no"])]) + if test "$gl_cv_func_memmem_works" != yes; then REPLACE_MEMMEM=1 AC_LIBOBJ([memmem]) fi fi - gl_PREREQ_MEMMEM -]) +]) # gl_FUNC_MEMMEM # Prerequisites of lib/memmem.c. AC_DEFUN([gl_PREREQ_MEMMEM], [:]) |