# Header checks
include(CheckIncludeFile)
-check_include_file(unistd.h HAVE_UNISTD_H)
+check_include_file( malloc.h HAVE_MALLOC_H )
+check_include_file( stat.h HAVE_STAT_H )
+check_include_file( sys/stat.h HAVE_SYS_STAT_H )
+check_include_file( unistd.h HAVE_UNISTD_H )
# Function checks
include(CheckFunctionExists)
check_function_exists( drand48 HAVE_DRAND48 )
check_function_exists( cbrt HAVE_CBRT )
+check_function_exists( getpagesize HAVE_GETPAGESIZE)
+check_function_exists( mallinfo HAVE_MALLINFO )
+check_function_exists( mallopt HAVE_MALLOPT )
+check_function_exists( mstats HAVE_MSTATS )
check_function_exists( srand48 HAVE_SRAND48 )
check_function_exists( strcasecmp HAVE_STRCASECMP )
+# Type checks
+# The function check_size_type also checks if the type exists
+# and sets HAVE_${VARIABLE} accordingly.
+include(CheckTypeSize)
+
+check_type_size( ssize_t SSIZE_T )
+check_type_size( intptr_t INTPTR_T )
+
# Write check results to config.h header
configure_file(config-cmake.h.in config.h)
#define PACKAGE_VERSION "@GRAPHVIZ_VERSION_FULL@"
// Include headers
+#cmakedefine HAVE_MALLOC_H
+#cmakedefine HAVE_STAT_H
+#cmakedefine HAVE_SYS_STAT_H
#cmakedefine HAVE_UNISTD_H
// Functions
#cmakedefine HAVE_DRAND48
#cmakedefine HAVE_CBRT
+#cmakedefine HAVE_GETPAGESIZE
+#cmakedefine HAVE_MALLINFO
+#cmakedefine HAVE_MALLOPT
+#cmakedefine HAVE_MSTATS
#cmakedefine HAVE_SRAND48
#cmakedefine HAVE_STRCASECMP
+
+// Types
+#cmakedefine HAVE_SSIZE_T
+#cmakedefine HAVE_INTPTR_T
+
+// Typedefs for missing types
+#ifndef HAVE_SSIZE_T
+typedef int ssize_t;
+#endif
add_subdirectory(patchwork)
add_subdirectory(pathplan)
add_subdirectory(twopigen)
+add_subdirectory(vmalloc)
# Dependent on: cdt
add_subdirectory(cgraph)
--- /dev/null
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+add_library(vmalloc STATIC
+ # Header files
+ vmalloc.h
+ vmhdr.h
+
+ # Source files
+ malloc.c
+ vmbest.c
+ vmclear.c
+ vmclose.c
+ vmdcheap.c
+ vmdebug.c
+ vmdisc.c
+ vmlast.c
+ vmopen.c
+ vmpool.c
+ vmprivate.c
+ vmprofile.c
+ vmregion.c
+ vmsegment.c
+ vmset.c
+ vmstat.c
+ vmstrdup.c
+ vmtrace.c
+ vmwalk.c
+)
** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
*/
-#if HAVE_STAT_H
+#ifdef HAVE_STAT_H
#include <stat.h>
#else
-#if HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#endif
#include <io.h>
#endif
-#include <inttypes.h>
-
/* Common types, and macros for vmalloc functions.
**
** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
#include "config.h"
+#include <inttypes.h>
+#include <stdlib.h>
+
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif // HAVE_SYS_TYPES_H
#define COUNT(n) ((n) += 1)
#endif /*DEBUG*/
#define VMPAGESIZE 8192
-#if HAVE_GETPAGESIZE
+#ifdef HAVE_GETPAGESIZE
#define GETPAGESIZE(x) ((x) ? (x) : \
(((x)=getpagesize()) < VMPAGESIZE ? ((x)=VMPAGESIZE) : (x)) )
#else