Sam Steingold wrote: > > The problem that clisp/src/m4/ioctl.m4 tests against is fixed in Solaris 7 > > and newer, but is present in Solaris 2.6, FreeBSD 6.4, IRIX 6.5. > > are they still "porting targets"? > could you please move this to gnulib from clisp?
FreeBSD 6.4 is not so different from the newest FreeBSD 8.x; therefore I think current FreeBSD has the same problem. And you surely don't want to drop FreeBSD from clisp's porting targets. > g++ -I/home/sds/src/top/include > -I/home/sds/src/clisp/sf/clisp/build-g-gxx/gllib -W -Wswitch -Wcomment > -Wpointer-arith -Wimplicit -Wreturn-type -Wno-sign-compare > -Wno-format-nonliteral -Wno-invalid-offsetof -falign-functions=4 -g -O0 > -DDEBUG_OS_ERROR -DDEBUG_SPVW -DDEBUG_BYTECODE -DSAFETY=3 -DDEBUG_GCSAFETY > -DENABLE_UNICODE -DDYNAMIC_FFI -I. -c spvw.c > /home/sds/src/clisp/sf/clisp/build-g-gxx/gllib/sys/ioctl.h:361: error: > declaration of C function 'int ioctl(int, int, ...)' conflicts with > /usr/include/sys/ioctl.h:42: error: previous declaration 'int ioctl(int, long > unsigned int, ...)' here > > $ grep REPLACE_IOCTL config.status > S["REPLACE_IOCTL"]="0" > ... > configure:22838: checking for ioctl with POSIX signature > configure:22855: g++ -c conftest.c >&5 > configure:22855: $? = 0 > configure:22863: result: yes OK, so because you are using a C++ compiler, gnulib's test for the ioctl() prototype produced the wrong result (it did not detect a clash). This should fix it and a couple of similar issues. Lesson to remember: When we declare a system function with 'extern ...', we need to add a "C" linkage specifier in C++ mode. Not needed for variables (at least with g++), because the linkage of 'extern int foo;' and 'extern "C" int foo;' is the same. 2011-07-21 Bruno Haible <br...@clisp.org> Declare system functions in a way that works with C++. * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR) [C++]: In the test program, declare fdopendir as extern "C". * m4/frexpl.m4 (gl_FUNC_FREXPL_WORKS) [C++]: In the test program, declare frexpl as extern "C". * m4/getaddrinfo.m4 (gl_GETADDRINFO) [C++]: In the test program, declare gai_strerror as extern "C". * m4/getdomainname.m4 (gl_FUNC_GETDOMAINNAME) [C++]: In the test programs, declare gai_strerror as extern "C". * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R) [C++]: In the test program, declare getlogin_r as extern "C". * m4/ioctl.m4 (gl_FUNC_IOCTL) [C++]: In the test program, declare ioctl as extern "C". * m4/ldexpl.m4 (gl_FUNC_LDEXPL_WORKS) [C++]: In the test program, declare ldexpl as extern "C". * m4/logb.m4 (gl_FUNC_LOGB) [C++]: In the test programs, declare logb as extern "C". * m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS) [C++]: In the test program, declare getmntinfo as extern "C". * m4/stpncpy.m4 (gl_FUNC_STPNCPY) [C++]: In the test program, declare stpncpy as extern "C". * m4/strerror_r.m4 (gl_FUNC_STRERROR_R_WORKS) [C++]: In the test program, declare __xpg_strerror_r as extern "C". * m4/strndup.m4 (gl_FUNC_STRNDUP) [C++]: In the test program, declare strndup as extern "C". * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT) [C++]: In the test program, declare memset and bzero as extern "C". Reported by Sam Steingold <s...@gnu.org>. --- m4/fdopendir.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/fdopendir.m4 Thu Jul 21 23:39:36 2011 @@ -1,4 +1,4 @@ -# serial 7 +# serial 8 # See if we need to provide fdopendir. dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. @@ -26,7 +26,11 @@ #include <fcntl.h> #include <unistd.h> #if !HAVE_DECL_FDOPENDIR -extern DIR *fdopendir (int); +extern +# ifdef __cplusplus +"C" +# endif +DIR *fdopendir (int); #endif ]], [int result = 0; int fd = open ("conftest.c", O_RDONLY); --- m4/frexpl.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/frexpl.m4 Thu Jul 21 23:39:30 2011 @@ -1,4 +1,4 @@ -# frexpl.m4 serial 14 +# frexpl.m4 serial 15 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -115,7 +115,11 @@ # undef LDBL_MIN_EXP # define LDBL_MIN_EXP (-16381) #endif -extern long double frexpl (long double, int *); +extern +#ifdef __cplusplus +"C" +#endif +long double frexpl (long double, int *); int main() { int result = 0; --- m4/getaddrinfo.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/getaddrinfo.m4 Thu Jul 21 23:39:56 2011 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 26 +# getaddrinfo.m4 serial 27 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -92,7 +92,11 @@ #include <ws2tcpip.h> #endif #include <stddef.h> -extern const char *gai_strerror(int);]])], +extern +#ifdef __cplusplus +"C" +#endif +const char *gai_strerror(int);]])], [gl_cv_func_gai_strerror_posix_signature=yes], [gl_cv_func_gai_strerror_posix_signature=no])]) if test $gl_cv_func_gai_strerror_posix_signature = no; then --- m4/getdomainname.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/getdomainname.m4 Thu Jul 21 23:54:59 2011 @@ -1,4 +1,4 @@ -# getdomainname.m4 serial 7 +# getdomainname.m4 serial 8 dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,7 +28,11 @@ AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <stddef.h> - extern int getdomainname (char *, size_t); + extern + #ifdef __cplusplus + "C" + #endif + int getdomainname (char *, size_t); ]], [[getdomainname(NULL, 0);]])], [gl_cv_func_getdomainname_in_libnsl=yes]) @@ -63,7 +67,12 @@ #include <netdb.h> #endif #include <unistd.h> - extern int getdomainname (char *, int);]], + extern + #ifdef __cplusplus + "C" + #endif + int getdomainname (char *, int); + ]], [[]])], [gl_cv_decl_getdomainname_argtype2='int'], [gl_cv_decl_getdomainname_argtype2='size_t']) --- m4/getlogin_r.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/getlogin_r.m4 Thu Jul 21 23:41:04 2011 @@ -1,4 +1,4 @@ -#serial 10 +#serial 11 # Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. # @@ -50,7 +50,11 @@ #include <stddef.h> #include <unistd.h> #if !HAVE_DECL_GETLOGIN_R -extern int getlogin_r (char *, size_t); +extern +# ifdef __cplusplus +"C" +# endif +int getlogin_r (char *, size_t); #endif int main (void) --- m4/ioctl.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/ioctl.m4 Thu Jul 21 23:42:27 2011 @@ -1,4 +1,4 @@ -# ioctl.m4 serial 3 +# ioctl.m4 serial 4 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -24,7 +24,12 @@ [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/ioctl.h>]], - [[extern int ioctl (int, int, ...);]]) + [[extern + #ifdef __cplusplus + "C" + #endif + int ioctl (int, int, ...); + ]]) ], [gl_cv_func_ioctl_posix_signature=yes], [gl_cv_func_ioctl_posix_signature=no]) --- m4/ldexpl.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/ldexpl.m4 Thu Jul 21 23:42:45 2011 @@ -1,4 +1,4 @@ -# ldexpl.m4 serial 11 +# ldexpl.m4 serial 12 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -86,7 +86,11 @@ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <math.h> -extern long double ldexpl (long double, int); +extern +#ifdef __cplusplus +"C" +#endif +long double ldexpl (long double, int); int main() { int result = 0; --- m4/logb.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/logb.m4 Thu Jul 21 23:43:32 2011 @@ -1,4 +1,4 @@ -# logb.m4 serial 2 +# logb.m4 serial 3 dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,11 @@ # define __NO_MATH_INLINES 1 /* for glibc */ #endif #include <math.h> - extern double logb (double x); + extern + #ifdef __cplusplus + "C" + #endif + double logb (double x); double x;]], [[x = logb(x);]])], [LOGB_LIBM=]) @@ -33,7 +37,11 @@ # define __NO_MATH_INLINES 1 /* for glibc */ #endif #include <math.h> - extern double logb (double x); + extern + #ifdef __cplusplus + "C" + #endif + double logb (double x); double x;]], [[x = logb(x);]])], [LOGB_LIBM="-lm"]) --- m4/ls-mntd-fs.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/ls-mntd-fs.m4 Thu Jul 21 23:43:51 2011 @@ -1,4 +1,4 @@ -# serial 28 +# serial 29 # How to list mounted file systems. # Copyright (C) 1998-2004, 2006, 2009-2011 Free Software Foundation, Inc. @@ -247,7 +247,11 @@ #if HAVE_SYS_STATVFS_H # include <sys/statvfs.h> #endif -extern int getmntinfo (struct statfs **, int); +extern +#ifdef __cplusplus +"C" +#endif +int getmntinfo (struct statfs **, int); ]], [])], [fu_cv_sys_mounted_getmntinfo2=no], [fu_cv_sys_mounted_getmntinfo2=yes]) --- m4/stpncpy.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/stpncpy.m4 Thu Jul 21 23:47:45 2011 @@ -1,4 +1,4 @@ -# stpncpy.m4 serial 14 +# stpncpy.m4 serial 15 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -35,7 +35,11 @@ #include <string.h> /* for strcpy */ /* The stpncpy prototype is missing in <string.h> on AIX 4. */ #if !HAVE_DECL_STPNCPY -extern char *stpncpy (char *dest, const char *src, size_t n); +extern +# ifdef __cplusplus +"C" +# endif +char *stpncpy (char *dest, const char *src, size_t n); #endif int main () { --- m4/strerror_r.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/strerror_r.m4 Thu Jul 21 23:48:14 2011 @@ -1,4 +1,4 @@ -# strerror_r.m4 serial 12 +# strerror_r.m4 serial 13 dnl Copyright (C) 2002, 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -138,7 +138,11 @@ [AC_LANG_PROGRAM( [[#include <errno.h> #include <string.h> - extern int __xpg_strerror_r(int, char *, size_t); + extern + #ifdef __cplusplus + "C" + #endif + int __xpg_strerror_r(int, char *, size_t); ]], [[int result = 0; char buf[256] = "^"; --- m4/strndup.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/strndup.m4 Thu Jul 21 23:49:12 2011 @@ -1,4 +1,4 @@ -# strndup.m4 serial 19 +# strndup.m4 serial 20 dnl Copyright (C) 2002-2003, 2005-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -25,7 +25,11 @@ AC_LANG_PROGRAM([[#include <string.h> #include <stdlib.h>]], [[ #ifndef HAVE_DECL_STRNDUP - extern char *strndup (const char *, size_t); + extern + #ifdef __cplusplus + "C" + #endif + char *strndup (const char *, size_t); #endif char *s; s = strndup ("some longer string", 15); --- m4/sys_select_h.m4.orig Thu Jul 21 23:55:04 2011 +++ m4/sys_select_h.m4 Thu Jul 21 23:49:59 2011 @@ -1,4 +1,4 @@ -# sys_select_h.m4 serial 19 +# sys_select_h.m4 serial 20 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,18 @@ [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[ #undef memset #define memset nonexistent_memset - extern void *memset (void *, int, unsigned long); + extern + #ifdef __cplusplus + "C" + #endif + void *memset (void *, int, unsigned long); #undef bzero #define bzero nonexistent_bzero - extern void bzero (void *, unsigned long); + extern + #ifdef __cplusplus + "C" + #endif + void bzero (void *, unsigned long); fd_set fds; FD_ZERO (&fds); ]]) -- In memoriam Ludwig Beck <http://en.wikipedia.org/wiki/Ludwig_Beck>