autoconf malloc.h, and clear old c++ conf tests

This commit is contained in:
Jean-Francois Dockes 2020-05-20 18:50:43 +02:00
parent 90fd4865eb
commit e61ec4b7af
5 changed files with 20 additions and 51 deletions

View File

@ -19,9 +19,6 @@
/* Path to the file program */ /* Path to the file program */
#define FILE_PROG "/usr/bin/file" #define FILE_PROG "/usr/bin/file"
/* "Have C++0x" */
#define HAVE_CXX0X_UNORDERED 1
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
@ -45,8 +42,14 @@
/* Define to 1 if you have the `z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1 #define HAVE_LIBZ 1
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <malloc/malloc.h> header file. */
#undef HAVE_MALLOC_MALLOC_H
/* Define to 1 if you have the `malloc_trim' function. */ /* Define to 1 if you have the `malloc_trim' function. */
/* #undef HAVE_MALLOC_TRIM */ #undef HAVE_MALLOC_TRIM
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1 #define HAVE_MEMORY_H 1
@ -60,12 +63,6 @@
/* Define to 1 if you have the `setrlimit' function. */ /* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1 #define HAVE_SETRLIMIT 1
/* Has std::shared_ptr */
#define HAVE_SHARED_PTR_STD
/* Has std::tr1::shared_ptr */
/* #undef HAVE_SHARED_PTR_TR1 */
/* Define to 1 if you have the <spawn.h> header file. */ /* Define to 1 if you have the <spawn.h> header file. */
#define HAVE_SPAWN_H 1 #define HAVE_SPAWN_H 1
@ -102,9 +99,6 @@
/* Define to 1 if you have the <sys/vfs.h> header file. */ /* Define to 1 if you have the <sys/vfs.h> header file. */
/* #undef HAVE_SYS_VFS_H */ /* #undef HAVE_SYS_VFS_H */
/* "Have tr1" */
/* #undef HAVE_TR1_UNORDERED */
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */ /* #undef HAVE_UNISTD_H */

View File

@ -18,9 +18,6 @@
/* Path to the file program */ /* Path to the file program */
#undef FILE_PROG #undef FILE_PROG
/* "Have C++0x" */
#undef HAVE_CXX0X_UNORDERED
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
@ -45,6 +42,12 @@
/* Define to 1 if you have the `z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ #undef HAVE_LIBZ
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <malloc/malloc.h> header file. */
#undef HAVE_MALLOC_MALLOC_H
/* Define to 1 if you have the `malloc_trim' function. */ /* Define to 1 if you have the `malloc_trim' function. */
#undef HAVE_MALLOC_TRIM #undef HAVE_MALLOC_TRIM
@ -60,12 +63,6 @@
/* Define to 1 if you have the `setrlimit' function. */ /* Define to 1 if you have the `setrlimit' function. */
#undef HAVE_SETRLIMIT #undef HAVE_SETRLIMIT
/* Has std::shared_ptr */
#undef HAVE_SHARED_PTR_STD
/* Has std::tr1::shared_ptr */
#undef HAVE_SHARED_PTR_TR1
/* Define to 1 if you have the <spawn.h> header file. */ /* Define to 1 if you have the <spawn.h> header file. */
#undef HAVE_SPAWN_H #undef HAVE_SPAWN_H
@ -102,9 +99,6 @@
/* Define to 1 if you have the <sys/vfs.h> header file. */ /* Define to 1 if you have the <sys/vfs.h> header file. */
#undef HAVE_SYS_VFS_H #undef HAVE_SYS_VFS_H
/* "Have tr1" */
#undef HAVE_TR1_UNORDERED
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H

View File

@ -37,7 +37,6 @@ AC_SYS_LARGEFILE
# OpenBSD needs sys/param.h for mount.h to compile # OpenBSD needs sys/param.h for mount.h to compile
AC_CHECK_HEADERS([sys/param.h, spawn.h]) AC_CHECK_HEADERS([sys/param.h, spawn.h])
AC_CHECK_FUNCS([posix_spawn setrlimit kqueue vsnprintf malloc_trim])
if test "x$ac_cv_func_posix_spawn" = xyes; then : if test "x$ac_cv_func_posix_spawn" = xyes; then :
AC_ARG_ENABLE(posix_spawn, AC_ARG_ENABLE(posix_spawn,
@ -49,35 +48,14 @@ if test X$posixSpawnEnabled = Xyes ; then
AC_DEFINE(USE_POSIX_SPAWN, 1, [Use posix_spawn()]) AC_DEFINE(USE_POSIX_SPAWN, 1, [Use posix_spawn()])
fi fi
# Check for where to find unordered_map etc. AC_CHECK_HEADERS([sys/mount.h sys/statfs.h sys/statvfs.h sys/vfs.h malloc.h malloc/malloc.h], [], [],
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(tr1/unordered_map,[AC_DEFINE([HAVE_TR1_UNORDERED],
[],["Have tr1"])],[])
AC_CHECK_HEADER(unordered_map,[AC_DEFINE([HAVE_CXX0X_UNORDERED],
[],["Have C++0x"])],[])
AC_TRY_COMPILE([
#include <memory>
],[
std::shared_ptr<int> ptr;
], rcl_shared_ptr_std="1", rcl_shared_ptr_std="0")
AC_TRY_COMPILE([
#include <tr1/memory>
],[
std::tr1::shared_ptr<int> ptr;
], rcl_shared_ptr_tr1="1", rcl_shared_ptr_tr1="0")
if test X$rcl_shared_ptr_std = X1; then
AC_DEFINE(HAVE_SHARED_PTR_STD, [], [Has std::shared_ptr])
elif test X$rcl_shared_ptr_tr1 = X1; then
AC_DEFINE(HAVE_SHARED_PTR_TR1, [], [Has std::tr1::shared_ptr])
fi
AC_LANG_POP([C++])
AC_CHECK_HEADERS([sys/mount.h sys/statfs.h sys/statvfs.h sys/vfs.h], [], [],
[#ifdef HAVE_SYS_PARAM_H [#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> # include <sys/param.h>
#endif #endif
]) ])
AC_CHECK_FUNCS([posix_spawn setrlimit kqueue vsnprintf malloc_trim])
# Use specific 'file' command ? (Useful on solaris to specify # Use specific 'file' command ? (Useful on solaris to specify
# /usr/local/bin/file instead of the system's which doesn't understand '-i' # /usr/local/bin/file instead of the system's which doesn't understand '-i'
AC_ARG_WITH(file-command, AC_ARG_WITH(file-command,

View File

@ -16,7 +16,11 @@
*/ */
#include "autoconfig.h" #include "autoconfig.h"
#if defined(HAVE_MALLOC_H)
#include <malloc.h> #include <malloc.h>
#elif defined(HAVE_MALLOC_MALLOC_H)
#include <malloc/malloc.h>
#endif
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>

View File

@ -23,7 +23,6 @@
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>