[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in AC_FUNC_MEMCMP when using g++
From: |
Akim Demaille |
Subject: |
Re: Bug in AC_FUNC_MEMCMP when using g++ |
Date: |
Sat, 17 May 2003 12:29:05 +0200 |
User-agent: |
Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux) |
| It seems that the testsource for AC_FUNC_MEMCMP in autoconf 2.57 does
| not contain a string.h include which makes the check fail when running
| a C++ compiler (g++ v3.1 in my case). This can be reproduced by using
| the following configure.ac
| ---
| AC_INIT(memcpy_bug, 1.0)
| AC_CHECK_HEADERS
| AC_FUNC_MEMCMP
| ---
| and trying both a './configure' and a './configure CC=g++'.
| The first gives
| ---
| checking for working memcmp... yes
| ---
| while the second gives
| ---
| checking for working memcmp... no
| ---
|
| An addition of
| ---
| #ifdef HAVE_STRING_H
| #include <string.h>
| #endif
| ---
| to the testsource should fix this problem.
|
| Regards,
| Sander Niemeijer
Thanks, I'm installing the following patch:
Index: ChangeLog
from Akim Demaille <address@hidden>
* lib/autoconf/functions.m4: Use the default includes so that
memcmp be declared before being tested.
Reported by Sander Niemeijer.
(AC_FUNC_ERROR_AT_LINE, AC_FUNC_GETGROUPS, AC_FUNC_STRNLEN): Likewise.
* doc/autoconf.texi (Default Includes): Document
AC_INCLUDES_DEFAULT.
Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.294
diff -u -u -w -r1.294 NEWS
--- NEWS 17 May 2003 09:44:22 -0000 1.294
+++ NEWS 17 May 2003 10:27:39 -0000
@@ -1,7 +1,7 @@
* Major changes in Autoconf 2.57a -*- outline -*-
** New macros
- AC_C_RESTRICT
+ AC_C_RESTRICT, AC_INCLUDES_DEFAULT.
** AC_DECL_SYS_SIGLIST
Works again.
Index: THANKS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/THANKS,v
retrieving revision 1.109
diff -u -u -w -r1.109 THANKS
--- THANKS 16 May 2003 09:54:46 -0000 1.109
+++ THANKS 17 May 2003 10:27:40 -0000
@@ -171,6 +171,7 @@
Russ Allbery address@hidden
Ryuji Abe address@hidden
Sam Varshavchik address@hidden
+Sander Niemeijer address@hidden
Scott Bambrough address@hidden
Scott Stanton address@hidden
Simon Leinen address@hidden
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.734
diff -u -u -w -r1.734 autoconf.texi
--- doc/autoconf.texi 17 May 2003 09:44:22 -0000 1.734
+++ doc/autoconf.texi 17 May 2003 10:28:03 -0000
@@ -3077,7 +3077,12 @@
unconditional includes, and check the existence of the headers you
include beforehand (@pxref{Header Files}).
-Most generic macros provide the following default set of includes:
+Most generic macros use the following macro to provide the default set
+of includes:
+
address@hidden AC_DEFAULT_INCLUDES (@ovar{include-directives})
address@hidden
+Expand to @var{include-directives} if defined, otherwise to:
@example
@group
@@ -3118,15 +3123,15 @@
@end group
@end example
-If the default includes are used, then Autoconf will automatically check
-for the presence of these headers and their compatibility, i.e., you
-don't need to run @code{AC_HEADERS_STDC}, nor check for @file{stdlib.h}
-etc.
+If the default includes are used, then check for the presence of these
+headers and their compatibility, i.e., you don't need to run
address@hidden, nor check for @file{stdlib.h} etc.
These headers are checked for in the same order as they are included.
For instance, on some systems @file{string.h} and @file{strings.h} both
exist, but conflict. Then @code{HAVE_STRING_H} will be defined, but
@code{HAVE_STRINGS_H} won't.
address@hidden defmac
@node Alternative Programs
@section Alternative Programs
@@ -13253,12 +13258,12 @@
@defmac AC_TEST_CPP
@acindex{TEST_CPP}
address@hidden, replaced with @code{AC_PREPROC_IFELSE}.
address@hidden, replaced by @code{AC_PREPROC_IFELSE}.
@end defmac
@defmac AC_TEST_PROGRAM
@acindex{TEST_PROGRAM}
address@hidden, replaced with @code{AC_RUN_IFELSE}.
address@hidden, replaced by @code{AC_RUN_IFELSE}.
@end defmac
@defmac AC_TIMEZONE
Index: lib/autoconf/functions.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/functions.m4,v
retrieving revision 1.75
diff -u -u -w -r1.75 functions.m4
--- lib/autoconf/functions.m4 31 Oct 2002 17:33:26 -0000 1.75
+++ lib/autoconf/functions.m4 17 May 2003 10:28:04 -0000
@@ -1,6 +1,6 @@
# This file is part of Autoconf. -*- Autoconf -*-
# Checking for functions.
-# Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -443,7 +443,8 @@
AC_DEFUN([AC_FUNC_ERROR_AT_LINE],
[AC_LIBSOURCES([error.h, error.c])dnl
AC_CACHE_CHECK([for error_at_line], ac_cv_lib_error_at_line,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([],[error_at_line (0, 0, "", 0, "");])],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [error_at_line (0, 0, "", 0, "");])],
[ac_cv_lib_error_at_line=yes],
[ac_cv_lib_error_at_line=no])])
if test $ac_cv_lib_error_at_line = no; then
@@ -597,7 +598,7 @@
# getgroups function only if there is such a function.
if test $ac_cv_func_getgroups = yes; then
AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works,
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[/* On Ultrix 4.3, getgroups (0, 0) always fails. */
exit (getgroups (0, 0) == -1 ? 1 : 0);]])],
[ac_cv_func_getgroups_works=yes],
@@ -902,7 +903,7 @@
AN_FUNCTION([memcmp], [AC_FUNC_MEMCMP])
AC_DEFUN([AC_FUNC_MEMCMP],
[AC_CACHE_CHECK([for working memcmp], ac_cv_func_memcmp_working,
-[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[
+[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
/* Some versions of memcmp are not 8-bit clean. */
char c0 = 0x40, c1 = 0x80, c2 = 0x81;
if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
@@ -1543,7 +1544,7 @@
AN_FUNCTION([strnlen], [AC_FUNC_STRNLEN])
AC_DEFUN([AC_FUNC_STRNLEN],
[AC_CACHE_CHECK([for working strnlen], ac_cv_func_strnlen_working,
-[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[
+[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
#define S "foobar"
#define S_LEN (sizeof S - 1)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Bug in AC_FUNC_MEMCMP when using g++,
Akim Demaille <=