f04c258e3e27d16905684915df3ba0b611890f30
hiram
  Wed Jul 26 10:29:41 2017 -0700
fixup userApps build for Mac OSX build refs #19715

diff --git src/inc/common.mk src/inc/common.mk
index 43d506f..96ad92c 100644
--- src/inc/common.mk
+++ src/inc/common.mk
@@ -193,31 +193,38 @@
 # $(info have MYSQLINC: ${MYSQLINC})
 # $(info have MYSQLLIBS: ${MYSQLLIBS})
 
 # OK to add -lstdc++ to all MYSQLLIBS just in case it is
 #    MySQL version 5.6 libraries, but no 'librt' on Mac OSX
 ifeq (${FULLWARN},hgwdev)
   MYSQLLIBS += /usr/lib/gcc/x86_64-redhat-linux/4.4.4/libstdc++.a /usr/lib/debug/usr/lib64/librt.a
 else
   ifeq ($(UNAME_S),Darwin)
     MYSQLLIBS += -lstdc++
   else
     MYSQLLIBS += -lstdc++ -lrt
   endif
 endif
 
-L+=${PNGLIB} -lz -lm
+ifeq (${ZLIB},)
+  ZLIB=-lz
+  ifneq ($(wildcard /opt/local/lib/libz.a),)
+    ZLIB=/opt/local/lib/libz.a
+  endif
+endif
+
+L+=${PNGLIB} ${ZLIB} -lm
 HG_INC+=${PNGINCL}
 
 # pass through COREDUMP
 ifneq (${COREDUMP},)
     HG_DEFS+=-DCOREDUMP
 endif
 
 # autodetect UCSC additional source code with password for some external tracks on gbib
 GBIBDIR = /hive/groups/browser/gbib/
 ifneq ($(wildcard ${GBIBDIR}/*.c),)
   HG_DEFS+=-DUSE_GBIB_PWD
   HG_INC += -I${GBIBDIR}
 endif
 
 SYS = $(shell uname -s)