don't build mmap_hook when --enable-minimal is given to configure

Refers to github issue #1418
diff --git a/Makefile.am b/Makefile.am
index e5b7cc3..96a3828 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -251,9 +251,12 @@
                     src/windows/shortproc.asm \
                     src/windows/auto_testing_hook.h
 
+
 ### Unittests
-TESTS += low_level_alloc_unittest
+
+if WITH_HEAP_PROFILER_OR_CHECKER
 WINDOWS_PROJECTS += vsprojects/low_level_alloc_unittest/low_level_alloc_unittest.vcxproj
+TESTS += low_level_alloc_unittest
 LOW_LEVEL_ALLOC_UNITTEST_INCLUDES = src/base/low_level_alloc.h \
                                     src/base/basictypes.h \
                                     src/gperftools/malloc_hook.h \
@@ -271,7 +274,7 @@
 # We don't need that functionality here, so we turn it off to reduce deps.
 low_level_alloc_unittest_CXXFLAGS = -DNO_TCMALLOC_SAMPLES
 low_level_alloc_unittest_LDADD = $(LIBSPINLOCK)
-
+endif WITH_HEAP_PROFILER_OR_CHECKER
 
 ### ------- stack trace
 
@@ -581,12 +584,14 @@
 malloc_hook_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS)
 malloc_hook_test_LDADD = libtcmalloc_minimal.la $(PTHREAD_LIBS)
 
+if WITH_HEAP_PROFILER_OR_CHECKER
 if !MINGW
 TESTS += mmap_hook_test
 mmap_hook_test_SOURCES = src/tests/mmap_hook_test.cc \
                          src/mmap_hook.cc
 mmap_hook_test_LDADD = $(LIBSPINLOCK)
 endif !MINGW
+endif WITH_HEAP_PROFILER_OR_CHECKER
 
 TESTS += malloc_extension_test
 WINDOWS_PROJECTS += vsprojects/malloc_extension_test/malloc_extension_test.vcxproj