Fix:maptool:Better check for sbrk
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 21 Jul 2011 09:18:51 +0000 (09:18 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 21 Jul 2011 09:18:51 +0000 (09:18 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4656 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/CMakeLists.txt
navit/config.h.cmake
navit/configure.in
navit/navit/maptool/maptool.c

index dac1256..9f12448 100644 (file)
@@ -114,6 +114,7 @@ CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
 CHECK_SYMBOL_EXISTS(system stdlib.h HAVE_SYSTEM)
 CHECK_SYMBOL_EXISTS(CreateProcess windows.h HAVE_CREATEPROCESS)
 CHECK_FUNCTION_EXISTS(stpcpy HAVE_STPCPY)
+CHECK_FUNCTION_EXISTS(sbrk HAVE_SBRK)
 
 
 ### Configure build
index be7cc92..924e38c 100644 (file)
@@ -70,3 +70,5 @@
 #cmakedefine EZXML_NOMMAP 0
 
 #cmakedefine HAVE_STPCPY 1
+
+#cmakedefine HAVE_SBRK 1
index 95ec21f..bddb089 100644 (file)
@@ -388,6 +388,11 @@ AC_TRY_LINK([#include <stdlib.h>], [system("/bin/true");],AC_MSG_RESULT(yes);AC_
 AC_MSG_CHECKING(for CreateProcess)
 AC_TRY_LINK([#include <windows.h>], [CreateProcess(NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL);],AC_MSG_RESULT(yes);AC_DEFINE(HAVE_CREATEPROCESS, 1, [Define to 1 if you have the `CreateProcess' function.]) speech_cmdline=yes; speech_cmdline_reason="CreateProcess exists", AC_MSG_RESULT(no))
 
+# sbrk
+AC_MSG_CHECKING(for sbrk)
+AC_TRY_LINK([#include <unistd.h>], [sbrk(0);],AC_MSG_RESULT(yes);AC_DEFINE(HAVE_SBRK, 1, [Define to 1 if you have the `sbrk' function.]),AC_MSG_RESULT(no))
+
+
 AC_ARG_ENABLE(graphics-sdl, [  --disable-graphics-sdl             don't create graphics sdl], graphics_sdl=$enableval;graphics_sdl_reason="configure parameter")
 
 if test "x${graphics_sdl}" = "xyes" ; then
index 23b41bf..9381eb7 100644 (file)
@@ -82,7 +82,7 @@ progress_time(void)
 static void
 progress_memory(void)
 {
-#ifdef HAVE_UNISTD_H
+#ifdef HAVE_SBRK
        long mem=(long)sbrk(0)-start_brk;
        fprintf(stderr," %ld MB",mem/1024/1024);
 #endif
@@ -785,7 +785,7 @@ int main(int argc, char **argv)
        p.process_relations=1;
        p.timestamp=current_to_iso8601();
 
-#ifdef HAVE_UNISTD_H
+#ifdef HAVE_SBRK
        start_brk=(long)sbrk(0);
 #endif
        gettimeofday(&start_tv, NULL);