+2011-07-21 Bruno Haible <bruno@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 <sds@gnu.org>.
+
2011-07-12 Jim Meyering <meyering@redhat.com>
maint.mk: prohibit inclusion of "verify.h" without use
-# serial 7
+# serial 8
# See if we need to provide fdopendir.
dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
#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);
-# 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,
# 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;
-# 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,
#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
-# 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,
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])
#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'])
-#serial 10
+#serial 11
# Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
#
#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)
-# 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,
[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])
-# 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,
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;
-# 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,
# 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=])
# 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"])
-# serial 28
+# serial 29
# How to list mounted file systems.
# Copyright (C) 1998-2004, 2006, 2009-2011 Free Software Foundation, Inc.
#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])
-# 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
#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 ()
{
-# 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,
[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] = "^";
-# 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,
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);
-# 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,
[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);
]])