From 2f3ef9c88089366f2701a39af149186f5472b8fd Mon Sep 17 00:00:00 2001 From: Erwin Janssen Date: Thu, 5 Jan 2017 14:34:50 +0100 Subject: [PATCH] Move checks from features/vmalloc to configure.ac Instead of checking certain headers and functions in a seperate config script, place these checks in configure.ac and use HAVE_* style defines. Some checks were already present in configure.ac, the others have been added. No addtional defines in windows/config.h were needed. There is only one check remaining in features/vmalloc. --- configure.ac | 4 ++-- lib/vmalloc/features/vmalloc | 9 --------- lib/vmalloc/malloc.c | 14 +++++++------- lib/vmalloc/vmhdr.h | 5 +---- windows/include/FEATURE/vmalloc | 15 +-------------- 5 files changed, 11 insertions(+), 36 deletions(-) diff --git a/configure.ac b/configure.ac index 361fe078b..f8cdb55f9 100644 --- a/configure.ac +++ b/configure.ac @@ -419,7 +419,7 @@ dnl Checks for header files # AC_HEADER_STDC AC_CHECK_HEADERS(malloc.h \ fcntl.h search.h termios.h \ - unistd.h strings.h \ + unistd.h strings.h stat.h \ sys/time.h sys/types.h sys/select.h \ sys/stat.h sys/mman.h \ sys/ioctl.h sys/inotify.h crt_externs.h) @@ -447,7 +447,7 @@ LIBS=$save_LIBS # Checks for library functions AC_CHECK_FUNCS([lrand48 drand48 srand48 setmode setenv getenv \ - cbrt vsnprintf _NSGetEnviron]) + cbrt vsnprintf _NSGetEnviron mallopt mallinfo mstats getpagesize]) AC_REPLACE_FUNCS([strcasecmp strncasecmp strcasestr]) diff --git a/lib/vmalloc/features/vmalloc b/lib/vmalloc/features/vmalloc index 9cecdfcdc..ff3cbb233 100644 --- a/lib/vmalloc/features/vmalloc +++ b/lib/vmalloc/features/vmalloc @@ -5,15 +5,6 @@ # Written by Kiem-Phong Vo (08/15/95). #################################################################### -lib getpagesize -hdr stat -sys stat -typ ssize_t -hdr malloc -lib mallopt -lib mallinfo -lib mstats - std malloc note{ stuck with standard malloc }end noexecute{ _BEGIN_EXTERNS_ extern void _exit(int); diff --git a/lib/vmalloc/malloc.c b/lib/vmalloc/malloc.c index d50ff97ab..7a07110b3 100644 --- a/lib/vmalloc/malloc.c +++ b/lib/vmalloc/malloc.c @@ -33,10 +33,10 @@ int _STUB_malloc; ** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94. */ -#if _hdr_stat +#if HAVE_STAT_H #include #else -#if _sys_stat +#if HAVE_SYS_STAT_H #include #endif #endif @@ -289,7 +289,7 @@ void *valloc(reg size_t size) return (*Vmregion->meth.alignf) (Vmregion, size, _Vmpagesize); } -#if _hdr_malloc +#ifdef HAVE_MALLOC_H #define calloc ______calloc #define free ______free @@ -301,7 +301,7 @@ void *valloc(reg size_t size) /* in Windows, this is a macro defined in malloc.h and not a function */ #undef alloca -#if _lib_mallopt +#ifdef HAVE_MALLOPT int mallopt(int cmd, int value) { VMFLINIT(); @@ -309,7 +309,7 @@ int mallopt(int cmd, int value) } #endif -#if _lib_mallinfo +#ifdef HAVE_MALLINFO struct mallinfo mallinfo(void) { Vmstat_t sb; @@ -327,7 +327,7 @@ struct mallinfo mallinfo(void) } #endif -#if _lib_mstats +#ifdef HAVE_MSTATS struct mstats mstats(void) { Vmstat_t sb; @@ -346,6 +346,6 @@ struct mstats mstats(void) } #endif -#endif/*_hdr_malloc*/ +#endif/* HAVE_MALLOC_H */ #endif /*_std_malloc || _BLD_INSTRUMENT_ || cray*/ diff --git a/lib/vmalloc/vmhdr.h b/lib/vmalloc/vmhdr.h index a44793fe2..313742502 100644 --- a/lib/vmalloc/vmhdr.h +++ b/lib/vmalloc/vmhdr.h @@ -82,7 +82,7 @@ extern "C" { #define COUNT(n) ((n) += 1) #endif /*DEBUG*/ #define VMPAGESIZE 8192 -#if _lib_getpagesize +#if HAVE_GETPAGESIZE #define GETPAGESIZE(x) ((x) ? (x) : \ (((x)=getpagesize()) < VMPAGESIZE ? ((x)=VMPAGESIZE) : (x)) ) #else @@ -445,9 +445,6 @@ extern "C" { extern void _cleanup(void); /* for vmdcsbrk.c */ -#if !_typ_ssize_t - typedef int ssize_t; -#endif #if !defined(_WIN32) extern Vmuchar_t *sbrk(ssize_t); #endif diff --git a/windows/include/FEATURE/vmalloc b/windows/include/FEATURE/vmalloc index 1c4e00c1f..a92d3a2d5 100644 --- a/windows/include/FEATURE/vmalloc +++ b/windows/include/FEATURE/vmalloc @@ -2,17 +2,4 @@ #ifndef _def_atexit_vmalloc #define _def_atexit_vmalloc 1 -#undef _sys_types -#define _sys_types 1 /* #include ok */ - -#undef _lib_getpagesize -#define _lib_getpagesize 0 /* getpagesize() in default lib(s) */ - -#undef _sys_stat -#define _sys_stat 1 /* #include ok */ - -#undef _typ_ssize_t -#define _typ_ssize_t 1 /* ssize_t is a type */ - -#undef _hdr_malloc -#define _hdr_malloc 1 /* #include ok */ +#endif -- 2.40.0