25d3c5346f2049356174f7487b4be5606c87cd60
hiram
  Thu Sep 7 15:40:15 2017 -0700
now using static libm.a on hgwdev refs #9149

diff --git src/inc/common.mk src/inc/common.mk
index 3b0ea23..0a73c19 100644
--- src/inc/common.mk
+++ src/inc/common.mk
@@ -12,33 +12,37 @@
 endif
 ifneq (,$(findstring -,$(MACHTYPE)))
 #    $(info MACHTYPE has - sign ${MACHTYPE})
     MACHTYPE:=$(shell uname -m)
 #    $(info MACHTYPE has - sign set to: ${MACHTYPE})
 endif
 
 HG_DEFS=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DMACHTYPE_${MACHTYPE}
 HG_INC+=-I../inc -I../../inc -I../../../inc -I../../../../inc -I../../../../../inc -I$(kentSrc)/htslib
 
 # to check for Mac OSX Darwin specifics:
 UNAME_S := $(shell uname -s)
 # to check for builds on hgwdev
 FULLWARN = $(shell uname -n)
 
+ifeq (${PTHREADLIB},)
+  PTHREADLIB=-lpthread
+endif
+
 # pthreads is required
 ifneq ($(UNAME_S),Darwin)
-  L+=-pthread
+  L+=${PTHREADLIB}
 endif
 
 # autodetect if openssl is installed
 ifeq (${SSLDIR},)
   SSLDIR = /usr/include/openssl
 endif
 
 # autodetect UCSC installation of hal:
 ifeq (${HALDIR},)
     HALDIR = /hive/groups/browser/hal/halRelease
     ifneq ($(wildcard ${HALDIR}),)
         ifeq (${USE_HAL},)
           USE_HAL=1
         endif
     endif
@@ -53,30 +57,40 @@
 
 # libssl: disabled by default
 ifneq (${SSL_DIR}, "/usr/include/openssl")
   ifneq ($(UNAME_S),Darwin)
     L+=-L${SSL_DIR}/lib
   endif
     HG_INC+=-I${SSL_DIR}/include
 endif
 # on hgwdev, already using the static library with mysqllient.
 ifeq (${FULLWARN},hgwdev)
    L+=/usr/lib64/libssl.a /usr/lib64/libcrypto.a -lkrb5
 else
    L+=-lssl -lcrypto
 endif
 
+# autodetect where libm is installed
+ifeq (${MLIB},)
+  ifneq ($(wildcard /usr/lib64/libm.a),)
+      MLIB=/usr/lib64/libm.a
+  endif
+endif
+ifeq (${MLIB},)
+  MLIB=-lm
+endif
+
 # autodetect where png is installed
 ifeq (${PNGLIB},)
   ifneq ($(wildcard /usr/lib64/libpng.a),)
       PNGLIB=/usr/lib64/libpng.a
   endif
 endif
 ifeq (${PNGLIB},)
   ifneq ($(wildcard /usr/lib/libpng.a),)
       PNGLIB=/usr/lib/libpng.a
   endif
 endif
 ifeq (${PNGLIB},)
   ifneq ($(wildcard /opt/local/lib/libpng.a),)
       PNGLIB=/opt/local/lib/libpng.a
   endif
@@ -218,31 +232,31 @@
 endif
 
 ifeq (${ZLIB},)
   ZLIB=-lz
   ifneq ($(wildcard /opt/local/lib/libz.a),)
     ZLIB=/opt/local/lib/libz.a
   endif
   ifneq ($(wildcard /usr/lib64/libz.a),)
     ZLIB=/usr/lib64/libz.a
   endif
 endif
 
 #global external libraries
 L += $(kentSrc)/htslib/libhts.a
 
-L+=${PNGLIB} ${ZLIB} -lm
+L+=${PNGLIB} ${ZLIB} ${MLIB}
 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)