b3d8bf0f8db07a9ed4e414a233f01044506e8db9
galt
  Tue Jul 6 22:58:11 2010 -0700
trying to autodetect PNG,SSL,BAM; also trying to use PNG statically linked
diff --git src/inc/common.mk src/inc/common.mk
index 05bdda8..5c73dfc 100644
--- src/inc/common.mk
+++ src/inc/common.mk
@@ -10,17 +10,49 @@
 #global external libraries 
 L=
 
+# autodetect if openssl is installed
+ifeq (${SSLDIR},)
+  SSLDIR = /usr/include/openssl
+endif
+ifeq (${USE_SSL},)
+  ifneq ($(wildcard ${SSLDIR}),)
+     USE_SSL=1
+  endif
+endif
+
+
 # libssl: disabled by default
 ifeq (${USE_SSL},1)
     L+=-lssl
     HG_DEFS+=-DUSE_SSL
 endif
 
-# libpng: disabled by default
-ifeq (${USE_PNG},1)
+
+# autodetect if png is installed
+ifeq (${USE_PNG},)
+  ifneq ($(wildcard /usr/include/png.h),)
+    USE_PNG=1
+  endif
+endif
+
     ifeq (${PNGLIB},)
-	PNGLIB=-lpng
+  PNGLIB=/usr/lib64/libpng.a
+else
+  ifeq (${USE_PNG},)
+    USE_PNG=1
+  endif
+endif
+ifeq (${USE_PNG},)
+  ifneq (${PNGLIB},)
+    ifneq ($(wildcard ${PNGLIB}),)
+      USE_PNG=1
     endif
+  endif
+endif
+
+# libpng: disabled by default
+#  for dynamic linking PNGLIB=-lpng
+ifeq (${USE_PNG},1)
     L+=${PNGLIB}
     HG_DEFS+=-DUSE_PNG
     HG_INC+=${PNGINCL}
@@ -31,11 +63,21 @@
     endif
 endif
 
-# libbam (samtools, and Angie's KNETFILE_HOOKS extension to it): disabled by default
-ifeq (${USE_BAM},1)
+# autodetect if bam is installed
     ifeq (${SAMDIR},)
       SAMDIR = /hive/data/outside/samtools/svn_${MACHTYPE}/samtools
+  ifneq ($(wildcard ${SAMDIR}),)
+     KNETFILE_HOOK=1
     endif
+endif
+ifeq (${USE_BAM},)
+  ifneq ($(wildcard ${SAMDIR}),)
+     USE_BAM=1
+  endif
+endif
+
+# libbam (samtools, and Angie's KNETFILE_HOOKS extension to it): disabled by default
+ifeq (${USE_BAM},1)
     ifeq (${SAMINC},)
         SAMINC = ${SAMDIR}
     endif