],[
AC_MSG_RESULT(Using system zlib)
zlib_msg="system zlib"
+ AC_DEFINE(HAVE_SYS_ZLIB,1,[Have system zlib])
],[
AC_MSG_RESULT(Using embedded zlib)
have_zlib=no
AC_CHECK_FUNCS(sysconf)
AC_CHECK_FUNCS(sched_setaffinity)
+ AC_CHECK_FUNCS(sched_getcpu)
dnl ****************************************************************
dnl *** Check for sched_setaffinity from glibc versions before ***
#endif
#include <unistd.h>
#include <stdlib.h>
-#ifdef HOST_WIN32
-#undef HAVE_ZLIB
-#endif
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
#include <zlib.h>
#endif
#include <mono/metadata/profiler.h>
typedef struct {
FILE *file;
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
gzFile *gzfile;
#endif
unsigned char *buf;
load_data (ProfContext *ctx, int size)
{
ensure_buffer (ctx, size);
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
if (ctx->gzfile)
return gzread (ctx->gzfile, ctx->buf, size) == size;
else
printf ("Cannot open file: %s\n", name);
exit (1);
}
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
ctx->gzfile = gzdopen (fileno (ctx->file), "rb");
#endif
if (!load_data (ctx, 32))
#include "utils.c"
#include "proflog.h"
-#ifdef HOST_WIN32
-#undef HAVE_ZLIB
-#endif
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
#include <zlib.h>
#endif
struct _MonoProfiler {
LogBuffer *buffers;
FILE* file;
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
gzFile *gzfile;
#endif
int pipe_output;
p = write_int32 (p, 0); /* flags */
p = write_int32 (p, 0); /* pid */
p = write_int32 (p, 0); /* opsystem */
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
if (profiler->gzfile) {
gzwrite (profiler->gzfile, hbuf, p - hbuf);
} else {
p = write_int64 (p, buf->obj_base);
p = write_int64 (p, buf->thread_id);
p = write_int64 (p, buf->method_base);
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
if (profiler->gzfile) {
gzwrite (profiler->gzfile, hbuf, p - hbuf);
gzwrite (profiler->gzfile, buf->buf, buf->data - buf->buf);
#endif
fwrite (hbuf, p - hbuf, 1, profiler->file);
fwrite (buf->buf, buf->data - buf->buf, 1, profiler->file);
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
}
#endif
free_buffer (buf, buf->size);
dump_buffer (prof, TLS_GET (tlsbuffer));
TLS_SET (tlsbuffer, NULL);
release_lock ();
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
if (prof->gzfile)
gzclose (prof->gzfile);
#endif
printf ("Cannot create profiler output: %s\n", filename);
exit (1);
}
-#if defined (HAVE_ZLIB)
+#if defined (HAVE_SYS_ZLIB)
if (use_zip)
prof->gzfile = gzdopen (fileno (prof->file), "wb");
#endif